diff --git a/src/components/StreakTracker.tsx b/src/components/StreakTracker.tsx
index 9f681b27..fc85190a 100644
--- a/src/components/StreakTracker.tsx
+++ b/src/components/StreakTracker.tsx
@@ -687,7 +687,7 @@ export default function StreakTracker() {
)}
- {!freezeLoading && freeze?.hasFreeze && (
+ {freeze && freeze.hasFreeze && (
@@ -699,16 +699,16 @@ export default function StreakTracker() {
@@ -717,7 +717,8 @@ export default function StreakTracker() {
@@ -725,7 +726,7 @@ export default function StreakTracker() {
)}
- {!freezeLoading && !freeze?.hasFreeze && (
+ {freeze && !freeze.hasFreeze && (
Streak Freeze
@@ -747,13 +748,13 @@ export default function StreakTracker() {
)}
diff --git a/src/components/TodayFocusHero.tsx b/src/components/TodayFocusHero.tsx
index f3f741ff..e1e05e3f 100644
--- a/src/components/TodayFocusHero.tsx
+++ b/src/components/TodayFocusHero.tsx
@@ -42,6 +42,8 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
const [greeting, setGreeting] = useState<"morning" | "afternoon" | "evening">("morning");
const [todayKey, setTodayKey] = useState("");
const [isMounted, setIsMounted] = useState(false);
+ const [isSaving, setIsSaving] = useState(false);
+ const [isClearing, setIsClearing] = useState(false);
const greetingLabel = useMemo(() => {
const base =
@@ -105,6 +107,7 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
const trimmedGoal = inputValue.trim();
if (!trimmedGoal || !todayKey) return;
+ setIsSaving(true);
try {
window.localStorage.setItem(todayKey, trimmedGoal);
} catch (e) {}
@@ -122,12 +125,15 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
});
} catch (err) {
console.error("Failed to save daily focus", err);
+ } finally {
+ setIsSaving(false);
}
}
async function handleClear() {
if (!todayKey) return;
+ setIsClearing(true);
try {
window.localStorage.removeItem(todayKey);
} catch (e) {}
@@ -143,6 +149,8 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
});
} catch (err) {
console.error("Failed to clear daily focus", err);
+ } finally {
+ setIsClearing(false);
}
}
@@ -219,9 +227,10 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
@@ -242,8 +251,9 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {
setInputValue(event.target.value)}
+ disabled={isSaving || isClearing}
placeholder="Write your main dev goal for today..."
- className="w-full rounded-xl border border-[var(--border)] bg-[var(--background)] px-4 py-3 text-sm text-[var(--foreground)] shadow-sm transition placeholder:text-[var(--muted-foreground)]"
+ className="w-full rounded-xl border border-[var(--border)] bg-[var(--background)] px-4 py-3 text-sm text-[var(--foreground)] shadow-sm transition placeholder:text-[var(--muted-foreground)] disabled:opacity-50 disabled:cursor-not-allowed"
/>
@@ -251,18 +261,19 @@ export default function TodayFocusHero({ userName }: TodayFocusHeroProps) {