Skip to content

Commit 3398dac

Browse files
dcc123456KevinHuSh
andauthored
Fix: Optimize styling and add a search settings loading state #3221 (#9830)
### What problem does this PR solve? Fix: Optimize styling and add a search settings loading state #3221 - Updated the calendar component's background color to use a variable - Modified the Spin component's styling to use the primary text color instead of black - Added a form submission loading state to the search settings component - Optimized the search settings form, unifying the styles of the model selection and input fields ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu <[email protected]>
1 parent 7eb25e0 commit 3398dac

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

web/src/components/originui/calendar/index.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
.rdp-selected {
2-
background-color: #f5f5f529;
2+
background-color: var(--background-highlight);
33
}
44
.range-start {
5-
background-color: #f5f5f5;
5+
background-color: var(--text-secondary);
66
border-top-left-radius: 10px;
77
border-bottom-left-radius: 10px;
88
button {
99
color: rgba(0, 0, 0, 0.8);
1010
}
1111
}
1212
.range-end {
13-
background-color: #f5f5f5;
13+
background-color: var(--text-secondary);
1414
border-top-right-radius: 10px;
1515
border-bottom-right-radius: 10px;
1616
button {

web/src/components/ui/spin.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export const Spin: React.FC<SpinProps> = ({
2525
className={cn(
2626
'relative',
2727
{
28-
'after:content-[""] after:absolute after:inset-0 after:z-10 after:bg-black/40 after:transition-all after:duration-300':
28+
'after:content-[""] after:absolute after:inset-0 after:z-10 after:bg-text-primary/40 after:transition-all after:duration-300 h-full w-full':
2929
spinning,
3030
},
3131
className,
3232
)}
3333
>
3434
{spinning && (
35-
<div className="absolute inset-0 z-10 flex items-center justify-center bg-black/30 ">
35+
<div className="absolute inset-0 z-10 flex items-center justify-center bg-text-primary/30 ">
3636
<div
3737
className={cn(
3838
'rounded-full border-muted-foreground border-2 border-t-transparent animate-spin',

web/src/pages/next-search/search-setting.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
MultiSelectOptionType,
2222
} from '@/components/ui/multi-select';
2323
import { RAGFlowSelect } from '@/components/ui/select';
24+
import { Spin } from '@/components/ui/spin';
2425
import { Switch } from '@/components/ui/switch';
2526
import { Textarea } from '@/components/ui/textarea';
2627
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
@@ -226,11 +227,13 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
226227
});
227228

228229
const { updateSearch } = useUpdateSearch();
230+
const [formSubmitLoading, setFormSubmitLoading] = useState(false);
229231
const { data: systemSetting } = useFetchTenantInfo();
230232
const onSubmit = async (
231233
formData: IUpdateSearchProps & { tenant_id: string },
232234
) => {
233235
try {
236+
setFormSubmitLoading(true);
234237
const { search_config, ...other_formdata } = formData;
235238
const {
236239
llm_setting,
@@ -262,6 +265,8 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
262265
setOpen(false);
263266
} catch (error) {
264267
console.error('Failed to update search:', error);
268+
} finally {
269+
setFormSubmitLoading(false);
265270
}
266271
};
267272
return (
@@ -486,15 +491,16 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
486491
render={({ field }) => (
487492
<FormItem className="flex flex-col">
488493
<FormLabel>
489-
<span className="text-destructive mr-1"> *</span>Model
494+
<span className="text-destructive mr-1"> *</span>
495+
{t('chat.model')}
490496
</FormLabel>
491497
<FormControl>
492498
<RAGFlowSelect
493499
{...field}
494500
options={rerankModelOptions}
495501
triggerClassName={'bg-bg-input'}
496502
// disabled={disabled}
497-
placeholder={'model'}
503+
placeholder={t('chat.model')}
498504
/>
499505
</FormControl>
500506
<FormMessage />
@@ -523,6 +529,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
523529
</FormControl>
524530
<FormControl>
525531
<Input
532+
type={'number'}
526533
className="h-7 w-20 bg-bg-card"
527534
max={2048}
528535
min={0}
@@ -619,7 +626,14 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
619626
>
620627
{t('search.cancelText')}
621628
</Button>
622-
<Button type="submit">{t('search.okText')}</Button>
629+
<Button type="submit" disabled={formSubmitLoading}>
630+
{formSubmitLoading && (
631+
<div className="size-4">
632+
<Spin size="small" />
633+
</div>
634+
)}
635+
{t('search.okText')}
636+
</Button>
623637
</div>
624638
</form>
625639
</Form>

0 commit comments

Comments
 (0)