[feat] hide notice on successful start + tool button bg on dark mode

This commit is contained in:
Purp1e
2025-03-23 13:53:28 +08:00
parent 7e2e556485
commit 08017293b0
5 changed files with 9 additions and 10 deletions

View File

View File

@@ -30,21 +30,21 @@ export default function PreferenceLayout({
<CardIcon
type="menu"
onClick={() => router.push("/preference/general")}
className={cn(pathname === "/preference/general" && "bg-black/5")}
className={cn(pathname === "/preference/general" && "bg-black/5 dark:bg-white/5")}
>
<SettingConfig />
</CardIcon>
<CardIcon
type="menu"
onClick={() => router.push("/preference/path")}
className={cn(pathname === "/preference/path" && "bg-black/5")}
className={cn(pathname === "/preference/path" && "bg-black/5 dark:bg-white/5")}
>
<AssemblyLine />
</CardIcon>
<CardIcon
type="menu"
onClick={() => router.push("/preference/replay")}
className={cn(pathname === "/preference/replay" && "bg-black/5")}
className={cn(pathname === "/preference/replay" && "bg-black/5 dark:bg-white/5")}
>
<Videocamera />
</CardIcon>

View File

@@ -41,7 +41,7 @@ export function Prepare() {
const init = async () => {
await steam.store.start()
await app.store.start()
if (!app.state.inited) await autoGetPaths()
if (!app.state.inited) await autoGetPaths(false)
setInited(true)
}
void init()
@@ -86,7 +86,7 @@ export function Prepare() {
}
}
const autoGetPaths = async () => {
const autoGetPaths = async (toast?: boolean) => {
try {
const steam_path = await invoke<string>("get_steam_path")
if (steam_path) steam.setDir(steam_path)
@@ -101,7 +101,7 @@ export function Prepare() {
})
if (cs2_path) {
steam.setCsDir(cs2_path)
addToast({ title: "自动获取路径成功", color: "success" })
if (toast) addToast({ title: "自动获取路径成功", color: "success" })
}
} catch (e) {
addToast({ title: "自动获取CS2路径失败", color: "danger" })

View File

@@ -36,7 +36,7 @@ const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
className={cn(
"flex gap-1.5 items-center font-semibold",
type === "menu" &&
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
"transition cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-2 py-1 rounded-md active:scale-95",
className,
)}
{...rest}

View File

@@ -1,14 +1,13 @@
import type { ReactNode } from "react"
interface ToolButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
interface ToolButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: ReactNode
}
export const ToolButton = ({ children, ...rest }: ToolButtonProps) => {
return (
<button
type="button"
className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 rounded-md text-sm leading-none"
className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 dark:bg-white/5 dark:hover:bg-white/10 rounded-md text-sm leading-none"
{...rest}
>
{children}