Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
172 lines (148 loc) · 5.97 KB
/
Copy pathscript.js
File metadata and controls
172 lines (148 loc) · 5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
document.addEventListener('DOMContentLoaded', () => {
initThemeManager();
initMobileMenu();
renderCourses();
renderProjects();
initContactForm();
applyGreetingRules();
document.getElementById('year').textContent = new Date().getFullYear();
});
/* =========================================
REQUISITO: ESTRUTURA DE DECISÃO (IF/ELSE)
========================================= */
function applyGreetingRules() {
const greetingElement = document.getElementById('dynamic-greeting');
if (!greetingElement) return;
const currentHour = new Date().getHours();
let greetingText = "";
// If/Else de validação do horário
if (currentHour >= 5 && currentHour < 12) {
greetingText = "☀️ Bom dia! Visão Técnica e Estratégica.";
} else if (currentHour >= 12 && currentHour < 18) {
greetingText = "🌤️ Boa tarde! Visão Técnica e Estratégica.";
} else {
greetingText = "🌙 Boa noite! Visão Técnica e Estratégica.";
}
greetingElement.textContent = greetingText;
}
/* =========================================
REQUISITO: ARRAYS DE DADOS
========================================= */
const portfolioData = {
courses: [
{ name: "React e TypeScript", institution: "Rocketseat", period: "2024", type: "extra" },
{ name: "Engenharia de Prompt e IA Aplicada", institution: "Alura", period: "2024", type: "extra" },
{ name: "Clean Architecture & SOLID", institution: "Udemy", period: "2023", type: "extra" }
],
projects: [
{
title: "Zenix Deep Dive (ZDD)",
description: "Plataforma focada em análise gerencial e otimização de frotas e seguros corporativos, usando arquitetura limpa.",
tags: ["React", "Node.js", "Arquitetura"],
link: "#",
github: "#"
},
{
title: "IA Condominial",
description: "Sistema autônomo baseado em IA para gerenciamento de ocorrências, aprovação de verbas e balancetes em condomínios.",
tags: ["AI", "Python", "Dashboard"],
link: "#",
github: "#"
},
{
title: "Gestão FATEC",
description: "Projeto acadêmico de alta complexidade contendo backlog dinâmico e gestão de sprints integrados com APIs abertas.",
tags: ["Vanilla JS", "HTML", "CSS"],
link: "#",
github: "#"
}
]
};
/* =========================================
REQUISITOS: REPETIÇÃO (FOR) E FUNÇÕES
========================================= */
function renderCourses() {
const container = document.getElementById('courses-container');
if (!container) return;
container.innerHTML = '';
// Uso do FOR para renderizar cursos do array
for (let i = 0; i < portfolioData.courses.length; i++) {
const course = portfolioData.courses[i];
const card = document.createElement('div');
card.className = 'course-card glass-card';
card.innerHTML = `
<h3>${course.name}</h3>
<p><strong>Instituição:</strong> ${course.institution}</p>
<p><strong>Período:</strong> ${course.period}</p>
`;
container.appendChild(card);
}
}
function renderProjects() {
const container = document.getElementById('projects-container');
if (!container) return;
container.innerHTML = '';
// Uso do REPETIDOR para renderizar projetos do array
for (let i = 0; i < portfolioData.projects.length; i++) {
const proj = portfolioData.projects[i];
// Simulador de Forzinho em tags
let tagsHtml = '';
for (let j = 0; j < proj.tags.length; j++) {
tagsHtml += `<span class="tag">${proj.tags[j]}</span>`;
}
const card = document.createElement('div');
card.className = 'project-card glass-card';
card.innerHTML = `
<div class="project-info">
<h3>${proj.title}</h3>
<p>${proj.description}</p>
<div class="project-tags">
${tagsHtml}
</div>
</div>
`;
container.appendChild(card);
}
}
/* =========================================
FUNÇÕES ADICIONAIS: FORMULÁRIO E ESTADO
========================================= */
function initContactForm() {
const form = document.getElementById('contact-form');
if (!form) return;
form.addEventListener('submit', (e) => {
e.preventDefault();
const name = form.name.value.trim();
const email = form.email.value.trim();
const message = form.message.value.trim();
const msgBox = document.getElementById('form-message');
// REQUISITO: DECISÃO (VALIDAÇÃO IF/ELSE)
if (name === '' || email === '' || message === '') {
msgBox.innerHTML = '<span style="color: #ff4a4a;">Por favor, preencha todos os campos!</span>';
} else if (!email.includes('@')) {
msgBox.innerHTML = '<span style="color: #ff4a4a;">Por favor, insira um e-mail válido!</span>';
} else {
msgBox.innerHTML = '<span style="color: #4aff8a;">Mensagem enviada com sucesso! Logo entrarei em contato.</span>';
form.reset();
}
setTimeout(() => msgBox.innerHTML = '', 4000);
});
}
function initThemeManager() {
const themeBtn = document.getElementById('theme-toggle');
const htmlElement = document.documentElement;
htmlElement.setAttribute('data-theme', 'dark');
themeBtn.addEventListener('click', () => {
const currentTheme = htmlElement.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
htmlElement.setAttribute('data-theme', newTheme);
});
}
function initMobileMenu() {
const hamburger = document.querySelector('.hamburger');
const nav = document.querySelector('.nav');
if (!hamburger) return;
hamburger.addEventListener('click', () => {
nav.classList.toggle('active');
});
}