File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 88 import { type Problem , type ClosedRange , createValidRange } from " ./utils/types" ;
99 import { cacheInput , loadLastInput } from " ./cacher" ;
1010
11+ const maxDiff = 3854 ;
12+ const minDiff = 0 ;
13+
1114 let cachedInput : ClosedRange | null = loadLastInput ();
1215 let currentInput : ClosedRange | null ;
1316
14- let under_diff = $state <number >(cachedInput ? cachedInput .min : 0 );
15- let over_diff = $state <number >(cachedInput ? cachedInput .max : 3854 );
17+ let under_diff = $state <number >(cachedInput ? cachedInput .min : minDiff );
18+ let over_diff = $state <number >(cachedInput ? cachedInput .max : maxDiff );
1619
1720 let errors = $derived ({
1821 rangeError: under_diff > over_diff ,
7477 <p class =" text-destructive mb-2 text-sm" >最高Diffが負の値になっています。</p >
7578 {:else if errors .isMinusUnderDiff }
7679 <p class =" text-destructive mb-2 text-sm" >最低Diffが負の値になっています</p >
80+ {:else if errors .invalidRange }
81+ <p class =" text-destructive mb-2 text-sm" >不正なDiff範囲になっています。</p >
7782 {/if }
7883
7984 <div class =" flex items-center gap-2" >
8085 <Input type ="number" placeholder ="最低Diffを入力してください。" isErrors ={errors } bind:value ={under_diff } />
8186 <Input type ="number" placeholder ="最高Diffを入力してください。" isErrors ={errors } bind:value ={over_diff } />
82- <!--TODO: ここのonClickに入力値保存機能をつける-->
8387 <Button onclick ={() => {sendQuery (), cacheInput (currentInput ! )}} class ="shrink-0 w-24 h-12 flex justify-center items-center" disabled ={loading }>
84- <!--ここまで-->
8588 {#if loading }
8689 <div class =" animate-spin [animation-duration: 1.05s]" >
8790 <Loader size =" 1.5rem" />
You can’t perform that action at this time.
0 commit comments