新增分享功能
This commit is contained in:
@@ -7,7 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { CheckCircle, XCircle, Brain, Lightbulb, BarChart3, ArrowLeft, Loader2, Printer } from "lucide-react"
|
||||
import { CheckCircle, XCircle, Brain, Lightbulb, BarChart3, ArrowLeft, Loader2, Printer, Share2 } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
import { CreativeAnalysis } from "@/components/creative-analysis"
|
||||
import { CombinedAnalysis } from "@/components/combined-analysis"
|
||||
@@ -344,7 +344,7 @@ function AdminResultDetailContent() {
|
||||
{/* 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 justify-between">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link href="/admin/results">
|
||||
@@ -364,17 +364,39 @@ function AdminResultDetailContent() {
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: `${user.name} - ${testTypeInfo.name}測試結果`,
|
||||
text: `查看${user.name}的${testTypeInfo.name}測試結果`,
|
||||
url: window.location.href
|
||||
})
|
||||
} else {
|
||||
navigator.clipboard.writeText(window.location.href)
|
||||
alert('連結已複製到剪貼簿')
|
||||
}
|
||||
}}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Share2 className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">分享結果</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => window.print()}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Printer className="w-4 h-4 mr-2" />
|
||||
列印結果
|
||||
<Printer className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">列印結果</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { Brain, Lightbulb, BarChart3, Home, RotateCcw, TrendingUp, Target, Award, Printer } from "lucide-react"
|
||||
import { Brain, Lightbulb, BarChart3, Home, RotateCcw, TrendingUp, Target, Award, Printer, Share2 } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
import { getRecommendations } from "@/lib/utils/score-calculator"
|
||||
import { useAuth } from "@/lib/hooks/use-auth"
|
||||
@@ -236,7 +236,7 @@ export default function CombinedResultsPage() {
|
||||
{/* 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 justify-between">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-gradient-to-r from-primary to-accent rounded-lg flex items-center justify-center">
|
||||
<BarChart3 className="w-6 h-6 text-white" />
|
||||
@@ -248,17 +248,39 @@ export default function CombinedResultsPage() {
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: '綜合能力測試結果',
|
||||
text: '查看我的綜合能力測試結果',
|
||||
url: window.location.href
|
||||
})
|
||||
} else {
|
||||
navigator.clipboard.writeText(window.location.href)
|
||||
alert('連結已複製到剪貼簿')
|
||||
}
|
||||
}}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Share2 className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">分享結果</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => window.print()}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Printer className="w-4 h-4 mr-2" />
|
||||
列印結果
|
||||
<Printer className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">列印結果</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { Lightbulb, Home, RotateCcw, TrendingUp, Printer } from "lucide-react"
|
||||
import { Lightbulb, Home, RotateCcw, TrendingUp, Printer, Share2 } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
import { creativeQuestions } from "@/lib/questions/creative-questions"
|
||||
import { useAuth } from "@/lib/hooks/use-auth"
|
||||
@@ -257,7 +257,7 @@ export default function CreativeResultsPage() {
|
||||
{/* 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 justify-between">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-accent rounded-lg flex items-center justify-center">
|
||||
<Lightbulb className="w-6 h-6 text-accent-foreground" />
|
||||
@@ -269,17 +269,39 @@ export default function CreativeResultsPage() {
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: '創意能力測試結果',
|
||||
text: '查看我的創意能力測試結果',
|
||||
url: window.location.href
|
||||
})
|
||||
} else {
|
||||
navigator.clipboard.writeText(window.location.href)
|
||||
alert('連結已複製到剪貼簿')
|
||||
}
|
||||
}}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Share2 className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">分享結果</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => window.print()}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Printer className="w-4 h-4 mr-2" />
|
||||
列印結果
|
||||
<Printer className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">列印結果</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { CheckCircle, XCircle, Brain, Home, RotateCcw, Printer } from "lucide-react"
|
||||
import { CheckCircle, XCircle, Brain, Home, RotateCcw, Printer, Share2 } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
|
||||
interface LogicQuestion {
|
||||
@@ -131,7 +131,7 @@ export default function LogicResultsPage() {
|
||||
{/* 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 justify-between">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-primary rounded-lg flex items-center justify-center">
|
||||
<Brain className="w-6 h-6 text-primary-foreground" />
|
||||
@@ -143,17 +143,39 @@ export default function LogicResultsPage() {
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: '邏輯思維測試結果',
|
||||
text: '查看我的邏輯思維測試結果',
|
||||
url: window.location.href
|
||||
})
|
||||
} else {
|
||||
navigator.clipboard.writeText(window.location.href)
|
||||
alert('連結已複製到剪貼簿')
|
||||
}
|
||||
}}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Share2 className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">分享結果</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => window.print()}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="print:hidden"
|
||||
>
|
||||
<Printer className="w-4 h-4 mr-2" />
|
||||
列印結果
|
||||
<Printer className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">列印結果</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
|
Reference in New Issue
Block a user