Files
supabase/apps/www/components/SurveyResults/charts/InitialPayingCustomersChart.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

47 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { SurveyChart, buildWhereClause } from '../SurveyChart'
function generateInitialPayingCustomersSQL(activeFilters: Record<string, string>) {
const whereClause = buildWhereClause(activeFilters)
return `WITH customer_source_mapping AS (
SELECT
id,
CASE
WHEN source IN (
'Personal/professional network',
'Inbound from social media (Twitter, LinkedIn, etc.)',
'Cold outreach or sales',
'Content (blog, newsletter, SEO)',
'Developer communities (Discord, Slack, Reddit, etc.)',
'Open source users who converted',
'Accelerators/incubators',
'Hacker News or Product Hunt'
) THEN source
ELSE 'Other'
END AS source_clean
FROM (
SELECT id, unnest(initial_paying_customers) AS source
FROM responses_2025
${whereClause}
) sub
)
SELECT
source_clean AS source,
COUNT(DISTINCT id) AS respondents
FROM customer_source_mapping
GROUP BY source_clean
ORDER BY respondents DESC;`
}
export function InitialPayingCustomersChart() {
return (
<SurveyChart
title="Where did your startup’s initial paying customers come from?"
targetColumn="initial_paying_customers"
filterColumns={['person_age', 'location', 'team_size']}
functionName="get_initial_paying_customers_stats"
generateSQLQuery={generateInitialPayingCustomersSQL}
/>
)
}