feat: Integrate new dashboard design and components, remove old dashboard routes, and update dependencies.
This commit is contained in:
@@ -38,7 +38,7 @@ import { useCallback, useEffect, useState } from "react";
|
||||
import { protectedRouteMiddleware } from "../../middleware/authMiddleware";
|
||||
import { apiClient } from "../../utils/api-client";
|
||||
|
||||
export const Route = createFileRoute("/dashboard/apikey")({
|
||||
export const Route = createFileRoute("/admin/apikey")({
|
||||
beforeLoad: protectedRouteMiddleware,
|
||||
component: DashboardApikeyComponent,
|
||||
});
|
||||
@@ -1,4 +1,3 @@
|
||||
import { authClient } from "@/utils/auth-client";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
@@ -23,9 +22,10 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useSnapshot } from "valtio";
|
||||
import { authClient } from "@/utils/auth-client";
|
||||
import { authStore } from "../../store/auth";
|
||||
|
||||
export const Route = createFileRoute("/dashboard/")({
|
||||
export const Route = createFileRoute("/admin/")({
|
||||
component: DashboardComponent,
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ import { protectedRouteMiddleware } from "@/middleware/authMiddleware";
|
||||
import { authClient } from "@/utils/auth-client";
|
||||
import { authStore } from "../../store/auth";
|
||||
|
||||
export const Route = createFileRoute("/dashboard")({
|
||||
export const Route = createFileRoute("/admin")({
|
||||
component: DashboardLayout,
|
||||
beforeLoad: protectedRouteMiddleware,
|
||||
onEnter({ context }) {
|
||||
@@ -55,25 +55,25 @@ function DashboardLayout() {
|
||||
{
|
||||
icon: IconHome,
|
||||
label: "Beranda",
|
||||
to: "/dashboard",
|
||||
to: "/admin",
|
||||
description: "Ringkasan sistem & statistik",
|
||||
},
|
||||
{
|
||||
icon: IconUsers,
|
||||
label: "Pengguna",
|
||||
to: "/dashboard/users",
|
||||
to: "/admin/users",
|
||||
description: "Kelola akun & hak akses",
|
||||
},
|
||||
{
|
||||
icon: IconKey,
|
||||
label: "API Key",
|
||||
to: "/dashboard/apikey",
|
||||
to: "/admin/apikey",
|
||||
description: "Manajemen kunci akses API",
|
||||
},
|
||||
{
|
||||
icon: IconSettings,
|
||||
label: "Pengaturan",
|
||||
to: "/dashboard/settings",
|
||||
to: "/admin/settings",
|
||||
description: "Konfigurasi sistem",
|
||||
},
|
||||
];
|
||||
@@ -98,8 +98,8 @@ function DashboardLayout() {
|
||||
|
||||
const isActive = (path: string) => {
|
||||
const current = location.pathname;
|
||||
if (path === "/dashboard")
|
||||
return current === "/dashboard" || current === "/dashboard/";
|
||||
if (path === "/admin")
|
||||
return current === "/admin" || current === "/admin/";
|
||||
return current.startsWith(path);
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ function DashboardLayout() {
|
||||
leftSection={
|
||||
<IconSettings style={{ width: rem(14), height: rem(14) }} />
|
||||
}
|
||||
onClick={() => navigate({ to: "/dashboard/settings" })}
|
||||
onClick={() => navigate({ to: "/admin/settings" })}
|
||||
>
|
||||
Pengaturan
|
||||
</Menu.Item>
|
||||
@@ -1,11 +1,11 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { protectedRouteMiddleware } from "../../middleware/authMiddleware";
|
||||
|
||||
export const Route = createFileRoute("/dashboard/settings")({
|
||||
export const Route = createFileRoute("/admin/settings")({
|
||||
beforeLoad: protectedRouteMiddleware,
|
||||
component: DashboardSettingsComponent,
|
||||
});
|
||||
|
||||
function DashboardSettingsComponent() {
|
||||
return <div>Hello from /dashboard/settings!</div>;
|
||||
return <div>Hello from /admin/settings!</div>;
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { protectedRouteMiddleware } from "../../middleware/authMiddleware";
|
||||
|
||||
export const Route = createFileRoute("/dashboard/users")({
|
||||
export const Route = createFileRoute("/admin/users")({
|
||||
beforeLoad: protectedRouteMiddleware,
|
||||
component: DashboardUsersComponent,
|
||||
});
|
||||
|
||||
function DashboardUsersComponent() {
|
||||
return <div>Hello from /dashboard/users!</div>;
|
||||
return <div>Hello from /admin/users!</div>;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ function HeroSection() {
|
||||
<Group gap="md">
|
||||
<Button
|
||||
component={Link}
|
||||
to="/dashboard"
|
||||
to="/admin"
|
||||
size="lg"
|
||||
variant="filled"
|
||||
rightSection={<IconRocket size="1.25rem" />}
|
||||
|
||||
@@ -157,7 +157,7 @@ function Profile() {
|
||||
variant="light"
|
||||
color="orange"
|
||||
leftSection={<IconDashboard size={18} />}
|
||||
onClick={() => navigate({ to: "/dashboard" })}
|
||||
onClick={() => navigate({ to: "/admin" })}
|
||||
>
|
||||
Admin Panel
|
||||
</Button>
|
||||
|
||||
@@ -39,7 +39,7 @@ function SignupComponent() {
|
||||
if (error) {
|
||||
setError(error.message || "Failed to sign up");
|
||||
} else {
|
||||
navigate({ to: "/dashboard" });
|
||||
navigate({ to: "/admin" });
|
||||
}
|
||||
} catch {
|
||||
setError("An unexpected error occurred");
|
||||
|
||||
Reference in New Issue
Block a user