Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/dark mode : Added shadcn dark mode to dashboard #852

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/dashboard/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"html-to-image": "^1.11.11",
"lottie-react": "^2.4.0",
"lucide-react": "^0.471.1",
"next-themes": "^0.4.4",
"radash": "^12.1.0",
"react": "^18.3.1",
"react-complex-tree": "^2.4.4",
Expand Down
39 changes: 39 additions & 0 deletions pkg/dashboard/frontend/src/components/ModeToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use client"

import { Moon, Sun } from "lucide-react"
import { useTheme } from "next-themes"

import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

export function ModeToggle() {
const { setTheme } = useTheme()

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon">
<Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span className="sr-only">Toggle theme</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => setTheme("light")}>
Light
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("dark")}>
Dark
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("system")}>
System
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
2 changes: 1 addition & 1 deletion pkg/dashboard/frontend/src/components/apis/APIHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const APIHistory: React.FC<Props> = ({
})

if (!requestHistory.length) {
return <p className="px-2">There is no history.</p>
return <p className="px-2 text-foreground">There is no history.</p>
}

return (
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot view the lines, they should be a light color

image

Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ function ReactFlowLayout() {
</Panel>
)}
<Panel position="bottom-left" className="flex flex-col gap-y-1">
<div className="rounded-md border bg-white p-2">
<div className="mb-2 text-center text-xs font-semibold">
<div className="rounded-md border-border bg-background p-2">
<div className="mb-2 text-center text-xs font-semibold text-foreground">
Connector Types
</div>
<div className="grid grid-cols-2 items-center gap-x-4 gap-y-2 text-xs font-semibold">
<span className="h-1 border-b-2 border-dashed border-black" />
<span>Triggers</span>
<span className="h-1 border-b-2 border-black" />
<span>Dependencies</span>
<span className="h-1 border-b-2 border-dashed border-foreground" />
<span className="text-foreground">Triggers</span>
<span className="h-1 border-b-2 border-dashed border-foreground" />
<span className="text-foreground">Dependencies</span>
</div>
</div>
</Panel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const DetailsDrawer = ({

return (
<Drawer modal={false} direction="right" open={open}>
<DrawerContent className="fixed inset-auto bottom-0 right-0 mt-24 flex h-full w-[380px] flex-col rounded-l-[10px] rounded-r-none bg-white">
<DrawerContent className="fixed inset-auto bottom-0 right-0 mt-24 flex h-full w-[380px] flex-col rounded-l-[10px] rounded-r-none bg-background border border-border">
<div className="mx-auto w-full max-w-sm p-4">
<DrawerHeader
className={`flex items-center react-flow__node-${nodeType}`}
Expand All @@ -130,11 +130,11 @@ export const DetailsDrawer = ({
{children}
{address && (
<div className="flex flex-col">
<span className="font-bold">Address:</span>
<span className="font-bold text-foreground">Address:</span>
{address.startsWith('http') ? (
<a
target="_blank"
className="hover:underline"
className="hover:underline text-foreground"
href={address}
rel="noreferrer"
>
Expand All @@ -147,13 +147,13 @@ export const DetailsDrawer = ({
)}
{services?.length ? (
<div className="flex flex-col">
<span className="font-bold">Requested by:</span>
<span className="font-bold text-foreground">Requested by:</span>
<div className="flex flex-col items-start gap-y-1">
{services.map((s) => (
<button
key={s}
type="button"
className="hover:underline"
className="hover:underline text-foreground"
onClick={() => selectServiceNode(s)}
>
{s}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export default function NitricEdge({
<div
data-testid={`edge-label-${id}`}
className={cn(
'nodrag absolute rounded-sm border bg-white p-1 text-[9px] font-semibold tracking-normal transition-all',
selected ? 'border-primary' : 'border-gray-500',
'nodrag absolute rounded-sm border bg-background text-foreground p-1 text-[9px] font-semibold tracking-normal transition-all',
selected ? 'border-primary' : 'border-border',
)}
style={{
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ const NodeBase: FC<PropsWithChildren<Props>> = ({
<DetailsDrawer {...drawerOptions} open={selected && !dragging} />
)}
<div className="wrapper gradient relative flex flex-grow overflow-hidden rounded-md p-0.5">
<div className="relative flex grow items-center justify-center gap-4 rounded bg-white pr-4">
<div className="relative flex grow items-center justify-center gap-4 rounded bg-background text-foreground border border-border">
<div className="flex h-full w-14 items-center justify-center">
<div className="gradient relative flex size-10 items-center justify-center overflow-hidden rounded-full">
<div className="z-10 flex size-9 items-center justify-center rounded-full bg-white">
<div className="z-10 flex size-9 items-center justify-center rounded-full bg-background">
<Icon className={'resource-icon size-6'} />
</div>
</div>
</div>
<div className="text-sm font-semibold">{title}</div>
<div className="text-sm font-semibold text-foreground">{title}</div>

<Handle type="target" isConnectable={false} position={Position.Top} />
<Handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const ScheduleNode: ComponentType<NodeProps<ScheduleNodeData>> = (
{data.resource.expression ? (
<>
<div className="flex flex-col">
<span className="font-bold">Cron:</span>
<span>{data.resource.expression}</span>
<span className="font-bold text-foreground">Cron:</span>
<span className="text-foreground">{data.resource.expression}</span>
</div>
<div className="flex flex-col">
<span className="font-bold">Description:</span>
<span>
<span className="font-bold text-foreground">Description:</span>
<span className="text-foreground">
{cronstrue.toString(data.resource.expression, {
verbose: true,
})}
Expand All @@ -41,8 +41,8 @@ export const ScheduleNode: ComponentType<NodeProps<ScheduleNodeData>> = (
</>
) : (
<div className="flex flex-col">
<span className="font-bold">Rate:</span>
<span>Every {data.resource.rate}</span>
<span className="font-bold text-foreground">Rate:</span>
<span className="text-foreground">Every {data.resource.rate}</span>
</div>
)}
</>
Expand Down
Loading
Loading