From 6cb863c7c2665d9531d2f83149fd816f09e50131 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?=
<80620802+burakboduroglu@users.noreply.github.com>
Date: Sun, 2 Aug 2026 19:46:26 +0300
Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=8C=8D=20locale-aware=20notificati?=
=?UTF-8?q?on=20dates=20and=20a=20real=20pomodoro=20countdown=20-=20notifi?=
=?UTF-8?q?cation-center:=20date/time=20formatting=20used=20toLocaleString?=
=?UTF-8?q?([],=20=E2=80=A6),=20=20=20which=20ignores=20the=20app's=20lang?=
=?UTF-8?q?uage=20toggle=20and=20follows=20the=20browser's=20own=20=20=20l?=
=?UTF-8?q?ocale=20instead=20=E2=80=94=20now=20threaded=20through=20the=20?=
=?UTF-8?q?user's=20actual=20preference=20-=20notification-center:=20hardc?=
=?UTF-8?q?oded=20Turkish=20strings=20(title,=20empty=20state,=20=20=20cle?=
=?UTF-8?q?ar-all,=20dismiss)=20moved=20to=20i18n=20so=20English=20mode=20?=
=?UTF-8?q?renders=20correctly=20too=20-=20exam-detail-page:=20results=20t?=
=?UTF-8?q?ab's=20DataTable=20used=20PageSpinner=20as=20its=20=20=20Suspen?=
=?UTF-8?q?se=20fallback=20instead=20of=20DataTableSkeleton,=20same=20size?=
=?UTF-8?q?-mismatch=20=20=20jump=20as=20the=20earlier=20course-detail=20p?=
=?UTF-8?q?anels=20-=20pomodoro-page:=20the=20clock=20now=20counts=20down?=
=?UTF-8?q?=20from=20a=20configurable=20target=20=20=20(15/25/45/60=20min?=
=?UTF-8?q?=20presets=20or=20a=20custom=20value,=20persisted=20locally)=20?=
=?UTF-8?q?instead=20=20=20of=20counting=20up=20forever;=20flips=20to=20a?=
=?UTF-8?q?=20highlighted=20"+overtime"=20readout=20and=20=20=20fires=20on?=
=?UTF-8?q?e=20flash=20once=20the=20target=20is=20crossed,=20matching=20th?=
=?UTF-8?q?e=20technique's=20=20=20fixed=20work=20interval=20=E2=80=94=20t?=
=?UTF-8?q?he=20backend=20session=20itself=20is=20still=20an=20=20=20open-?=
=?UTF-8?q?ended=20start/finish=20stopwatch,=20this=20only=20changes=20the?=
=?UTF-8?q?=20display?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/layout/notification-center.tsx | 25 ++--
.../layout/shell-unread-badge.test.tsx | 2 +-
src/i18n/messages.ts | 24 ++++
src/pages/exam-detail-page.tsx | 2 +-
src/pages/pomodoro-page.tsx | 130 +++++++++++++++---
5 files changed, 147 insertions(+), 36 deletions(-)
diff --git a/src/components/layout/notification-center.tsx b/src/components/layout/notification-center.tsx
index 697d5b3..6a5eb34 100644
--- a/src/components/layout/notification-center.tsx
+++ b/src/components/layout/notification-center.tsx
@@ -20,11 +20,12 @@ import {
getDismissedNotificationIds,
type NotificationItem,
} from "@/lib/notifications";
-import { useT } from "@/stores/preferences-context";
+import { usePreferences } from "@/stores/preferences-context";
import { useShellFeed } from "@/stores/shell-feed-context";
export function NotificationCenter() {
- const t = useT();
+ const { t, locale } = usePreferences();
+ const dateLocale = () => (locale() === "tr" ? "tr-TR" : "en-US");
const navigate = useNavigate();
const feed = useShellFeed();
const [open, setOpen] = createSignal(false);
@@ -76,7 +77,7 @@ export function NotificationCenter() {
type: "event",
title: e.title,
description: e.starts_at
- ? new Date(e.starts_at).toLocaleString([], {
+ ? new Date(e.starts_at).toLocaleString(dateLocale(), {
month: "short",
day: "numeric",
hour: "2-digit",
@@ -100,7 +101,7 @@ export function NotificationCenter() {
type: "exam",
title: ex.title,
description: ex.starts_at
- ? new Date(ex.starts_at).toLocaleString([], {
+ ? new Date(ex.starts_at).toLocaleString(dateLocale(), {
month: "short",
day: "numeric",
hour: "2-digit",
@@ -123,7 +124,7 @@ export function NotificationCenter() {
type: "homework",
title: hw.title,
description: hw.due_at
- ? `${t("homework.dueAt")}: ${new Date(hw.due_at).toLocaleDateString([], {
+ ? `${t("homework.dueAt")}: ${new Date(hw.due_at).toLocaleDateString(dateLocale(), {
month: "short",
day: "numeric",
})}`
@@ -203,8 +204,8 @@ export function NotificationCenter() {
"topbar-control relative flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-xl outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
open() && "bg-muted text-foreground"
)}
- title={t("rightPanel.messagesTitle")}
- aria-label="Bildirimler"
+ title={t("notifications.title")}
+ aria-label={t("notifications.title")}
>
0}>
@@ -219,7 +220,7 @@ export function NotificationCenter() {
-
Bildirimler
+ {t("notifications.title")}
0}>
{unreadCount()}
@@ -234,10 +235,10 @@ export function NotificationCenter() {
size="sm"
class="h-7 px-2 text-[11px] font-semibold text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded-lg"
onClick={handleDismissAll}
- title="Tüm Bildirimleri Temizle"
+ title={t("notifications.clearAll")}
>
- Tümünü Sil
+ {t("notifications.clearAll")}
@@ -259,7 +260,7 @@ export function NotificationCenter() {
- Henüz yeni bir bildiriminiz yok.
+ {t("notifications.empty")}
}
@@ -302,7 +303,7 @@ export function NotificationCenter() {
- }>
+ }>
0}
fallback={}
diff --git a/src/pages/pomodoro-page.tsx b/src/pages/pomodoro-page.tsx
index 338daa7..e7768d3 100644
--- a/src/pages/pomodoro-page.tsx
+++ b/src/pages/pomodoro-page.tsx
@@ -1,4 +1,4 @@
-import { Show, Suspense, createMemo, createResource, createSignal } from "solid-js";
+import { For, Show, Suspense, createEffect, createMemo, createResource, createSignal } from "solid-js";
import type { ColumnDef } from "@tanstack/solid-table";
import { getPomodoroMe } from "@/api/pomodoro";
import { postPomodoroFinish } from "@/api/pomodoro";
@@ -9,9 +9,9 @@ import { PageHeader } from "@/components/layout/page-header";
import { Alert } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
-import { DataTable } from "@/components/ui/data-table";
+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
import { IconCheck, IconClock } from "@/components/ui/icons";
-import { PageSpinner } from "@/components/ui/page-spinner";
+import { Input } from "@/components/ui/input";
import { createFlash } from "@/lib/flash";
import { createNow } from "@/lib/create-now";
import { triggerConfetti } from "@/lib/confetti";
@@ -19,6 +19,20 @@ import { cn } from "@/lib/cn";
import { formatDateTime, formatDurationClock } from "@/lib/format";
import { usePreferences, useT } from "@/stores/preferences-context";
+const DURATION_KEY = "hezarfen.pomodoro.targetMinutes";
+const PRESET_MINUTES = [15, 25, 45, 60];
+const DEFAULT_MINUTES = 25;
+const MAX_MINUTES = 180;
+
+function readTargetMinutes(): number {
+ try {
+ const saved = Number(localStorage.getItem(DURATION_KEY));
+ return Number.isFinite(saved) && saved > 0 && saved <= MAX_MINUTES ? saved : DEFAULT_MINUTES;
+ } catch {
+ return DEFAULT_MINUTES;
+ }
+}
+
export default function PomodoroPage() {
return (
@@ -40,6 +54,41 @@ function PomodoroContent() {
const current = running();
return current ? now() - current.started_at : null;
});
+
+ // Pomodoro-style countdown: purely a client-side display target — the
+ // backend session is still just an open-ended start/finish stopwatch, so
+ // this only changes what the clock shows, not what gets recorded.
+ const [targetMinutes, setTargetMinutes] = createSignal(readTargetMinutes());
+ createEffect(() => {
+ try {
+ localStorage.setItem(DURATION_KEY, String(targetMinutes()));
+ } catch {
+ // Duration just won't be remembered next visit.
+ }
+ });
+ const targetMs = () => targetMinutes() * 60_000;
+ const remainingMs = createMemo(() => {
+ const dur = runningDuration();
+ return dur == null ? null : Math.max(0, targetMs() - dur);
+ });
+ const overtimeMs = createMemo(() => {
+ const dur = runningDuration();
+ return dur == null ? 0 : Math.max(0, dur - targetMs());
+ });
+ const isOvertime = () => overtimeMs() > 0;
+
+ // One flash when the countdown crosses zero, not one per tick.
+ const [targetNotified, setTargetNotified] = createSignal(false);
+ createEffect(() => {
+ if (!running()) {
+ setTargetNotified(false);
+ return;
+ }
+ if (isOvertime() && !targetNotified()) {
+ setTargetNotified(true);
+ setFlash(t("pomodoro.targetReached"));
+ }
+ });
const finishedSessions = createMemo(() => (log()?.items ?? []).filter((item) => item.finished_at != null));
const todayFocus = createMemo(() => {
const start = new Date(now());
@@ -91,8 +140,7 @@ function PomodoroContent() {
const progressPercent = createMemo(() => {
const dur = runningDuration();
if (!dur) return 0;
- const targetMs = 25 * 60 * 1000;
- return Math.min(1, dur / targetMs);
+ return Math.min(1, dur / targetMs());
});
const dashOffset = createMemo(() => {
@@ -157,27 +205,65 @@ function PomodoroContent() {
-
{running() ? t("pomodoro.current") : t("pomodoro.total")}
-
- {formatDurationClock(running() ? runningDuration() : log()?.total_focus_ms)}
+
+ {running() ? (isOvertime() ? t("pomodoro.overtime") : t("pomodoro.remaining")) : t("pomodoro.total")}
+
+
+ {running() && isOvertime() && "+"}
+ {formatDurationClock(running() ? (isOvertime() ? overtimeMs() : remainingMs()) : log()?.total_focus_ms)}
- void run(postPomodoroStart, t("pomodoro.started"))}>
-
- {t("pomodoro.start")}
+
+
void run(postPomodoroStart, t("pomodoro.started"))}>
+
+ {t("pomodoro.start")}
+
+ }
+ >
+
- }
- >
-
-
+
+
+ {/* Session length: like the classic Pomodoro technique, this is
+ configurable — locked once a session is running so it can't
+ drift mid-focus. */}
+
+
+ {(minutes) => (
+
+ )}
+
+ {
+ const value = Number(event.currentTarget.value);
+ if (Number.isFinite(value) && value > 0 && value <= MAX_MINUTES) setTargetMinutes(value);
+ }}
+ />
+
+
@@ -208,7 +294,7 @@ function PomodoroContent() {
- }>
+ }>