Files
hr-assessment-system/app/admin/test-links/page.tsx

114 lines
4.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client"
import { ProtectedRoute } from "@/components/protected-route"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import {
ArrowLeft,
Copy,
Link as LinkIcon,
Eye,
} from "lucide-react"
import Link from "next/link"
export default function TestLinksPage() {
const handleCopyLink = () => {
const url = `${typeof window !== 'undefined' ? window.location.origin : ''}/test-link`
navigator.clipboard.writeText(url)
alert('連結已複製到剪貼簿')
}
return (
<ProtectedRoute>
<div className="min-h-screen bg-background">
{/* Header */}
<header className="border-b bg-card/50 backdrop-blur-sm">
<div className="container mx-auto px-4 py-4">
<div className="flex items-center gap-3">
<Button variant="ghost" size="sm" asChild>
<Link href="/dashboard">
<ArrowLeft className="w-4 h-4 mr-2" />
</Link>
</Button>
<div className="w-10 h-10 bg-primary rounded-lg flex items-center justify-center">
<LinkIcon className="w-6 h-6 text-white" />
</div>
<div>
<h1 className="text-xl font-bold text-foreground"></h1>
<p className="text-sm text-muted-foreground">
</p>
</div>
</div>
</div>
</header>
{/* Main Content */}
<div className="container mx-auto px-4 py-8">
<div className="max-w-2xl mx-auto">
<Card>
<CardHeader className="text-center">
<CardTitle className="flex items-center justify-center gap-2">
<LinkIcon className="w-6 h-6" />
</CardTitle>
<CardDescription>
</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
{/* 連結顯示區域 */}
<div className="space-y-3">
<Label></Label>
<div className="flex items-center gap-2">
<Input
value={`${typeof window !== 'undefined' ? window.location.origin : ''}/test-link`}
readOnly
className="text-sm"
/>
<Button
onClick={() => {
const url = `${typeof window !== 'undefined' ? window.location.origin : ''}/test-link`
navigator.clipboard.writeText(url)
alert('連結已複製到剪貼簿')
}}
>
<Copy className="w-4 h-4" />
</Button>
</div>
</div>
{/* 功能說明 */}
<div className="bg-muted/50 rounded-lg p-4 space-y-2">
<h4 className="font-medium text-sm"></h4>
<ul className="text-sm text-muted-foreground space-y-1">
<li> </li>
<li> Aa123456</li>
<li> </li>
<li> </li>
</ul>
</div>
{/* 預覽按鈕 */}
<div className="flex justify-center">
<Button
variant="outline"
onClick={() => window.open('/test-link', '_blank')}
className="w-full sm:w-auto"
>
<Eye className="w-4 h-4 mr-2" />
</Button>
</div>
</CardContent>
</Card>
</div>
</div>
</div>
</ProtectedRoute>
)
}