feat: single-community mode (PUBLIC_SINGLE_COMMUNITY)
For instances that are one community (thebitcoin.win): "/" reroutes to the community page, community browsing and explore lead back to it, community names/handles are hidden on posts and in the header, and create-post preselects the community. Unset, behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011c5BZVwWdVLrdQi9htmuth
This commit is contained in:
1 parent
6609371a28
commit
a9bf3497fe
11 files changed
+105
-27
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { SINGLE_COMMUNITY } from '$lib/app/single'
|
||||
import { site } from '$lib/api/client.svelte'
|
||||
import { profile } from '$lib/app/auth'
|
||||
import { t } from '$lib/app/i18n'
|
||||
@@ -89,13 +90,15 @@
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<NavButton
|
||||
href="/explore/communities"
|
||||
label={$t('routes.explore.title')}
|
||||
icon={GlobeAlt}
|
||||
isSelectedFilter={(path) => path.startsWith('/explore')}
|
||||
class="order-1"
|
||||
/>
|
||||
{#if !SINGLE_COMMUNITY}
|
||||
<NavButton
|
||||
href="/explore/communities"
|
||||
label={$t('routes.explore.title')}
|
||||
icon={GlobeAlt}
|
||||
isSelectedFilter={(path) => path.startsWith('/explore')}
|
||||
class="order-1"
|
||||
/>
|
||||
{/if}
|
||||
<NavButton
|
||||
href="/search"
|
||||
label={$t('nav.search')}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { SINGLE_COMMUNITY } from '$lib/app/single'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profile as currentProfile, type ProfileInfo } from '$lib/app/auth'
|
||||
@@ -85,11 +86,15 @@ export function getGroups(
|
||||
name: t.get('nav.commands.main'),
|
||||
actions: [
|
||||
{ href: '/', name: t.get('nav.home'), icon: Home, shortcut: 'h' },
|
||||
{
|
||||
href: '/communities',
|
||||
name: t.get('nav.communities'),
|
||||
icon: GlobeAlt,
|
||||
},
|
||||
...(SINGLE_COMMUNITY
|
||||
? []
|
||||
: [
|
||||
{
|
||||
href: '/communities',
|
||||
name: t.get('nav.communities'),
|
||||
icon: GlobeAlt,
|
||||
},
|
||||
]),
|
||||
...(currentProfile.isMod()
|
||||
? [
|
||||
{
|
||||
@@ -420,11 +425,15 @@ export function dynamicActions(query: string): Group {
|
||||
icon: MagnifyingGlass,
|
||||
href: `/search?q=${query}`,
|
||||
},
|
||||
{
|
||||
name: t.get('nav.commands.communities', { default: query.trim() }),
|
||||
icon: Newspaper,
|
||||
href: `/explore/communities?q=${query}`,
|
||||
},
|
||||
...(SINGLE_COMMUNITY
|
||||
? []
|
||||
: [
|
||||
{
|
||||
name: t.get('nav.commands.communities', { default: query.trim() }),
|
||||
icon: Newspaper,
|
||||
href: `/explore/communities?q=${query}`,
|
||||
},
|
||||
]),
|
||||
]
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user