新增分享功能
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 { Button } from "@/components/ui/button"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Progress } from "@/components/ui/progress"
|
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 Link from "next/link"
|
||||||
import { CreativeAnalysis } from "@/components/creative-analysis"
|
import { CreativeAnalysis } from "@/components/creative-analysis"
|
||||||
import { CombinedAnalysis } from "@/components/combined-analysis"
|
import { CombinedAnalysis } from "@/components/combined-analysis"
|
||||||
@@ -344,7 +344,7 @@ function AdminResultDetailContent() {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="border-b bg-card/50 backdrop-blur-sm">
|
<header className="border-b bg-card/50 backdrop-blur-sm">
|
||||||
<div className="container mx-auto px-4 py-4">
|
<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="flex items-center gap-3">
|
||||||
<Button variant="ghost" size="sm" asChild>
|
<Button variant="ghost" size="sm" asChild>
|
||||||
<Link href="/admin/results">
|
<Link href="/admin/results">
|
||||||
@@ -364,15 +364,37 @@ function AdminResultDetailContent() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="flex justify-end gap-2">
|
||||||
onClick={() => window.print()}
|
<Button
|
||||||
variant="outline"
|
onClick={() => {
|
||||||
size="sm"
|
if (navigator.share) {
|
||||||
className="print:hidden"
|
navigator.share({
|
||||||
>
|
title: `${user.name} - ${testTypeInfo.name}測試結果`,
|
||||||
<Printer className="w-4 h-4 mr-2" />
|
text: `查看${user.name}的${testTypeInfo.name}測試結果`,
|
||||||
列印結果
|
url: window.location.href
|
||||||
</Button>
|
})
|
||||||
|
} 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 sm:mr-2" />
|
||||||
|
<span className="hidden sm:inline">列印結果</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Progress } from "@/components/ui/progress"
|
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 Link from "next/link"
|
||||||
import { getRecommendations } from "@/lib/utils/score-calculator"
|
import { getRecommendations } from "@/lib/utils/score-calculator"
|
||||||
import { useAuth } from "@/lib/hooks/use-auth"
|
import { useAuth } from "@/lib/hooks/use-auth"
|
||||||
@@ -236,7 +236,7 @@ export default function CombinedResultsPage() {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="border-b bg-card/50 backdrop-blur-sm">
|
<header className="border-b bg-card/50 backdrop-blur-sm">
|
||||||
<div className="container mx-auto px-4 py-4">
|
<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="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">
|
<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" />
|
<BarChart3 className="w-6 h-6 text-white" />
|
||||||
@@ -248,15 +248,37 @@ export default function CombinedResultsPage() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="flex justify-end gap-2">
|
||||||
onClick={() => window.print()}
|
<Button
|
||||||
variant="outline"
|
onClick={() => {
|
||||||
size="sm"
|
if (navigator.share) {
|
||||||
className="print:hidden"
|
navigator.share({
|
||||||
>
|
title: '綜合能力測試結果',
|
||||||
<Printer className="w-4 h-4 mr-2" />
|
text: '查看我的綜合能力測試結果',
|
||||||
列印結果
|
url: window.location.href
|
||||||
</Button>
|
})
|
||||||
|
} 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 sm:mr-2" />
|
||||||
|
<span className="hidden sm:inline">列印結果</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Progress } from "@/components/ui/progress"
|
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 Link from "next/link"
|
||||||
import { creativeQuestions } from "@/lib/questions/creative-questions"
|
import { creativeQuestions } from "@/lib/questions/creative-questions"
|
||||||
import { useAuth } from "@/lib/hooks/use-auth"
|
import { useAuth } from "@/lib/hooks/use-auth"
|
||||||
@@ -257,7 +257,7 @@ export default function CreativeResultsPage() {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="border-b bg-card/50 backdrop-blur-sm">
|
<header className="border-b bg-card/50 backdrop-blur-sm">
|
||||||
<div className="container mx-auto px-4 py-4">
|
<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="flex items-center gap-3">
|
||||||
<div className="w-10 h-10 bg-accent rounded-lg flex items-center justify-center">
|
<div className="w-10 h-10 bg-accent rounded-lg flex items-center justify-center">
|
||||||
<Lightbulb className="w-6 h-6 text-accent-foreground" />
|
<Lightbulb className="w-6 h-6 text-accent-foreground" />
|
||||||
@@ -269,15 +269,37 @@ export default function CreativeResultsPage() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="flex justify-end gap-2">
|
||||||
onClick={() => window.print()}
|
<Button
|
||||||
variant="outline"
|
onClick={() => {
|
||||||
size="sm"
|
if (navigator.share) {
|
||||||
className="print:hidden"
|
navigator.share({
|
||||||
>
|
title: '創意能力測試結果',
|
||||||
<Printer className="w-4 h-4 mr-2" />
|
text: '查看我的創意能力測試結果',
|
||||||
列印結果
|
url: window.location.href
|
||||||
</Button>
|
})
|
||||||
|
} 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 sm:mr-2" />
|
||||||
|
<span className="hidden sm:inline">列印結果</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@@ -5,7 +5,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Progress } from "@/components/ui/progress"
|
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"
|
import Link from "next/link"
|
||||||
|
|
||||||
interface LogicQuestion {
|
interface LogicQuestion {
|
||||||
@@ -131,7 +131,7 @@ export default function LogicResultsPage() {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="border-b bg-card/50 backdrop-blur-sm">
|
<header className="border-b bg-card/50 backdrop-blur-sm">
|
||||||
<div className="container mx-auto px-4 py-4">
|
<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="flex items-center gap-3">
|
||||||
<div className="w-10 h-10 bg-primary rounded-lg flex items-center justify-center">
|
<div className="w-10 h-10 bg-primary rounded-lg flex items-center justify-center">
|
||||||
<Brain className="w-6 h-6 text-primary-foreground" />
|
<Brain className="w-6 h-6 text-primary-foreground" />
|
||||||
@@ -143,15 +143,37 @@ export default function LogicResultsPage() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="flex justify-end gap-2">
|
||||||
onClick={() => window.print()}
|
<Button
|
||||||
variant="outline"
|
onClick={() => {
|
||||||
size="sm"
|
if (navigator.share) {
|
||||||
className="print:hidden"
|
navigator.share({
|
||||||
>
|
title: '邏輯思維測試結果',
|
||||||
<Printer className="w-4 h-4 mr-2" />
|
text: '查看我的邏輯思維測試結果',
|
||||||
列印結果
|
url: window.location.href
|
||||||
</Button>
|
})
|
||||||
|
} 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 sm:mr-2" />
|
||||||
|
<span className="hidden sm:inline">列印結果</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
Reference in New Issue
Block a user