···1111import type { Attribute } from "src/replicache/attributes";
1212import { Database } from "supabase/database.types";
1313import * as Y from "yjs";
1414-import { YJSFragmentToString } from "components/Blocks/TextBlock/RenderYJSFragment";
1414+import { YJSFragmentToString } from "src/utils/yjsFragmentToString";
1515import { pool } from "supabase/pool";
16161717let supabase = createServerClient<Database>(
+1
app/(home-pages)/discover/PubListing.tsx
···11"use client";
22import { AtUri } from "@atproto/syntax";
33import { PublicationSubscription } from "app/(home-pages)/reader/getSubscriptions";
44+import { SubscribeWithBluesky } from "app/lish/Subscribe";
45import { PubIcon } from "components/ActionBar/Publications";
56import { Separator } from "components/Layout";
67import { usePubTheme } from "components/ThemeManager/PublicationThemeProvider";
+6-4
app/(home-pages)/home/HomeLayout.tsx
···289289 !!leaflet.leaflets_to_documents?.find((l) => l.document);
290290 let drafts = !!leaflet.leaflets_in_publications?.length && !published;
291291 let docs = !leaflet.leaflets_in_publications?.length && !archived;
292292- // If no filters are active, show all
292292+293293+ // If no filters are active, show everything that is not archived
293294 if (
294295 !filter.drafts &&
295296 !filter.published &&
···298299 )
299300 return archived === false || archived === null || archived == undefined;
300301302302+ //if a filter is on, return itemsd of that filter that are also NOT archived
301303 return (
302302- (filter.drafts && drafts) ||
303303- (filter.published && published) ||
304304- (filter.docs && docs) ||
304304+ (filter.drafts && drafts && !archived) ||
305305+ (filter.published && published && !archived) ||
306306+ (filter.docs && docs && !archived) ||
305307 (filter.archived && archived)
306308 );
307309 },
···2727import { useState, useMemo } from "react";
2828import { useIsMobile } from "src/hooks/isMobile";
2929import { useReplicache, useEntity } from "src/replicache";
3030+import { useSubscribe } from "src/replicache/useSubscribe";
3031import { Json } from "supabase/database.types";
3132import {
3233 useBlocks,
···3435} from "src/hooks/queries/useBlocks";
3536import * as Y from "yjs";
3637import * as base64 from "base64-js";
3737-import { YJSFragmentToString } from "components/Blocks/TextBlock/RenderYJSFragment";
3838+import { YJSFragmentToString } from "src/utils/yjsFragmentToString";
3839import { BlueskyLogin } from "app/login/LoginForm";
3940import { moveLeafletToPublication } from "actions/publications/moveLeafletToPublication";
4041import { AddTiny } from "components/Icons/AddTiny";
···6364const UpdateButton = () => {
6465 let [isLoading, setIsLoading] = useState(false);
6566 let { data: pub, mutate } = useLeafletPublicationData();
6666- let { permission_token, rootEntity } = useReplicache();
6767+ let { permission_token, rootEntity, rep } = useReplicache();
6768 let { identity } = useIdentityData();
6869 let toaster = useToaster();
69707171+ // Get tags from Replicache state (same as draft editor)
7272+ let tags = useSubscribe(rep, (tx) => tx.get<string[]>("publication_tags"));
7373+ const currentTags = Array.isArray(tags) ? tags : [];
7474+7075 return (
7176 <ActionButton
7277 primary
···8186 leaflet_id: permission_token.id,
8287 title: pub.title,
8388 description: pub.description,
8989+ tags: currentTags,
8490 });
8591 setIsLoading(false);
8692 mutate();
···108114 let { identity } = useIdentityData();
109115 let { permission_token } = useReplicache();
110116 let query = useSearchParams();
111111- console.log(query.get("publish"));
112117 let [open, setOpen] = useState(query.get("publish") !== null);
113118114119 let isMobile = useIsMobile();
+1-1
app/[leaflet_id]/page.tsx
···4455import type { Fact } from "src/replicache";
66import type { Attribute } from "src/replicache/attributes";
77-import { YJSFragmentToString } from "components/Blocks/TextBlock/RenderYJSFragment";
77+import { YJSFragmentToString } from "src/utils/yjsFragmentToString";
88import { Leaflet } from "./Leaflet";
99import { scanIndexLocal } from "src/replicache/utils";
1010import { getRSVPData } from "actions/getRSVPData";
···55 CSSProperties,
66 useContext,
77 useEffect,
88- useMemo,
99- useState,
108} from "react";
119import {
1210 colorToString,
···1412 useColorAttributeNullable,
1513} from "./useColorAttribute";
1614import { Color as AriaColor, parseColor } from "react-aria-components";
1717-import { parse, contrastLstar, ColorSpace, sRGB } from "colorjs.io/fn";
18151916import { useEntity } from "src/replicache";
2017import { useLeafletPublicationData } from "components/PageSWRDataProvider";
···2320 PublicationThemeProvider,
2421} from "./PublicationThemeProvider";
2522import { PubLeafletPublication } from "lexicons/api";
2626-2727-type CSSVariables = {
2828- "--bg-leaflet": string;
2929- "--bg-page": string;
3030- "--primary": string;
3131- "--accent-1": string;
3232- "--accent-2": string;
3333- "--accent-contrast": string;
3434- "--highlight-1": string;
3535- "--highlight-2": string;
3636- "--highlight-3": string;
3737-};
3838-3939-// define the color defaults for everything
4040-export const ThemeDefaults = {
4141- "theme/page-background": "#FDFCFA",
4242- "theme/card-background": "#FFFFFF",
4343- "theme/primary": "#272727",
4444- "theme/highlight-1": "#FFFFFF",
4545- "theme/highlight-2": "#EDD280",
4646- "theme/highlight-3": "#FFCDC3",
4747-4848- //everywhere else, accent-background = accent-1 and accent-text = accent-2.
4949- // we just need to create a migration pipeline before we can change this
5050- "theme/accent-text": "#FFFFFF",
5151- "theme/accent-background": "#0000FF",
5252- "theme/accent-contrast": "#0000FF",
5353-};
2323+import { getColorContrast } from "./themeUtils";
54245525// define a function to set an Aria Color to a CSS Variable in RGB
5626function setCSSVariableToColor(
···368338 );
369339};
370340371371-// used to calculate the contrast between page and accent1, accent2, and determin which is higher contrast
372372-export function getColorContrast(color1: string, color2: string) {
373373- ColorSpace.register(sRGB);
374374-375375- let parsedColor1 = parse(`rgb(${color1})`);
376376- let parsedColor2 = parse(`rgb(${color2})`);
377377-378378- return contrastLstar(parsedColor1, parsedColor2);
379379-}
+27
components/ThemeManager/themeUtils.ts
···11+import { parse, contrastLstar, ColorSpace, sRGB } from "colorjs.io/fn";
22+33+// define the color defaults for everything
44+export const ThemeDefaults = {
55+ "theme/page-background": "#FDFCFA",
66+ "theme/card-background": "#FFFFFF",
77+ "theme/primary": "#272727",
88+ "theme/highlight-1": "#FFFFFF",
99+ "theme/highlight-2": "#EDD280",
1010+ "theme/highlight-3": "#FFCDC3",
1111+1212+ //everywhere else, accent-background = accent-1 and accent-text = accent-2.
1313+ // we just need to create a migration pipeline before we can change this
1414+ "theme/accent-text": "#FFFFFF",
1515+ "theme/accent-background": "#0000FF",
1616+ "theme/accent-contrast": "#0000FF",
1717+};
1818+1919+// used to calculate the contrast between page and accent1, accent2, and determin which is higher contrast
2020+export function getColorContrast(color1: string, color2: string) {
2121+ ColorSpace.register(sRGB);
2222+2323+ let parsedColor1 = parse(`rgb(${color1})`);
2424+ let parsedColor2 = parse(`rgb(${color2})`);
2525+2626+ return contrastLstar(parsedColor1, parsedColor2);
2727+}
+1-1
components/ThemeManager/useColorAttribute.ts
···22import { Color, parseColor } from "react-aria-components";
33import { useEntity, useReplicache } from "src/replicache";
44import { FilterAttributes } from "src/replicache/attributes";
55-import { ThemeDefaults } from "./ThemeProvider";
55+import { ThemeDefaults } from "./themeUtils";
6677export function useColorAttribute(
88 entity: string | null,
+5-14
components/Toolbar/BlockToolbar.tsx
···22import { ToolbarButton } from ".";
33import { Separator, ShortcutKey } from "components/Layout";
44import { metaKey } from "src/utils/metaKey";
55-import { getBlocksWithType } from "src/hooks/queries/useBlocks";
65import { useUIState } from "src/useUIState";
76import { LockBlockButton } from "./LockBlockButton";
87import { TextAlignmentButton } from "./TextAlignmentToolbar";
98import { ImageFullBleedButton, ImageAltTextButton } from "./ImageToolbar";
109import { DeleteSmall } from "components/Icons/DeleteSmall";
1010+import { getSortedSelection } from "components/SelectionManager/selectionState";
11111212export const BlockToolbar = (props: {
1313 setToolbarState: (
···66666767const MoveBlockButtons = () => {
6868 let { rep } = useReplicache();
6969- const getSortedSelection = async () => {
7070- let selectedBlocks = useUIState.getState().selectedBlocks;
7171- let siblings =
7272- (await rep?.query((tx) =>
7373- getBlocksWithType(tx, selectedBlocks[0].parent),
7474- )) || [];
7575- let sortedBlocks = siblings.filter((s) =>
7676- selectedBlocks.find((sb) => sb.value === s.value),
7777- );
7878- return [sortedBlocks, siblings];
7979- };
8069 return (
8170 <>
8271 <ToolbarButton
8372 hiddenOnCanvas
8473 onClick={async () => {
8585- let [sortedBlocks, siblings] = await getSortedSelection();
7474+ if (!rep) return;
7575+ let [sortedBlocks, siblings] = await getSortedSelection(rep);
8676 if (sortedBlocks.length > 1) return;
8777 let block = sortedBlocks[0];
8878 let previousBlock =
···139129 <ToolbarButton
140130 hiddenOnCanvas
141131 onClick={async () => {
142142- let [sortedBlocks, siblings] = await getSortedSelection();
132132+ if (!rep) return;
133133+ let [sortedBlocks, siblings] = await getSortedSelection(rep);
143134 if (sortedBlocks.length > 1) return;
144135 let block = sortedBlocks[0];
145136 let nextBlock = siblings
+1-1
components/Toolbar/MultiSelectToolbar.tsx
···88import { LockBlockButton } from "./LockBlockButton";
99import { Props } from "components/Icons/Props";
1010import { TextAlignmentButton } from "./TextAlignmentToolbar";
1111-import { getSortedSelection } from "components/SelectionManager";
1111+import { getSortedSelection } from "components/SelectionManager/selectionState";
12121313export const MultiselectToolbar = (props: {
1414 setToolbarState: (
+2-1
components/Toolbar/index.tsx
···1313import { TextToolbar } from "./TextToolbar";
1414import { BlockToolbar } from "./BlockToolbar";
1515import { MultiselectToolbar } from "./MultiSelectToolbar";
1616-import { AreYouSure, deleteBlock } from "components/Blocks/DeleteBlock";
1616+import { AreYouSure } from "components/Blocks/DeleteBlock";
1717+import { deleteBlock } from "src/utils/deleteBlock";
1718import { TooltipButton } from "components/Buttons";
1819import { TextAlignmentToolbar } from "./TextAlignmentToolbar";
1920import { useIsMobile } from "src/hooks/isMobile";
+1-1
components/utils/UpdateLeafletTitle.tsx
···88import { useEntity, useReplicache } from "src/replicache";
99import * as Y from "yjs";
1010import * as base64 from "base64-js";
1111-import { YJSFragmentToString } from "components/Blocks/TextBlock/RenderYJSFragment";
1111+import { YJSFragmentToString } from "src/utils/yjsFragmentToString";
1212import { useParams, useRouter, useSearchParams } from "next/navigation";
1313import { focusBlock } from "src/utils/focusBlock";
1414import { useIsMobile } from "src/hooks/isMobile";