diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 28a007d..c11fed6 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -16,7 +16,7 @@ "url": "/update/checking", "width": 1000, "height": 600, - "minWidth": 900, + "minWidth": 1000, "minHeight": 500 } ], diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index d6f0611..9d85157 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -17,7 +17,7 @@ "url": "/update/checking", "width": 1000, "height": 600, - "minWidth": 900, + "minWidth": 1000, "minHeight": 500, "titleBarStyle": "Overlay", "hiddenTitle": true diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index 567a6a4..7e292d6 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -17,7 +17,7 @@ "url": "/update/checking", "width": 1000, "height": 632, - "minWidth": 900, + "minWidth": 1000, "minHeight": 532, "decorations": false, "shadow": true diff --git a/src/app/main/game/berrydash/leaderboards/page.tsx b/src/app/main/game/berrydash/leaderboards/page.tsx index bbdcc82..9f9f347 100644 --- a/src/app/main/game/berrydash/leaderboards/page.tsx +++ b/src/app/main/game/berrydash/leaderboards/page.tsx @@ -9,6 +9,7 @@ import { useRouter } from 'next/navigation' import { platform } from '@tauri-apps/plugin-os' import { fetch } from '@tauri-apps/plugin-http' import { verifySignature } from '@/lib/util' +import Dropdown from '@/components/Dropdown' interface BaseEntry { id: number @@ -165,21 +166,21 @@ export default function BerryDashLeaderboards () {
{selected == 1 && (
- + options={[ + { label: 'Normal Berry', value: 0 }, + { label: 'Poison Berry', value: 1 }, + { label: 'Slow Berry', value: 2 }, + { label: 'Ultra Berry', value: 3 }, + { label: 'Speedy Berry', value: 4 }, + { label: 'Coin Berry', value: 5 }, + { label: 'Random Berry', value: 6 }, + { label: 'Anti Berry', value: 7 }, + { label: 'Golden Berry', value: 8 } + ]} + onChange={e => setSelectedBerryOption(Number(e))} + />
)}

void | Promise +} + +export default function Dropdown ({ value, options, onChange }: Props) { + const [open, setOpen] = useState(false) + const ref = useRef(null) + + const selected = options.find(o => o.value === value) + + useEffect(() => { + const handleClick = (e: MouseEvent) => { + if (!ref.current?.contains(e.target as Node)) { + setOpen(false) + } + } + window.addEventListener('mousedown', handleClick) + return () => window.removeEventListener('mousedown', handleClick) + }, []) + + return ( +

+ + {open && ( +
+ {options.map(option => ( +
{ + await onChange(option.value) + setOpen(false) + }} + > + {option.label} +
+ ))} +
+ )} +
+ ) +} diff --git a/src/styles/dropdown.css b/src/styles/dropdown.css new file mode 100644 index 0000000..e35f492 --- /dev/null +++ b/src/styles/dropdown.css @@ -0,0 +1,29 @@ +@import 'tailwindcss'; + +.dropdown { + @apply relative w-40; +} + +.dropdown-btn { + @apply w-full flex items-center justify-between px-3 py-1.5 rounded-md cursor-pointer bg-(--col2) hover:bg-(--col3) border border-(--col4) hover:border-(--col5) text-white; +} + +.dropdown-arrow { + @apply w-4 h-4 transition-transform stroke-current stroke-2 fill-none; +} + +.dropdown-arrow.open { + @apply rotate-180; +} + +.dropdown-menu { + @apply absolute z-50 mt-1 w-full rounded-md shadow-lg overflow-hidden bg-(--col2) border border-(--col4) divide-y divide-(--col4); +} + +.dropdown-item { + @apply px-3 py-1.5 cursor-pointer transition-colors hover:bg-(--col3); +} + +.dropdown-item.active { + @apply bg-(--col3) hover:bg-(--col4); +} \ No newline at end of file