feat: release 0.7.0 celebration flow
This commit is contained in:
@@ -1505,6 +1505,15 @@ p {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.celebration-score {
|
||||
width: 80vw;
|
||||
font-size: clamp(5.5rem, 28vw, 8.5rem);
|
||||
}
|
||||
|
||||
.celebration-glow {
|
||||
width: min(78vw, 240px);
|
||||
}
|
||||
|
||||
.form-actions .button,
|
||||
.form-actions a.button {
|
||||
width: 100%;
|
||||
@@ -1606,14 +1615,23 @@ p {
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
overflow: visible;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.complete-dialog:not([open]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.complete-dialog[open] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.complete-dialog::backdrop {
|
||||
@@ -1641,6 +1659,70 @@ p {
|
||||
touch-action: pan-y;
|
||||
}
|
||||
|
||||
.celebration-layer {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 90;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.celebration-score,
|
||||
.celebration-glow,
|
||||
.celebration-particle {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.celebration-score {
|
||||
width: min(80vw, 520px);
|
||||
padding: 0;
|
||||
background:
|
||||
linear-gradient(
|
||||
135deg,
|
||||
rgba(255, 255, 255, 0.98) 0%,
|
||||
rgba(214, 234, 255, 0.92) 18%,
|
||||
rgba(94, 168, 255, 0.72) 42%,
|
||||
rgba(52, 211, 153, 0.74) 70%,
|
||||
rgba(255, 255, 255, 0.92) 100%
|
||||
);
|
||||
color: transparent;
|
||||
-webkit-text-fill-color: transparent;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-stroke: 1px rgba(255, 255, 255, 0.22);
|
||||
font-size: clamp(6.5rem, 28vw, 12rem);
|
||||
font-weight: 900;
|
||||
line-height: 0.9;
|
||||
letter-spacing: -0.08em;
|
||||
text-align: center;
|
||||
transform: translate(-50%, -50%);
|
||||
filter:
|
||||
drop-shadow(0 10px 24px rgba(94, 168, 255, 0.18))
|
||||
drop-shadow(0 0 18px rgba(255, 255, 255, 0.18));
|
||||
animation: celebration-score-in 1.15s cubic-bezier(0.18, 0.84, 0.24, 1) forwards;
|
||||
}
|
||||
|
||||
.celebration-glow {
|
||||
width: min(56vw, 280px);
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background:
|
||||
radial-gradient(circle, rgba(94, 168, 255, 0.26) 0%, rgba(52, 211, 153, 0.2) 42%, rgba(94, 168, 255, 0) 74%);
|
||||
transform: translate(-50%, -50%);
|
||||
filter: blur(10px);
|
||||
animation: celebration-glow 0.95s ease-out forwards;
|
||||
}
|
||||
|
||||
.celebration-particle {
|
||||
width: var(--size, 10px);
|
||||
height: var(--size, 10px);
|
||||
border-radius: 999px;
|
||||
transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-4px);
|
||||
animation: celebration-particle 0.82s ease-out var(--delay, 0s) forwards;
|
||||
}
|
||||
|
||||
.choice-grid {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
@@ -1681,6 +1763,61 @@ p {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
@keyframes celebration-score-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -42%) scale(0.74);
|
||||
filter: blur(16px);
|
||||
}
|
||||
12% {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
filter: blur(0);
|
||||
}
|
||||
58% {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -53%) scale(1.03);
|
||||
filter: blur(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -76%) scale(1.08);
|
||||
filter: blur(20px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes celebration-glow {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%) scale(0.32);
|
||||
}
|
||||
22% {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%) scale(1.42);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes celebration-particle {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(0.4);
|
||||
filter: blur(4px);
|
||||
}
|
||||
18% {
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--distance) * -1)) scale(0.9);
|
||||
filter: blur(6px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 759px) {
|
||||
.calendar-toolbar-mobile__header {
|
||||
align-items: flex-start;
|
||||
@@ -1884,6 +2021,18 @@ p {
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.celebration-score {
|
||||
animation-duration: 0.46s;
|
||||
}
|
||||
|
||||
.celebration-glow,
|
||||
.celebration-particle {
|
||||
animation: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1100px) {
|
||||
.app-shell {
|
||||
display: grid;
|
||||
|
||||
@@ -20,9 +20,50 @@
|
||||
const quickWinSortIds = document.getElementById("quickWinSortIds");
|
||||
const quickWinSortSave = document.getElementById("quickWinSortSave");
|
||||
const quickWinToggleButtons = document.querySelectorAll("[data-quick-win-toggle]");
|
||||
const celebrationLayer = document.getElementById("celebrationLayer");
|
||||
const celebratePoints = Number.parseInt(document.body.dataset.celebratePoints || "", 10);
|
||||
const scrollRestoreKey = "putzliga:scroll-restore";
|
||||
let draggedQuickWin = null;
|
||||
let quickWinSortDirty = false;
|
||||
|
||||
function rememberScrollPosition() {
|
||||
try {
|
||||
window.sessionStorage.setItem(
|
||||
scrollRestoreKey,
|
||||
JSON.stringify({
|
||||
path: window.location.pathname,
|
||||
y: window.scrollY,
|
||||
}),
|
||||
);
|
||||
} catch (_) {
|
||||
// Ignore storage errors and continue normally.
|
||||
}
|
||||
}
|
||||
|
||||
function restoreScrollPosition() {
|
||||
try {
|
||||
const rawValue = window.sessionStorage.getItem(scrollRestoreKey);
|
||||
if (!rawValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
const saved = JSON.parse(rawValue);
|
||||
window.sessionStorage.removeItem(scrollRestoreKey);
|
||||
|
||||
if (!saved || saved.path !== window.location.pathname || typeof saved.y !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(() => {
|
||||
window.requestAnimationFrame(() => {
|
||||
window.scrollTo({ top: saved.y, behavior: "auto" });
|
||||
});
|
||||
});
|
||||
} catch (_) {
|
||||
// Ignore malformed storage data.
|
||||
}
|
||||
}
|
||||
|
||||
function buildCompletionOptions(button) {
|
||||
const options = [];
|
||||
const assignedPairs = [
|
||||
@@ -60,6 +101,7 @@
|
||||
choiceButton.textContent = option.label;
|
||||
choiceButton.addEventListener("click", () => {
|
||||
dialogChoice.value = option.value;
|
||||
rememberScrollPosition();
|
||||
dialog.close();
|
||||
dialogForm.submit();
|
||||
});
|
||||
@@ -74,13 +116,33 @@
|
||||
}
|
||||
|
||||
if (quickTaskOpen && quickTaskDialog) {
|
||||
quickTaskOpen.addEventListener("click", () => quickTaskDialog.showModal());
|
||||
quickTaskOpen.addEventListener("click", () => {
|
||||
if (!quickTaskDialog.open) {
|
||||
quickTaskDialog.showModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (quickTaskClose && quickTaskDialog) {
|
||||
quickTaskClose.addEventListener("click", () => quickTaskDialog.close());
|
||||
quickTaskClose.addEventListener("click", () => {
|
||||
if (quickTaskDialog.open) {
|
||||
quickTaskDialog.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[dialog, quickTaskDialog].forEach((activeDialog) => {
|
||||
if (!activeDialog) {
|
||||
return;
|
||||
}
|
||||
|
||||
activeDialog.addEventListener("click", (event) => {
|
||||
if (event.target === activeDialog && activeDialog.open) {
|
||||
activeDialog.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function updateQuickWinsState() {
|
||||
const selectedPresetCount = [...quickWinInputs].filter((input) => input.checked).length;
|
||||
const customSelected = quickWinCustomToggle?.checked === true;
|
||||
@@ -123,6 +185,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (dialogForm) {
|
||||
dialogForm.addEventListener("submit", () => {
|
||||
rememberScrollPosition();
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('form[action*="/complete"]').forEach((form) => {
|
||||
form.addEventListener("submit", () => {
|
||||
rememberScrollPosition();
|
||||
});
|
||||
});
|
||||
|
||||
const quickWinsForm = document.getElementById("quickWinsForm");
|
||||
if (quickWinsForm) {
|
||||
quickWinsForm.addEventListener("submit", () => {
|
||||
rememberScrollPosition();
|
||||
});
|
||||
}
|
||||
|
||||
function syncQuickWinSortIds() {
|
||||
if (!quickWinSortList || !quickWinSortIds) {
|
||||
return;
|
||||
@@ -140,6 +221,65 @@
|
||||
}
|
||||
}
|
||||
|
||||
function clearCelebrationQuery() {
|
||||
if (!window.history.replaceState) {
|
||||
return;
|
||||
}
|
||||
const url = new URL(window.location.href);
|
||||
if (!url.searchParams.has("celebrate_points")) {
|
||||
return;
|
||||
}
|
||||
url.searchParams.delete("celebrate_points");
|
||||
const nextUrl = `${url.pathname}${url.search}${url.hash}`;
|
||||
window.history.replaceState({}, document.title, nextUrl);
|
||||
}
|
||||
|
||||
function celebrateCompletion(points) {
|
||||
if (!celebrationLayer || !Number.isFinite(points) || points <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
celebrationLayer.hidden = false;
|
||||
celebrationLayer.setAttribute("aria-hidden", "false");
|
||||
celebrationLayer.innerHTML = "";
|
||||
|
||||
const score = document.createElement("div");
|
||||
score.className = "celebration-score";
|
||||
score.textContent = points;
|
||||
celebrationLayer.appendChild(score);
|
||||
|
||||
const glow = document.createElement("div");
|
||||
glow.className = "celebration-glow";
|
||||
celebrationLayer.appendChild(glow);
|
||||
|
||||
if (!prefersReducedMotion) {
|
||||
const colors = [
|
||||
"rgba(94, 168, 255, 0.96)",
|
||||
"rgba(52, 211, 153, 0.95)",
|
||||
"rgba(250, 204, 21, 0.92)",
|
||||
"rgba(191, 219, 254, 0.96)",
|
||||
];
|
||||
|
||||
Array.from({ length: 14 }).forEach((_, index) => {
|
||||
const particle = document.createElement("span");
|
||||
particle.className = "celebration-particle";
|
||||
particle.style.setProperty("--angle", `${Math.round((360 / 14) * index + Math.random() * 18)}deg`);
|
||||
particle.style.setProperty("--distance", `${72 + Math.round(Math.random() * 44)}px`);
|
||||
particle.style.setProperty("--delay", `${(Math.random() * 0.08).toFixed(2)}s`);
|
||||
particle.style.setProperty("--size", `${7 + Math.round(Math.random() * 7)}px`);
|
||||
particle.style.background = colors[index % colors.length];
|
||||
celebrationLayer.appendChild(particle);
|
||||
});
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
celebrationLayer.hidden = true;
|
||||
celebrationLayer.setAttribute("aria-hidden", "true");
|
||||
celebrationLayer.innerHTML = "";
|
||||
}, prefersReducedMotion ? 520 : 1500);
|
||||
}
|
||||
|
||||
if (quickWinSortList) {
|
||||
syncQuickWinSortIds();
|
||||
setQuickWinSortDirty(false);
|
||||
@@ -282,4 +422,11 @@
|
||||
togglePush().catch((error) => console.error("Push toggle failed", error));
|
||||
});
|
||||
}
|
||||
|
||||
if (Number.isFinite(celebratePoints) && celebratePoints > 0) {
|
||||
celebrateCompletion(celebratePoints);
|
||||
clearCelebrationQuery();
|
||||
}
|
||||
|
||||
restoreScrollPosition();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user