diff --git a/app/(home-pages)/notifications/CommentNotication.tsx b/app/(home-pages)/notifications/CommentNotication.tsx index b40c8b03..f2791955 100644 --- a/app/(home-pages)/notifications/CommentNotication.tsx +++ b/app/(home-pages)/notifications/CommentNotication.tsx @@ -1,4 +1,4 @@ -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/BaseTextBlock"; +import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { AppBskyActorProfile, PubLeafletComment, diff --git a/app/(home-pages)/notifications/Notification.tsx b/app/(home-pages)/notifications/Notification.tsx index ea85bfff..f70f7af2 100644 --- a/app/(home-pages)/notifications/Notification.tsx +++ b/app/(home-pages)/notifications/Notification.tsx @@ -1,6 +1,6 @@ "use client"; import { Avatar } from "components/Avatar"; -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/BaseTextBlock"; +import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { PubLeafletPublication, PubLeafletRichtextFacet } from "lexicons/api"; import { timeAgo } from "src/utils/timeAgo"; import { useReplicache, useEntity } from "src/replicache"; diff --git a/app/(home-pages)/notifications/ReplyNotification.tsx b/app/(home-pages)/notifications/ReplyNotification.tsx index 56fc2447..699b7174 100644 --- a/app/(home-pages)/notifications/ReplyNotification.tsx +++ b/app/(home-pages)/notifications/ReplyNotification.tsx @@ -1,5 +1,5 @@ import { Avatar } from "components/Avatar"; -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/BaseTextBlock"; +import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { ReplyTiny } from "components/Icons/ReplyTiny"; import { CommentInNotification, diff --git a/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx b/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx index 3b8a218e..b7a9a350 100644 --- a/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx +++ b/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx @@ -6,7 +6,7 @@ import { AppBskyActorProfile, AtUri } from "@atproto/api"; import { PubLeafletComment, PubLeafletDocument } from "lexicons/api"; import { ReplyTiny } from "components/Icons/ReplyTiny"; import { Avatar } from "components/Avatar"; -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/BaseTextBlock"; +import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { getProfileComments, diff --git a/app/lish/[did]/[publication]/[rkey]/BaseTextBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx similarity index 71% rename from app/lish/[did]/[publication]/[rkey]/BaseTextBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx index bf8b0cb2..50feeb13 100644 --- a/app/lish/[did]/[publication]/[rkey]/BaseTextBlock.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx @@ -1,17 +1,16 @@ import { ProfilePopover } from "components/ProfilePopover"; -import { TextBlockCore, TextBlockCoreProps, RichText } from "./TextBlockCore"; +import { + TextBlockCore, + TextBlockCoreProps, + RichText, +} from "../Blocks/TextBlockCore"; import { ReactNode } from "react"; // Re-export RichText for backwards compatibility export { RichText }; function DidMentionWithPopover(props: { did: string; children: ReactNode }) { - return ( - - ); + return ; } export function BaseTextBlock(props: Omit) { diff --git a/app/lish/[did]/[publication]/[rkey]/PubCodeBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/PubCodeBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/PublishBskyPostBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx similarity index 94% rename from app/lish/[did]/[publication]/[rkey]/PublishBskyPostBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx index 0f6ae045..44c41a60 100644 --- a/app/lish/[did]/[publication]/[rkey]/PublishBskyPostBlock.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx @@ -5,14 +5,14 @@ import { useHasPageLoaded } from "components/InitialPageLoadProvider"; import { BlueskyTiny } from "components/Icons/BlueskyTiny"; import { CommentTiny } from "components/Icons/CommentTiny"; import { QuoteTiny } from "components/Icons/QuoteTiny"; -import { ThreadLink, QuotesLink } from "./PostLinks"; +import { ThreadLink, QuotesLink } from "../PostLinks"; import { useLocalizedDate } from "src/hooks/useLocalizedDate"; import { BlueskyEmbed, PostNotAvailable, } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; import { BlueskyRichText } from "components/Blocks/BlueskyPostBlock/BlueskyRichText"; -import { openPage } from "./PostPages"; +import { openPage } from "../PostPages"; export const PubBlueskyPostBlock = (props: { post: PostView; @@ -22,10 +22,10 @@ export const PubBlueskyPostBlock = (props: { let post = props.post; const handleOpenThread = () => { - openPage( - props.pageId ? { type: "doc", id: props.pageId } : undefined, - { type: "thread", uri: post.uri }, - ); + openPage(props.pageId ? { type: "doc", id: props.pageId } : undefined, { + type: "thread", + uri: post.uri, + }); }; switch (true) { @@ -51,7 +51,9 @@ export const PubBlueskyPostBlock = (props: { let postId = post.uri.split("/")[4]; let url = `https://bsky.app/profile/${post.author.handle}/post/${postId}`; - const parent = props.pageId ? { type: "doc" as const, id: props.pageId } : undefined; + const parent = props.pageId + ? { type: "doc" as const, id: props.pageId } + : undefined; return (
p.type === "doc" && p.id === props.pageId, - ); + let isOpen = openPages.some((p) => p.type === "doc" && p.id === props.pageId); return (
{ e.preventDefault(); e.stopPropagation(); openPage( - props.parentPageId ? { type: "doc", id: props.parentPageId } : undefined, + props.parentPageId + ? { type: "doc", id: props.parentPageId } + : undefined, { type: "doc", id: props.pageId }, { scrollIntoView: false }, ); @@ -239,7 +241,9 @@ const Interactions = (props: { pageId: string; parentPageId?: string }) => { e.preventDefault(); e.stopPropagation(); openPage( - props.parentPageId ? { type: "doc", id: props.parentPageId } : undefined, + props.parentPageId + ? { type: "doc", id: props.parentPageId } + : undefined, { type: "doc", id: props.pageId }, { scrollIntoView: false }, ); diff --git a/app/lish/[did]/[publication]/[rkey]/PublishedPollBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx similarity index 98% rename from app/lish/[did]/[publication]/[rkey]/PublishedPollBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx index cab8f0f5..c552375b 100644 --- a/app/lish/[did]/[publication]/[rkey]/PublishedPollBlock.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx @@ -9,12 +9,12 @@ import { useState, useEffect } from "react"; import { ButtonPrimary, ButtonSecondary } from "components/Buttons"; import { useIdentityData } from "components/IdentityProvider"; import { AtpAgent } from "@atproto/api"; -import { voteOnPublishedPoll } from "./voteOnPublishedPoll"; -import { PollData } from "./fetchPollData"; +import { voteOnPublishedPoll } from "../voteOnPublishedPoll"; +import { PollData } from "../fetchPollData"; import { Popover } from "components/Popover"; import LoginForm from "app/login/LoginForm"; import { BlueskyTiny } from "components/Icons/BlueskyTiny"; -import { getVoterIdentities, VoterIdentity } from "./getVoterIdentities"; +import { getVoterIdentities, VoterIdentity } from "../getVoterIdentities"; import { Json } from "supabase/database.types"; import { InfoSmall } from "components/Icons/InfoSmall"; diff --git a/app/lish/[did]/[publication]/[rkey]/StaticMathBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/StaticMathBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/TextBlock.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx similarity index 94% rename from app/lish/[did]/[publication]/[rkey]/TextBlock.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx index 20c765a1..56d28c64 100644 --- a/app/lish/[did]/[publication]/[rkey]/TextBlock.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx @@ -1,13 +1,14 @@ "use client"; import { UnicodeString } from "@atproto/api"; -import { PubLeafletRichtextFacet } from "lexicons/api"; +import { PubLeafletRichtextFacet, PubLeafletBlocksText } from "lexicons/api"; import { useMemo } from "react"; -import { useHighlight } from "./useHighlight"; +import { useHighlight } from "../useHighlight"; import { BaseTextBlock } from "./BaseTextBlock"; type Facet = PubLeafletRichtextFacet.Main; export function TextBlock(props: { plaintext: string; + textSize?: PubLeafletBlocksText.Main["textSize"]; facets?: Facet[]; index: number[]; preview?: boolean; diff --git a/app/lish/[did]/[publication]/[rkey]/TextBlockCore.tsx b/app/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/TextBlockCore.tsx rename to app/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx b/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx index b848aa3f..4e27693e 100644 --- a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx @@ -5,7 +5,7 @@ import { useIdentityData } from "components/IdentityProvider"; import { CommentBox } from "./CommentBox"; import { Json } from "supabase/database.types"; import { PubLeafletComment } from "lexicons/api"; -import { BaseTextBlock } from "../../BaseTextBlock"; +import { BaseTextBlock } from "../../Blocks/BaseTextBlock"; import { useMemo, useState } from "react"; import { CommentTiny } from "components/Icons/CommentTiny"; import { Separator } from "components/Layout"; diff --git a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx index 40a341c8..06beadd0 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx @@ -20,18 +20,18 @@ import { } from "lexicons/api"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { TextBlock } from "./TextBlock"; +import { TextBlock } from "./Blocks/TextBlock"; import { Popover } from "components/Popover"; import { theme } from "tailwind.config"; import { ImageAltSmall } from "components/Icons/ImageAlt"; -import { StaticMathBlock } from "./StaticMathBlock"; -import { PubCodeBlock } from "./PubCodeBlock"; +import { StaticMathBlock } from "./Blocks/StaticMathBlock"; +import { PubCodeBlock } from "./Blocks/PubCodeBlock"; import { AppBskyFeedDefs } from "@atproto/api"; -import { PubBlueskyPostBlock } from "./PublishBskyPostBlock"; +import { PubBlueskyPostBlock } from "./Blocks/PublishBskyPostBlock"; import { openPage } from "./PostPages"; import { PageLinkBlock } from "components/Blocks/PageLinkBlock"; -import { PublishedPageLinkBlock } from "./PublishedPageBlock"; -import { PublishedPollBlock } from "./PublishedPollBlock"; +import { PublishedPageLinkBlock } from "./Blocks/PublishedPageBlock"; +import { PublishedPollBlock } from "./Blocks/PublishedPollBlock"; import { PollData } from "./fetchPollData"; import { ButtonPrimary } from "components/Buttons"; @@ -173,7 +173,13 @@ export let Block = ({ let uri = b.block.postRef.uri; let post = bskyPostData.find((p) => p.uri === uri); if (!post) return
no prefetched post rip
; - return ; + return ( + + ); } case PubLeafletBlocksIframe.isMain(b.block): { return ( diff --git a/app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx b/app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx index 009ac855..1f25bbba 100644 --- a/app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx @@ -12,8 +12,8 @@ import { PubLeafletPagesLinearDocument, } from "lexicons/api"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { TextBlockCore, TextBlockCoreProps } from "./TextBlockCore"; -import { StaticMathBlock } from "./StaticMathBlock"; +import { TextBlockCore, TextBlockCoreProps } from "./Blocks/TextBlockCore"; +import { StaticMathBlock } from "./Blocks/StaticMathBlock"; import { codeToHtml, bundledLanguagesInfo, bundledThemesInfo } from "shiki"; function StaticBaseTextBlock(props: Omit) { diff --git a/components/Toolbar/TextBlockTypeToolbar.tsx b/components/Toolbar/TextBlockTypeToolbar.tsx index c3af36ee..931edc6a 100644 --- a/components/Toolbar/TextBlockTypeToolbar.tsx +++ b/components/Toolbar/TextBlockTypeToolbar.tsx @@ -114,7 +114,7 @@ export const TextBlockTypeToolbar = (props: { > - + {