File size: 1,641 Bytes
1e22bf6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Slider, Stack, Switch, Text } from "@mantine/core";
import { useForm } from "@mantine/form";
import { usePubSub } from "create-pubsub/react";
import { settingsPubSub } from "../../../../modules/pubSub";

export default function SearchSettingsForm() {
  const [settings, setSettings] = usePubSub(settingsPubSub);
  const form = useForm({
    initialValues: settings,
    onValuesChange: setSettings,
  });

  return (
    <Stack gap="md">
      <Stack gap="xs" mb="md">
        <Text size="sm">Search Results Limit</Text>
        <Text size="xs" c="dimmed">
          Maximum number of search results to fetch. A higher value provides
          more results but may increase search time.
        </Text>
        <Slider
          {...form.getInputProps("searchResultsLimit")}
          min={5}
          max={30}
          step={5}
          marks={[5, 10, 15, 20, 25, 30].map((value) => ({
            value,
            label: value.toString(),
          }))}
        />
      </Stack>

      <Switch
        {...form.getInputProps("enableTextSearch", {
          type: "checkbox",
        })}
        label="Text Search"
        labelPosition="left"
        description="Enable or disable text search results. When enabled, relevant web pages will be displayed in the search results."
      />

      <Switch
        {...form.getInputProps("enableImageSearch", {
          type: "checkbox",
        })}
        label="Image Search"
        labelPosition="left"
        description="Enable or disable image search results. When enabled, relevant images will be displayed alongside web search results."
      />
    </Stack>
  );
}