"use client" import { useEffect, useState } from "react" import Link from "next/link" import { Button } from "@/components/ui/button" import { Card, CardContent } from "@/components/ui/card" import { Sparkles, Heart, Users, ArrowRight, Home, MessageCircle, BarChart3, Eye, EyeOff } from "lucide-react" import HeaderMusicControl from "@/components/header-music-control" import { WishService } from "@/lib/supabase-service" export default function ThankYouPage() { const [wishes, setWishes] = useState([]) const [showContent, setShowContent] = useState(false) const [lastWishIsPublic, setLastWishIsPublic] = useState(true) useEffect(() => { const fetchWishes = async () => { try { // 獲取所有困擾案例 const allWishesData = await WishService.getAllWishes() // 轉換數據格式 const convertWish = (wish: any) => ({ id: wish.id, title: wish.title, currentPain: wish.current_pain, expectedSolution: wish.expected_solution, expectedEffect: wish.expected_effect || "", createdAt: wish.created_at, isPublic: wish.is_public, email: wish.email, images: wish.images, like_count: wish.like_count || 0, // 包含點讚數 }) const allWishes = allWishesData.map(convertWish) setWishes(allWishes) // 檢查最後一個提交的願望是否為公開 if (allWishes.length > 0) { const lastWish = allWishes[allWishes.length - 1] setLastWishIsPublic(lastWish.isPublic !== false) } } catch (error) { console.error("獲取統計數據失敗:", error) // 如果 Supabase 連接失敗,回退到 localStorage const savedWishes = JSON.parse(localStorage.getItem("wishes") || "[]") setWishes(savedWishes) if (savedWishes.length > 0) { const lastWish = savedWishes[savedWishes.length - 1] setLastWishIsPublic(lastWish.isPublic !== false) } } } fetchWishes() // 延遲顯示內容,創造進入效果 setTimeout(() => setShowContent(true), 300) }, []) const totalWishes = wishes.length const publicWishes = wishes.filter((wish) => wish.isPublic !== false).length const privateWishes = wishes.filter((wish) => wish.isPublic === false).length const thisWeek = wishes.filter((wish) => { const wishDate = new Date(wish.createdAt) const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) return wishDate >= oneWeekAgo }).length return (
{/* 增強的星空背景 */}
{/* 更多的星星 */} {[...Array(50)].map((_, i) => (
))} {/* 特殊的感謝星星 */} {[...Array(20)].map((_, i) => (
))} {/* 光芒效果 */}
{/* Header - 修復跑版問題 */}
{/* Logo 區域 - 防止文字換行 */}

資訊部.心願星河

{/* 導航區域 */}
{/* Main Content */}
{/* 感謝標題區域 */}
{/* 感謝圖標 */}
{/* 周圍的小心心 */} {[...Array(8)].map((_, i) => (
))}

感謝你的信任與分享

你的困擾已經成功提交,我們會認真分析並提供專業建議

每一個真實的工作困擾都是改善的起點,你的分享將幫助我們創造更好的解決方案

我們的專業團隊會仔細研究你的案例,用科技的力量為你和更多人解決職場挑戰

{/* 隱私狀態說明 */}
{lastWishIsPublic ? ( <> 你的分享已公開,其他人可以看到並產生共鳴 ) : ( <> 你的分享保持私密,僅用於問題分析和改善 )}
{/* 統計卡片 */}
{totalWishes}
個案例已收集
包括你剛才分享的經歷
{thisWeek}
本週新增案例
你不是一個人在面對挑戰
無限的可能性
每個問題都能找到解決方案
{/* 隱私統計說明 */} {privateWishes > 0 && (
{publicWishes} 個公開案例
{privateWishes} 個私密案例

所有案例都會用於問題分析,幫助改善整體工作環境

)} {/* 激勵訊息卡片 */}

你的分享推動了積極的改變

勇於面對挑戰

願意分享工作困擾需要勇氣。你的坦誠讓我們能夠深入了解職場的真實挑戰,這是解決問題的重要第一步。

共同的使命

在這個平台上,有許多和你面臨相似挑戰的人。你的經驗分享讓大家知道,我們都在為更好的工作環境而努力。

推動實際改變

每一個案例都是我們開發解決方案的重要依據。你的困擾將幫助我們創造更智能、更實用的工作工具。

創造更好未來

我們相信科技能夠讓工作變得更有效率、更有意義。你的分享是實現這個目標的重要推動力。

{/* 行動按鈕 */}

接下來你可以...

{lastWishIsPublic ? ( ) : ( )}
{/* 底部激勵訊息 */}

再次感謝你的信任與分享

每一份真實的經歷都是推動職場環境改善的重要力量

) }