feat: restructure app.html to support custom icon svg

This commit is contained in:
James Xylight committed 2025-08-23 15:27:43 -07:00
1 parent 0247d6dc4d
commit e36789175f
10 files changed
+146 -133

No files matched your search

+1
View File
@@ -1 +1,2 @@
*.json *.json
app.html
+3 -26
View File
@@ -5,39 +5,16 @@
<link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" /> <link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" />
<link rel="manifest" href="/manifest.json" /> <link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="keywords" content="lemmy, client" />
%sveltekit.head% %sveltekit.head%
</head> </head>
<body> <body>
<div <div
style=" style="z-index:-50;position:absolute;inset:0;display:grid;place-items:center; "
z-index: -50;
position: absolute;
inset: 0;
display: grid;
place-items: center;
color: #fafafe;
"
> >
<svg <svg width="50" height="50"><use width="50" height="50" xlink:href='/img/logo-isolated.svg' href="/img/logo-isolated.svg"></use></svg>
width="40"
height="40"
viewBox="15 15 70 70"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
>
<path
d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8867L55 79.1133C51.906 80.8996 48.094 80.8996 45 79.1133L27.2872 68.8867C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z"
/>
</svg>
</div> </div>
<div <div
style=" style="display: contents;"
display: contents;
flex-direction: column;
display: flex;
min-height: 100vh;
"
> >
%sveltekit.body% %sveltekit.body%
</div> </div>
+2 -3
View File
@@ -10,13 +10,12 @@
{width} {width}
height={width} height={width}
viewBox="0 0 100 100" viewBox="0 0 100 100"
fill="none" fill="currentColor"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="inline fill-black dark:fill-white hover:fill-slate-700 dark:hover:fill-zinc-300 transition-colors" class="inline hover:fill-slate-700 dark:hover:fill-zinc-300 transition-colors"
> >
<path <path
id="hexagon" id="hexagon"
d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z" d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z"
class=""
/> />
</svg> </svg>
+11 -8
View File
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { env } from '$env/dynamic/public'
import { notifications, profile } from '$lib/auth.svelte' import { notifications, profile } from '$lib/auth.svelte'
import SiteCard from '$lib/components/lemmy/SiteCard.svelte' import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
@@ -169,13 +170,15 @@
> >
<Icon src={ServerStack} size="16" micro /> <Icon src={ServerStack} size="16" micro />
</Button> </Button>
<Button {#if env.PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
color="tertiary" <Button
href="https://github.com/Xyphyn/Photon" color="tertiary"
title={$t('nav.menu.source')} href="https://github.com/Xyphyn/Photon"
size="square-md" title={$t('nav.menu.source')}
> size="square-md"
<Icon src={CodeBracketSquare} size="16" micro /> >
</Button> <Icon src={CodeBracketSquare} size="16" micro />
</Button>
{/if}
</div> </div>
</li> </li>
@@ -0,0 +1,94 @@
<script lang="ts">
import { Badge, Button, Menu, MenuButton } from 'mono-svelte'
import {
CheckCircle,
ChevronUpDown,
Icon,
QuestionMarkCircle,
UserGroup,
} from 'svelte-hero-icons'
import Avatar from '../Avatar.svelte'
import { profile } from '$lib/auth.svelte'
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { t } from '$lib/i18n/translations'
function switchTo(id: number) {
profile.meta.profile = id
goto(page.url, {
invalidateAll: true,
})
}
</script>
<Menu placement="bottom">
{#snippet target()}
<Button
color="tertiary"
alignment="left"
size="md"
rounding="xl"
class="flex flex-row gap-2 items-center"
>
{#snippet prefix()}
<Avatar
url={profile.current.avatar}
alt={profile.current.username}
width={24}
/>
{/snippet}
<div class="flex-1">
<div class="font-medium">{profile.current.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{profile.current.instance}
</div>
</div>
{#snippet suffix()}
<Icon
src={ChevronUpDown}
size="16"
micro
class="block justify-self-end"
/>
{/snippet}
</Button>
{/snippet}
{#each profile.meta.profiles as p}
{@const selected = profile.meta.profile == p.id}
<MenuButton
onclick={() => switchTo(p.id)}
class={[selected && 'bg-slate-100! dark:bg-zinc-800!']}
>
{#snippet prefix()}
<Avatar url={p.avatar} alt={p.username} width={24} />
{/snippet}
<div>
<div class="font-medium text-sm">{p.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{p.instance}
</div>
</div>
<div class="flex-1"></div>
{#if !p.jwt}
<Badge color="gray-subtle" class="p-1!">
<Icon src={QuestionMarkCircle} size="16" micro />
</Badge>
{/if}
{#if selected}
<Icon
src={CheckCircle}
class="text-primary-900 dark:text-primary-100"
size="16"
micro
/>
{/if}
</MenuButton>
{/each}
<MenuButton href="/accounts">
{#snippet prefix()}
<Icon src={UserGroup} size="16" micro />
{/snippet}
{$t('account.accounts')}
</MenuButton>
</Menu>
+32 -82
View File
@@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { notifications, profile } from '$lib/auth.svelte.js' import { notifications, profile } from '$lib/auth.svelte.js'
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte' import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte' import Expandable from '$lib/components/ui/Expandable.svelte'
@@ -8,28 +6,26 @@
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { communityLink } from '$lib/lemmy/generic' import { communityLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte.js' import { settings } from '$lib/settings.svelte.js'
import { Badge, Button, Menu, MenuButton, Option, Select } from 'mono-svelte' import { theme } from '$lib/ui/colors.svelte'
import { Badge, Option, Select } from 'mono-svelte'
import { import {
ArrowLeftOnRectangle, ArrowLeftOnRectangle,
Bookmark, Bookmark,
CheckCircle,
ChevronUpDown,
Cog6Tooth, Cog6Tooth,
ComputerDesktop, ComputerDesktop,
Icon,
Identification, Identification,
Inbox, Inbox,
Moon, Moon,
QuestionMarkCircle,
Sun, Sun,
Swatch, Swatch,
UserCircle, UserCircle,
UserGroup, UserGroup,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
import Avatar from '../Avatar.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte' import EndPlaceholder from '../EndPlaceholder.svelte'
import { theme } from '$lib/ui/colors.svelte' import ProfileSelection from './ProfileSelection.svelte'
import Logo from '../Logo.svelte'
import { PUBLIC_XYLIGHT_MODE } from '$env/static/public'
interface Props { interface Props {
style?: string style?: string
@@ -40,78 +36,7 @@
</script> </script>
<nav class={['flex flex-col overflow-auto gap-1', clazz]} {style}> <nav class={['flex flex-col overflow-auto gap-1', clazz]} {style}>
<Menu placement="bottom"> <ProfileSelection />
{#snippet target()}
<Button
color="tertiary"
alignment="left"
size="md"
class="flex flex-row gap-2 items-center"
>
{#snippet prefix()}
<Avatar
url={profile.current.avatar}
alt={profile.current.username}
width={24}
/>
{/snippet}
<div class="flex-1">
<div class="font-medium">{profile.current.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{profile.current.instance}
</div>
</div>
{#snippet suffix()}
<Icon
src={ChevronUpDown}
size="16"
micro
class="block justify-self-end"
/>
{/snippet}
</Button>
{/snippet}
{#each profile.meta.profiles as p}
<MenuButton
onclick={() => {
profile.meta.profile = p.id
goto(page.url, {
invalidateAll: true,
})
}}
>
{#snippet prefix()}
<Avatar url={p.avatar} alt={p.username} width={24} />
{/snippet}
<div>
<div class="font-medium text-sm">{p.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{p.instance}
</div>
</div>
{#if profile.meta.profile == p.id}
<Icon
src={CheckCircle}
class="text-primary-900 dark:text-primary-100 ml-auto"
size="16"
micro
/>
{/if}
{#if !p.jwt}
<Badge color="gray-subtle" class="ml-auto p-1!">
<Icon src={QuestionMarkCircle} size="16" micro />
</Badge>
{/if}
</MenuButton>
{/each}
<MenuButton href="/accounts">
{#snippet prefix()}
<Icon src={UserGroup} size="16" micro />
{/snippet}
{$t('account.accounts')}
</MenuButton>
</Menu>
<EndPlaceholder size="xs">{$t('profile.profile')}</EndPlaceholder> <EndPlaceholder size="xs">{$t('profile.profile')}</EndPlaceholder>
{#if profile.current?.jwt} {#if profile.current?.jwt}
<SidebarButton <SidebarButton
@@ -143,7 +68,7 @@
/> />
<SidebarButton <SidebarButton
href="/accounts" href="/accounts"
title={$t('accounts.accounts')} label={$t('account.accounts')}
icon={UserGroup} icon={UserGroup}
/> />
{/if} {/if}
@@ -235,4 +160,29 @@
{/if} {/if}
<div class="flex-1 h-full mt-auto"></div> <div class="flex-1 h-full mt-auto"></div>
<footer
class="flex gap-6 flex-col xl:flex-row text-sm text-slate-600 dark:text-zinc-300"
>
<div class="flex items-center gap-2">
<Logo width={16} />
<span class="font-medium">
{__VERSION__}
</span>
</div>
{#if PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
<a
href="https://github.com/xyphyn/photon"
class="text-blue-600 dark:text-blue-400/60 hover:underline"
>
{$t('nav.menu.source')}
</a>
<a
href="https://buymeacoffee.com/xylight"
class="text-blue-600 dark:text-blue-400/60 hover:underline"
>
{$t('nav.menu.donate')}
</a>
{/if}
</footer>
</nav> </nav>
@@ -46,7 +46,7 @@
{#if customIcon} {#if customIcon}
{@render customIcon({ selected })} {@render customIcon({ selected })}
{:else if icon} {:else if icon}
<Icon src={icon} solid size="20" /> <Icon src={icon} mini size="18" />
{/if} {/if}
{/snippet} {/snippet}
{label} {label}
-11
View File
@@ -545,17 +545,6 @@
"delete": "Delete", "delete": "Delete",
"restore": "Restore" "restore": "Restore"
}, },
"mediaBias": {
"description": "Description",
"credibility": "Credibility",
"reporting": "Factual Reporting",
"noData": {
"title": "No data",
"description": "There is no bias data for this website."
},
"downloading": "Downloading dataset",
"loading": "Loading source"
},
"link": { "link": {
"title": "Alternative Links", "title": "Alternative Links",
"actions": "Link Actions" "actions": "Link Actions"
+1 -1
View File
@@ -1,3 +1,3 @@
<svg fill="white" width="100" height="100" viewBox="15 15 70 70" xmlns="http://www.w3.org/2000/svg"> <svg fill="currentColor" width="100" height="100" viewBox="15 15 70 70" xmlns="http://www.w3.org/2000/svg">
<path d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8867L55 79.1133C51.906 80.8996 48.094 80.8996 45 79.1133L27.2872 68.8867C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z"/> <path d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8867L55 79.1133C51.906 80.8996 48.094 80.8996 45 79.1133L27.2872 68.8867C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 476 B

After

Width:  |  Height:  |  Size: 484 B

+1 -1
View File
@@ -20,7 +20,7 @@
"display": "standalone", "display": "standalone",
"scope": "/", "scope": "/",
"theme_color": "#000000", "theme_color": "#000000",
"description": "A client for Lemmy with design as priority.", "description": "A Svelte based web client for Lemmy.",
"screenshots": [ "screenshots": [
{ {
"form_factor": "wide", "form_factor": "wide",