feat: menubar

This commit is contained in:
mozzie 2024-09-02 10:06:06 +08:00
parent ef6599445d
commit 7fb2511ba4
5 changed files with 65 additions and 13 deletions

View File

@ -19,6 +19,7 @@
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-menubar": "^1.1.1",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-select": "^2.1.1",

View File

@ -0,0 +1,28 @@
"use client"
import * as React from "react"
import * as ProgressPrimitive from "@radix-ui/react-progress"
import { cn } from "@/lib/utils"
const Progress = React.forwardRef<
React.ElementRef<typeof ProgressPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
>(({ className, value, ...props }, ref) => (
<ProgressPrimitive.Root
ref={ref}
className={cn(
"relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
className
)}
{...props}
>
<ProgressPrimitive.Indicator
className="h-full w-full flex-1 bg-primary transition-all"
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
))
Progress.displayName = ProgressPrimitive.Root.displayName
export { Progress }

View File

@ -1,6 +1,8 @@
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";
import { useEffect, useState } from "react";
interface ScanProgress {
percentage: number;
}
@ -36,8 +38,7 @@ export const Datasource = () => {
<Button onClick={() => window.ipcRenderer.send("scan-dicom")}>
</Button>
<div>{progress?.percentage}</div>
<div>{JSON.stringify(result)}</div>
<Progress value={progress?.percentage} />
</div>
</div>
);

View File

@ -1,26 +1,22 @@
import { Toaster } from "@/components/ui/toaster";
import { LeftDocker } from "./LeftDocker";
import { Outlet } from "react-router-dom";
import { MenuBar } from "./MenuBar";
const LayoutMain = () => {
const platform =
document.querySelector("html")?.getAttribute("platform") ?? "macos";
// const titleBarStyles =
// platform === "macos" ? "pl-[5rem] pr-[.5rem]" : "pl-[.5rem]";
const titleBarStyles = platform === "macos" ? "px-[.5rem]" : "pl-[.5rem]";
const titleBarStyles = platform === "macos" ? "pl-[80px]" : "pl-[.5rem]";
return (
<div className="h-full">
<div
className={`title-bar drag h-[36px] flex ${
platform === "macos" ? "justify-center" : ""
}`}
>
<div
className={`inline-flex no-drag items-center justify-between ${titleBarStyles}`}
>
<img src="logo.svg" className="h-[20px]" />
<span className="pl-2 text-xs">CVPilot Tool</span>
<div className={`title-bar drag h-[36px] flex`}>
<div className={`inline-flex no-drag items-center ${titleBarStyles}`}>
{platform !== "macos" && <img src="logo.svg" className="h-[20px]" />}
<MenuBar />
{/* <span className="pl-2 text-xs">CVPilot Tool</span> */}
</div>
</div>
<div className="relative h-[calc(100%-36px)]">

View File

@ -34,6 +34,9 @@ importers:
'@radix-ui/react-menubar':
specifier: ^1.1.1
version: 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@radix-ui/react-progress':
specifier: ^1.1.0
version: 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@radix-ui/react-radio-group':
specifier: ^1.2.0
version: 1.2.0(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -1044,6 +1047,19 @@ packages:
'@types/react-dom':
optional: true
'@radix-ui/react-progress@1.1.0':
resolution: {integrity: sha512-aSzvnYpP725CROcxAOEBVZZSIQVQdHgBr2QQFKySsaD14u8dNT0batuXI+AAGDdAHfXH8rbnHmjYFqVJ21KkRg==}
peerDependencies:
'@types/react': '*'
'@types/react-dom': '*'
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
'@types/react':
optional: true
'@types/react-dom':
optional: true
'@radix-ui/react-radio-group@1.2.0':
resolution: {integrity: sha512-yv+oiLaicYMBpqgfpSPw6q+RyXlLdIpQWDHZbUKURxe+nEh53hFXPPlfhfQQtYkS5MMK/5IWIa76SksleQZSzw==}
peerDependencies:
@ -4989,6 +5005,16 @@ snapshots:
'@types/react': 18.3.4
'@types/react-dom': 18.3.0
'@radix-ui/react-progress@1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@radix-ui/react-context': 1.1.0(@types/react@18.3.4)(react@18.3.1)
'@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
optionalDependencies:
'@types/react': 18.3.4
'@types/react-dom': 18.3.0
'@radix-ui/react-radio-group@1.2.0(@types/react-dom@18.3.0)(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@radix-ui/primitive': 1.1.0