revert fb8e77bb68
Local Build and Deploy / deploy (push) Successful in 1m11s

revert style: clean up code with prettier and eslint
This commit is contained in:
remco committed 2026-07-12 21:02:03 +02:00
1 parent 27de078f54
commit e85e4d74ea
378 files changed
+20710 -22428

No files matched your search

+21 -19
View File
@@ -1,16 +1,16 @@
"use client";
'use client'
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
interface QuestionResult {
id: number;
question: string;
options: string;
votes: string[]; // array of answer strings
id: number
question: string
options: string
votes: string[] // array of answer strings
}
interface Props {
questions: QuestionResult[];
questions: QuestionResult[]
}
export function PollResultsView({ questions }: Props) {
@@ -21,14 +21,14 @@ export function PollResultsView({ questions }: Props) {
</CardHeader>
<CardContent className="space-y-6">
{questions.map((q) => {
const options = q.options.split("\n").filter(Boolean);
const totalVotes = q.votes.length;
const options = q.options.split('\n').filter(Boolean)
const totalVotes = q.votes.length
// Count votes per option
const voteCounts = new Map<string, number>();
for (const opt of options) voteCounts.set(opt, 0);
const voteCounts = new Map<string, number>()
for (const opt of options) voteCounts.set(opt, 0)
for (const vote of q.votes) {
voteCounts.set(vote, (voteCounts.get(vote) ?? 0) + 1);
voteCounts.set(vote, (voteCounts.get(vote) ?? 0) + 1)
}
return (
@@ -37,8 +37,8 @@ export function PollResultsView({ questions }: Props) {
{options.length > 0 ? (
<div className="space-y-2">
{options.map((opt) => {
const count = voteCounts.get(opt) ?? 0;
const pct = totalVotes > 0 ? Math.round((count / totalVotes) * 100) : 0;
const count = voteCounts.get(opt) ?? 0
const pct = totalVotes > 0 ? Math.round((count / totalVotes) * 100) : 0
return (
<div key={opt}>
<div className="flex justify-between text-xs mb-1">
@@ -54,19 +54,21 @@ export function PollResultsView({ questions }: Props) {
/>
</div>
</div>
);
)
})}
</div>
) : (
<div className="text-sm text-muted-foreground">{totalVotes} free-text responses</div>
<div className="text-sm text-muted-foreground">
{totalVotes} free-text responses
</div>
)}
<p className="text-xs text-muted-foreground mt-2">
{totalVotes} total vote{totalVotes !== 1 ? "s" : ""}
{totalVotes} total vote{totalVotes !== 1 ? 's' : ''}
</p>
</div>
);
)
})}
</CardContent>
</Card>
);
)
}