Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
241 lines (211 loc) · 11.7 KB
/
Copy pathscript.js
File metadata and controls
241 lines (211 loc) · 11.7 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
document.addEventListener("DOMContentLoaded", () => {
const EN = {
"nav.sobre": "about",
"nav.tec": "stack",
"nav.projetos": "projects",
"nav.formacao": "education",
"nav.cert": "certificates",
"nav.traj": "journey",
"nav.conteudos": "content",
"nav.contato": "contact",
"theme.dark": "dark",
"theme.light": "light",
"hero.role": "Back-end Java developer in training · Computer Science",
"hero.pitch": "I’m building my career in back-end development with Java. Every line of code is a step forward, and I share this whole journey on my social media for anyone who wants to follow along.",
"hero.status": "Open to software development internships",
"hero.cta1": "See projects",
"hero.cta2": "Download résumé",
"hero.cta3": "Get in touch",
"hero.file": "AboutMe.java",
"hero.code": '<code><span class="k">public class</span> <span class="t">AboutMe</span> {\n\n <span class="t">String</span> name = <span class="s">"Anthony Magalhães"</span>;\n <span class="t">String</span> degree = <span class="s">"Computer Science"</span>;\n <span class="t">String</span> focus = <span class="s">"Back-end"</span>;\n <span class="t">String</span> language = <span class="s">"Java"</span>;\n <span class="t">String</span> city = <span class="s">"Contagem, Brazil"</span>;\n <span class="t">boolean</span> openToInternship = <span class="k">true</span>;\n\n <span class="c">// always learning something new</span>\n}</code>',
"sobre.title": "About me",
"sobre.p1": "I'm a Computer Science student, and what hooks me on programming is turning a problem into something that works. Back-end development with Java is where I want to build my career.",
"sobre.p2": "I decided to document my whole programming journey, and Instagram is where I share most of it day to day: the wins, the mistakes and everything I learn along the way. If you're also starting out in tech, or just want to follow along, come find me at <a class=\"link\" href=\"https://www.instagram.com/dev.anthonym/\" target=\"_blank\" rel=\"noopener\">@dev.anthonym</a>. For longer, more in-depth content, there's YouTube, and my professional journey lives on LinkedIn and GitHub.",
"sobre.p3": "Behind the content are my daily studies and projects, like the Ticket Triage System, inspired by my IT internship at Contagem City Hall. I use generative AI as a tool for studying and development, always making sure I understand the code that goes into my projects.",
"sobre.interesses": "interests",
"sobre.interesses.list": "<li>Back-end development</li><li>Databases</li><li>Software architecture</li><li>AI applied to real problems</li>",
"sobre.objetivos": "goals",
"sobre.objetivos.list": "<li>Land a software development internship</li><li>Go deeper into Java and Spring Boot</li><li>Become fluent in English</li><li>Graduate in 2028</li>",
"sobre.github": "github activity",
"contrib.menos": "Less",
"contrib.mais": "More",
"tec.title": "Stack",
"tec.java": "Main language, daily OOP practice",
"tec.spring": "REST APIs in the Ticket Triage System",
"tec.sqlite": "Data persistence in IntegraSaúde",
"tec.git": "Version control with Conventional Commits",
"tec.eclipse": "Everyday IDE, with Spring Tools",
"tec.uso": "using",
"tec.estudando": "learning",
"proj.title": "Projects",
"proj.dev": "in development",
"proj.done": "completed",
"proj.andamento": "in progress",
"proj.repo": "View repository",
"proj.triagem.title": "AI-powered Ticket Triage System",
"proj.triagem.desc": "It started at my internship, where support tickets are read and sorted by hand. When a ticket is opened, a generative AI classifies its category and priority, summarizes the issue and suggests a reply.",
"proj.triagem.feat": "<li>Automatic triage with the Claude API</li><li>Reports built with SQL queries</li><li>Weekly CSV report</li>",
"proj.integra.desc": "Medication and appointment reminders with patient and caregiver profiles. If a dose isn't confirmed in time, the caregiver gets an alert. An academic group project for the Software Quality Assurance course, where I was in charge of development.",
"proj.curso.desc": "The code from my daily Java and Object-Oriented Programming studies, organized lesson by lesson. It's the most honest record of my progress.",
"form.title": "Education",
"form.curso": "Bachelor's in Computer Science",
"form.previsao": "Expected graduation: Dec 2028",
"cert.title": "Certificates",
"cert.java": "Java: Object-Oriented Programming and Projects",
"cert.ingles": "English from beginner to fluency",
"cert.note": "New certificates will show up here as soon as they're completed.",
"traj.title": "Timeline",
"traj.sub": "My journey told as a commit history, newest first.",
"traj.1": "<b>feat:</b> start of documenting my progress in public on GitHub, LinkedIn, Instagram and YouTube",
"traj.2": "<b>feat(project):</b> started the AI-powered Ticket Triage System",
"traj.3": "<b>feat(project):</b> final delivery of the IntegraSaúde project",
"traj.4": "<b>chore(studies):</b> consistency in my Java and English studies",
"traj.5": "<b>feat(career):</b> IT internship at Contagem City Hall",
"traj.6": "<b>init:</b> started my Computer Science degree at UNA Contagem",
"cont.title": "Content",
"cont.sub": "Studies, projects and behind the scenes: these are the channels where I share every step of my programming journey.",
"cont.ig": "Tech content with a relaxed vibe: quick tips, news and stuff only devs get.",
"cont.yt": "What I'm studying, my progress, thoughts on tech and my daily routine.",
"cont.li": "My professional journey: projects, courses and lessons learned.",
"contato.title": "Contact",
"contato.sub": "To reach me by email, just fill out the form. If you prefer, you can also find me on LinkedIn and my other social media.",
"form.nome": "Name",
"form.msg": "Message",
"form.enviar": "Send message",
"footer.ai": "This website was built with generative AI (Claude)."
};
const MSG = {
pt: {
name: "Informe seu nome.",
email: "Informe um e-mail válido.",
message: "Escreva uma mensagem com pelo menos 10 caracteres.",
check: "Confira os campos destacados.",
sent: "Mensagem enviada. Respondo em breve.",
mail: "Abrindo seu app de e-mail com a mensagem pronta.",
fail: "Não foi possível enviar agora. Tente pelo e-mail dev.anthony.m@gmail.com."
},
en: {
name: "Enter your name.",
email: "Enter a valid email.",
message: "Write a message with at least 10 characters.",
check: "Check the highlighted fields.",
sent: "Message sent. I'll get back to you soon.",
mail: "Opening your email app with the message ready.",
fail: "Couldn't send right now. Try emailing dev.anthony.m@gmail.com."
}
};
const store = {
get(key) { try { return localStorage.getItem(key); } catch { return null; } },
set(key, value) { try { localStorage.setItem(key, value); } catch { } }
};
const body = document.body;
const i18nEls = Array.from(document.querySelectorAll("[data-i18n]"));
i18nEls.forEach((el) => { el.dataset.pt = el.innerHTML; });
let lang = store.get("portfolio-lang") === "en" ? "en" : "pt";
let theme = store.get("portfolio-theme") === "light" ? "light" : "dark";
const themeLabel = document.getElementById("themeLabel");
function applyLang() {
document.documentElement.lang = lang === "en" ? "en" : "pt-BR";
i18nEls.forEach((el) => {
if (el === themeLabel) return;
const key = el.dataset.i18n;
el.innerHTML = lang === "en" && EN[key] ? EN[key] : el.dataset.pt;
});
document.querySelectorAll("[data-lang-opt]").forEach((opt) => {
opt.classList.toggle("is-on", opt.dataset.langOpt === lang);
});
applyTheme();
}
function applyTheme() {
body.setAttribute("data-theme", theme);
const key = theme === "dark" ? "theme.dark" : "theme.light";
themeLabel.textContent = lang === "en" ? EN[key] : (theme === "dark" ? "escuro" : "claro");
}
document.getElementById("langToggle").addEventListener("click", () => {
lang = lang === "pt" ? "en" : "pt";
store.set("portfolio-lang", lang);
applyLang();
});
document.getElementById("themeToggle").addEventListener("click", () => {
theme = theme === "dark" ? "light" : "dark";
store.set("portfolio-theme", theme);
applyTheme();
});
applyLang();
const nav = document.getElementById("nav");
const menuToggle = document.getElementById("menuToggle");
menuToggle.addEventListener("click", () => {
const open = nav.classList.toggle("is-open");
menuToggle.setAttribute("aria-expanded", String(open));
});
nav.querySelectorAll("a").forEach((link) => {
link.addEventListener("click", () => {
nav.classList.remove("is-open");
menuToggle.setAttribute("aria-expanded", "false");
});
});
const navLinks = Array.from(nav.querySelectorAll("a"));
const spy = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) return;
navLinks.forEach((link) => {
link.classList.toggle("is-active", link.getAttribute("href") === "#" + entry.target.id);
});
});
}, { rootMargin: "-40% 0px -55% 0px" });
document.querySelectorAll("main section[id]").forEach((section) => spy.observe(section));
document.querySelectorAll(".github-stats img").forEach((img) => {
img.addEventListener("error", () => {
img.style.display = "none";
const card = img.closest(".card");
const allHidden = Array.from(card.querySelectorAll("img")).every((i) => i.style.display === "none");
if (allHidden) card.style.display = "none";
});
});
const form = document.getElementById("contactForm");
const fields = {
name: [document.getElementById("fieldName"), document.getElementById("errorName")],
email: [document.getElementById("fieldEmail"), document.getElementById("errorEmail")],
message: [document.getElementById("fieldMessage"), document.getElementById("errorMessage")]
};
const status = document.getElementById("formStatus");
function setError(name, message) {
const [input, errorEl] = fields[name];
input.classList.toggle("has-error", Boolean(message));
errorEl.textContent = message || "";
}
Object.keys(fields).forEach((name) => {
fields[name][0].addEventListener("input", () => setError(name, ""));
});
form.addEventListener("submit", async (event) => {
event.preventDefault();
const t = MSG[lang];
const name = fields.name[0].value.trim();
const email = fields.email[0].value.trim();
const message = fields.message[0].value.trim();
let ok = true;
if (name.length < 2) { setError("name", t.name); ok = false; } else setError("name", "");
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { setError("email", t.email); ok = false; } else setError("email", "");
if (message.length < 10) { setError("message", t.message); ok = false; } else setError("message", "");
if (!ok) { status.textContent = t.check; return; }
if (form.action.includes("SEU_ID")) {
const subject = encodeURIComponent("Contato pelo portfólio: " + name);
const text = encodeURIComponent(message + "\n\n" + name + " (" + email + ")");
window.location.href = "mailto:dev.anthony.m@gmail.com?subject=" + subject + "&body=" + text;
status.textContent = t.mail;
return;
}
try {
const response = await fetch(form.action, {
method: "POST",
body: new FormData(form),
headers: { Accept: "application/json" }
});
if (!response.ok) throw new Error();
status.textContent = t.sent;
form.reset();
} catch {
status.textContent = t.fail;
}
});
});