1.1.1
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
@apply flex flex-col p-4 space-y-1;
|
||||
@apply flex flex-col p-4 space-y-1 overflow-y-auto overflow-x-hidden;
|
||||
}
|
||||
|
||||
.link {
|
||||
|
||||
@@ -20,6 +20,7 @@ import { usePathname, useSearchParams } from 'next/navigation'
|
||||
|
||||
export default function Sidebar () {
|
||||
const {
|
||||
normalConfig,
|
||||
getListOfGames,
|
||||
setShowPopup,
|
||||
setPopupMode,
|
||||
@@ -88,7 +89,11 @@ export default function Sidebar () {
|
||||
? 'active'
|
||||
: ''
|
||||
} ml-auto w-50 ${
|
||||
pathname === '/' || pathname === '/game' ? '' : 'hidden'
|
||||
normalConfig?.settings.alwaysShowGamesInSidebar ||
|
||||
pathname === '/' ||
|
||||
pathname === '/game'
|
||||
? ''
|
||||
: 'hidden'
|
||||
}`}
|
||||
>
|
||||
<FontAwesomeIcon icon={faGamepad} className='mr-1' />{' '}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { ServerVersionsResponse } from './types/ServerVersionsResponse'
|
||||
import { GameVersion } from './types/GameVersion'
|
||||
import { Game } from './types/Game'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
const roboto = Roboto({
|
||||
subsets: ['latin']
|
||||
@@ -78,6 +79,8 @@ export default function RootLayout ({
|
||||
}
|
||||
}
|
||||
|
||||
const pathname = usePathname()
|
||||
|
||||
const notifyUser = useCallback(
|
||||
async (title: string, body: string) => {
|
||||
if (!normalConfig?.settings.allowNotifications) return
|
||||
@@ -512,7 +515,11 @@ export default function RootLayout ({
|
||||
<button
|
||||
className='close-button'
|
||||
onClick={() => {
|
||||
if (popupMode == 0 && selectedGame) {
|
||||
if (
|
||||
popupMode == 0 &&
|
||||
selectedGame &&
|
||||
pathname === '/'
|
||||
) {
|
||||
setSelectedGame(null)
|
||||
setSelectedVersionList([])
|
||||
} else {
|
||||
@@ -523,7 +530,7 @@ export default function RootLayout ({
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={
|
||||
popupMode == 0 && selectedGame
|
||||
popupMode == 0 && selectedGame && pathname === '/'
|
||||
? faChevronLeft
|
||||
: faXmark
|
||||
}
|
||||
|
||||
@@ -8,10 +8,12 @@ import { useGlobal } from '../GlobalProvider'
|
||||
|
||||
export default function Settings () {
|
||||
const [allowNotifications, setAllowNotifications] = useState(false)
|
||||
const [alwaysShowGamesInSidebar, setAlwaysShowGamesInSidebar] =
|
||||
useState(false)
|
||||
const [useWineOnUnixWhenNeeded, setUseWineOnUnixWhenNeeded] = useState(false)
|
||||
const [wineOnUnixCommand, setWineOnUnixCommand] = useState('wine %path%')
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
const { normalConfig } = useGlobal()
|
||||
const { normalConfig, setNormalConfig } = useGlobal()
|
||||
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
@@ -21,6 +23,9 @@ export default function Settings () {
|
||||
)
|
||||
setWineOnUnixCommand(normalConfig.settings.wineOnUnixCommand)
|
||||
setAllowNotifications(normalConfig.settings.allowNotifications)
|
||||
setAlwaysShowGamesInSidebar(
|
||||
normalConfig.settings.alwaysShowGamesInSidebar
|
||||
)
|
||||
setLoaded(true)
|
||||
break
|
||||
}
|
||||
@@ -44,6 +49,30 @@ export default function Settings () {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Setting
|
||||
label='Always show games in sidebar'
|
||||
value={alwaysShowGamesInSidebar}
|
||||
onChange={async () => {
|
||||
while (normalConfig != null) {
|
||||
setAlwaysShowGamesInSidebar(!alwaysShowGamesInSidebar)
|
||||
setNormalConfig({
|
||||
...normalConfig,
|
||||
settings: {
|
||||
...normalConfig.settings,
|
||||
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
||||
}
|
||||
})
|
||||
writeNormalConfig({
|
||||
...normalConfig,
|
||||
settings: {
|
||||
...normalConfig.settings,
|
||||
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Setting
|
||||
label='Use wine to launch Berry Dash when needed'
|
||||
value={useWineOnUnixWhenNeeded}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export class SettingsType {
|
||||
constructor(
|
||||
public allowNotifications: boolean = true,
|
||||
public alwaysShowGamesInSidebar: boolean = true,
|
||||
public useWineOnUnixWhenNeeded: boolean = false,
|
||||
public wineOnUnixCommand: string = 'wine %path%'
|
||||
) { }
|
||||
|
||||
Reference in New Issue
Block a user