update: macos blurred window and radius setup

This commit is contained in:
Purp1e
2024-09-27 11:20:48 +08:00
parent 46c6dbfa61
commit a70bf60ed5
11 changed files with 54 additions and 33 deletions

View File

@@ -17,7 +17,7 @@ tauri-build = { version = "2.0.0-rc", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-rc", features = [ tauri = { version = "2.0.0-rc", features = [ "macos-private-api",
"tray-icon" "tray-icon"
] } ] }
window-vibrancy = "0.5.2" window-vibrancy = "0.5.2"

View File

@@ -46,6 +46,7 @@
"identifier": "upup.cool", "identifier": "upup.cool",
"plugins": {}, "plugins": {},
"app": { "app": {
"macOSPrivateApi": true,
"windows": [ "windows": [
{ {
"fullscreen": false, "fullscreen": false,
@@ -61,7 +62,7 @@
"transparent": true, "transparent": true,
"theme": "Light", "theme": "Light",
"hiddenTitle": true, "hiddenTitle": true,
"titleBarStyle": "Overlay" "titleBarStyle": "Transparent"
} }
], ],
"security": { "security": {

View File

@@ -1,6 +1,9 @@
"use client"
import Header from "@/components/window/Header"; import Header from "@/components/window/Header";
import Nav from "@/components/window/Nav"; import Nav from "@/components/window/Nav";
import SideBar from "@/components/window/SideBar"; import SideBar from "@/components/window/SideBar";
import clsx from "clsx";
// import { platform } from "@tauri-apps/plugin-os"
export default function BaseLayout({ export default function BaseLayout({
children, children,
@@ -8,18 +11,24 @@ export default function BaseLayout({
children: React.ReactNode; children: React.ReactNode;
}) { }) {
return ( return (
<div className="bg-[#f1f0f2] h-full w-full"> <div className="w-full h-full bg-transparent">
{/* bg-[#f1f0f2] */}
<Nav /> <Nav />
<div className="flex flex-col w-full h-full"> <div className="flex flex-col w-full h-full">
<SideBar /> <SideBar />
<main className="flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden "> <main
className={clsx(
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden"
// platform() === "windows" ? "ml-20" : "ml-[4.25rem]"
)}
>
<Header /> <Header />
{children} {children}
</main> </main>
</div> </div>
</div> </div>
); )
} }

View File

@@ -10,7 +10,9 @@ body {
height: 100%; height: 100%;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu,
Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
background: transparent; /* background: transparent; */
background: rgba(242, 241, 243, 0.3);
border-radius: 10px;
} }
a { a {

View File

@@ -6,7 +6,7 @@ const Home = () => {
const router = useRouter(); const router = useRouter();
return ( return (
<main <main
className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 items-center justify-center" className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region data-tauri-drag-region
> >
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS </h1> <h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS </h1>

View File

@@ -2,12 +2,12 @@ import Nav from "@/components/window/Nav"
export default function BaseLayout({ children }: { children: React.ReactNode }) { export default function BaseLayout({ children }: { children: React.ReactNode }) {
return ( return (
<div className="bg-[#f1f0f2] h-full w-full"> <div className="w-full h-full">
<Nav /> <Nav />
<div className="flex flex-col w-full h-full"> <div className="flex flex-col w-full h-full">
<main <main
className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 p-6 items-center justify-center" className="flex flex-col items-center justify-center w-full h-screen gap-6 p-6"
data-tauri-drag-region data-tauri-drag-region
> >
{children} {children}

View File

@@ -5,7 +5,7 @@ export default function Page() {
const { dir, updateDir, csDir, updateCsDir, currentUser } = useSteamStore() const { dir, updateDir, csDir, updateCsDir, currentUser } = useSteamStore()
return ( return (
<div <div
className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 items-center justify-center" className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region data-tauri-drag-region
> >
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS工具箱</h1> <h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS工具箱</h1>

View File

@@ -22,7 +22,7 @@ const CommonDir = () => {
</CardIcon> </CardIcon>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<div className="flex gap-2.5"> <div className="flex gap-1.5">
<RoundedButton>Steam安装位置</RoundedButton> <RoundedButton>Steam安装位置</RoundedButton>
<RoundedButton>CS2游戏目录</RoundedButton> <RoundedButton>CS2游戏目录</RoundedButton>
<RoundedButton></RoundedButton> <RoundedButton></RoundedButton>

View File

@@ -8,7 +8,7 @@ interface CardProps {
const Card = ({ children }: CardProps) => { const Card = ({ children }: CardProps) => {
return ( return (
<div <div
className="dark:from-black/10 dark:to-black/5 dark:border-white/[6%] px-4 pt-3 pb-4 flex flex-col gap-2 border w-full rounded-lg bg-gradient-to-br from-white/90 to-white/80 border-black/[6%]" className="dark:from-black/10 dark:to-black/5 dark:border-white/[6%] px-4 pt-3 pb-4 flex flex-col gap-2 border w-full rounded-lg bg-gradient-to-br from-white/80 to-white/70 border-black/[6%]"
data-tauri-drag-region data-tauri-drag-region
> >
{children} {children}

View File

@@ -2,7 +2,7 @@
import { RocketOne, Minus, Close, Square } from "@icon-park/react" import { RocketOne, Minus, Close, Square } from "@icon-park/react"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process" import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { getCurrentWindow } from "@tauri-apps/api/window" import { getCurrentWindow } from "@tauri-apps/api/window"
// import { invoke } from "@tauri-apps/api/core"; import { platform } from "@tauri-apps/plugin-os"
import { useRouter } from "next/navigation" import { useRouter } from "next/navigation"
const Nav = () => { const Nav = () => {
@@ -41,6 +41,9 @@ const Nav = () => {
> >
<RocketOne size={16} /> <RocketOne size={16} />
</button> </button>
{/* { platform() === "windows" && ( */}
<>
<button <button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95" className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize} onClick={minimize}
@@ -59,6 +62,8 @@ const Nav = () => {
> >
<Close size={16} /> <Close size={16} />
</button> </button>
</>
{/* )} */}
</nav> </nav>
) )
} }

View File

@@ -3,6 +3,7 @@ import { ReactNode } from "react"
import clsx from "clsx" import clsx from "clsx"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react" import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { useRouter } from "next/navigation" import { useRouter } from "next/navigation"
// import { platform } from "@tauri-apps/plugin-os"
import useAppStore from "@/store/app" import useAppStore from "@/store/app"
interface SideButtonProps { interface SideButtonProps {
@@ -41,7 +42,10 @@ const SideBar = () => {
return ( return (
<div <div
className="absolute left-0 flex flex-col w-20 h-full select-none py-7" className={clsx(
"absolute left-0 flex flex-col h-full select-none w-20 py-7",
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
)}
data-tauri-drag-region data-tauri-drag-region
> >
<section className="mx-auto"> <section className="mx-auto">
@@ -74,7 +78,7 @@ const SideBar = () => {
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region> <div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
<p></p> <p></p>
<p onClick={()=> setVersion("x.y.z")}>{version}</p> <p onClick={() => setVersion("x.y.z")}>{version}</p>
</div> </div>
</div> </div>
) )