Files
supabase/apps/www/components/SurveyResults/SurveyChapterSection.tsx
Danny WhiteandJoshen Lim b53893a580 feat: state of startups 2025 results page (#37782)
* wip: fist commit

* feat: ascii art

* wip: stepped animations

* wip: bars bars bars

* wip: styles

* wip: styles

* wip: styles

* fix: absolute bar chart values

* fix: type errors

* chore: reorg components

* chore: reorg public assets

* wip: simplify filters

* wip: simplify filters hook

* wip: chart cleanup

* fix: empty state on charts

* fix: build issues

* wip: simplify stat percentage card

* wip: misc

* fix: floating ToC scroll intersection

* fix: brackets

* feat: line animations

* fix: wipe off animation

* fix: smooth out animation

* wip: refactor

* wip: style improvements

* fix: gradient smoothing

* fix: smooth expansion and view transitions

* wip: design polish

* wip: polish

* wip: polish

* wip: polish

* wip: copy

* wip: quote avatars

* wip: headshots

* fix: pair component styles

* fix: pair flex

* wip: chart data improvement

* wip: chart improvements

* wip: quote avatars

* fix: chart data

* wip: remove graph comments

* wip: misc

* wip: poc chart

* fix: demo sql

* wip: prep for functions

* feat: dedicated functions approach

* fix: hardcoded stats

* wip: cleanup

* wip: cleanup

* wip: cleanup

* wip: feature flag basics

* wip: thank you list

* wip: flex with simpler shuffle

* wip: misc styles

* fix: env var for sentry

* fix: duplicate var

* fix: mobile style improvements

* fix: pattern sharpness

* fix: table of contents link

* Fix feature flag

* Tiny fix

* minor copywriting improvements

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-04 11:04:30 +10:00

109 lines
3.6 KiB
TypeScript

import { SurveyStatCard } from './SurveyStatCard'
import { SurveyWordCloud } from './SurveyWordCloud'
import { SurveySummarizedAnswer } from './SurveySummarizedAnswer'
import { SurveyRankedAnswersPair } from './SurveyRankedAnswersPair'
import { SurveySectionBreak } from './SurveySectionBreak'
import { AcceleratorParticipationChart } from './charts/AcceleratorParticipationChart'
import { RoleChart } from './charts/RoleChart'
import { IndustryChart } from './charts/IndustryChart'
import { FundingStageChart } from './charts/FundingStageChart'
import { DatabasesChart } from './charts/DatabasesChart'
import { AIModelsChart } from './charts/AIModelsChart'
import { LocationChart } from './charts/LocationChart'
import { SalesToolsChart } from './charts/SalesToolsChart'
import { AICodingToolsChart } from './charts/AICodingToolsChart'
import { RegularSocialMediaUseChart } from './charts/RegularSocialMediaUseChart'
import { NewIdeasChart } from './charts/NewIdeasChart'
import { InitialPayingCustomersChart } from './charts/InitialPayingCustomersChart'
import { WorldOutlookChart } from './charts/WorldOutlookChart'
import { BiggestChallengeChart } from './charts/BiggestChallengeChart'
interface SurveyChapterSectionProps {
title: string
description: string
stats?: Array<{ percent: number; label: string }>
charts?: string[]
wordCloud?: {
label: string
words: { text: string; count: number }[]
}
summarizedAnswer?: {
label: string
answers: string[]
}
rankedAnswersPair?: Array<{ label: string; answers: string[] }>
children?: React.ReactNode
}
export function SurveyChapterSection({
title,
description,
stats,
charts,
wordCloud,
summarizedAnswer,
rankedAnswersPair,
children,
}: SurveyChapterSectionProps) {
const chartComponents = {
RoleChart,
IndustryChart,
FundingStageChart,
AcceleratorParticipationChart,
DatabasesChart,
AICodingToolsChart,
AIModelsChart,
RegularSocialMediaUseChart,
NewIdeasChart,
InitialPayingCustomersChart,
SalesToolsChart,
WorldOutlookChart,
BiggestChallengeChart,
LocationChart,
}
return (
<div id={title.toLowerCase().replace(/\s+/g, '-')} className="">
<div className="max-w-[60rem] mx-auto flex flex-col md:border-x border-muted">
<header className="grid grid-cols-1 md:grid-cols-3 text-balance">
<h3 className="pt-8 pb-4 px-8 md:border-r border-muted text-brand-link dark:text-brand font-mono uppercase tracking-wider text-sm">
{title}
</h3>
<p className="pb-8 md:pt-8 px-8 md:col-span-2 text-foreground-light text-lg md:text-xl leading-relaxed">
{description}
</p>
</header>
{stats && (
<aside className="border-t border-muted flex flex-col xs:flex-row flex-wrap divide-y xs:divide-x xs:divide-y-0 divide-muted">
{stats.map((stat, index) => (
<SurveyStatCard key={index} percent={stat.percent} label={stat.label} />
))}
</aside>
)}
{charts?.map((chartName, index) => {
const ChartComponent = chartComponents[chartName as keyof typeof chartComponents]
return ChartComponent ? <ChartComponent key={index} /> : null
})}
{rankedAnswersPair && <SurveyRankedAnswersPair rankedAnswersPair={rankedAnswersPair} />}
{wordCloud && <SurveyWordCloud label={wordCloud.label} answers={wordCloud.words} />}
{summarizedAnswer && (
<SurveySummarizedAnswer
label={summarizedAnswer.label}
answers={summarizedAnswer.answers}
/>
)}
{children}
</div>
<SurveySectionBreak />
</div>
)
}