chore: remove orphaned shadcn settings sub-pages (wrong design system); design rules added to FORGE_NOTES

This commit is contained in:
Forge
2026-03-26 07:57:56 +08:00
parent ac0222fbf9
commit e6ccda70d2
4 changed files with 0 additions and 283 deletions

View File

@@ -1,93 +0,0 @@
'use client';
import { useQuery } from '@tanstack/react-query';
import { Card, CardContent } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import { MapPin, Plus, ChevronRight } from 'lucide-react';
import { api } from '@/lib/api';
interface Zone {
id: string;
name: string;
}
interface Area {
id: string;
name: string;
description?: string;
zones?: Zone[];
}
export default function AreasPage() {
const { data, isLoading } = useQuery({
queryKey: ['areas'],
queryFn: async () => (await api.get('/api/v1/areas')).data,
});
const areas: Area[] = Array.isArray(data) ? data : (data?.data ?? []);
return (
<div>
<div className="mb-6 flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold text-slate-800">Areas & Zones</h1>
<p className="text-slate-500 text-sm mt-1">Service area and coverage zones</p>
</div>
<div className="flex gap-2">
<Button variant="outline" size="sm">
<Plus size={14} className="mr-1.5" />Add Zone
</Button>
<Button style={{ backgroundColor: '#0891B2', color: 'white' }} size="sm">
<Plus size={14} className="mr-1.5" />Add Area
</Button>
</div>
</div>
{isLoading ? (
<div className="space-y-3">
{Array.from({ length: 3 }).map((_, i) => (
<Skeleton key={i} className="h-20 w-full rounded-xl" />
))}
</div>
) : areas.length === 0 ? (
<div className="text-center py-16 text-slate-400">
<MapPin size={40} className="mx-auto mb-3 opacity-30" />
<p>No service areas yet</p>
</div>
) : (
<div className="space-y-3">
{areas.map((area) => (
<Card key={area.id} className="hover:border-cyan-200 transition-colors">
<CardContent className="p-4">
<div className="flex items-start justify-between">
<div className="flex items-start gap-3">
<div className="w-8 h-8 rounded-lg bg-cyan-50 flex items-center justify-center mt-0.5">
<MapPin size={16} className="text-cyan-600" />
</div>
<div>
<p className="font-semibold text-slate-800">{area.name}</p>
{area.description && <p className="text-sm text-slate-500 mt-0.5">{area.description}</p>}
{area.zones && area.zones.length > 0 && (
<div className="mt-2 flex gap-1.5 flex-wrap">
{area.zones.map(z => (
<span key={z.id} className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-100 text-slate-600">
{z.name}
</span>
))}
</div>
)}
</div>
</div>
<div className="flex items-center gap-2">
<span className="text-xs text-slate-400">{area.zones?.length ?? 0} zone{(area.zones?.length ?? 0) !== 1 ? 's' : ''}</span>
<ChevronRight size={16} className="text-slate-300" />
</div>
</div>
</CardContent>
</Card>
))}
</div>
)}
</div>
);
}

View File

@@ -1,31 +0,0 @@
'use client';
import { Card, CardContent } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Plus } from 'lucide-react';
export default function PlansPage() {
return (
<div>
<div className="mb-6 flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold text-slate-800">Service Plans</h1>
<p className="text-slate-500 text-sm mt-1">Manage internet subscription plans</p>
</div>
<Button style={{ backgroundColor: '#0891B2' }}>
<Plus size={16} className="mr-2" />
Add Plan
</Button>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<Card className="border shadow-sm border-dashed border-slate-300">
<CardContent className="flex flex-col items-center justify-center py-12 text-slate-400">
<Plus size={24} className="mb-2" />
<p className="text-sm">Create your first plan</p>
</CardContent>
</Card>
</div>
</div>
);
}

View File

