Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions app/components/RoleSwitcher.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Geist, Geist_Mono } from "next/font/google";
import { CartProvider } from "./context/CartContext";
import { AuthProvider } from "./context/AuthContext";
import { ThemeProvider } from "./context/ThemeContext";
import RoleSwitcher from "./components/RoleSwitcher";
import "./globals.css";

const geistSans = Geist({
Expand Down Expand Up @@ -35,7 +34,6 @@ export default function RootLayout({
<AuthProvider>
<CartProvider>
{children}
<RoleSwitcher />
</CartProvider>
</AuthProvider>
</ThemeProvider>
Expand Down
28 changes: 17 additions & 11 deletions app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useRouter } from "next/navigation";
import { useAuth } from "@/app/context/AuthContext";
import { useState, useEffect } from "react";
import { useTheme } from "@/app/context/ThemeContext";
import { Switch } from "@/components/ui/switch";

export default function ProfilePage() {
const router = useRouter();
Expand Down Expand Up @@ -197,26 +196,33 @@ export default function ProfilePage() {
<span className="text-lg">🌙</span>
<span className="font-medium">Dark Mode</span>
</div>
<Switch
checked={theme === "dark"}
onCheckedChange={() => toggleTheme()}
<button
onClick={toggleTheme}
className="rounded-lg border border-stone-200 dark:border-stone-700 px-3 py-1.5 text-xs font-bold hover:bg-stone-50 dark:hover:bg-stone-700/40 transition-colors"
aria-label="Toggle dark mode"
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dark Mode toggle button uses aria-label, which overrides the visible "On/Off" text for screen readers, but it does not expose the current state. Consider using aria-pressed (or role="switch" + aria-checked) and either remove aria-label or include the current state in it so assistive tech can announce whether dark mode is on/off.

Suggested change
aria-label="Toggle dark mode"
aria-label={`Dark mode ${theme === "dark" ? "on" : "off"}`}
aria-pressed={theme === "dark"}

Copilot uses AI. Check for mistakes.
/>
>
{theme === "dark" ? "On" : "Off"}
</button>
</div>
)}
<div className="flex items-center justify-between p-3 rounded-lg border border-stone-200 dark:border-stone-700">
<div className="flex items-center gap-3">
<span className="text-lg">🔔</span>
<span className="font-medium">Notifications</span>
</div>
<Switch
checked={notificationsEnabled}
onCheckedChange={(checked) => {
setNotificationsEnabled(checked);
localStorage.setItem("quickbite_notifications_enabled", String(checked));
<button
onClick={() => {
setNotificationsEnabled((prev) => {
const next = !prev;
localStorage.setItem("quickbite_notifications_enabled", String(next));
return next;
});
Comment on lines +215 to +219
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localStorage.setItem(...) is executed inside the setNotificationsEnabled functional updater. Updater functions are expected to be pure and can be invoked more than once in React dev/Strict Mode, so this side effect may run multiple times. Prefer moving the persistence to a useEffect on notificationsEnabled, or compute next outside the updater and perform the storage write separately.

Suggested change
setNotificationsEnabled((prev) => {
const next = !prev;
localStorage.setItem("quickbite_notifications_enabled", String(next));
return next;
});
const next = !notificationsEnabled;
setNotificationsEnabled(next);
localStorage.setItem("quickbite_notifications_enabled", String(next));

Copilot uses AI. Check for mistakes.
}}
className="rounded-lg border border-stone-200 dark:border-stone-700 px-3 py-1.5 text-xs font-bold hover:bg-stone-50 dark:hover:bg-stone-700/40 transition-colors"
aria-label="Toggle notifications"
/>
>
{notificationsEnabled ? "On" : "Off"}
</button>
Comment on lines +213 to +225
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same accessibility issue for the Notifications toggle: aria-label overrides the "On/Off" text but the control doesn't expose its pressed/checked state. Add aria-pressed (or role="switch" + aria-checked) and ensure the accessible name/description communicates the current state.

Copilot uses AI. Check for mistakes.
</div>
</div>
</div>
Expand Down
Loading