feat: add environment labels (local/dev/stage/prod) for connections
Visual badges help distinguish environments across the UI to prevent running dangerous queries on production. Environment color takes priority over custom connection color for the toolbar border. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
src/lib/environment.ts
Normal file
13
src/lib/environment.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const ENVIRONMENTS = [
|
||||
{ value: "local", label: "LOCAL", color: "#6b7280", bgClass: "bg-gray-500/20", textClass: "text-gray-400", borderClass: "border-gray-500/40" },
|
||||
{ value: "dev", label: "DEV", color: "#3b82f6", bgClass: "bg-blue-500/20", textClass: "text-blue-400", borderClass: "border-blue-500/40" },
|
||||
{ value: "stage", label: "STG", color: "#f59e0b", bgClass: "bg-amber-500/20", textClass: "text-amber-400", borderClass: "border-amber-500/40" },
|
||||
{ value: "prod", label: "PROD", color: "#ef4444", bgClass: "bg-red-500/20", textClass: "text-red-400", borderClass: "border-red-500/40" },
|
||||
] as const;
|
||||
|
||||
export type EnvironmentValue = (typeof ENVIRONMENTS)[number]["value"];
|
||||
|
||||
export function getEnvironment(value?: string) {
|
||||
if (!value) return null;
|
||||
return ENVIRONMENTS.find((e) => e.value === value) ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user