mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 16:07:10 +00:00
Settings Page
This commit is contained in:
parent
c37bf1d9f9
commit
955f9f2861
@ -13,9 +13,9 @@ export default function DashboardPage({ username, name }: DashboardPageProps) {
|
|||||||
<Sidebar
|
<Sidebar
|
||||||
username={username}
|
username={username}
|
||||||
fullName={name}
|
fullName={name}
|
||||||
breadcrumbPath={['Home', 'Dashboard']}
|
breadcrumbPath={['/', 'Dashboard']}
|
||||||
>
|
>
|
||||||
<main className="pl-4">
|
<main>
|
||||||
<h1>Dashboard</h1>
|
<h1>Dashboard</h1>
|
||||||
</main>
|
</main>
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
|
|||||||
31
app/dashboard/settings/SettingsPage.tsx
Normal file
31
app/dashboard/settings/SettingsPage.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Sidebar from "@/components/Sidebar";
|
||||||
|
|
||||||
|
interface DashboardPageProps {
|
||||||
|
username: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DashboardPage({ username, name }: DashboardPageProps) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Sidebar
|
||||||
|
username={username}
|
||||||
|
fullName={name}
|
||||||
|
breadcrumbPath={['/', 'Dashboard', 'Settings']}
|
||||||
|
>
|
||||||
|
<main>
|
||||||
|
<h1 className="text-2xl font-bold">Settings</h1>
|
||||||
|
<p className="text-sm opacity-70">Manage your instance settings</p>
|
||||||
|
|
||||||
|
<div className="tabs tabs-border pt-8">
|
||||||
|
<input type="radio" name="user_settings" className="tab text-primary" aria-label="User Settings" defaultChecked/>
|
||||||
|
<div className="tab-content bg-base-100 p-10">User Settings</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</Sidebar>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
41
app/dashboard/settings/page.tsx
Normal file
41
app/dashboard/settings/page.tsx
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import SettingsPage from "./SettingsPage";
|
||||||
|
import Loading from "@/components/Loading";
|
||||||
|
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import axios from "axios";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
export default function Dashboard() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [username, setUsername] = useState("");
|
||||||
|
const [name, setName] = useState("");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const init = async () => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
if (!token) {
|
||||||
|
router.push("/");
|
||||||
|
}
|
||||||
|
const response = await axios.post("/api/user/validate", { token });
|
||||||
|
if (response.data.message !== "Valid") {
|
||||||
|
Cookies.remove("token");
|
||||||
|
router.push("/");
|
||||||
|
} else {
|
||||||
|
setUsername(response.data.username);
|
||||||
|
setName(response.data.name);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
init();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <Loading />;
|
||||||
|
} else {
|
||||||
|
return <SettingsPage username={username} name={name} />;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@ interface BreadcrumbsProps {
|
|||||||
export default function Breadcrumbs({ breadcrumbPath = ['Home'] }: BreadcrumbsProps) {
|
export default function Breadcrumbs({ breadcrumbPath = ['Home'] }: BreadcrumbsProps) {
|
||||||
return(
|
return(
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="breadcrumbs text-sm">
|
<div className="breadcrumbs text-sm bg-base-200 pb-6">
|
||||||
<ul className="pl-4 pt-4">
|
<ul className="pl-4 pt-4">
|
||||||
{breadcrumbPath.map((item, index) => (
|
{breadcrumbPath.map((item, index) => (
|
||||||
<li key={index}>
|
<li key={index}>
|
||||||
@ -18,7 +18,6 @@ export default function Breadcrumbs({ breadcrumbPath = ['Home'] }: BreadcrumbsPr
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
<div className="divider"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -180,7 +180,9 @@ export default function Sidebar({ children, username, fullName, breadcrumbPath }
|
|||||||
{/* Main content */}
|
{/* Main content */}
|
||||||
<main className="flex-1 overflow-auto">
|
<main className="flex-1 overflow-auto">
|
||||||
<Breadcrumbs breadcrumbPath={breadcrumbPath} />
|
<Breadcrumbs breadcrumbPath={breadcrumbPath} />
|
||||||
{children}
|
<div className="p-8 ">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user