mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
* 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>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||
|
||
function generateRegularSocialMediaUseSQL(activeFilters: Record<string, string>) {
|
||
const whereClause = buildWhereClause(activeFilters)
|
||
|
||
return `WITH regular_social_media_use_mapping AS (
|
||
SELECT
|
||
id,
|
||
CASE
|
||
WHEN platform IN (
|
||
'X (Twitter)',
|
||
'Threads',
|
||
'BlueSky',
|
||
'LinkedIn',
|
||
'Reddit',
|
||
'TikTok',
|
||
'Instagram',
|
||
'YouTube',
|
||
'Mastodon',
|
||
'Discord',
|
||
'I’ve given up social media'
|
||
) THEN platform
|
||
ELSE 'Other'
|
||
END AS platform_clean
|
||
FROM (
|
||
SELECT id, unnest(regular_social_media_use) AS platform
|
||
FROM responses_2025
|
||
${whereClause}
|
||
) sub
|
||
)
|
||
SELECT
|
||
platform_clean AS platform,
|
||
COUNT(DISTINCT id) AS total
|
||
FROM regular_social_media_use_mapping
|
||
GROUP BY platform_clean
|
||
ORDER BY total DESC;`
|
||
}
|
||
|
||
export function RegularSocialMediaUseChart() {
|
||
return (
|
||
<SurveyChart
|
||
title="Which social media platforms do you use at least 3× per week?"
|
||
targetColumn="regular_social_media_use"
|
||
filterColumns={['person_age', 'location', 'money_raised']}
|
||
functionName="get_regular_social_media_use_stats"
|
||
generateSQLQuery={generateRegularSocialMediaUseSQL}
|
||
/>
|
||
)
|
||
}
|