33import { useEffect , useMemo , useState } from "react" ;
44import { Button } from "@/components/ui/button" ;
55import { Input } from "@/components/ui/input" ;
6- import { Select } from "@/components/ui/select" ;
6+ import {
7+ Select ,
8+ SelectContent ,
9+ SelectGroup ,
10+ SelectItem ,
11+ SelectTrigger ,
12+ SelectValue ,
13+ } from "@/components/ui/select" ;
714
815const units = [ "B" , "KiB" , "MiB" , "GiB" , "TiB" , "PiB" , "EiB" , "ZiB" , "YiB" ] ;
916
@@ -493,20 +500,22 @@ export default function ErasureCodeCalculator() {
493500 < label className = "block" >
494501 < span className = "text-sm font-medium text-foreground" > Stripe size (K + M)</ span >
495502 < Select
496- value = { stripeSize ? String ( stripeSize ) : "" }
497- onChange = { ( event ) => setStripeSize ( Number ( event . target . value ) ) }
498- className = "mt-2"
503+ value = { stripeSize ? String ( stripeSize ) : undefined }
504+ onValueChange = { ( value ) => setStripeSize ( Number ( value ) ) }
499505 disabled = { stripeInfo . stripeSizes . length === 0 }
500506 >
501- { stripeInfo . stripeSizes . length === 0 ? (
502- < option value = "" > Unavailable</ option >
503- ) : (
504- stripeInfo . stripeSizes . map ( ( value ) => (
505- < option key = { value } value = { value } >
506- { value }
507- </ option >
508- ) )
509- ) }
507+ < SelectTrigger className = "mt-2" >
508+ < SelectValue placeholder = "Unavailable" />
509+ </ SelectTrigger >
510+ < SelectContent >
511+ < SelectGroup >
512+ { stripeInfo . stripeSizes . map ( ( value ) => (
513+ < SelectItem key = { value } value = { String ( value ) } >
514+ { value }
515+ </ SelectItem >
516+ ) ) }
517+ </ SelectGroup >
518+ </ SelectContent >
510519 </ Select >
511520 < p className = "mt-2 text-xs text-muted-foreground" >
512521 Stripe size is the number of drives in each erasure set (data + parity). Larger
@@ -517,20 +526,22 @@ export default function ErasureCodeCalculator() {
517526 < label className = "block" >
518527 < span className = "text-sm font-medium text-foreground" > Parity (M)</ span >
519528 < Select
520- value = { parity ? String ( parity ) : "" }
521- onChange = { ( event ) => setParity ( Number ( event . target . value ) ) }
522- className = "mt-2"
529+ value = { parity ? String ( parity ) : undefined }
530+ onValueChange = { ( value ) => setParity ( Number ( value ) ) }
523531 disabled = { parityOptions . length === 0 }
524532 >
525- { parityOptions . length === 0 ? (
526- < option value = "" > Unavailable</ option >
527- ) : (
528- parityOptions . map ( ( value ) => (
529- < option key = { value } value = { value } >
530- { value }
531- </ option >
532- ) )
533- ) }
533+ < SelectTrigger className = "mt-2" >
534+ < SelectValue placeholder = "Unavailable" />
535+ </ SelectTrigger >
536+ < SelectContent >
537+ < SelectGroup >
538+ { parityOptions . map ( ( value ) => (
539+ < SelectItem key = { value } value = { String ( value ) } >
540+ { value }
541+ </ SelectItem >
542+ ) ) }
543+ </ SelectGroup >
544+ </ SelectContent >
534545 </ Select >
535546 < p className = "mt-2 text-xs text-muted-foreground" >
536547 Parity controls resiliency. Higher M increases fault tolerance but reduces usable
0 commit comments