From ac96f86e29884cd2267bda7be87e10f8d5fd3d25 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Mon, 20 Apr 2026 11:41:01 +0000 Subject: [PATCH] Admin: replace top tabs with sidebar menu (RTL on right) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task #9 — the admin page used a horizontal Tabs bar across the top. User wanted an OS-style admin shell with a vertical side menu that sits on the right in Arabic and on the left in English. Changes (artifacts/teaboy-os/src/pages/admin.tsx): - Removed the Tabs/TabsList/TabsTrigger/TabsContent layout - Added local section state ("dashboard" | "apps" | "services" | "users" | "settings"), defaulting to dashboard - Desktop (>=md): vertical sidebar (240px wide) with icon + label for each section, glass-style highlighted active item. Sidebar is the first DOM child of the flex row, so under dir="rtl" it naturally appears on the right; under dir="ltr" on the left. - Mobile ((null); const [editingService, setEditingService] = useState<{ id?: number; form: ServiceForm } | null>(null); const [newUserForm, setNewUserForm] = useState<{ username: string; email: string; password: string } | null>(null); + const [section, setSection] = useState("dashboard"); + const [mobileNavOpen, setMobileNavOpen] = useState(false); + + const navItems: { key: AdminSection; label: string; Icon: typeof LayoutDashboard }[] = [ + { key: "dashboard", label: t("admin.nav.dashboard"), Icon: LayoutDashboard }, + { key: "apps", label: t("admin.nav.apps"), Icon: Grid2X2 }, + { key: "services", label: t("admin.nav.services"), Icon: Coffee }, + { key: "users", label: t("admin.nav.users"), Icon: UsersIcon }, + { key: "settings", label: t("admin.nav.settings"), Icon: Settings }, + ]; + + const renderNavList = (onSelect?: () => void) => ( + + ); const emptyAppForm: AppForm = { nameAr: "", nameEn: "", slug: "", iconName: "Grid2X2", route: "/", color: "#6366f1", sortOrder: 0 }; const emptyServiceForm: ServiceForm = { nameAr: "", nameEn: "", descriptionAr: "", descriptionEn: "", price: "0.00", imageUrl: "", isAvailable: true }; @@ -171,10 +210,27 @@ export default function AdminPage() { > -
- -

{t("admin.title")}

+
+ +

{t("admin.title")}

+ + + + + +
+ +

{t("admin.title")}

+
+ {renderNavList(() => setMobileNavOpen(false))} +
+
{/* Edit App Modal */} @@ -303,17 +359,24 @@ export default function AdminPage() { )} -
- - - {t("admin.manageApps")} - {t("admin.manageServices")} - {t("admin.manageUsers")} - {t("admin.siteSettings")} - +
+ {/* Sidebar (desktop) */} + - {/* Apps Tab */} - + {/* Main content */} +
+ {section === "dashboard" && ( +
+ {t("admin.dashboardSoon")} +
+ )} + + {section === "apps" && ( +
))} - +
+ )} - {/* Services Tab */} - + {section === "services" && ( +
))} -
+
+ )} - {/* Users Tab */} - + {section === "users" && ( +
))} -
+
+ )} - - - - + {section === "settings" && ( +
+ +
+ )} + );