···1919import { LeafletLayout } from "components/LeafletLayout";
2020import { fetchPollData } from "./fetchPollData";
21212222-export async function DocumentPageRenderer({ did, rkey }: { did: string; rkey: string }) {
2222+export async function DocumentPageRenderer({
2323+ did,
2424+ rkey,
2525+}: {
2626+ did: string;
2727+ rkey: string;
2828+}) {
2329 let agent = new AtpAgent({
2430 service: "https://public.api.bsky.app",
2531 fetch: (...args) =>
···3036 });
31373238 let [document, profile] = await Promise.all([
3333- getPostPageData(
3434- AtUri.make(did, ids.PubLeafletDocument, rkey).toString(),
3535- ),
3939+ getPostPageData(AtUri.make(did, ids.PubLeafletDocument, rkey).toString()),
3640 agent.getProfile({ actor: did }),
3741 ]);
3842···101105 let pubRecord = document.documents_in_publications[0]?.publications
102106 ?.record as PubLeafletPublication.Record | undefined;
103107 let theme = pubRecord?.theme || record.theme || null;
104104- let pub_creator = document.documents_in_publications[0]?.publications
105105- ?.identity_did || did;
108108+ let pub_creator =
109109+ document.documents_in_publications[0]?.publications?.identity_did || did;
106110107111 let firstPage = record.pages[0];
108112 let blocks: PubLeafletPagesLinearDocument.Block[] = [];
+1
components/Layout.tsx
···11+"use client";
12import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
23import { theme } from "tailwind.config";
34import { NestedCardThemeProvider } from "./ThemeManager/ThemeProvider";
+1-42
components/ThemeManager/PubThemeSetter.tsx
···1616import { PubAccentPickers } from "./PubPickers/PubAcccentPickers";
1717import { Separator } from "components/Layout";
1818import { PubSettingsHeader } from "app/lish/[did]/[publication]/dashboard/PublicationSettings";
1919+import { ColorToRGB, ColorToRGBA } from "./colorToLexicons";
19202021export type ImageState = {
2122 src: string;
···343344 </div>
344345 );
345346};
346346-347347-export function ColorToRGBA(color: Color) {
348348- if (!color)
349349- return {
350350- $type: "pub.leaflet.theme.color#rgba" as const,
351351- r: 0,
352352- g: 0,
353353- b: 0,
354354- a: 1,
355355- };
356356- let c = color.toFormat("rgba");
357357- const r = c.getChannelValue("red");
358358- const g = c.getChannelValue("green");
359359- const b = c.getChannelValue("blue");
360360- const a = c.getChannelValue("alpha");
361361- return {
362362- $type: "pub.leaflet.theme.color#rgba" as const,
363363- r: Math.round(r),
364364- g: Math.round(g),
365365- b: Math.round(b),
366366- a: Math.round(a * 100),
367367- };
368368-}
369369-function ColorToRGB(color: Color) {
370370- if (!color)
371371- return {
372372- $type: "pub.leaflet.theme.color#rgb" as const,
373373- r: 0,
374374- g: 0,
375375- b: 0,
376376- };
377377- let c = color.toFormat("rgb");
378378- const r = c.getChannelValue("red");
379379- const g = c.getChannelValue("green");
380380- const b = c.getChannelValue("blue");
381381- return {
382382- $type: "pub.leaflet.theme.color#rgb" as const,
383383- r: Math.round(r),
384384- g: Math.round(g),
385385- b: Math.round(b),
386386- };
387387-}
+2-2
components/ThemeManager/ThemeSetter.tsx
···7070 }, [rep, props.entityID]);
71717272 if (!permission) return null;
7373- if (pub) return null;
7373+ if (pub?.publications) return null;
74747575 return (
7676 <>
···111111 }, [rep, props.entityID]);
112112113113 if (!permission) return null;
114114- if (pub) return null;
114114+ if (pub?.publications) return null;
115115 return (
116116 <div className="themeSetterContent flex flex-col w-full overflow-y-scroll no-scrollbar">
117117 <div className="themeBGLeaflet flex">
+44
components/ThemeManager/colorToLexicons.ts
···11+import { Color } from "react-aria-components";
22+33+export function ColorToRGBA(color: Color) {
44+ if (!color)
55+ return {
66+ $type: "pub.leaflet.theme.color#rgba" as const,
77+ r: 0,
88+ g: 0,
99+ b: 0,
1010+ a: 1,
1111+ };
1212+ let c = color.toFormat("rgba");
1313+ const r = c.getChannelValue("red");
1414+ const g = c.getChannelValue("green");
1515+ const b = c.getChannelValue("blue");
1616+ const a = c.getChannelValue("alpha");
1717+ return {
1818+ $type: "pub.leaflet.theme.color#rgba" as const,
1919+ r: Math.round(r),
2020+ g: Math.round(g),
2121+ b: Math.round(b),
2222+ a: Math.round(a * 100),
2323+ };
2424+}
2525+2626+export function ColorToRGB(color: Color) {
2727+ if (!color)
2828+ return {
2929+ $type: "pub.leaflet.theme.color#rgb" as const,
3030+ r: 0,
3131+ g: 0,
3232+ b: 0,
3333+ };
3434+ let c = color.toFormat("rgb");
3535+ const r = c.getChannelValue("red");
3636+ const g = c.getChannelValue("green");
3737+ const b = c.getChannelValue("blue");
3838+ return {
3939+ $type: "pub.leaflet.theme.color#rgb" as const,
4040+ r: Math.round(r),
4141+ g: Math.round(g),
4242+ b: Math.round(b),
4343+ };
4444+}