@@ -1,43 +0,0 @@
'use client';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Button } from '@/components/ui/button';
export default function TenantSettingsPage() {
return (
<div>
<div className="mb-6">
<h1 className="text-2xl font-bold text-slate-800">Tenant Settings</h1>
<p className="text-slate-500 text-sm mt-1">Configure your ISP business details</p>
</div>
<Card className="border shadow-sm max-w-2xl">
<CardHeader>
<CardTitle className="text-base">Business Information</CardTitle>
<CardDescription>Update your ISP company details</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-1.5">
<Label>Business Name</Label>
<Input placeholder="e.g. My Internet Services" />
</div>
<div className="space-y-1.5">
<Label>Address</Label>
<Input placeholder="Business address" />
</div>
<div className="space-y-1.5">
<Label>Phone</Label>
<Input placeholder="+63 9XX XXX XXXX" />
</div>
<div className="space-y-1.5">
<Label>Email</Label>
<Input type="email" placeholder="info@yourisp.com" />
</div>
<Button style={{ backgroundColor: '#0891B2' }}>Save Changes</Button>
</CardContent>
</Card>
</div>
);
}

View File

@@ -1,116 +0,0 @@
'use client';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api';
import { Card, CardContent } from '@/components/ui/card';
import { Skeleton } from '@/components/ui/skeleton';
import { Badge } from '@/components/ui/badge';
import { UserPlus } from 'lucide-react';
interface User {
id: string;
firstName: string;
lastName: string;
email: string;
isActive: boolean;
roles: Array<{ role: string }>;
}
const roleColors: Record<string, string> = {
ADMIN: 'bg-purple-100 text-purple-700',
STAFF: 'bg-blue-100 text-blue-700',
TECHNICIAN: 'bg-orange-100 text-orange-700',
COLLECTOR: 'bg-green-100 text-green-700',
};
export default function UsersSettingsPage() {
const qc = useQueryClient();
const { data: users, isLoading } = useQuery<User[]>({
queryKey: ['users'],
queryFn: async () => {
const res = await api.get('/api/v1/users');
return res.data;
},
});
const toggleActive = useMutation({
mutationFn: async ({ id, isActive }: { id: string; isActive: boolean }) => {
await api.patch(`/api/v1/users/${id}`, { isActive: !isActive });
},
onSuccess: () => qc.invalidateQueries({ queryKey: ['users'] }),
});
return (
<div>
<div className="flex items-center justify-between mb-6">
<div>
<h1 className="text-2xl font-bold text-slate-800">Users</h1>
<p className="text-slate-500 text-sm mt-1">Manage staff access and roles</p>
</div>
<button
className="flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium text-white"
style={{ backgroundColor: '#0891B2' }}
>
<UserPlus size={16} />
Add User
</button>
</div>
<Card className="border shadow-sm">
<CardContent className="p-0">
<table className="w-full text-sm">
<thead>
<tr className="border-b bg-slate-50">
<th className="text-left px-4 py-3 font-medium text-slate-500">Name</th>
<th className="text-left px-4 py-3 font-medium text-slate-500 hidden md:table-cell">Email</th>
<th className="text-left px-4 py-3 font-medium text-slate-500">Role</th>
<th className="text-left px-4 py-3 font-medium text-slate-500">Status</th>
<th className="px-4 py-3"></th>
</tr>
</thead>
<tbody>
{isLoading
? Array.from({ length: 4 }).map((_, i) => (
<tr key={i} className="border-b">
{[...Array(5)].map((_, j) => (
<td key={j} className="px-4 py-3"><Skeleton className="h-4 w-20" /></td>
))}
</tr>
))
: users?.map((u) => {
const role = u.roles?.[0]?.role ?? 'STAFF';
return (
<tr key={u.id} className="border-b hover:bg-slate-50">
<td className="px-4 py-3 font-medium text-slate-800">
{u.firstName} {u.lastName}
</td>
<td className="px-4 py-3 text-slate-600 hidden md:table-cell">{u.email}</td>
<td className="px-4 py-3">
<span className={`px-2 py-0.5 rounded-full text-xs font-medium ${roleColors[role] ?? 'bg-gray-100 text-gray-500'}`}>
{role}
</span>
</td>
<td className="px-4 py-3">
<span className={`px-2 py-0.5 rounded-full text-xs font-medium ${u.isActive ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'}`}>
{u.isActive ? 'Active' : 'Inactive'}
</span>
</td>
<td className="px-4 py-3">
<button
onClick={() => toggleActive.mutate({ id: u.id, isActive: u.isActive })}
className="text-xs text-slate-500 hover:text-slate-800 underline"
>
{u.isActive ? 'Deactivate' : 'Activate'}
</button>
</td>
</tr>
);
})}
</tbody>
</table>
</CardContent>
</Card>
</div>
);
}