|
1 | 1 | import { useConfig } from "@/context/config-provider"; |
2 | 2 | import { useTheme } from "@/context/theme-provider"; |
3 | 3 | import { cn } from "@/lib/utils"; |
4 | | -import { ReactElement, useState } from "react"; |
| 4 | +import { ReactElement, useMemo, useState } from "react"; |
5 | 5 | import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"; |
6 | 6 | import Link from "next/link"; |
7 | 7 | import { |
@@ -35,8 +35,38 @@ export default function SidebarTab({ tabs }: Readonly<SidebarTabProps>) { |
35 | 35 |
|
36 | 36 | const config = useConfig(); |
37 | 37 |
|
| 38 | + /** |
| 39 | + * Adding color to help identify the database. |
| 40 | + * Some people have multiple databases open at the same time. |
| 41 | + * This will help them identify the database they are working on. |
| 42 | + * |
| 43 | + * https://github.com/outerbase/studio/issues/234 |
| 44 | + */ |
| 45 | + const databaseColorIndicatorClassName = useMemo(() => { |
| 46 | + if (config.color === "red") { |
| 47 | + return `border-l-8 border-red-400 dark:border-red-800`; |
| 48 | + } else if (config.color === "blue") { |
| 49 | + return `border-l-8 border-blue-400 dark:border-blue-800`; |
| 50 | + } else if (config.color === "green") { |
| 51 | + return `border-l-8 border-green-400 dark:border-green-800`; |
| 52 | + } else if (config.color === "yellow") { |
| 53 | + return `border-l-8 border-yellow-400 dark:border-yellow-800`; |
| 54 | + } else if (config.color === "purple") { |
| 55 | + return `border-l-8 border-purple-400 dark:border-purple-800`; |
| 56 | + } else if (config.color === "gray") { |
| 57 | + return `border-l-8 border-gray-400 dark:border-gray-800`; |
| 58 | + } |
| 59 | + |
| 60 | + return ""; |
| 61 | + }, [config.color]); |
| 62 | + |
38 | 63 | return ( |
39 | | - <div className={cn("flex h-full bg-neutral-50 dark:bg-neutral-950")}> |
| 64 | + <div |
| 65 | + className={cn( |
| 66 | + "flex h-full bg-neutral-50 dark:bg-neutral-950", |
| 67 | + databaseColorIndicatorClassName |
| 68 | + )} |
| 69 | + > |
40 | 70 | <div className={cn("shrink-0")}> |
41 | 71 | <div className="flex flex-col border-r border-neutral-200 dark:border-neutral-800 h-full p-3 gap-4"> |
42 | 72 | <DropdownMenu modal={false}> |
|
0 commit comments