// DEPLOY_CONFIG: {"triggers": [{"name": "voting_closed_results_email", "on": "collection.update", "collection": "votes", "actions": [{"type": "email", "to": "{{participant.email}}", "subject": "Voting closed: results and winner", "body": "Hi {{participant.name}},\n\nVoting has closed. Here are the results:\n\nWinner: {{results.winner}}\n\nVote breakdown:\n{{results.breakdown}}\n\nSummary:\n{{results.summary}}\n\nThanks for participating!"}]}]} import { useState } from 'react'; import { useAuth, usePresence } from '@deplixo/sdk'; import { ContestList } from './components/ContestList.jsx'; import { ContestDetail } from './components/ContestDetail.jsx'; import { CreateContest } from './components/CreateContest.jsx'; // PROGRESS:sc_001:complete:Setting up the photo contest platform function App() { const { user, loading, login, logout } = useAuth(); const [view, setView] = useState('list'); const [selectedContestId, setSelectedContestId] = useState(null); const [isAdmin, setIsAdmin] = useState(false); usePresence( user ? { id: user.id, name: user.name, avatar: user.avatar, role: isAdmin ? 'admin' : 'user', view, } : null ); if (loading) { return (

Loading Photo Contest...

); } if (!user) { return (
📸

Photo Contest

Sign in with Google to upload photos, vote, and join the contest experience.

); } const navigateToContest = (contestId) => { setSelectedContestId(contestId); setView('detail'); }; const navigateBack = () => { setSelectedContestId(null); setView('list'); }; return (
{view !== 'list' && ( )}

📸 Photo Contest

{user?.name}
{view === 'list' && ( setView('create')} currentUser={user} /> )} {view === 'create' && ( )} {view === 'detail' && selectedContestId && ( )}
); } ReactDOM.createRoot(document.getElementById("root")).render();