Add dropdown arrow to library to show/hide games

This commit is contained in:
Lncvrt committed 2026-07-29 05:31:08 -07:00
1 parent bac028efc3
commit 28b88f4033
4 files changed
+34 -1

No files matched your search

+5
View File
@@ -86,6 +86,7 @@ export default function RootLayout ({
const [versions, setVersions] = useState<Store | null>(null) const [versions, setVersions] = useState<Store | null>(null)
const [account, setAccount] = useState<Store | null>(null) const [account, setAccount] = useState<Store | null>(null)
const [sidebarShowGames, setSidebarShowGames] = useState<boolean>(false)
const [linuxUseWine, setLinuxUseWine] = useState<boolean>(false) const [linuxUseWine, setLinuxUseWine] = useState<boolean>(false)
const [linuxWineCommand, setLinuxWineCommand] = const [linuxWineCommand, setLinuxWineCommand] =
useState<string>('wine %path%') useState<string>('wine %path%')
@@ -827,6 +828,9 @@ export default function RootLayout ({
} }
watchSettings<string>('theme', v => setTheme(v ?? 'dark')) watchSettings<string>('theme', v => setTheme(v ?? 'dark'))
watchSettings<boolean>('sidebarShowGames', v =>
setSidebarShowGames(v ?? true)
)
watchSettings<boolean>('linuxUseWine', v => setLinuxUseWine(v ?? false)) watchSettings<boolean>('linuxUseWine', v => setLinuxUseWine(v ?? false))
watchSettings<string>('linuxWineCommand', v => watchSettings<string>('linuxWineCommand', v =>
setLinuxWineCommand(v ?? 'wine %path%') setLinuxWineCommand(v ?? 'wine %path%')
@@ -892,6 +896,7 @@ export default function RootLayout ({
settings, settings,
versions, versions,
account, account,
sidebarShowGames,
linuxUseWine, linuxUseWine,
linuxWineCommand, linuxWineCommand,
theme, theme,
+12
View File
@@ -0,0 +1,12 @@
import '@/styles/dropdown.css'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faChevronDown } from '@fortawesome/free-solid-svg-icons'
export default function ExpandArrow ({ open }: { open: boolean }) {
return (
<FontAwesomeIcon
icon={faChevronDown}
className={`dropdown-arrow ${!open ? 'open' : ''}`}
/>
)
}
+16 -1
View File
@@ -24,6 +24,7 @@ import { getCurrentWindow } from '@tauri-apps/api/window'
import { Lexend } from 'next/font/google' import { Lexend } from 'next/font/google'
import React, { useState } from 'react' import React, { useState } from 'react'
import { message } from '@tauri-apps/plugin-dialog' import { message } from '@tauri-apps/plugin-dialog'
import ExpandArrow from './ExpandArrow'
const lexend = Lexend({ const lexend = Lexend({
subsets: ['latin'] subsets: ['latin']
@@ -44,7 +45,8 @@ export default function Sidebar () {
settings, settings,
developerMode, developerMode,
accountName, accountName,
accountAdmin accountAdmin,
sidebarShowGames
} = useGlobal() } = useGlobal()
const pathname = usePathname() const pathname = usePathname()
@@ -138,8 +140,21 @@ export default function Sidebar () {
}} }}
> >
<FontAwesomeIcon icon={faHexagonNodes} className='mr-2' /> Library <FontAwesomeIcon icon={faHexagonNodes} className='mr-2' /> Library
{(pathname === '/main/library' ||
pathname.startsWith('/main/game')) && (
<div
className='ml-auto w-6 h-6 flex justify-center items-center'
onClick={async e => {
e.preventDefault()
await settings?.set('sidebarShowGames', !sidebarShowGames)
}}
>
<ExpandArrow open={sidebarShowGames} />
</div>
)}
</Link> </Link>
{(pathname === '/main/library' || pathname.startsWith('/main/game')) && {(pathname === '/main/library' || pathname.startsWith('/main/game')) &&
sidebarShowGames &&
serverVersionList?.games serverVersionList?.games
.filter(g => .filter(g =>
serverVersionList.versions serverVersionList.versions
+1
View File
@@ -54,6 +54,7 @@ type GlobalCtxType = {
settings: Store | null settings: Store | null
versions: Store | null versions: Store | null
account: Store | null account: Store | null
sidebarShowGames: boolean
linuxUseWine: boolean linuxUseWine: boolean
linuxWineCommand: string linuxWineCommand: string
theme: string theme: string