Skip to content

Commit 4945246

Browse files
committed
✨ feat: Add local storage badge and update task management description for guest mode.
1 parent 9d8a568 commit 4945246

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

app/components/SyncBadge.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
import { useDriveContext } from "@/app/components/hooks/DriveHook";
2-
import { BadgeCheck, RefreshCw } from "lucide-react"; // Using BadgeCheck icon
2+
import { BadgeCheck, RefreshCw, HardDrive } from "lucide-react"; // Using HardDrive for local
33
import { useLanguage } from "@/app/components/hooks/LanguageHook";
44

55
export default function SyncBadge({
66
showLabel = true,
77
}: {
88
showLabel?: boolean;
99
}) {
10-
const { isSyncing, user } = useDriveContext();
10+
const { isSyncing, user, storageMode } = useDriveContext();
1111
const { t } = useLanguage();
1212

1313
if (!user) return null;
1414

15+
if (storageMode === "guest") {
16+
return (
17+
<div className="flex items-center gap-2 transition-all duration-300">
18+
{/* Mobile: Icon only, text-neutral/content */}
19+
<div className="sm:hidden text-base-content/70 p-2">
20+
<HardDrive className="w-6 h-6" />
21+
</div>
22+
23+
{/* Desktop: Badge style - Neutral/Info */}
24+
<div className="hidden sm:flex badge badge-neutral gap-2 p-3 font-medium shadow-sm">
25+
<HardDrive className="w-4 h-4" />
26+
{t("local_storage")}
27+
</div>
28+
</div>
29+
);
30+
}
31+
1532
if (isSyncing) {
1633
return (
1734
<div className="flex items-center gap-2 transition-all duration-300">

app/components/hooks/LanguageHook.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const translations: Record<Language, Record<string, string>> = {
4646
guest: "Guest",
4747
continue_guest: "Continue as Guest",
4848
guest_login_desc: "Your data is saved on this device only.",
49+
manage_description_guest: "Your tasks are saved locally on this device.",
50+
local_storage: "Local Storage",
4951
},
5052
es: {
5153
"app.title": "byteTasks",
@@ -62,6 +64,8 @@ const translations: Record<Language, Record<string, string>> = {
6264
"task.empty.subtitle": "¡Añade una arriba para empezar!",
6365
my_tasks: "Mis Tareas",
6466
manage_description: "Gestiona tus tareas sincronizadas con Google Drive.",
67+
manage_description_guest:
68+
"Tus tareas se guardan localmente en este dispositivo.",
6569
"theme.select": "Seleccionar Tema",
6670
"shortcuts.title": "Atajos de Teclado",
6771
"shortcuts.add": "Añadir Tarea",
@@ -76,6 +80,7 @@ const translations: Record<Language, Record<string, string>> = {
7680
guest: "Invitado",
7781
continue_guest: "Continuar como Invitado",
7882
guest_login_desc: "Tus datos se guardan solo en este dispositivo.",
83+
local_storage: "Almacenamiento Local",
7984
},
8085
};
8186

app/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default function Home() {
2020
handleGuestLogin,
2121
tasks,
2222
setTasks,
23+
storageMode,
2324
} = useDriveContext();
2425
const { t } = useLanguage();
2526

@@ -124,7 +125,9 @@ export default function Home() {
124125
</h2>
125126
</div>
126127
<p className="text-base-content/60">
127-
{t("manage_description")}
128+
{storageMode === "guest"
129+
? t("manage_description_guest")
130+
: t("manage_description")}
128131
</p>
129132
</div>
130133
<TaskList

0 commit comments

Comments
 (0)