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:
larsiandClaude Opus 5.5 committed 2026-11-14 01:06:07 +01:00
1 parent 6609371a28
commit a9bf3497fe
11 files changed
+105 -27

No files matched your search

+4 -3
View File
@@ -1,4 +1,5 @@
<script lang="ts" module>
import { SINGLE_COMMUNITY } from '$lib/app/single'
import type { Community, Person, SubscribedType } from '$lib/api/types'
import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n'
@@ -197,13 +198,13 @@
<header
class={[
'grid w-full meta',
community ? 'grid-rows-2' : 'grid-rows-1 minimal',
community && !SINGLE_COMMUNITY ? 'grid-rows-2' : 'grid-rows-1 minimal',
'text-xs min-w-0 max-w-full text-slate-600 dark:text-zinc-400',
]}
class:compact={view == 'compact'}
{style}
>
{#if showCommunity && community}
{#if showCommunity && community && !SINGLE_COMMUNITY}
<Popover>
{#snippet target(attachment)}
<button
@@ -249,7 +250,7 @@
{/snippet}
</Popover>
{/if}
{#if showCommunity && community}
{#if showCommunity && community && !SINGLE_COMMUNITY}
<CommunityLink
{community}
style="grid-area: community;"
+6 -3
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import { SINGLE_COMMUNITY } from '$lib/app/single'
import type { PostView } from '$lib/api/types'
import { settings } from '$lib/app/settings.svelte'
import Placeholder from '$lib/ui/info/Placeholder.svelte'
@@ -41,9 +42,11 @@
title="No posts"
description="There are no posts that match this filter."
>
<Button href="/communities" icon={Plus}>
<span>Follow some communities</span>
</Button>
{#if !SINGLE_COMMUNITY}
<Button href="/communities" icon={Plus}>
<span>Follow some communities</span>
</Button>
{/if}
</Placeholder>
</div>
{:else}
@@ -1,4 +1,5 @@
<script lang="ts">
import { SINGLE_COMMUNITY } from '$lib/app/single'
import { browser } from '$app/environment'
import { client } from '$lib/api/client.svelte'
import type { GetPosts, PostView } from '$lib/api/types'
@@ -163,6 +164,7 @@
title={$t('routes.frontpage.empty.title')}
description={$t('routes.frontpage.empty.description')}
>
{#if !SINGLE_COMMUNITY}
<Button
href="/communities"
rounding="pill"
@@ -171,6 +173,7 @@
>
{$t('nav.communities')}
</Button>
{/if}
</Placeholder>
</div>
{:else}