-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(settings): self-host settings plane, Sim wordmark in sidebar #5990
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6e21cc1
feat(settings): self-host settings plane, Sim wordmark in sidebar
TheodoreSpeaks 2fa102e
docs(readme): point Chat keys at the self-host settings plane
TheodoreSpeaks 8cc1ceb
improvement(settings): make the sidebar wordmark a plane attribute
TheodoreSpeaks 09a13b9
fix(settings): hide self-host Chat keys on non-hosted deployments
TheodoreSpeaks 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 was deleted.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { Suspense } from 'react' | ||
| import type { Metadata } from 'next' | ||
| import { notFound, redirect } from 'next/navigation' | ||
| import { | ||
| getSelfHostSettingsHref, | ||
| getSettingsSectionMeta, | ||
| parseSettingsPathSection, | ||
| SELFHOST_SETTINGS_ITEMS, | ||
| } from '@/components/settings/navigation' | ||
| import { SelfHostSettingsRenderer } from '@/components/settings/selfhost-settings-renderer' | ||
| import { getSession } from '@/lib/auth' | ||
| import { isBillingEnabled, isHosted } from '@/lib/core/config/env-flags' | ||
|
|
||
| interface SelfHostSettingsSectionPageProps { | ||
| params: Promise<{ section: string }> | ||
| } | ||
|
|
||
| export async function generateMetadata({ | ||
| params, | ||
| }: SelfHostSettingsSectionPageProps): Promise<Metadata> { | ||
| const { section } = await params | ||
| const parsed = parseSettingsPathSection({ | ||
| path: section, | ||
| items: SELFHOST_SETTINGS_ITEMS, | ||
| defaultSection: null, | ||
| }) | ||
| const meta = parsed ? getSettingsSectionMeta('selfhost', parsed) : null | ||
| return { title: meta ? `${meta.label} - Self-host settings` : 'Self-host settings' } | ||
| } | ||
|
|
||
| export default async function SelfHostSettingsSectionPage({ | ||
| params, | ||
| }: SelfHostSettingsSectionPageProps) { | ||
| const session = await getSession() | ||
| if (!session?.user) redirect('/login') | ||
|
|
||
| const { section } = await params | ||
| const parsed = parseSettingsPathSection({ | ||
| path: section, | ||
| items: SELFHOST_SETTINGS_ITEMS, | ||
| defaultSection: null, | ||
| }) | ||
| if (!parsed) notFound() | ||
| if (parsed === 'billing' && !isBillingEnabled) redirect(getSelfHostSettingsHref('general')) | ||
| if (parsed === 'chat-keys' && !isHosted) redirect(getSelfHostSettingsHref('general')) | ||
|
|
||
| /** | ||
| * Sections read URL query params via nuqs (which uses `useSearchParams` | ||
| * internally), so the renderer must sit under a Suspense boundary. | ||
| */ | ||
| return ( | ||
| <Suspense fallback={null}> | ||
| <SelfHostSettingsRenderer section={parsed} /> | ||
| </Suspense> | ||
| ) | ||
| } | ||
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,10 @@ | ||
| import { redirect } from 'next/navigation' | ||
| import { StandaloneSettingsShell } from '@/components/settings/standalone-settings-shell' | ||
| import { getSession } from '@/lib/auth' | ||
|
|
||
| export default async function SelfHostSettingsLayout({ children }: { children: React.ReactNode }) { | ||
| const session = await getSession() | ||
| if (!session?.user) redirect('/login') | ||
|
|
||
| return <StandaloneSettingsShell plane='selfhost'>{children}</StandaloneSettingsShell> | ||
| } |
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,6 @@ | ||
| import { redirect } from 'next/navigation' | ||
| import { getSelfHostSettingsHref } from '@/components/settings/navigation' | ||
|
|
||
| export default function SelfHostSettingsPage() { | ||
| redirect(getSelfHostSettingsHref('general')) | ||
| } |
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
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.