Files
supabase/apps/studio/components/ui/Charts/Charts.constants.ts
T
Alaister YoungandAlaister Young b0e31be89a chore(studio): remove dead code found by knip (#49719)
Removes Studio code that nothing imports, as reported by knip. First PR
in a stack of three: this one is pure deletions, #49720 removes the
unused dependencies, #49721 upgrades knip and adds the CI gate so this
doesn't accumulate again.

Every file was verified with a repo-wide grep for its basename, exported
symbols, and string/dynamic imports before deletion — none are reachable
via `next/dynamic`, a barrel file, or a config.

**Removed:**
-
`Billing/Usage/UsageWarningAlerts/{CPU,RAM,DiskIOBandwidth}Warnings.tsx`
(whole directory)
- `DataWarehouse/FormFooterChangeBadge.tsx` (whole directory)
- `Database/Replication/ReplicationDiagram/EmptyReplicationDiagram.tsx`
- `Integrations/Vercel/OrganizationPicker.tsx`
- `QueryInsights/QueryInsightsTable/QueryInsightsTableRow.tsx`
- `hooks/misc/useTrackExperimentExposure.ts`
- `data/ai/{parse-client-code,sql-policy}-mutation.ts`,
`data/misc/parse-query-mutation.ts`,
`data/database/table-check-rls-mutation.ts`
-
`data/notifications/notifications-v2-{archive-all-mutation,summary-query}.ts`
+ their two now-unused keys in `notifications/keys.ts` (`listV2` kept)
-
`data/platform-apps/platform-app-{update,signing-key-delete}-mutation.ts`
- `DateTimeFormats.DATE_ONLY` and the unused
`Notebooks.{MarkdownCell,LogCell,ChartConfig}` types

**Changed:**
- `ReportPadding` no longer has a duplicate default export; its 9
default importers (observability pages) now use the named export

Not removed: `CONSTRAINT_TYPE`'s unused members mirror the closed set of
`pg_constraint.contype` values, so they're documentation rather than
dead code — suppressed narrowly in #49721's knip config instead.

## To test

- `pnpm --filter studio run typecheck` and `lint:ratchet` pass
- Observability pages (`/project/[ref]/observability/*`) still render
with padding — they're the only code touched, via the `ReportPadding`
import change
- Notifications popover still loads and marks-as-read (the removed keys
weren't used for invalidation)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Removed Features**
  - Removed CPU, memory, and disk usage warning alerts.
- Removed the Vercel organization picker and empty replication diagram.
  - Removed query insights row actions and several SQL assistance tools.
  - Removed notification summary and archive-all capabilities.
  - Removed platform app update and signing-key deletion actions.
- Removed the form change-count badge and experiment exposure tracking.

- **Refactor**
- Updated observability reports to use the revised report layout export.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-08-31 10:55:23 +08:00

106 lines
2.3 KiB
TypeScript

// Just extracting the color configuration to a single file so that it's easier to observe
// Needs better naming to be honest, but just to get things going
// For ChartHandler
export const CHART_COLORS = {
TICK: 'var(--background-overlay-hover)',
AXIS: 'var(--background-overlay-hover)',
GREEN_1: 'hsl(var(--brand-default))',
GREEN_2: 'hsl(var(--brand-500))',
RED_1: 'hsl(var(--destructive-default))',
RED_2: 'hsl(var(--destructive-500))',
REFERENCE_LINE: 'var(--foreground-muted)',
REFERENCE_LINE_TEXT: 'var(--foreground-muted)',
}
const LIGHT_STACKED_CHART_COLORS = [
'#3ECF8E',
'#DA760B',
'#097c4f',
'#EDC35E',
'#65BCD9',
'#0063E8',
'#DB8DF9',
'#B616A6',
]
const LIGHT_STACKED_CHART_FILLS = [
'#9FE8C7',
'#FFB885',
'#4BA67A',
'#F6D99F',
'#B2DCEC',
'#80B1F4',
'#EDC9FC',
'#DB8BD3',
]
const DARK_STACKED_CHART_COLORS = [
'#3ECF8E',
'#A3FFC2',
'#DA760B',
'#EDD35E',
'#65BCD9',
'#0063E8',
'#DB8DF9',
'#B616A6',
]
const DARK_STACKED_CHART_FILLS = [
'#2A5C3F',
'#1F3D2A',
'#5C3D0A',
'#5C5230',
'#2A3D45',
'#001F3D',
'#4A3D5C',
'#3D1F3A',
]
// Default to light mode colors, will be updated based on theme
export let STACKED_CHART_COLORS = LIGHT_STACKED_CHART_COLORS
export let STACKED_CHART_FILLS = LIGHT_STACKED_CHART_FILLS
// Function to update colors based on theme
export const updateStackedChartColors = (isDarkMode: boolean) => {
STACKED_CHART_COLORS = isDarkMode ? DARK_STACKED_CHART_COLORS : LIGHT_STACKED_CHART_COLORS
STACKED_CHART_FILLS = isDarkMode ? DARK_STACKED_CHART_FILLS : LIGHT_STACKED_CHART_FILLS
}
export type ValidStackColor =
| 'brand'
| 'blue'
| 'red'
| 'yellow'
| 'green'
| 'slate'
| 'indigo'
| 'tomato'
| 'orange'
| 'amber'
export const genStackColorScales = (colors: ValidStackColor[]) =>
colors.map((color) => {
let scale = 9
if (color === 'slate') {
scale = 11
}
return {
lighter: `var(--color-${color}-${scale - 1}00)`,
base: `var(--color-${color}-${scale * 100})`,
darker: `var(--color-${color}-${scale + 1}00)`,
}
})
export const DEFAULT_STACK_COLORS: ValidStackColor[] = [
'brand',
'slate',
'blue',
'yellow',
'indigo',
]
export enum DateTimeFormats {
FULL = 'MMM D, YYYY, hh:mma',
FULL_SECONDS = 'MMM D, hh:mm:ssa',
}