-
-
Notifications
You must be signed in to change notification settings - Fork 29
refactor(settings): restructure settings page #292
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
Open
hiitsrob
wants to merge
8
commits into
rivenmedia:main
Choose a base branch
from
hiitsrob:settings-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e2410fe
refactor(settings): restructure settings page
hiitsrob a370fe3
refactor(settings): improve type safety, accessibility, and code quality
hiitsrob e1409f2
refactor(settings): improve docstring coverage
hiitsrob e98b840
refactor(settings): remove tests
hiitsrob 9b3522c
refactor(settings): migrate to client-side reactive store architecture
hiitsrob 8d9724a
Merge branch 'main' into settings-refactor
hiitsrob eeaa0b0
fix: address code review feedback for settings refactor
hiitsrob beedab7
fix(settings): include sectionId in error response for debugging
hiitsrob 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,45 @@ | ||
| <script lang="ts"> | ||
| import * as Alert from "$lib/components/ui/alert"; | ||
| import { Button } from "$lib/components/ui/button"; | ||
| import AlertTriangle from "@lucide/svelte/icons/alert-triangle"; | ||
| import RefreshCw from "@lucide/svelte/icons/refresh-cw"; | ||
|
|
||
| interface Props { | ||
| title?: string; | ||
| message: string; | ||
| hint?: string; | ||
| onRetry?: () => void; | ||
| } | ||
|
|
||
| let { | ||
| title = "Unable to Connect", | ||
| message, | ||
| hint = "Please check that the Riven backend is running and accessible.", | ||
| onRetry | ||
| }: Props = $props(); | ||
|
|
||
| function handleRetry() { | ||
| if (onRetry) { | ||
| onRetry(); | ||
| } else { | ||
| window.location.reload(); | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <div class="flex h-full items-center justify-center p-8"> | ||
| <Alert.Root variant="destructive" class="max-w-md"> | ||
| <AlertTriangle class="h-5 w-5" /> | ||
| <Alert.Title class="text-lg">{title}</Alert.Title> | ||
| <Alert.Description class="mt-2 space-y-4"> | ||
| <p>{message}</p> | ||
| {#if hint} | ||
| <p class="text-sm opacity-80">{hint}</p> | ||
| {/if} | ||
| <Button onclick={handleRetry} variant="outline" size="sm" class="mt-2 gap-2"> | ||
| <RefreshCw class="h-4 w-4" /> | ||
| Try Again | ||
| </Button> | ||
| </Alert.Description> | ||
| </Alert.Root> | ||
| </div> |
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 |
|---|---|---|
| @@ -1,39 +1,59 @@ | ||
| export { translation } from "@sjsf/form/translations/en"; | ||
| import type { FormState, ValidatorFactoryOptions } from "@sjsf/form"; | ||
| import type { components } from "$lib/providers/riven"; | ||
|
|
||
| export type AppSettings = components["schemas"]["AppModel"]; | ||
| export type SettingsFormState = FormState<AppSettings>; | ||
|
|
||
| export { resolver } from "@sjsf/form/resolvers/basic"; | ||
| // Side-effect imports: register additional field types | ||
| import "@sjsf/form/fields/extra/enum-include"; | ||
| import "@sjsf/form/fields/extra/multi-enum-include"; | ||
| import "@sjsf/form/fields/extra/unknown-native-file-include"; | ||
|
|
||
| export { theme } from "@sjsf/shadcn4-theme"; | ||
| import "@sjsf/shadcn4-theme/extra-widgets/textarea-include"; | ||
| import "@sjsf/shadcn4-theme/extra-widgets/checkboxes-include"; | ||
| import "@sjsf/shadcn4-theme/extra-widgets/radio-include"; | ||
| import "@sjsf/shadcn4-theme/extra-widgets/file-include"; | ||
| import "@sjsf/shadcn4-theme/extra-widgets/date-picker-include"; | ||
| // import "@sjsf-lab/shadcn-extras-theme/extra-widgets/password-include"; | ||
| // import "@sjsf-lab/shadcn-extras-theme/extra-widgets/tags-input-include"; | ||
|
|
||
| export { createFormIdBuilder as idBuilder } from "@sjsf/sveltekit"; | ||
| // Theme with custom widgets | ||
| import { theme as baseTheme } from "@sjsf/shadcn4-theme"; | ||
| import { extendByRecord } from "@sjsf/form/lib/resolver"; | ||
| import { CustomRankWidget, NullableArrayWidget, NullablePrimitiveWidget } from "./widgets"; | ||
|
|
||
| export { createFormMerger as merger } from "@sjsf/form/mergers/modern"; | ||
| export const theme = extendByRecord(baseTheme, { | ||
| customRankWidget: CustomRankWidget, | ||
| nullableArrayWidget: NullableArrayWidget, | ||
| nullablePrimitiveWidget: NullablePrimitiveWidget | ||
| }); | ||
|
|
||
| import type { ValidatorFactoryOptions } from "@sjsf/form"; | ||
| // Validator with custom formats | ||
| import { addFormComponents, createFormValidator } from "@sjsf/ajv8-validator"; | ||
| import addFormats from "ajv-formats"; | ||
|
|
||
| /** Matches paths starting with / or . (absolute or relative filesystem paths) */ | ||
| const PATH_FORMAT_REGEX = /^[/.].*/; | ||
|
|
||
| /** | ||
| * Permissive regex for multi-host URI fields - accepts any non-empty string. | ||
| * Intended to allow flexible formats: single host, host:port, comma-separated hosts, etc. | ||
| * This is a placeholder; tighten validation here if stricter format enforcement is needed. | ||
| */ | ||
| const MULTI_HOST_URI_REGEX = /^.+$/; | ||
|
|
||
| export const validator = <T>(options: ValidatorFactoryOptions) => | ||
| createFormValidator<T>({ | ||
| ...options, | ||
| ajvPlugins: (ajv) => { | ||
| addFormComponents(addFormats(ajv)); | ||
|
|
||
| ajv.addFormat("path", PATH_FORMAT_REGEX); | ||
| ajv.addFormat("multi-host-uri", MULTI_HOST_URI_REGEX); | ||
|
|
||
| return ajv; | ||
| } | ||
| }); | ||
|
|
||
| // Form utilities | ||
| export { translation } from "@sjsf/form/translations/en"; | ||
| // Use compat resolver (not basic) because it handles enum fields correctly. | ||
| // Basic resolver maps enums to stringField (text input); compat returns enumField (select). | ||
| export { resolver } from "@sjsf/form/resolvers/compat"; | ||
| export { createFormIdBuilder as idBuilder } from "@sjsf/sveltekit"; | ||
| export { createFormMerger as merger } from "@sjsf/form/mergers/modern"; |
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.