From 6e9b87ace562ccc67e501d17189864c0b69e1330 Mon Sep 17 00:00:00 2001 From: plumbestie Date: Thu, 19 Feb 2026 00:22:16 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=95=8C=EB=A6=BC=20=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EC=99=84=EB=A3=8C=20=ED=86=A0=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EA=B4=80=EB=A0=A8=20js=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/team_apply.js | 67 +++++++++++++++++++++++++++++++++ templates/teams/team_apply.html | 1 + 2 files changed, 68 insertions(+) create mode 100644 static/js/team_apply.js diff --git a/static/js/team_apply.js b/static/js/team_apply.js new file mode 100644 index 0000000..84d267b --- /dev/null +++ b/static/js/team_apply.js @@ -0,0 +1,67 @@ +const showToast = (message, type = "success") => { + const toast = document.createElement("div"); + toast.className = `ref-toast ref-toast-${type}`; + toast.textContent = message; + + Object.assign(toast.style, { + position: "fixed", + bottom: "50px", + left: "50%", + transform: "translateX(-50%) translateY(20px)", + background: type === "success" ? "#4272EF" : "#FF6B6B", + color: "#fff", + padding: "12px 25px", + borderRadius: "30px", + fontSize: "15px", + fontWeight: "500", + boxShadow: "0 4px 15px rgba(0,0,0,0.2)", + opacity: "0", + transition: "all 0.3s ease", + zIndex: "9999", + }); + + document.body.appendChild(toast); + + requestAnimationFrame(() => { + toast.style.opacity = "1"; + toast.style.transform = "translateX(-50%) translateY(0)"; + }); + + setTimeout(() => { + toast.style.opacity = "0"; + toast.style.transform = "translateX(-50%) translateY(20px)"; + setTimeout(() => toast.remove(), 300); + }, 2000); +}; + +const bindNotifyBtn = () => { + document.querySelectorAll(".noti_button").forEach(btn => { + btn.addEventListener("click", (e) => { + e.preventDefault(); + + const form = btn.closest("form"); + + fetch(form.action, { + method: "POST", + body: new FormData(form), + }) + .then(res => { + if (res.ok) { + showToast("알림 신청이 완료되었습니다.", "success"); + btn.disabled = true; + btn.textContent = "신청 완료"; + btn.style.background = "#ccc"; + } else { + showToast("신청 중 오류가 발생했습니다.", "error"); + } + }) + .catch(() => showToast("네트워크 오류가 발생했습니다.", "error")); + }); + }); +}; + +if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", bindNotifyBtn); +} else { + bindNotifyBtn(); +} \ No newline at end of file diff --git a/templates/teams/team_apply.html b/templates/teams/team_apply.html index afbdb5a..2b0612c 100644 --- a/templates/teams/team_apply.html +++ b/templates/teams/team_apply.html @@ -156,6 +156,7 @@

{% endif %} + {% endblock %}