From 12d5f948dd6fbf843c9efdc204fd58cca10c041f Mon Sep 17 00:00:00 2001 From: Florian <45694132+flo-bit@users.noreply.github.com> Date: Sun, 25 Jan 2026 01:11:14 +0000 Subject: [PATCH] profile stuff --- src/lib/helper.ts | 30 ++++++++++++++++++++++-------- src/lib/types.ts | 37 +++++++++++++++++++------------------ src/lib/components/MarkdownTextEditor.svelte | 8 ++++++-- src/lib/components/PlainTextEditor.svelte | 10 ++++++++-- src/lib/website/Account.svelte | 2 +- src/lib/website/EditBar.svelte | 30 ------------------------------ src/lib/website/EditableProfile.svelte | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------ src/lib/website/EditableWebsite.svelte | 25 +++++++++++++++++-------- src/lib/website/Profile.svelte | 35 +++++++++++++++++++++++++++-------- src/lib/website/Settings.svelte | 74 -------------------------------------------------------------------------- src/lib/website/Website.svelte | 10 ++++++++-- src/lib/website/load.ts | 25 +++++++++++++++++-------- src/lib/cards/BaseCard/BaseEditingCard.svelte | 2 +- 13 file(s) changed, 181 insertion(s)(+), 192 deletion(s)(-) diff --git a/src/lib/helper.ts b/src/lib/helper.ts --- a/src/lib/helper.ts +++ b/src/lib/helper.ts @@ -285,7 +285,7 @@ } export function getName(data: WebsiteData): string { - return (data.publication?.name ?? data.profile.displayName) || data.handle; + return data.publication?.name || data.profile.displayName || data.handle; } export function getDescription(data: WebsiteData): string { @@ -300,6 +300,10 @@ return data?.publication?.preferences?.hideProfile; return data.page !== 'blento.self'; +} + +export function getProfilePosition(data: WebsiteData): 'side' | 'top' { + return data?.publication?.preferences?.profilePosition ?? 'side'; } export function isTyping() { @@ -475,13 +479,23 @@ data.publication.url += '/' + data.page.replace('blento.', ''); } } - promises.push( - putRecord({ - collection: 'site.standard.publication', - rkey: data.page, - record: data.publication - }) - ); + if (data.page !== 'blento.self') { + promises.push( + putRecord({ + collection: 'app.blento.page', + rkey: data.page, + record: data.publication + }) + ); + } else { + promises.push( + putRecord({ + collection: 'site.standard.publication', + rkey: data.page, + record: data.publication + }) + ); + } console.log('updating or adding publication', data.publication); } diff --git a/src/lib/types.ts b/src/lib/types.ts --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -33,25 +33,26 @@ handle: string; cards: Item[]; - publication: - | { - url?: string; - name?: string; - description?: string; - icon?: Blob; - preferences?: { - /** - * @deprecated - * - * use hideProfileSection instead - */ - hideProfile?: boolean; + publication: { + url?: string; + name?: string; + description?: string; + icon?: Blob; + preferences?: { + /** + * @deprecated + * + * use hideProfileSection instead + */ + hideProfile?: boolean; - // use this instead - hideProfileSection?: boolean; - }; - } - | undefined; + // use this instead + hideProfileSection?: boolean; + + // 'side' (default on desktop) or 'top' (always top like mobile view) + profilePosition?: 'side' | 'top'; + }; + }; profile: AppBskyActorDefs.ProfileViewDetailed; additionalData: Record; diff --git a/src/lib/components/MarkdownTextEditor.svelte b/src/lib/components/MarkdownTextEditor.svelte --- a/src/lib/components/MarkdownTextEditor.svelte +++ b/src/lib/components/MarkdownTextEditor.svelte @@ -19,14 +19,16 @@ key = 'text', placeholder = '', defaultContent = '', - class: className + class: className, + onupdate }: { - editor: Editor | null; + editor?: Editor | null; contentDict: Record; key: string; placeholder?: string; defaultContent?: string; class?: string; + onupdate?: (content: string) => void; } = $props(); const update = async () => { @@ -41,6 +43,8 @@ const markdown = turndownService.turndown(html); contentDict[key] = markdown; + + onupdate?.(markdown); }; onMount(async () => { diff --git a/src/lib/components/PlainTextEditor.svelte b/src/lib/components/PlainTextEditor.svelte --- a/src/lib/components/PlainTextEditor.svelte +++ b/src/lib/components/PlainTextEditor.svelte @@ -15,19 +15,25 @@ key, class: className, placeholder = '', - defaultContent = '' + defaultContent = '', + onupdate }: { contentDict: Record; key: string; class?: string; placeholder?: string; defaultContent?: string; + onupdate?: (content: string) => void; } = $props(); const update = async () => { if (!editor) return; - contentDict[key] = editor.getText(); + const text = editor.getText(); + + contentDict[key] = text; + + onupdate?.(text); }; onMount(async () => { diff --git a/src/lib/website/Account.svelte b/src/lib/website/Account.svelte --- a/src/lib/website/Account.svelte +++ b/src/lib/website/Account.svelte @@ -14,7 +14,7 @@ {#if user.isLoggedIn && user.profile} -
+
{#snippet child({ props })}
-