import React, { useState, useEffect } from 'react';
import {
Heart,
Users,
ShieldCheck,
Star,
CheckCircle2,
ArrowRight,
BarChart3,
Lightbulb,
Award
} from 'lucide-react';
const CORE_VALUES = [
{
id: 'respect',
title: '尊重',
description: '看重他人的感受、權利與獨特性。',
icon: ,
color: 'bg-pink-50',
borderColor: 'border-pink-200'
},
{
id: 'responsibility',
title: '負責',
description: '認真完成自己的任務,並勇於承擔後果。',
icon: ,
color: 'bg-blue-50',
borderColor: 'border-blue-200'
},
{
id: 'cooperation',
title: '合作',
description: '與他人攜手並進,為了共同目標努力。',
icon: ,
color: 'bg-green-50',
borderColor: 'border-green-200'
},
{
id: 'integrity',
title: '誠實',
description: '說實話、做對的事,贏得他人的信任。',
icon: ,
color: 'bg-yellow-50',
borderColor: 'border-yellow-200'
}
];
const SCENARIOS = [
{
id: 1,
value: 'respect',
question: '當你在討論中與同學意見不同時,最好的實踐方式是?',
options: [
{ text: '大聲反駁,直到對方認輸', isCorrect: false, feedback: '這可能會傷害同學的感情。' },
{ text: '耐心聽完對方的想法,再平和地表達自己的意見', isCorrect: true, feedback: '很好!這展現了對他人想法的尊重。' },
{ text: '不說話,心裡默默討厭對方', isCorrect: false, feedback: '溝通才是解決差異的好方法。' }
]
},
{
id: 2,
value: 'responsibility',
question: '分組作業時,如果你分配到的任務比較難,你會?',
options: [
{ text: '假裝忘記做,等其他同學幫忙完成', isCorrect: false, feedback: '這樣會增加組員的負擔喔。' },
{ text: '直接放棄,說自己不會做', isCorrect: false, feedback: '嘗試努力或尋求建議也是負責的表現。' },
{ text: '儘力嘗試,若遇到困難主動找老師或組長討論', isCorrect: true, feedback: '正確!積極面對困難是負責任的典範。' }
]
},
{
id: 3,
value: 'cooperation',
question: '大掃除時,你發現自己負責的區域做完了,但旁邊的同學還在忙,你會?',
options: [
{ text: '主動詢問:「需要我幫忙嗎?」一起完成任務', isCorrect: true, feedback: '太棒了!團結力量大,這就是合作精神。' },
{ text: '趕快收拾東西回座位休息', isCorrect: false, feedback: '班級環境需要大家共同維護。' },
{ text: '站在旁邊看同學做,順便給他建議', isCorrect: false, feedback: '實際動手幫忙會比口頭建議更有力量。' }
]
}
];
export default function App() {
const [view, setView] = useState('home'); // home, vote, quiz, results
const [votes, setVotes] = useState({ respect: 0, responsibility: 0, cooperation: 0, integrity: 0 });
const [hasVoted, setHasVoted] = useState(false);
const [quizIndex, setQuizIndex] = useState(0);
const [score, setScore] = useState(0);
const [feedback, setFeedback] = useState(null);
const handleVote = (id) => {
setVotes(prev => ({ ...prev, [id]: prev[id] + 1 }));
setHasVoted(true);
};
const handleQuizAnswer = (option) => {
setFeedback(option.feedback);
if (option.isCorrect) {
setScore(prev => prev + 1);
}
setTimeout(() => {
setFeedback(null);
if (quizIndex < SCENARIOS.length - 1) {
setQuizIndex(prev => prev + 1);
} else {
setView('results');
}
}, 2000);
};
const resetAll = () => {
setView('home');
setQuizIndex(0);
setScore(0);
setHasVoted(false);
};
return (
{/* Header */}
{/* Navigation Tabs */}
{/* Main Content Area */}
{/* View: Home (Value Definitions) */}
{view === 'home' && (
什麼是我們的核心價值?
{CORE_VALUES.map((val) => (
{val.icon}
{val.title}
{val.description}
))}
)}
{/* View: Vote */}
{view === 'vote' && (
心目中最希望班級做到的價值
每人投下一票,看看班級共同最重視的是什麼?
{!hasVoted ? (
{CORE_VALUES.map((val) => (
))}
) : (
投票成功!看看大家的選擇:
{CORE_VALUES.map((val) => {
const total = Object.values(votes).reduce((a, b) => a + b, 0);
const percentage = total === 0 ? 0 : Math.round((votes[val.id] / total) * 100);
return (
{val.title}
{votes[val.id]} 票 ({percentage}%)
);
})}
)}
)}
{/* View: Quiz */}
{view === 'quiz' && (
情境挑戰 {quizIndex + 1} / {SCENARIOS.length}
目前分數: {score}
{SCENARIOS[quizIndex].question}
{SCENARIOS[quizIndex].options.map((option, idx) => (
))}
{feedback && (
{feedback.includes('很好') || feedback.includes('正確') || feedback.includes('太棒') ? '💡 答對了!' : '💡 小提醒:'} {feedback}
)}
)}
{/* View: Results */}
{view === 'results' && (
挑戰完成!
你的「價值實踐力」得分:{score} / {SCENARIOS.length}
「最偉大的價值不是掛在牆上的口號,而是我們每天如何對待彼此。」
)}
{/* Footer */}
);
}