first commit
This commit is contained in:
36
src/pages/dashboard/index.tsx
Normal file
36
src/pages/dashboard/index.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { useAuthStore } from '@/app/store/authStore'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
export default function DashboardPage() {
|
||||
const logout = useAuthStore((s) => s.logout)
|
||||
const user = useAuthStore((s) => s.user)
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[var(--bg-base)] p-8">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<header className="flex justify-between items-center mb-8">
|
||||
<h1 className="text-3xl font-bold text-[var(--text-primary)]">Dashboard</h1>
|
||||
<Button onClick={logout} variant="outline">
|
||||
Logout
|
||||
</Button>
|
||||
</header>
|
||||
|
||||
<main className="grid gap-6">
|
||||
<div className="p-6 bg-[var(--bg-surface)] rounded-[var(--radius-lg)] shadow-[var(--shadow-sm)] border border-[var(--border-default)]">
|
||||
<h2 className="text-xl font-semibold text-[var(--text-primary)] mb-2">Welcome, {user?.username || 'Admin'}!</h2>
|
||||
<p className="text-[var(--text-secondary)]">This is your TBBank Admin Dashboard.</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div key={i} className="p-4 bg-[var(--bg-surface)] rounded-[var(--radius-md)] border border-[var(--border-default)]">
|
||||
<h3 className="font-medium text-[var(--text-primary)]">Stat {i}</h3>
|
||||
<p className="text-2xl font-bold text-[var(--brand-500)]">0</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
48
src/pages/login/index.tsx
Normal file
48
src/pages/login/index.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import { AuthLayout } from '@/layouts/AuthLayout'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { useLogin } from '@/features/auth/hooks/useLogin'
|
||||
import { useState } from 'react'
|
||||
|
||||
export default function LoginPage() {
|
||||
const [username, setUsername] = useState('')
|
||||
const [password, setPassword] = useState('')
|
||||
const { login, isLoading } = useLogin()
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
login({ username, password })
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
<div className="w-full max-w-md p-8 bg-[var(--bg-surface)] rounded-[var(--radius-lg)] shadow-[var(--shadow-lg)] border border-[var(--border-default)]">
|
||||
<h1 className="text-2xl font-bold text-[var(--text-primary)] mb-6 text-center">Login</h1>
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-[var(--text-secondary)]">Username</label>
|
||||
<Input
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
placeholder="Enter your username"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-[var(--text-secondary)]">Password</label>
|
||||
<Input
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder="Enter your password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="w-full" isLoading={isLoading}>
|
||||
Sign In
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user