update style of add system dialog

This commit is contained in:
Henry Dollman
2025-02-06 20:01:04 -05:00
parent 44d930a700
commit 31d52d5e15
2 changed files with 31 additions and 26 deletions

View File

@@ -1,12 +1,12 @@
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { import {
Dialog, Dialog,
DialogContent, DialogContent,
DialogDescription, DialogDescription,
DialogFooter, DialogFooter,
DialogHeader, DialogHeader,
DialogTitle, DialogTitle,
DialogTrigger, DialogTrigger,
} from "@/components/ui/dialog" } from "@/components/ui/dialog"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
@@ -44,14 +44,9 @@ export function AddSystemButton({ className }: { className?: string }) {
KEY: "${publicKey}"`) KEY: "${publicKey}"`)
} }
function copyDockerRun(port: string) { function copyDockerRun(port: string) {
copyToClipboard(`docker run -d \ copyToClipboard(
--name beszel-agent \ `docker run -d --name beszel-agent --network host --restart unless-stopped -v /var/run/docker.sock:/var/run/docker.sock:ro -e KEY="${publicKey}" -e PORT=${port} henrygd/beszel-agent:latest`
--network host \ )
--restart unless-stopped \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-e KEY="${publicKey}" \
-e PORT=${port} \
henrygd/beszel-agent:latest`)
} }
function copyInstallCommand(port: string) { function copyInstallCommand(port: string) {
@@ -91,7 +86,7 @@ export function AddSystemButton({ className }: { className?: string }) {
</Trans> </Trans>
</Button> </Button>
</DialogTrigger> </DialogTrigger>
<DialogContent className="w-[90%] sm:max-w-[440px] rounded-lg"> <DialogContent className="w-[90%] sm:w-auto sm:ns-dialog max-w-full rounded-lg">
<Tabs defaultValue="docker"> <Tabs defaultValue="docker">
<DialogHeader> <DialogHeader>
<DialogTitle className="mb-2"> <DialogTitle className="mb-2">
@@ -106,7 +101,7 @@ export function AddSystemButton({ className }: { className?: string }) {
</DialogHeader> </DialogHeader>
{/* Docker */} {/* Docker */}
<TabsContent value="docker"> <TabsContent value="docker">
<DialogDescription className="mb-4 leading-normal"> <DialogDescription className="mb-4 leading-normal w-0 min-w-full">
<Trans> <Trans>
The agent must be running on the system to connect. Copy the The agent must be running on the system to connect. Copy the
<code className="bg-muted px-1 rounded-sm leading-3">docker-compose.yml</code> for the agent below. <code className="bg-muted px-1 rounded-sm leading-3">docker-compose.yml</code> for the agent below.
@@ -115,7 +110,7 @@ export function AddSystemButton({ className }: { className?: string }) {
</TabsContent> </TabsContent>
{/* Binary */} {/* Binary */}
<TabsContent value="binary"> <TabsContent value="binary">
<DialogDescription className="mb-4 leading-normal"> <DialogDescription className="mb-4 leading-normal w-0 min-w-full">
<Trans> <Trans>
The agent must be running on the system to connect. Copy the installation command for the agent below. The agent must be running on the system to connect. Copy the installation command for the agent below.
</Trans> </Trans>
@@ -168,24 +163,24 @@ export function AddSystemButton({ className }: { className?: string }) {
</div> </div>
{/* Docker */} {/* Docker */}
<TabsContent value="docker"> <TabsContent value="docker">
<DialogFooter className="flex justify-end gap-2 sm:w-[calc(100%+20px)] sm:-ms-[20px]"> <DialogFooter className="flex justify-end gap-x-2 gap-y-3 flex-col">
<div className="flex gap-0 border border-muted rounded-lg"> <div className="flex gap-0 rounded-lg">
<Button <Button
type="button" type="button"
variant={"ghost"} variant="outline"
onClick={() => copyDockerCompose(port.current.value)} onClick={() => copyDockerCompose(port.current.value)}
className="rounded-r-none border-r-0" className="rounded-e-none dark:border-e-0 grow"
> >
<Trans>Copy</Trans> docker compose <Trans>Copy</Trans> docker compose
</Button> </Button>
<div className="w-px h-full bg-muted"></div> <div className="w-px h-full bg-muted"></div>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button variant="ghost" className={"px-2 rounded-l-none border-l-0"}> <Button variant="outline" className={"px-2 rounded-s-none border-s-0"}>
<ChevronDownIcon /> <ChevronDownIcon />
</Button> </Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent> <DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => copyDockerRun(port.current.value)}> <DropdownMenuItem onClick={() => copyDockerRun(port.current.value)}>
<Trans>Copy</Trans> docker run <Trans>Copy</Trans> docker run
</DropdownMenuItem> </DropdownMenuItem>
@@ -199,8 +194,8 @@ export function AddSystemButton({ className }: { className?: string }) {
</TabsContent> </TabsContent>
{/* Binary */} {/* Binary */}
<TabsContent value="binary"> <TabsContent value="binary">
<DialogFooter className="flex justify-end gap-2 sm:w-[calc(100%+20px)] sm:-ms-[20px]"> <DialogFooter className="flex justify-end gap-x-2 gap-y-3 flex-col">
<Button type="button" variant={"ghost"} onClick={() => copyInstallCommand(port.current.value)}> <Button type="button" variant="outline" onClick={() => copyInstallCommand(port.current.value)}>
<Trans>Copy Linux command</Trans> <Trans>Copy Linux command</Trans>
</Button> </Button>
<Button> <Button>

View File

@@ -78,9 +78,19 @@
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground;
} }
}
@layer utilities {
.link { .link {
@apply text-primary font-medium underline-offset-4 hover:underline; @apply text-primary font-medium underline-offset-4 hover:underline;
} }
/* New system dialog width */
.ns-dialog {
min-width: 30.3rem;
}
:where(:lang(zh), :lang(zh-CN), :lang(ko)) .ns-dialog {
min-width: 27.9rem;
}
} }
.recharts-tooltip-wrapper { .recharts-tooltip-wrapper {