mirror of
https://github.com/supabase/supabase.git
synced 2026-09-07 02:20:52 +08:00
## Before Feedback on security pages is being routed to general docs feedback. ## After Feedback on security pages is routed to security team.
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import { pick } from 'lodash'
|
|
|
|
/**
|
|
* Gets the Notion team to send feedback to based on the pathname.
|
|
*/
|
|
const getLinearTeam = (pathname: string) => {
|
|
const DEFAULT_TEAM = 'Docs'
|
|
|
|
// Pathname has format `/guides/(team)/**`
|
|
const pathParts = pathname.split('/')
|
|
|
|
if (pathParts[1] !== 'guides' || !pathParts[2]) return DEFAULT_TEAM
|
|
|
|
switch (pathParts[2]) {
|
|
case 'database':
|
|
return 'Postgres'
|
|
case 'auth':
|
|
return 'Auth'
|
|
case 'storage':
|
|
return 'Storage'
|
|
case 'functions':
|
|
return 'Functions'
|
|
case 'realtime':
|
|
return 'Realtime'
|
|
case 'ai':
|
|
return 'AI'
|
|
case 'local-development':
|
|
case 'self-hosting':
|
|
case 'deployment':
|
|
return 'Dev Workflows'
|
|
case 'integrations':
|
|
return 'API'
|
|
case 'security':
|
|
return 'Security'
|
|
case 'platform':
|
|
case 'monitoring-troubleshooting':
|
|
return 'Infra'
|
|
default:
|
|
return DEFAULT_TEAM
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the tab selection state from the URL search params.
|
|
*
|
|
* Sanitizes by including only those search params that are explicitly marked
|
|
* as query groups.
|
|
*/
|
|
const getSanitizedTabParams = () => {
|
|
const searchParams = new URLSearchParams(window.location.search)
|
|
const queryGroups = searchParams.getAll('queryGroups')
|
|
|
|
return pick(Object.fromEntries(searchParams.entries()), queryGroups)
|
|
}
|
|
|
|
export { getLinearTeam, getSanitizedTabParams }
|