diff --git a/src/components/ui.tsx b/src/components/ui.tsx
index 9a35629..52d4990 100644
--- a/src/components/ui.tsx
+++ b/src/components/ui.tsx
@@ -1,3 +1,5 @@
+import * as RadixSelect from '@radix-ui/react-select'
+import { Check, ChevronDown } from 'lucide-react'
import type { ComponentPropsWithoutRef, ReactNode } from 'react'
type Variant = 'default' | 'muted' | 'success' | 'warning' | 'danger' | 'info'
@@ -72,17 +74,70 @@ export function Input({ className, ...props }: ComponentPropsWithoutRef<'input'>
)
}
-export function Select({ className, children, ...props }: ComponentPropsWithoutRef<'select'>) {
+export function Select({
+ value,
+ onValueChange,
+ children,
+ className,
+ id,
+}: {
+ value?: string | number
+ onValueChange?: (value: string) => void
+ children: ReactNode
+ className?: string
+ id?: string
+}) {
return (
-
+
+
+
+
+
+ {children}
+
)
}
diff --git a/src/routes/batteries.tsx b/src/routes/batteries.tsx
index 21cd835..030af63 100644
--- a/src/routes/batteries.tsx
+++ b/src/routes/batteries.tsx
@@ -6,13 +6,14 @@ import { useEffect, useMemo, useState } from 'react'
import { z } from 'zod'
import { orpc } from '@/client/orpc'
import { MotionCardDiv, MotionHeader, MotionSection, MotionTableRow } from '@/components/motion'
-import { Badge, Button, Card, Input, SectionTitle, Select } from '@/components/ui'
+import { Badge, Button, Card, Input, SectionTitle, Select, SelectOption } from '@/components/ui'
import type { BatteryInfo, BatteryListSort, PowerStatus } from '@/domain/battery'
import { BATTERY_LIST_SORT, BATTERY_LIST_SORT_VALUES, POWER_STATUS, POWER_STATUS_VALUES } from '@/domain/battery'
const pageSizeOptions = [20, 50, 100] as const
type PageSizeOption = (typeof pageSizeOptions)[number]
const firstPageCursor = '__FIRST_PAGE__'
+const allPowerStatusValue = 'all'
const searchFilterSchema = z.preprocess(
(value) => (typeof value === 'string' ? value.trim() || undefined : value),
@@ -78,7 +79,7 @@ function parseSort(value: string): BatteryListSort {
}
function parsePowerStatus(value: string): PowerStatus | undefined {
- if (value === '') return undefined
+ if (value === allPowerStatusValue) return undefined
const parsed = Number(value)
@@ -326,22 +327,22 @@ function BatteriesPage() {
@@ -352,21 +353,21 @@ function BatteriesPage() {
@@ -377,20 +378,20 @@ function BatteriesPage() {