feat(frontend): request logs; refactor frontend components

This commit is contained in:
2025-12-01 18:48:22 +08:00
parent d783cf2591
commit a9cb9510c5
28 changed files with 649 additions and 160 deletions

View File

@@ -1,4 +1,7 @@
import { Component, createSignal } from 'solid-js';
import { Button } from './ui/Button';
import { Card } from './ui/Card';
import { Input } from './ui/Input';
interface LoginProps {
onLoginSuccess: (token: string) => void;
@@ -39,7 +42,7 @@ const Login: Component<LoginProps> = (props) => {
return (
<div class="min-h-screen bg-gray-100 flex items-center justify-center">
<div class="bg-white p-8 rounded-lg shadow-md w-96">
<Card class="p-8 w-96">
<h1 class="text-2xl font-bold text-gray-900 mb-6 text-center">
My Linspirer Admin Login
</h1>
@@ -49,12 +52,11 @@ const Login: Component<LoginProps> = (props) => {
<label class="block text-gray-700 text-sm font-medium mb-2" for="password">
Password
</label>
<input
<Input
id="password"
type="password"
value={password()}
onInput={(e) => setPassword(e.currentTarget.value)}
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500"
placeholder="Enter admin password"
disabled={isLoading()}
required
@@ -67,19 +69,19 @@ const Login: Component<LoginProps> = (props) => {
</div>
)}
<button
<Button
type="submit"
size="lg"
disabled={isLoading()}
class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:bg-gray-400"
>
{isLoading() ? 'Logging in...' : 'Login'}
</button>
</Button>
</form>
<div class="mt-4 text-center text-sm text-gray-500">
<p>Default password: admin123</p>
</div>
</div>
</Card>
</div>
);
};