Skip to content

Commit

Permalink
feat: remove mica effect and support windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
reyamir committed Nov 2, 2024
1 parent a42542c commit d1018ba
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
6 changes: 0 additions & 6 deletions src-tauri/src/commands/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ pub fn open_window(window: NewWindow, app_handle: tauri::AppHandle) -> Result<St
.transparent(true)
.decorations(false)
.closable(window.closable)
.effects(WindowEffectsConfig {
state: None,
effects: vec![Effect::Mica],
radius: None,
color: None,
})
.build()
.unwrap();

Expand Down
7 changes: 1 addition & 6 deletions src-tauri/tauri.windows.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
"minWidth": 480,
"minHeight": 700,
"transparent": true,
"decorations": false,
"windowEffects": {
"effects": [
"mica"
]
}
"decorations": false
}
]
}
Expand Down
14 changes: 12 additions & 2 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { commands } from "@/commands.gen";
import { cn } from "@/commons";
import { Spinner } from "@/components";
import type { Metadata, NostrEvent } from "@/types";
import { type QueryClient, queryOptions } from "@tanstack/react-query";
Expand Down Expand Up @@ -36,7 +37,7 @@ export const Route = createRootRouteWithContext<RouterContext>()({
});

function Screen() {
const { queryClient } = Route.useRouteContext();
const { queryClient, platform } = Route.useRouteContext();

useEffect(() => {
const unlisten = getCurrentWindow().listen<string>(
Expand All @@ -60,7 +61,16 @@ function Screen() {
};
}, []);

return <Outlet />;
return (
<div
className={cn(
"size-full",
platform === "windows" ? "bg-neutral-100 dark:bg-neutral-900" : "",
)}
>
<Outlet />
</div>
);
}

function Pending() {
Expand Down
11 changes: 10 additions & 1 deletion src/routes/_app.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ export const Route = createLazyFileRoute("/_app")({
});

function Layout() {
const { platform } = Route.useRouteContext();

return (
<div className="flex flex-col w-screen h-screen">
<Topbar />
<div className="flex-1 bg-neutral-100 dark:bg-neutral-900 border-t-[.5px] border-black/20 dark:border-white/30">
<div
className={cn(
"flex-1 bg-neutral-100 dark:bg-neutral-900 border-t-[.5px]",
platform === "windows"
? "border-black/10 dark:border-white/10"
: "border-black/20 dark:border-white/30",
)}
>
<Outlet />
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion src/routes/new.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import { cn } from "@/commons";
import { createLazyFileRoute } from "@tanstack/react-router";

export const Route = createLazyFileRoute("/new")({
component: Screen,
});

function Screen() {
const { platform } = Route.useRouteContext();

return (
<div
data-tauri-drag-region
className="bg-white/50 dark:bg-black/50 relative size-full flex items-center justify-center"
className={cn(
"relative size-full flex items-center justify-center",
platform === "windows"
? "bg-neutral-200 dark:bg-neutral-900"
: "bg-white/20 dark:bg-black/20",
)}
>
<div className="w-[350px] flex flex-col gap-8">
<div className="flex flex-col gap-1 text-center">
Expand Down

0 comments on commit d1018ba

Please sign in to comment.