Skip to content

Commit

Permalink
added webpage context to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster committed Nov 25, 2023
1 parent 3abc07e commit 059cfe4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/components/Settings/Sections/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SectionHeading from '../Elements/SectionHeading'
import FieldWrapper from '../Elements/FieldWrapper'
import { useSettings } from '../../../hooks/useSettings'
import { ThemeOptions } from '../../../config/settings'
import * as Switch from '@radix-ui/react-switch'

const GeneralSettings = () => {
const [settings, setSettings] = useSettings()
Expand Down Expand Up @@ -40,6 +41,27 @@ const GeneralSettings = () => {
))}
</select>
</FieldWrapper>
<FieldWrapper
title="Webpage Context"
description="Enable Syncia to answer questions based on the current webpage content"
row
>
<Switch.Root
checked={generalSettings.webpageContext}
onCheckedChange={(value) =>
setSettings({
...settings,
general: {
...generalSettings,
webpageContext: value,
},
})
}
className="cdx-w-[42px] cdx-h-[25px] cdx-bg-neutral-500 cdx-rounded-full cdx-relative data-[state=checked]:cdx-bg-blue-500 cdx-outline-none cdx-cursor-default"
>
<Switch.Thumb className="cdx-block cdx-w-[21px] cdx-h-[21px] cdx-bg-white cdx-rounded-full cdx-transition-transform cdx-duration-100 cdx-translate-x-0.5 cdx-will-change-transform data-[state=checked]:cdx-translate-x-[19px]" />
</Switch.Root>
</FieldWrapper>
</div>
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/config/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type Settings = {
}
general: {
theme: ThemeOptions
webpageContext: boolean
}
}

Expand All @@ -51,5 +52,6 @@ export const defaultSettings: Settings = {
},
general: {
theme: ThemeOptions.SYSTEM,
webpageContext: true,
},
}

0 comments on commit 059cfe4

Please sign in to comment.