'use client' import { Setting } from '@/components/Setting' import { useGlobal } from '@/providers/GlobalProvider' import { copyToClipboard } from '@/lib/clipboard' import { platform } from '@tauri-apps/plugin-os' import { open } from '@tauri-apps/plugin-dialog' import { invoke } from '@tauri-apps/api/core' import Dropdown from '@/components/Dropdown' import { WebviewWindow } from '@tauri-apps/api/webviewWindow' export default function Settings () { const { settings, version, notificationsAllowed, sidebarAlwaysShowGames, linuxUseWine, linuxWineCommand, theme, customDataLocation, downloadProgress, setMovingData } = useGlobal() return ( <>

Settings

{ await settings?.set('notificationsAllowed', !notificationsAllowed) }} title='This setting does as you expect, allow the launcher to send notifications for when stuff like downloading is done.' /> { await settings?.set( 'sidebarAlwaysShowGames', !sidebarAlwaysShowGames ) }} title="This setting will make it so when you are on a page like this, the games won't disappear." /> { await settings?.set('linuxUseWine', !linuxUseWine) }} className={platform() == 'linux' ? '' : 'hidden'} /> {platform() == 'linux' && linuxUseWine && ( <>

Wine Command:

await settings?.set('linuxWineCommand', e.target.value) } className='input-field my-1' > )} 0} onChange={async () => { if (customDataLocation) { try { setMovingData(true) await invoke('move_game_data', { destination: '' }) await settings?.set('customDataLocation', '') await invoke('restart_app') } catch { setMovingData(false) } } else { const selected = await open({ directory: true, title: 'Select data location' }) if (!selected || typeof selected !== 'string') return try { setMovingData(true) await invoke('move_game_data', { destination: selected }) await settings?.set('customDataLocation', selected) await invoke('restart_app') } catch { setMovingData(false) } } }} title='Move game data to a custom storage location, like a different disk.' /> {customDataLocation && (

{customDataLocation}

)}

Theme:

{ await settings?.set('theme', val) const window = await WebviewWindow.getByLabel( 'berrydashleaderboards' ) if (window) { await window.close() new WebviewWindow('berrydashleaderboards', { title: 'Berry Dash Leaderboards', url: 'https://games.lncvrt.xyz/game/berry-dash/leaderboards?launcher=1&theme=' + val, width: 800, height: 600, resizable: false, maximizable: false }) } }} />

await copyToClipboard(`v${version}`, notificationsAllowed) } title='The current launcher version.' > v{version}

) }