-
Notifications
You must be signed in to change notification settings - Fork 0
feat: app settings #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7adcda8
fix: make settings dialog side bar not lazy
jvxz 80b057e
feat: add tab ref to useSettingsDialog
jvxz 2a3544a
feat: add matrix event type schema
jvxz ddab06f
feat: add initial settings schema
jvxz 45f562e
feat: enhance settings dialog sidebar
jvxz eb98e8d
fix: fix matrix event type schema
jvxz 9cb7aa5
feat: enhance settings schema types + add defaults
jvxz a0b5329
feat: add settings client plugin
jvxz 9d6c2e2
feat: add useSettings convenience composable
jvxz cd7cd22
feat: enhance settings dialog components
jvxz fd82de8
Merge branch 'main' into feat/app-settings
jvxz e4e5056
Merge branch 'main' into feat/app-settings
jvxz d0e8ba0
Merge branch 'main' into feat/app-settings
jvxz d7aa6bc
refactor: edit objectValues util
jvxz a70e5a7
feat: enhance form primitive component
jvxz 63442d6
refactor: edit settings structure
jvxz d1b995c
refactor: edit settings content layout component
jvxz 8595975
fix: adjust variable names
jvxz 0dcf0c9
feat: add settings form components
jvxz 8b7d04a
feat: add settings content components
jvxz 0b27531
feat: make dialog title the correct tab
jvxz 9749f7f
feat: add search functionality
jvxz aab1e62
fix: remove duplicate search dialog reset
jvxz ebd507f
refactor: remove unnecessary useLocalStorage setting
jvxz 6044aa0
fix: fix silly mistake
jvxz 94afea7
refactor: remove unused type
jvxz 463a14f
chore(lint): apply lint fixes
autofix-ci[bot] 8321cef
fix: reset search query on dialog unmount
jvxz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <script lang="ts" setup> | ||
| import type { PrimitiveProps } from 'reka-ui' | ||
|
|
||
| defineProps<PrimitiveProps>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <Primitive v-bind="$props" :class="cn('mt-12 flex flex-col p-3.5 mx-auto max-w-screen-md', $attrs.class)"> | ||
| <slot /> | ||
| </Primitive> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <script lang="ts" setup> | ||
| const props = defineProps<{ | ||
| category: SettingsCategory | ||
| }>() | ||
|
|
||
| const Content = defineAsyncComponent(async () => { | ||
| try { | ||
| const c = await import(`~/components/settings/content/${props.category}.vue`) | ||
| return c | ||
| } | ||
| catch { | ||
| return h('div', { innerHTML: `Please create ~/components/settings/content/${props.category}.vue` }) | ||
| } | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <Content /> | ||
| </template> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <script lang="ts" setup> | ||
| const settings = useSettings() | ||
| </script> | ||
|
|
||
| <template> | ||
| <SettingsContentLayout> | ||
| <SettingsFormSwitch | ||
| v-model:model-value="settings.accessibility.uiAnimations" | ||
| :label="SETTINGS_ITEM_METADATA.accessibility.uiAnimations.title" | ||
| :description="SETTINGS_ITEM_METADATA.accessibility.uiAnimations.description" | ||
| > | ||
| </SettingsFormSwitch> | ||
| </SettingsContentLayout> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <script lang="ts" setup> | ||
| const settings = useSettings() | ||
| </script> | ||
|
|
||
| <template> | ||
| <SettingsContentLayout> | ||
| <SettingsFormAutocomplete | ||
| v-model:model-value="settings.appearance.font" | ||
| :label="SETTINGS_ITEM_METADATA.appearance.font.title" | ||
| :description="SETTINGS_ITEM_METADATA.appearance.font.description" | ||
| :options="SETTINGS_ITEM_METADATA.appearance.font.options" | ||
| :default-option="DEFAULT_SETTINGS.appearance.font" | ||
| /> | ||
| </SettingsContentLayout> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <script lang="ts" setup generic="T extends string[] | undefined"> | ||
| import type { SettingsFormPrimitiveProps } from './types' | ||
|
|
||
| type ValueType = T extends string[] ? T[number] : string | ||
|
|
||
| defineProps<SettingsFormPrimitiveProps & { | ||
| options: T | ||
| defaultOption?: ValueType | ||
| }>() | ||
|
|
||
| const modelValue = defineModel<ValueType>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <SettingsFormPrimitive v-bind="$props"> | ||
| <USelectRoot v-model:model-value="modelValue"> | ||
| <USelectTrigger class="min-w-48"> | ||
| <USelectValue> | ||
| {{ modelValue }} | ||
| </USelectValue> | ||
| </USelectTrigger> | ||
| <USelectContent> | ||
| <USelectItem | ||
| v-for="option in options" | ||
| :key="option" | ||
| :value="option" | ||
| > | ||
| <USelectItemText> | ||
| {{ option }} | ||
| </USelectItemText> | ||
| </USelectItem> | ||
| </USelectContent> | ||
| </USelectRoot> | ||
| </SettingsFormPrimitive> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <script lang="ts" setup> | ||
| import type { FormPrimitiveProps } from '~/components/form/primitive.vue' | ||
|
|
||
| defineProps<FormPrimitiveProps & { description?: string }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <FormPrimitive v-bind="$props" class="flex gap-2 items-center justify-between space-y-0"> | ||
| <template #label="{ id }"> | ||
| <div class="flex flex-col gap-1"> | ||
| <ULabel :for="id" class="text-base font-medium m-0"> | ||
| {{ label }} | ||
| </ULabel> | ||
| <p v-if="description" class="text-sm text-muted-foreground"> | ||
| {{ description }} | ||
| </p> | ||
| </div> | ||
| </template> | ||
| <slot /> | ||
| </FormPrimitive> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <script lang="ts" setup> | ||
| import type { SettingsFormPrimitiveProps } from './types' | ||
|
|
||
| defineProps<SettingsFormPrimitiveProps>() | ||
|
|
||
| const modelValue = defineModel<boolean>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <FormPrimitive v-bind="$props" class="flex gap-2 items-center justify-between space-y-0"> | ||
| <template #label="{ id }"> | ||
| <div class="flex flex-col gap-1"> | ||
| <ULabel :for="id" class="text-base font-medium m-0"> | ||
| {{ label }} | ||
| </ULabel> | ||
| <p v-if="description" class="text-sm text-muted-foreground"> | ||
| {{ description }} | ||
| </p> | ||
| </div> | ||
| </template> | ||
| <USwitch v-model="modelValue" /> | ||
| </FormPrimitive> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import type { FormPrimitiveProps } from '~/components/form/primitive.vue' | ||
|
|
||
| export type SettingsFormPrimitiveProps = FormPrimitiveProps & { | ||
| description?: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| export const useSettingsDialog = createGlobalState(() => { | ||
| const open = shallowRef(false) | ||
| const tab = shallowRef<SettingsCategory>(SETTINGS_DEFAULT_TAB) | ||
|
|
||
| return { | ||
| open, | ||
| tab, | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const useSettings = () => useNuxtApp().$settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { EventType } from 'matrix-js-sdk' | ||
| import * as v from 'valibot' | ||
|
|
||
| export const EventTypeSchema = v.picklist(objectValues(EventType)) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.