260320:1549 Refactor Overrall #08 Fix: pnpm frontend deploy
Build and Deploy / deploy (push) Failing after 1m16s
Build and Deploy / deploy (push) Failing after 1m16s
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
// File: app/(dashboard)/dashboard/can/page.tsx
|
||||
'use client';
|
||||
|
||||
import { useAuthStore } from '@/lib/stores/auth-store';
|
||||
import { Can } from '@/components/common/can';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export default function CanTestPage() {
|
||||
const { user } = useAuthStore();
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-2xl font-bold">RBAC / Permission Test Page</h1>
|
||||
|
||||
{/* User Info Card */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Current User Info</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
<div className="flex gap-2">
|
||||
<span className="font-semibold">Username:</span>
|
||||
<span>{user?.username || 'Not logged in'}</span>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<span className="font-semibold">Role:</span>
|
||||
<Badge variant="outline">{user?.role || 'None'}</Badge>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<span className="font-semibold">Permissions:</span>
|
||||
<span>{user?.permissions?.join(', ') || 'No explicit permissions'}</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Permission Tests */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Component Visibility Tests (using <Can />)</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
|
||||
<div className="p-4 border rounded bg-gray-50 flex flex-col gap-2">
|
||||
<p className="text-sm font-medium">1. Admin Role Check</p>
|
||||
<Can role="Admin" fallback={<span className="text-red-500 text-sm">❌ You are NOT an Admin (Hidden)</span>}>
|
||||
<Button variant="default" className="w-fit">✅ Visible to Admin Only</Button>
|
||||
</Can>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border rounded bg-gray-50 flex flex-col gap-2">
|
||||
<p className="text-sm font-medium">2. 'document:create' Permission</p>
|
||||
<Can permission="document:create" fallback={<span className="text-red-500 text-sm">❌ Missing 'document:create' (Hidden)</span>}>
|
||||
<Button variant="secondary" className="w-fit">✅ Visible with 'document:create'</Button>
|
||||
</Can>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border rounded bg-gray-50 flex flex-col gap-2">
|
||||
<p className="text-sm font-medium">3. 'document:delete' Permission</p>
|
||||
<Can permission="document:delete" fallback={<span className="text-red-500 text-sm">❌ Missing 'document:delete' (Hidden)</span>}>
|
||||
<Button variant="destructive" className="w-fit">✅ Visible with 'document:delete'</Button>
|
||||
</Can>
|
||||
</div>
|
||||
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Toast Test */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Toast Notification Test</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex gap-4">
|
||||
<Button
|
||||
onClick={() => toast.success("Operation Successful", { description: "This is a success toast message." })}
|
||||
>
|
||||
Trigger Success Toast
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={() => toast.error("Operation Failed", { description: "This is an error toast message." })}
|
||||
>
|
||||
Trigger Error Toast
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className="p-4 bg-blue-50 text-blue-800 rounded">
|
||||
<strong>Tip:</strong> You can mock different roles by modifying the user state in local storage or using the `setAuth` method in console.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// File: app/layout.tsx
|
||||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css"; // Import CSS Variables
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "LCBP3-DMS",
|
||||
description: "Document Management System for Laem Chabang Port Phase 3",
|
||||
};
|
||||
|
||||
interface RootLayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function RootLayout({ children }: RootLayoutProps) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<head />
|
||||
<body
|
||||
className={cn(
|
||||
"min-h-screen bg-background font-sans antialiased",
|
||||
inter.className
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { AdminSidebar } from "@/components/admin/sidebar";
|
||||
|
||||
export default function TestAdminSidebarPage() {
|
||||
return (
|
||||
<div className="flex min-h-screen bg-background">
|
||||
<AdminSidebar />
|
||||
<div className="flex-1 p-6">
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-3xl font-bold tracking-tight">Admin Sidebar Test</h1>
|
||||
<p className="text-muted-foreground">
|
||||
ทดสอบการทำงานของเมนู admin sidebar
|
||||
</p>
|
||||
|
||||
<div className="grid gap-4">
|
||||
<div className="p-4 border rounded-lg">
|
||||
<h2 className="text-xl font-semibold mb-2">รายการเมนู Admin:</h2>
|
||||
<ul className="list-disc list-inside space-y-1 text-sm">
|
||||
<li>Access Control - Users, Roles, Organizations</li>
|
||||
<li>Document Control - Projects, Contracts, Numbering, Reference Data, Workflows</li>
|
||||
<li>Drawing Master - Contract/Shop Categories</li>
|
||||
<li>Monitoring - Audit Logs, System Logs, Sessions</li>
|
||||
<li>Migration - Review Queue, Error Logs</li>
|
||||
<li>Settings</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="p-4 bg-blue-50 border border-blue-200 rounded-lg">
|
||||
<p className="text-sm text-blue-800">
|
||||
ℹ️ Admin sidebar มีเมนูแบบ collapsible สำหรับแต่ละหมวดหมู่
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { Sidebar } from "@/components/layout/sidebar";
|
||||
import { Header } from "@/components/layout/header";
|
||||
|
||||
export default function TestSidebarPage() {
|
||||
return (
|
||||
<div className="flex min-h-screen bg-background">
|
||||
<Sidebar />
|
||||
<div className="flex-1 flex flex-col min-h-screen overflow-hidden">
|
||||
<Header />
|
||||
<main className="flex-1 overflow-y-auto p-6 bg-muted/10">
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-3xl font-bold tracking-tight">Sidebar Menu Test</h1>
|
||||
<p className="text-muted-foreground">
|
||||
ทดสอบการทำงานของเมนู sidebar ว่าสามารถใช้งานได้จริง
|
||||
</p>
|
||||
|
||||
<div className="grid gap-4">
|
||||
<div className="p-4 border rounded-lg">
|
||||
<h2 className="text-xl font-semibold mb-2">รายการเมนูที่ตรวจสอบ:</h2>
|
||||
<ul className="list-disc list-inside space-y-1 text-sm">
|
||||
<li>Dashboard - ลิงก์ไป /dashboard</li>
|
||||
<li>Correspondences - ลิงก์ไป /correspondences</li>
|
||||
<li>RFAs - ลิงก์ไป /rfas</li>
|
||||
<li>Drawings - ลิงก์ไป /drawings</li>
|
||||
<li>Circulations - ลิงก์ไป /circulation</li>
|
||||
<li>Transmittals - ลิงก์ไป /transmittals</li>
|
||||
<li>Search - ลิงก์ไป /search</li>
|
||||
<li>Admin Panel - ลิงก์ไป /admin (สำหรับ admin/DC เท่านั้น)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border rounded-lg">
|
||||
<h2 className="text-xl font-semibold mb-2">การทดสอบ:</h2>
|
||||
<ol className="list-decimal list-inside space-y-1 text-sm">
|
||||
<li>คลิกที่เมนูแต่ละรายการใน sidebar</li>
|
||||
<li>ตรวจสอบว่าลิงก์ทำงานได้ถูกต้อง</li>
|
||||
<li>ตรวจสอบว่าเมนู active state แสดงผลถูกต้อง</li>
|
||||
<li>ทดสอบการสลับ collapse/expand sidebar</li>
|
||||
<li>ทดสอบ responsive menu บนมือถือ</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div className="p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<p className="text-sm text-green-800">
|
||||
✅ Sidebar component โหลดสำเร็จแล้ว - สามารถทดสอบการทำงานได้
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user