Skip to content

Commit

Permalink
fix(115): support float QPS (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirCute authored Dec 25, 2024
1 parent 2ea71ea commit 66a081c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/pages/manage/storages/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export type ItemProps = DriverItem & {
onChange?: (value: number) => void
value: number
}
| {
type: Type.Float
onChange?: (value: number) => void
value: number
}
| {
type: Type.String | Type.Text
onChange?: (value: string) => void
Expand Down Expand Up @@ -85,6 +90,19 @@ const Item = (props: ItemProps) => {
}
/>
</Match>
<Match when={props.type === Type.Float}>
<Input
type="number"
id={props.name}
readOnly={props.readonly}
value={props.value as number}
onInput={
props.type === Type.Float
? (e) => props.onChange?.(parseFloat(e.currentTarget.value))
: undefined
}
/>
</Match>
<Match when={props.type === Type.Bool}>
<HopeSwitch
id={props.name}
Expand Down
1 change: 1 addition & 0 deletions src/types/item_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export enum Type {
Bool = "bool",
Text = "text",
Number = "number",
Float = "float",
}

0 comments on commit 66a081c

Please sign in to comment.