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 })}
-