diff --git a/actions/getIdentityData.ts b/actions/getIdentityData.ts index 6e8bc4f2..ec8482ad 100644 --- a/actions/getIdentityData.ts +++ b/actions/getIdentityData.ts @@ -33,9 +33,11 @@ export async function uncachedGetIdentityData() { permission_tokens!inner( id, root_entity, + title, + description, permission_token_rights(*), - leaflets_to_documents(*, documents(*)), - leaflets_in_publications(*, publications(*), documents(*)) + leaflets_to_documents(*), + leaflets_in_publications(*, publications(*)) ) ), user_subscriptions(plan, status, current_period_end), diff --git a/actions/login.ts b/actions/login.ts index ff909cf8..db5742cc 100644 --- a/actions/login.ts +++ b/actions/login.ts @@ -15,6 +15,7 @@ import { linkOrphanedEmailSubscribers } from "src/utils/linkOrphanedEmailSubscri export async function loginWithEmailToken( localLeaflets: { token: { id: string }; added_at: string }[], + redirectRoute?: string, ) { const client = await pool.connect(); const db = drizzle(client); @@ -123,4 +124,5 @@ export async function loginWithEmailToken( } } client.release(); + if (result?.identity && redirectRoute) redirect(redirectRoute); } diff --git a/actions/publications/subscribeEmail.tsx b/actions/publications/subscribeEmail.tsx index b5b5037f..d6dbad43 100644 --- a/actions/publications/subscribeEmail.tsx +++ b/actions/publications/subscribeEmail.tsx @@ -21,7 +21,7 @@ import { backfillAtprotoSubscriptionsForIdentity, publishAtprotoSubscriptionForDid, unsubscribeToPublication, -} from "app/lish/subscribeToPublication"; +} from "app/(app)/lish/subscribeToPublication"; import type { OAuthSessionError } from "src/atproto-oauth"; import { normalizePublicationRecord } from "src/utils/normalizeRecords"; import { linkOrphanedEmailSubscribers } from "src/utils/linkOrphanedEmailSubscribers"; diff --git a/app/(home-pages)/(writer)/WriterShell.tsx b/app/(app)/(home-pages)/(writer)/WriterShell.tsx similarity index 100% rename from app/(home-pages)/(writer)/WriterShell.tsx rename to app/(app)/(home-pages)/(writer)/WriterShell.tsx diff --git a/app/(home-pages)/(writer)/home/Actions/Actions.tsx b/app/(app)/(home-pages)/(writer)/home/Actions/Actions.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/Actions/Actions.tsx rename to app/(app)/(home-pages)/(writer)/home/Actions/Actions.tsx diff --git a/app/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx b/app/(app)/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx similarity index 94% rename from app/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx rename to app/(app)/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx index cb9f8f54..ffd06b9a 100644 --- a/app/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx +++ b/app/(app)/(home-pages)/(writer)/home/Actions/CreateNewButton.tsx @@ -13,9 +13,9 @@ export const CreateNewLeafletButton = (props: { compact?: boolean }) => { let isMobile = useIsMobile(); let openNewLeaflet = (id: string) => { if (isMobile) { - window.location.href = `/${id}?focusFirstBlock`; + window.location.href = `/${id}?focusFirstBlock&addToHome`; } else { - window.open(`/${id}?focusFirstBlock`, "_blank"); + window.open(`/${id}?focusFirstBlock&addToHome`, "_blank"); } }; return ( diff --git a/app/(home-pages)/(writer)/home/Actions/HomeThemeSetter.tsx b/app/(app)/(home-pages)/(writer)/home/Actions/HomeThemeSetter.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/Actions/HomeThemeSetter.tsx rename to app/(app)/(home-pages)/(writer)/home/Actions/HomeThemeSetter.tsx diff --git a/app/(home-pages)/(writer)/home/HomeEmpty/DiscoverIllo.tsx b/app/(app)/(home-pages)/(writer)/home/HomeEmpty/DiscoverIllo.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/HomeEmpty/DiscoverIllo.tsx rename to app/(app)/(home-pages)/(writer)/home/HomeEmpty/DiscoverIllo.tsx diff --git a/app/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx b/app/(app)/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx similarity index 94% rename from app/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx rename to app/(app)/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx index 517e2580..5174eea5 100644 --- a/app/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx +++ b/app/(app)/(home-pages)/(writer)/home/HomeEmpty/HomeEmpty.tsx @@ -63,9 +63,9 @@ const DocBanner = () => { onClick={async () => { let openNewLeaflet = (id: string) => { if (isMobile) { - window.location.href = `/${id}?focusFirstBlock`; + window.location.href = `/${id}?focusFirstBlock&addToHome`; } else { - window.open(`/${id}?focusFirstBlock`, "_blank"); + window.open(`/${id}?focusFirstBlock&addToHome`, "_blank"); } }; diff --git a/app/(home-pages)/(writer)/home/HomeEmpty/WelcomeToLeafletIllo.tsx b/app/(app)/(home-pages)/(writer)/home/HomeEmpty/WelcomeToLeafletIllo.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/HomeEmpty/WelcomeToLeafletIllo.tsx rename to app/(app)/(home-pages)/(writer)/home/HomeEmpty/WelcomeToLeafletIllo.tsx diff --git a/app/(home-pages)/(writer)/home/HomeLayout.tsx b/app/(app)/(home-pages)/(writer)/home/HomeLayout.tsx similarity index 79% rename from app/(home-pages)/(writer)/home/HomeLayout.tsx rename to app/(app)/(home-pages)/(writer)/home/HomeLayout.tsx index ad008f19..541418a7 100644 --- a/app/(home-pages)/(writer)/home/HomeLayout.tsx +++ b/app/(app)/(home-pages)/(writer)/home/HomeLayout.tsx @@ -2,16 +2,9 @@ import { getHomeDocs } from "./storage"; import useSWR from "swr"; -import { - Fact, - PermissionToken, - ReplicacheProvider, - useEntity, -} from "src/replicache"; +import { PermissionToken, useEntity } from "src/replicache"; import { LeafletListItem } from "./LeafletList/LeafletListItem"; import { useIdentityData } from "components/IdentityProvider"; -import type { Attribute } from "src/replicache/attributes"; -import { callRPC } from "app/api/rpc/client"; import { StaticLeafletDataContext } from "components/PageSWRDataProvider"; import { type DashboardState, @@ -24,11 +17,14 @@ import { useState } from "react"; import { useDebouncedEffect } from "src/hooks/useDebouncedEffect"; import { HomeEmptyState } from "./HomeEmpty/HomeEmpty"; import { CreateNewLeafletButton } from "./Actions/CreateNewButton"; +import { LeafletCardReplicache } from "./LeafletList/LeafletCardReplicache"; export type Leaflet = { added_at: string; archived?: boolean | null; token: PermissionToken & { + title?: string | null; + description?: string | null; leaflets_in_publications?: Exclude< GetLeafletDataReturnType["result"]["data"], null @@ -43,9 +39,6 @@ export type Leaflet = { export const HomeContent = (props: { entityID: string | null; titles: { [root_entity: string]: string }; - initialFacts: { - [root_entity: string]: Fact[]; - }; }) => { let hasBackgroundImage = !!useEntity( props.entityID, @@ -92,7 +85,6 @@ export const HomeContent = (props: { > @@ -101,43 +93,9 @@ export const HomeContent = (props: { export function HomeLeafletList(props: { titles: { [root_entity: string]: string }; - initialFacts: { - [root_entity: string]: Fact[]; - }; searchValue: string; }) { let { identity } = useIdentityData(); - let { data: initialFacts } = useSWR( - "home-leaflet-data", - async () => { - if (identity) { - let { result } = await callRPC("getFactsFromHomeLeaflets", { - tokens: identity.permission_token_on_homepage.map( - (ptrh) => ptrh.permission_tokens.root_entity, - ), - }); - let titles = { - ...result.titles, - ...identity.permission_token_on_homepage.reduce( - (acc, tok) => { - let title = - tok.permission_tokens.leaflets_in_publications[0]?.title || - tok.permission_tokens.leaflets_to_documents[0]?.title; - if (title) acc[tok.permission_tokens.root_entity] = title; - return acc; - }, - {} as { [k: string]: string }, - ), - }; - return { ...result, titles }; - } - }, - { - fallbackData: { facts: props.initialFacts, titles: props.titles }, - revalidateOnFocus: false, - revalidateOnReconnect: false, - }, - ); let { data: localLeaflets } = useSWR("leaflets", () => getHomeDocs(), { fallbackData: [], @@ -161,8 +119,7 @@ export function HomeLeafletList(props: { defaultDisplay="grid" searchValue={props.searchValue} leaflets={leaflets} - titles={initialFacts?.titles || {}} - initialFacts={initialFacts?.facts || {}} + titles={props.titles} showPreview />
@@ -174,9 +131,6 @@ export function LeafletList(props: { leaflets: Leaflet[]; titles: { [root_entity: string]: string }; defaultDisplay: Exclude; - initialFacts: { - [root_entity: string]: Fact[]; - }; searchValue: string; showPreview?: boolean; }) { @@ -199,18 +153,17 @@ export function LeafletList(props: { ${display === "grid" ? "grid auto-rows-max md:grid-cols-4 sm:grid-cols-3 grid-cols-2 gap-y-4 gap-x-4 sm:gap-x-6 sm:gap-y-5 grow" : "flex flex-col gap-2"} `} > {props.leaflets.map(({ token: leaflet, added_at, archived }, index) => ( - - + ))}
); diff --git a/app/(home-pages)/(writer)/home/IdentitySetter.tsx b/app/(app)/(home-pages)/(writer)/home/IdentitySetter.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/IdentitySetter.tsx rename to app/(app)/(home-pages)/(writer)/home/IdentitySetter.tsx diff --git a/app/(app)/(home-pages)/(writer)/home/LeafletList/HomeLeafletFactsProvider.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/HomeLeafletFactsProvider.tsx new file mode 100644 index 00000000..2835219b --- /dev/null +++ b/app/(app)/(home-pages)/(writer)/home/LeafletList/HomeLeafletFactsProvider.tsx @@ -0,0 +1,25 @@ +"use client"; + +import useSWR from "swr"; +import { create, windowScheduler } from "@yornaath/batshit"; +import { callRPC } from "app/api/rpc/client"; +import type { Fact } from "src/replicache"; +import type { Attribute } from "src/replicache/attributes"; + +const leafletFactsBatcher = create({ + fetcher: async (roots: string[]) => { + const response = await callRPC("getFactsForRoots", { roots }); + return response.result.facts as { [root: string]: Fact[] }; + }, + resolver: (results, root: string) => results[root] ?? [], + scheduler: windowScheduler(10), +}); + +export function useLeafletFacts(root: string, enabled: boolean = true) { + const { data, isLoading } = useSWR( + enabled ? `leaflet-facts:${root}` : null, + () => leafletFactsBatcher.fetch(root), + { revalidateOnFocus: false, revalidateOnReconnect: false }, + ); + return { facts: data ?? null, isLoading }; +} diff --git a/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletCardReplicache.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletCardReplicache.tsx new file mode 100644 index 00000000..db4a11de --- /dev/null +++ b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletCardReplicache.tsx @@ -0,0 +1,50 @@ +"use client"; + +import { createContext, useCallback, useContext, useMemo, useState } from "react"; +import { ReplicacheProvider, type PermissionToken } from "src/replicache"; +import { useLeafletFacts } from "./HomeLeafletFactsProvider"; + +const CardVisibilityContext = createContext<{ + notifyVisible: () => void; +} | null>(null); + +export function useReportCardVisible() { + return useContext(CardVisibilityContext); +} + +export function LeafletCardReplicache(props: { + leaflet: PermissionToken; + loggedIn: boolean; + eagerLoadFacts: boolean; + children: React.ReactNode; +}) { + const [hasBeenVisible, setHasBeenVisible] = useState(props.eagerLoadFacts); + const { facts } = useLeafletFacts( + props.leaflet.root_entity, + hasBeenVisible, + ); + + const notifyVisible = useCallback(() => { + setHasBeenVisible((v) => v || true); + }, []); + const contextValue = useMemo(() => ({ notifyVisible }), [notifyVisible]); + + const initialFacts = facts ?? []; + const providerKey = `${props.leaflet.id}:${facts ? "loaded" : "loading"}`; + + return ( + + + {props.children} + + + ); +} diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletContent.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletContent.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletContent.tsx rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletContent.tsx diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx similarity index 74% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx index b18be9bf..ce9d87f6 100644 --- a/app/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx +++ b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletInfo.tsx @@ -1,8 +1,6 @@ "use client"; -import { useEntity } from "src/replicache"; import { LeafletOptions } from "./LeafletOptions"; import { timeAgo } from "src/utils/timeAgo"; -import { usePageTitle } from "components/utils/UpdateLeafletTitle"; import { useLeafletPublicationStatus } from "components/PageSWRDataProvider"; export const LeafletInfo = (props: { @@ -19,22 +17,20 @@ export const LeafletInfo = (props: { ? timeAgo(pubStatus.publishedAt) : ""; - // Look up root page first, like UpdateLeafletTitle does - let firstPage = useEntity(pubStatus?.leafletId ?? "", "root/page")[0]; - let entityID = firstPage?.data.value || pubStatus?.leafletId || ""; - let titleFromDb = usePageTitle(entityID); - - let title = props.title ?? titleFromDb ?? "Untitled"; + let showTitle = props.loggedIn || !!props.title; + let title = props.title ?? "Untitled"; return (
-

- {title} -

-
+ {showTitle && ( +

+ {title} +

+ )} +
diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx similarity index 94% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx index 979b0fba..25d0e675 100644 --- a/app/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx +++ b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletListItem.tsx @@ -5,6 +5,7 @@ import { useState, useRef, useEffect } from "react"; import { SpeedyLink } from "components/SpeedyLink"; import { useLeafletPublicationStatus } from "components/PageSWRDataProvider"; import { useCardBorderHidden } from "components/Pages/useCardBorderHidden"; +import { useReportCardVisible } from "./LeafletCardReplicache"; export const LeafletListItem = (props: { archived?: boolean | null; @@ -18,6 +19,7 @@ export const LeafletListItem = (props: { }) => { const cardBorderHidden = useCardBorderHidden(); const pubStatus = useLeafletPublicationStatus(); + const visibilityReporter = useReportCardVisible(); let [isOnScreen, setIsOnScreen] = useState(props.index < 16 ? true : false); let previewRef = useRef(null); @@ -28,6 +30,7 @@ export const LeafletListItem = (props: { entries.forEach((entry) => { if (entry.isIntersecting) { setIsOnScreen(true); + visibilityReporter?.notifyVisible(); } else { setIsOnScreen(false); } @@ -37,7 +40,7 @@ export const LeafletListItem = (props: { ); observer.observe(previewRef.current); return () => observer.disconnect(); - }, [previewRef]); + }, [previewRef, visibilityReporter]); const tokenId = pubStatus?.shareLink ?? ""; diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx similarity index 97% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx index b87c4715..7826b684 100644 --- a/app/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx +++ b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletOptions.tsx @@ -16,7 +16,7 @@ import { UnpublishSmall } from "components/Icons/UnpublishSmall"; import { deletePost, unpublishPost, -} from "app/lish/[did]/[publication]/dashboard/deletePost"; +} from "app/(app)/lish/[did]/[publication]/dashboard/deletePost"; import { ShareSmall } from "components/Icons/ShareSmall"; import { HideSmall } from "components/Icons/HideSmall"; import { hideDoc } from "../storage"; @@ -28,8 +28,8 @@ import { import { usePublicationData, mutatePublicationData, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; -import { ShareButton } from "app/[leaflet_id]/actions/ShareOptions"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +import { ShareButton } from "app/(app)/[leaflet_id]/actions/ShareOptions"; import { useLeafletPublicationStatus } from "components/PageSWRDataProvider"; export const LeafletOptions = (props: { diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletPreview.module.css b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletPreview.module.css similarity index 100% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletPreview.module.css rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletPreview.module.css diff --git a/app/(home-pages)/(writer)/home/LeafletList/LeafletPreview.tsx b/app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletPreview.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/LeafletList/LeafletPreview.tsx rename to app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletPreview.tsx diff --git a/app/(home-pages)/(writer)/home/icon.tsx b/app/(app)/(home-pages)/(writer)/home/icon.tsx similarity index 100% rename from app/(home-pages)/(writer)/home/icon.tsx rename to app/(app)/(home-pages)/(writer)/home/icon.tsx diff --git a/app/(app)/(home-pages)/(writer)/home/page.tsx b/app/(app)/(home-pages)/(writer)/home/page.tsx new file mode 100644 index 00000000..269f9b3e --- /dev/null +++ b/app/(app)/(home-pages)/(writer)/home/page.tsx @@ -0,0 +1,28 @@ +import { getIdentityData } from "actions/getIdentityData"; + +import { HomeContent } from "./HomeLayout"; + +export default async function Home() { + let auth_res = await getIdentityData(); + + let titles = + auth_res?.permission_token_on_homepage.reduce( + (acc, tok) => { + let title = + tok.permission_tokens.leaflets_in_publications[0]?.title || + tok.permission_tokens.leaflets_to_documents[0]?.title || + tok.permission_tokens.title || + undefined; + if (title) acc[tok.permission_tokens.root_entity] = title; + return acc; + }, + {} as { [k: string]: string }, + ) ?? {}; + + return ( + + ); +} diff --git a/app/(home-pages)/(writer)/home/storage.ts b/app/(app)/(home-pages)/(writer)/home/storage.ts similarity index 100% rename from app/(home-pages)/(writer)/home/storage.ts rename to app/(app)/(home-pages)/(writer)/home/storage.ts diff --git a/app/(home-pages)/(writer)/layout.tsx b/app/(app)/(home-pages)/(writer)/layout.tsx similarity index 100% rename from app/(home-pages)/(writer)/layout.tsx rename to app/(app)/(home-pages)/(writer)/layout.tsx diff --git a/app/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx b/app/(app)/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx similarity index 55% rename from app/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx rename to app/(app)/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx index 523e48eb..78135519 100644 --- a/app/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx +++ b/app/(app)/(home-pages)/(writer)/looseleafs/LooseleafsLayout.tsx @@ -2,20 +2,14 @@ import { DashboardPageLayout } from "components/PageLayouts/DashboardPageLayout"; import { useState } from "react"; import { useDebouncedEffect } from "src/hooks/useDebouncedEffect"; -import { Fact, PermissionToken } from "src/replicache"; -import { Attribute } from "src/replicache/attributes"; -import { callRPC } from "app/api/rpc/client"; +import { PermissionToken } from "src/replicache"; import { useIdentityData } from "components/IdentityProvider"; -import useSWR from "swr"; import { Leaflet, LeafletList } from "../home/HomeLayout"; import { CreateNewLeafletButton } from "../home/Actions/CreateNewButton"; export const LooseleafsContent = (props: { entityID: string | null; titles: { [root_entity: string]: string }; - initialFacts: { - [root_entity: string]: Fact[]; - }; }) => { let [searchValue, setSearchValue] = useState(""); let [debouncedSearchValue, setDebouncedSearchValue] = useState(""); @@ -37,7 +31,6 @@ export const LooseleafsContent = (props: { > @@ -46,39 +39,9 @@ export const LooseleafsContent = (props: { export const LooseleafList = (props: { titles: { [root_entity: string]: string }; - initialFacts: { - [root_entity: string]: Fact[]; - }; searchValue: string; }) => { let { identity } = useIdentityData(); - let { data: initialFacts } = useSWR( - "home-leaflet-data", - async () => { - if (identity) { - let { result } = await callRPC("getFactsFromHomeLeaflets", { - tokens: identity.permission_token_on_homepage.map( - (ptrh) => ptrh.permission_tokens.root_entity, - ), - }); - let titles = { - ...result.titles, - ...identity.permission_token_on_homepage.reduce( - (acc, tok) => { - let title = - tok.permission_tokens.leaflets_in_publications[0]?.title || - tok.permission_tokens.leaflets_to_documents[0]?.title; - if (title) acc[tok.permission_tokens.root_entity] = title; - return acc; - }, - {} as { [k: string]: string }, - ), - }; - return { ...result, titles }; - } - }, - { fallbackData: { facts: props.initialFacts, titles: props.titles } }, - ); let leaflets: Leaflet[] = identity ? identity.permission_token_on_homepage @@ -95,8 +58,7 @@ export const LooseleafList = (props: { defaultDisplay="list" searchValue={props.searchValue} leaflets={leaflets} - titles={initialFacts?.titles || {}} - initialFacts={initialFacts?.facts || {}} + titles={props.titles} showPreview /> ); diff --git a/app/(app)/(home-pages)/(writer)/looseleafs/page.tsx b/app/(app)/(home-pages)/(writer)/looseleafs/page.tsx new file mode 100644 index 00000000..b3e19c6d --- /dev/null +++ b/app/(app)/(home-pages)/(writer)/looseleafs/page.tsx @@ -0,0 +1,27 @@ +import { getIdentityData } from "actions/getIdentityData"; +import { LooseleafsContent } from "./LooseleafsLayout"; + +export default async function Home() { + let auth_res = await getIdentityData(); + + let titles = + auth_res?.permission_token_on_homepage.reduce( + (acc, tok) => { + let title = + tok.permission_tokens.leaflets_in_publications[0]?.title || + tok.permission_tokens.leaflets_to_documents[0]?.title || + tok.permission_tokens.title || + undefined; + if (title) acc[tok.permission_tokens.root_entity] = title; + return acc; + }, + {} as { [k: string]: string }, + ) ?? {}; + + return ( + + ); +} diff --git a/app/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx similarity index 94% rename from app/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx index 0bcc7404..185fb849 100644 --- a/app/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/BskyPostEmbedNotification.tsx @@ -2,7 +2,7 @@ import { BlueskyTiny } from "components/Icons/BlueskyTiny"; import { ContentLayout, Notification } from "./Notification"; import { HydratedBskyPostEmbedNotification } from "src/notifications"; import { AtUri } from "@atproto/api"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const BskyPostEmbedNotification = ( props: HydratedBskyPostEmbedNotification, diff --git a/app/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx similarity index 97% rename from app/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx index 3bf1e63d..42b9491d 100644 --- a/app/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/CommentMentionNotification.tsx @@ -8,7 +8,7 @@ import { Notification, } from "./Notification"; import { AtUri } from "@atproto/api"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const CommentMentionNotification = ( props: HydratedCommentMentionNotification, diff --git a/app/(home-pages)/(writer)/notifications/CommentNotication.tsx b/app/(app)/(home-pages)/(writer)/notifications/CommentNotication.tsx similarity index 91% rename from app/(home-pages)/(writer)/notifications/CommentNotication.tsx rename to app/(app)/(home-pages)/(writer)/notifications/CommentNotication.tsx index fde0e160..6c753560 100644 --- a/app/(home-pages)/(writer)/notifications/CommentNotication.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/CommentNotication.tsx @@ -1,4 +1,4 @@ -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; +import { BaseTextBlock } from "app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { AppBskyActorProfile, PubLeafletComment } from "lexicons/api"; import { HydratedCommentNotification } from "src/notifications"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; @@ -10,7 +10,7 @@ import { Notification, } from "./Notification"; import { AtUri } from "@atproto/api"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const CommentNotification = (props: HydratedCommentNotification) => { const docRecord = props.normalizedDocument; diff --git a/app/(home-pages)/(writer)/notifications/FollowNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/FollowNotification.tsx similarity index 100% rename from app/(home-pages)/(writer)/notifications/FollowNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/FollowNotification.tsx diff --git a/app/(home-pages)/(writer)/notifications/MentionNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/MentionNotification.tsx similarity index 96% rename from app/(home-pages)/(writer)/notifications/MentionNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/MentionNotification.tsx index fffb783b..ed941d0c 100644 --- a/app/(home-pages)/(writer)/notifications/MentionNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/MentionNotification.tsx @@ -2,7 +2,7 @@ import { MentionTiny } from "components/Icons/MentionTiny"; import { ContentLayout, Notification } from "./Notification"; import { HydratedMentionNotification } from "src/notifications"; import { AtUri } from "@atproto/api"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const MentionNotification = (props: HydratedMentionNotification) => { const docRecord = props.normalizedDocument; diff --git a/app/(home-pages)/(writer)/notifications/Notification.tsx b/app/(app)/(home-pages)/(writer)/notifications/Notification.tsx similarity index 97% rename from app/(home-pages)/(writer)/notifications/Notification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/Notification.tsx index 62fbc905..ba317a64 100644 --- a/app/(home-pages)/(writer)/notifications/Notification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/Notification.tsx @@ -1,6 +1,6 @@ "use client"; import { Avatar } from "components/Avatar"; -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; +import { BaseTextBlock } from "app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { PubLeafletRichtextFacet } from "lexicons/api"; import { timeAgo } from "src/utils/timeAgo"; import { useReplicache, useEntity } from "src/replicache"; diff --git a/app/(home-pages)/(writer)/notifications/NotificationList.tsx b/app/(app)/(home-pages)/(writer)/notifications/NotificationList.tsx similarity index 100% rename from app/(home-pages)/(writer)/notifications/NotificationList.tsx rename to app/(app)/(home-pages)/(writer)/notifications/NotificationList.tsx diff --git a/app/(home-pages)/(writer)/notifications/QuoteNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/QuoteNotification.tsx similarity index 94% rename from app/(home-pages)/(writer)/notifications/QuoteNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/QuoteNotification.tsx index 27335ad7..4f208e4c 100644 --- a/app/(home-pages)/(writer)/notifications/QuoteNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/QuoteNotification.tsx @@ -3,7 +3,7 @@ import { ContentLayout, Notification } from "./Notification"; import { HydratedQuoteNotification } from "src/notifications"; import { AtUri } from "@atproto/api"; import { Avatar } from "components/Avatar"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const QuoteNotification = (props: HydratedQuoteNotification) => { const postView = props.bskyPost.post_view as any; diff --git a/app/(home-pages)/(writer)/notifications/RecommendNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/RecommendNotification.tsx similarity index 94% rename from app/(home-pages)/(writer)/notifications/RecommendNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/RecommendNotification.tsx index d035c7ba..03294ba9 100644 --- a/app/(home-pages)/(writer)/notifications/RecommendNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/RecommendNotification.tsx @@ -5,7 +5,7 @@ import { AppBskyActorProfile } from "lexicons/api"; import { Avatar } from "components/Avatar"; import { AtUri } from "@atproto/api"; import { RecommendTinyFilled } from "components/Icons/RecommendTiny"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const RecommendNotification = ( props: HydratedRecommendNotification, diff --git a/app/(home-pages)/(writer)/notifications/ReplyNotification.tsx b/app/(app)/(home-pages)/(writer)/notifications/ReplyNotification.tsx similarity index 93% rename from app/(home-pages)/(writer)/notifications/ReplyNotification.tsx rename to app/(app)/(home-pages)/(writer)/notifications/ReplyNotification.tsx index ad0b67e5..444bf5f4 100644 --- a/app/(home-pages)/(writer)/notifications/ReplyNotification.tsx +++ b/app/(app)/(home-pages)/(writer)/notifications/ReplyNotification.tsx @@ -1,5 +1,5 @@ import { Avatar } from "components/Avatar"; -import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; +import { BaseTextBlock } from "app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { ReplyTiny } from "components/Icons/ReplyTiny"; import { CommentInNotification, @@ -10,7 +10,7 @@ import { HydratedCommentNotification } from "src/notifications"; import { PubLeafletComment } from "lexicons/api"; import { AppBskyActorProfile, AtUri } from "@atproto/api"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export const ReplyNotification = (props: HydratedCommentNotification) => { const docRecord = props.normalizedDocument; diff --git a/app/(home-pages)/(writer)/notifications/getNotifications.ts b/app/(app)/(home-pages)/(writer)/notifications/getNotifications.ts similarity index 100% rename from app/(home-pages)/(writer)/notifications/getNotifications.ts rename to app/(app)/(home-pages)/(writer)/notifications/getNotifications.ts diff --git a/app/(home-pages)/(writer)/notifications/page.tsx b/app/(app)/(home-pages)/(writer)/notifications/page.tsx similarity index 100% rename from app/(home-pages)/(writer)/notifications/page.tsx rename to app/(app)/(home-pages)/(writer)/notifications/page.tsx diff --git a/app/(home-pages)/layout.tsx b/app/(app)/(home-pages)/layout.tsx similarity index 100% rename from app/(home-pages)/layout.tsx rename to app/(app)/(home-pages)/layout.tsx diff --git a/app/(home-pages)/p/[didOrHandle]/PostsContent.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/PostsContent.tsx similarity index 97% rename from app/(home-pages)/p/[didOrHandle]/PostsContent.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/PostsContent.tsx index 1cb70263..19f708dd 100644 --- a/app/(home-pages)/p/[didOrHandle]/PostsContent.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/PostsContent.tsx @@ -2,7 +2,7 @@ import { EmptyState } from "components/EmptyState"; import { PostListing } from "components/PostListing"; -import type { Post } from "app/(home-pages)/reader/getReaderFeed"; +import type { Post } from "app/(app)/(home-pages)/reader/getReaderFeed"; import type { Cursor } from "./getProfilePosts"; import { getProfilePosts } from "./getProfilePosts"; import useSWRInfinite from "swr/infinite"; diff --git a/app/(home-pages)/p/[didOrHandle]/ProfileHeader.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/ProfileHeader.tsx similarity index 100% rename from app/(home-pages)/p/[didOrHandle]/ProfileHeader.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/ProfileHeader.tsx diff --git a/app/(home-pages)/p/[didOrHandle]/ProfileLayout.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/ProfileLayout.tsx similarity index 100% rename from app/(home-pages)/p/[didOrHandle]/ProfileLayout.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/ProfileLayout.tsx diff --git a/app/(home-pages)/p/[didOrHandle]/ProfileTabs.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/ProfileTabs.tsx similarity index 100% rename from app/(home-pages)/p/[didOrHandle]/ProfileTabs.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/ProfileTabs.tsx diff --git a/app/(home-pages)/p/[didOrHandle]/PubListing.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/PubListing.tsx similarity index 97% rename from app/(home-pages)/p/[didOrHandle]/PubListing.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/PubListing.tsx index 0155e4b6..cf523c33 100644 --- a/app/(home-pages)/p/[didOrHandle]/PubListing.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/PubListing.tsx @@ -1,6 +1,6 @@ "use client"; import { AtUri } from "@atproto/syntax"; -import { PublicationSubscription } from "app/(home-pages)/reader/getSubscriptions"; +import { PublicationSubscription } from "app/(app)/(home-pages)/reader/getSubscriptions"; import { PubIcon } from "components/ActionBar/Publications"; import { SubscribeInput } from "components/Subscribe/SubscribeButton"; import { usePubTheme } from "components/ThemeManager/PublicationThemeProvider"; diff --git a/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx similarity index 97% rename from app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx index 39b183ac..0804d2da 100644 --- a/app/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/comments/CommentsContent.tsx @@ -7,7 +7,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]/Blocks/BaseTextBlock"; +import { BaseTextBlock } from "app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { getProfileComments, @@ -15,7 +15,7 @@ import { type Cursor, } from "./getProfileComments"; import { timeAgo } from "src/utils/timeAgo"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; export const ProfileCommentsContent = (props: { did: string; diff --git a/app/(home-pages)/p/[didOrHandle]/comments/getProfileComments.ts b/app/(app)/(home-pages)/p/[didOrHandle]/comments/getProfileComments.ts similarity index 100% rename from app/(home-pages)/p/[didOrHandle]/comments/getProfileComments.ts rename to app/(app)/(home-pages)/p/[didOrHandle]/comments/getProfileComments.ts diff --git a/app/(home-pages)/p/[didOrHandle]/comments/page.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/comments/page.tsx similarity index 91% rename from app/(home-pages)/p/[didOrHandle]/comments/page.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/comments/page.tsx index 07cad5fe..122bd4b0 100644 --- a/app/(home-pages)/p/[didOrHandle]/comments/page.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/comments/page.tsx @@ -1,4 +1,4 @@ -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { getProfileComments } from "./getProfileComments"; import { ProfileCommentsContent } from "./CommentsContent"; diff --git a/app/(home-pages)/p/[didOrHandle]/getProfilePosts.ts b/app/(app)/(home-pages)/p/[didOrHandle]/getProfilePosts.ts similarity index 94% rename from app/(home-pages)/p/[didOrHandle]/getProfilePosts.ts rename to app/(app)/(home-pages)/p/[didOrHandle]/getProfilePosts.ts index bb469e87..ee3e4be1 100644 --- a/app/(home-pages)/p/[didOrHandle]/getProfilePosts.ts +++ b/app/(app)/(home-pages)/p/[didOrHandle]/getProfilePosts.ts @@ -1,8 +1,8 @@ "use server"; import { supabaseServerClient } from "supabase/serverClient"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; -import type { Post } from "app/(home-pages)/reader/getReaderFeed"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; +import type { Post } from "app/(app)/(home-pages)/reader/getReaderFeed"; import { normalizeDocumentRecord, normalizePublicationRecord, diff --git a/app/(home-pages)/p/[didOrHandle]/layout.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/layout.tsx similarity index 98% rename from app/(home-pages)/p/[didOrHandle]/layout.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/layout.tsx index f904338a..7f2b5676 100644 --- a/app/(home-pages)/p/[didOrHandle]/layout.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/layout.tsx @@ -1,4 +1,4 @@ -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { NotFoundLayout } from "components/PageLayouts/NotFoundLayout"; import { supabaseServerClient } from "supabase/serverClient"; import { Json } from "supabase/database.types"; diff --git a/app/(home-pages)/p/[didOrHandle]/page.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/page.tsx similarity index 90% rename from app/(home-pages)/p/[didOrHandle]/page.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/page.tsx index f1d4002b..1310ebb3 100644 --- a/app/(home-pages)/p/[didOrHandle]/page.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/page.tsx @@ -1,4 +1,4 @@ -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { getProfilePosts } from "./getProfilePosts"; import { ProfilePostsContent } from "./PostsContent"; diff --git a/app/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx similarity index 93% rename from app/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx index 941edcde..e09e37dd 100644 --- a/app/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/SubscriptionsContent.tsx @@ -3,12 +3,12 @@ import { EmptyState } from "components/EmptyState"; import { useEffect, useRef } from "react"; import useSWRInfinite from "swr/infinite"; -import { PubListing } from "app/(home-pages)/p/[didOrHandle]/PubListing"; +import { PubListing } from "app/(app)/(home-pages)/p/[didOrHandle]/PubListing"; import { getSubscriptions, type PublicationSubscription, -} from "app/(home-pages)/reader/getSubscriptions"; -import { Cursor } from "app/(home-pages)/reader/getReaderFeed"; +} from "app/(app)/(home-pages)/reader/getSubscriptions"; +import { Cursor } from "app/(app)/(home-pages)/reader/getReaderFeed"; export const ProfileSubscriptionsContent = (props: { did: string; diff --git a/app/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx b/app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx similarity index 82% rename from app/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx rename to app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx index bdbe3c56..986c0bc5 100644 --- a/app/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx +++ b/app/(app)/(home-pages)/p/[didOrHandle]/subscriptions/page.tsx @@ -1,5 +1,5 @@ -import { idResolver } from "app/(home-pages)/reader/idResolver"; -import { getSubscriptions } from "app/(home-pages)/reader/getSubscriptions"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; +import { getSubscriptions } from "app/(app)/(home-pages)/reader/getSubscriptions"; import { ProfileSubscriptionsContent } from "./SubscriptionsContent"; export default async function ProfileSubscriptionsPage(props: { diff --git a/app/(home-pages)/reader/FeedLayout.tsx b/app/(app)/(home-pages)/reader/FeedLayout.tsx similarity index 100% rename from app/(home-pages)/reader/FeedLayout.tsx rename to app/(app)/(home-pages)/reader/FeedLayout.tsx diff --git a/app/(home-pages)/reader/FeedSkeleton.tsx b/app/(app)/(home-pages)/reader/FeedSkeleton.tsx similarity index 100% rename from app/(home-pages)/reader/FeedSkeleton.tsx rename to app/(app)/(home-pages)/reader/FeedSkeleton.tsx diff --git a/app/(home-pages)/reader/GlobalContent.tsx b/app/(app)/(home-pages)/reader/GlobalContent.tsx similarity index 100% rename from app/(home-pages)/reader/GlobalContent.tsx rename to app/(app)/(home-pages)/reader/GlobalContent.tsx diff --git a/app/(home-pages)/reader/InboxContent.tsx b/app/(app)/(home-pages)/reader/InboxContent.tsx similarity index 100% rename from app/(home-pages)/reader/InboxContent.tsx rename to app/(app)/(home-pages)/reader/InboxContent.tsx diff --git a/app/(home-pages)/reader/NewContent.tsx b/app/(app)/(home-pages)/reader/NewContent.tsx similarity index 100% rename from app/(home-pages)/reader/NewContent.tsx rename to app/(app)/(home-pages)/reader/NewContent.tsx diff --git a/app/(home-pages)/reader/PreviewDrawer.tsx b/app/(app)/(home-pages)/reader/PreviewDrawer.tsx similarity index 100% rename from app/(home-pages)/reader/PreviewDrawer.tsx rename to app/(app)/(home-pages)/reader/PreviewDrawer.tsx diff --git a/app/(home-pages)/reader/ReaderMentionsContent.tsx b/app/(app)/(home-pages)/reader/ReaderMentionsContent.tsx similarity index 96% rename from app/(home-pages)/reader/ReaderMentionsContent.tsx rename to app/(app)/(home-pages)/reader/ReaderMentionsContent.tsx index b379075a..5c738637 100644 --- a/app/(home-pages)/reader/ReaderMentionsContent.tsx +++ b/app/(app)/(home-pages)/reader/ReaderMentionsContent.tsx @@ -1,7 +1,7 @@ "use client"; import useSWR from "swr"; import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; -import { BskyPostContent } from "app/lish/[did]/[publication]/[rkey]/BskyPostContent"; +import { BskyPostContent } from "app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent"; import { EmptyState } from "components/EmptyState"; import { DotLoader } from "components/utils/DotLoader"; diff --git a/app/(home-pages)/reader/enrichPost.ts b/app/(app)/(home-pages)/reader/enrichPost.ts similarity index 90% rename from app/(home-pages)/reader/enrichPost.ts rename to app/(app)/(home-pages)/reader/enrichPost.ts index 0fccc8c0..9812e6f5 100644 --- a/app/(home-pages)/reader/enrichPost.ts +++ b/app/(app)/(home-pages)/reader/enrichPost.ts @@ -1,7 +1,7 @@ import { AtUri } from "@atproto/api"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; -import { getConstellationBacklinks } from "app/lish/[did]/[publication]/[rkey]/getPostPageData"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; +import { getConstellationBacklinks } from "app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { normalizeDocumentRecord, normalizePublicationRecord, diff --git a/app/(home-pages)/reader/getHotFeed.ts b/app/(app)/(home-pages)/reader/getHotFeed.ts similarity index 100% rename from app/(home-pages)/reader/getHotFeed.ts rename to app/(app)/(home-pages)/reader/getHotFeed.ts diff --git a/app/(home-pages)/reader/getNewFeed.ts b/app/(app)/(home-pages)/reader/getNewFeed.ts similarity index 100% rename from app/(home-pages)/reader/getNewFeed.ts rename to app/(app)/(home-pages)/reader/getNewFeed.ts diff --git a/app/(home-pages)/reader/getReaderFeed.ts b/app/(app)/(home-pages)/reader/getReaderFeed.ts similarity index 100% rename from app/(home-pages)/reader/getReaderFeed.ts rename to app/(app)/(home-pages)/reader/getReaderFeed.ts diff --git a/app/(home-pages)/reader/getSubscriptions.ts b/app/(app)/(home-pages)/reader/getSubscriptions.ts similarity index 100% rename from app/(home-pages)/reader/getSubscriptions.ts rename to app/(app)/(home-pages)/reader/getSubscriptions.ts diff --git a/app/(home-pages)/reader/hot/page.tsx b/app/(app)/(home-pages)/reader/hot/page.tsx similarity index 100% rename from app/(home-pages)/reader/hot/page.tsx rename to app/(app)/(home-pages)/reader/hot/page.tsx diff --git a/app/(home-pages)/reader/idResolver.ts b/app/(app)/(home-pages)/reader/idResolver.ts similarity index 100% rename from app/(home-pages)/reader/idResolver.ts rename to app/(app)/(home-pages)/reader/idResolver.ts diff --git a/app/(home-pages)/reader/layout.tsx b/app/(app)/(home-pages)/reader/layout.tsx similarity index 100% rename from app/(home-pages)/reader/layout.tsx rename to app/(app)/(home-pages)/reader/layout.tsx diff --git a/app/(home-pages)/reader/new/page.tsx b/app/(app)/(home-pages)/reader/new/page.tsx similarity index 100% rename from app/(home-pages)/reader/new/page.tsx rename to app/(app)/(home-pages)/reader/new/page.tsx diff --git a/app/(home-pages)/reader/page.tsx b/app/(app)/(home-pages)/reader/page.tsx similarity index 100% rename from app/(home-pages)/reader/page.tsx rename to app/(app)/(home-pages)/reader/page.tsx diff --git a/app/(home-pages)/reader/trending/page.tsx b/app/(app)/(home-pages)/reader/trending/page.tsx similarity index 100% rename from app/(home-pages)/reader/trending/page.tsx rename to app/(app)/(home-pages)/reader/trending/page.tsx diff --git a/app/(home-pages)/tag/[tag]/getDocumentsByTag.ts b/app/(app)/(home-pages)/tag/[tag]/getDocumentsByTag.ts similarity index 91% rename from app/(home-pages)/tag/[tag]/getDocumentsByTag.ts rename to app/(app)/(home-pages)/tag/[tag]/getDocumentsByTag.ts index 45a0214d..54ead58e 100644 --- a/app/(home-pages)/tag/[tag]/getDocumentsByTag.ts +++ b/app/(app)/(home-pages)/tag/[tag]/getDocumentsByTag.ts @@ -1,10 +1,10 @@ "use server"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { supabaseServerClient } from "supabase/serverClient"; import { AtUri } from "@atproto/api"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; -import type { Post } from "app/(home-pages)/reader/getReaderFeed"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; +import type { Post } from "app/(app)/(home-pages)/reader/getReaderFeed"; import { normalizeDocumentRecord, normalizePublicationRecord, diff --git a/app/(home-pages)/tag/[tag]/layout.tsx b/app/(app)/(home-pages)/tag/[tag]/layout.tsx similarity index 100% rename from app/(home-pages)/tag/[tag]/layout.tsx rename to app/(app)/(home-pages)/tag/[tag]/layout.tsx diff --git a/app/(home-pages)/tag/[tag]/page.tsx b/app/(app)/(home-pages)/tag/[tag]/page.tsx similarity index 100% rename from app/(home-pages)/tag/[tag]/page.tsx rename to app/(app)/(home-pages)/tag/[tag]/page.tsx diff --git a/app/[leaflet_id]/AddToHomeEffect.tsx b/app/(app)/[leaflet_id]/AddToHomeEffect.tsx similarity index 94% rename from app/[leaflet_id]/AddToHomeEffect.tsx rename to app/(app)/[leaflet_id]/AddToHomeEffect.tsx index d3d9927a..347513b9 100644 --- a/app/[leaflet_id]/AddToHomeEffect.tsx +++ b/app/(app)/[leaflet_id]/AddToHomeEffect.tsx @@ -3,7 +3,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { useEffect, useRef } from "react"; import { mutate as swrMutate } from "swr"; -import { addDocToHome } from "app/(home-pages)/(writer)/home/storage"; +import { addDocToHome } from "app/(app)/(home-pages)/(writer)/home/storage"; import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; diff --git a/app/[leaflet_id]/Footer.tsx b/app/(app)/[leaflet_id]/Footer.tsx similarity index 95% rename from app/[leaflet_id]/Footer.tsx rename to app/(app)/[leaflet_id]/Footer.tsx index e48ad8d3..2f202aa3 100644 --- a/app/[leaflet_id]/Footer.tsx +++ b/app/(app)/[leaflet_id]/Footer.tsx @@ -5,11 +5,11 @@ import { Media } from "components/Media"; import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { Toolbar } from "components/Toolbar"; import { FootnoteToolbar } from "components/Toolbar/FootnoteToolbarWrapper"; -import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; +import { ShareOptions } from "app/(app)/[leaflet_id]/actions/ShareOptions"; import { AddToHomeButton, HomeButton, -} from "app/[leaflet_id]/actions/HomeButton"; +} from "app/(app)/[leaflet_id]/actions/HomeButton"; import { PublishButton } from "./actions/PublishButton"; import { useEntitySetContext } from "components/EntitySetProvider"; import { Watermark } from "components/Watermark"; @@ -20,7 +20,7 @@ import { useEntity, useReplicache } from "src/replicache"; import { block } from "sharp"; import { PostSettings } from "components/PostSettings"; import useSWR from "swr"; -import { getHomeDocs } from "app/(home-pages)/(writer)/home/storage"; +import { getHomeDocs } from "app/(app)/(home-pages)/(writer)/home/storage"; import { useAddToHomeParam } from "./AddToHomeEffect"; export function hasBlockToolbar(blockType: string | null | undefined) { diff --git a/app/[leaflet_id]/Leaflet.tsx b/app/(app)/[leaflet_id]/Leaflet.tsx similarity index 100% rename from app/[leaflet_id]/Leaflet.tsx rename to app/(app)/[leaflet_id]/Leaflet.tsx diff --git a/app/[leaflet_id]/Sidebar.tsx b/app/(app)/[leaflet_id]/Sidebar.tsx similarity index 91% rename from app/[leaflet_id]/Sidebar.tsx rename to app/(app)/[leaflet_id]/Sidebar.tsx index 7acd1cc1..abc664df 100644 --- a/app/[leaflet_id]/Sidebar.tsx +++ b/app/(app)/[leaflet_id]/Sidebar.tsx @@ -1,17 +1,17 @@ "use client"; import { Sidebar } from "components/ActionBar/Sidebar"; import { useEntitySetContext } from "components/EntitySetProvider"; -import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; +import { HelpButton } from "app/(app)/[leaflet_id]/actions/HelpButton"; import { AddToHomeButton, HomeButton, -} from "app/[leaflet_id]/actions/HomeButton"; +} from "app/(app)/[leaflet_id]/actions/HomeButton"; import { Media } from "components/Media"; import { useLeafletPublicationData, useLeafletPublicationPage, } from "components/PageSWRDataProvider"; -import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; +import { ShareOptions } from "app/(app)/[leaflet_id]/actions/ShareOptions"; import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { PublishButton } from "./actions/PublishButton"; import { PostSettings } from "components/PostSettings"; @@ -20,7 +20,7 @@ import { BackToPubButton } from "./actions/BackToPubButton"; import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; import useSWR from "swr"; -import { getHomeDocs } from "app/(home-pages)/(writer)/home/storage"; +import { getHomeDocs } from "app/(app)/(home-pages)/(writer)/home/storage"; import { useAddToHomeParam } from "./AddToHomeEffect"; export function LeafletSidebar() { diff --git a/app/[leaflet_id]/WelcomeModal.tsx b/app/(app)/[leaflet_id]/WelcomeModal.tsx similarity index 100% rename from app/[leaflet_id]/WelcomeModal.tsx rename to app/(app)/[leaflet_id]/WelcomeModal.tsx diff --git a/app/[leaflet_id]/actions/BackToPubButton.tsx b/app/(app)/[leaflet_id]/actions/BackToPubButton.tsx similarity index 88% rename from app/[leaflet_id]/actions/BackToPubButton.tsx rename to app/(app)/[leaflet_id]/actions/BackToPubButton.tsx index 574eb57b..699495be 100644 --- a/app/[leaflet_id]/actions/BackToPubButton.tsx +++ b/app/(app)/[leaflet_id]/actions/BackToPubButton.tsx @@ -1,4 +1,4 @@ -import { getBasePublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getBasePublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { ActionButton } from "components/ActionBar/ActionButton"; import { GoBackSmall } from "components/Icons/GoBackSmall"; import { SpeedyLink } from "components/SpeedyLink"; diff --git a/app/[leaflet_id]/actions/HelpButton.tsx b/app/(app)/[leaflet_id]/actions/HelpButton.tsx similarity index 95% rename from app/[leaflet_id]/actions/HelpButton.tsx rename to app/(app)/[leaflet_id]/actions/HelpButton.tsx index 4639601a..32ab9bbb 100644 --- a/app/[leaflet_id]/actions/HelpButton.tsx +++ b/app/(app)/[leaflet_id]/actions/HelpButton.tsx @@ -1,12 +1,12 @@ "use client"; -import { ShortcutKey } from "../../../components/Layout"; -import { Media } from "../../../components/Media"; -import { Popover } from "../../../components/Popover"; +import { ShortcutKey } from "components/Layout"; +import { Media } from "components/Media"; +import { Popover } from "components/Popover"; import { metaKey } from "src/utils/metaKey"; -import { useEntitySetContext } from "../../../components/EntitySetProvider"; +import { useEntitySetContext } from "components/EntitySetProvider"; import { useState } from "react"; import { ActionButton } from "components/ActionBar/ActionButton"; -import { HelpSmall } from "../../../components/Icons/HelpSmall"; +import { HelpSmall } from "components/Icons/HelpSmall"; import { isMac } from "src/utils/isDevice"; import { useIsMobile } from "src/hooks/isMobile"; import { HelpContent } from "components/ActionBar/DesktopNavigation"; diff --git a/app/[leaflet_id]/actions/HomeButton.tsx b/app/(app)/[leaflet_id]/actions/HomeButton.tsx similarity index 81% rename from app/[leaflet_id]/actions/HomeButton.tsx rename to app/(app)/[leaflet_id]/actions/HomeButton.tsx index 3737bc58..56009706 100644 --- a/app/[leaflet_id]/actions/HomeButton.tsx +++ b/app/(app)/[leaflet_id]/actions/HomeButton.tsx @@ -1,16 +1,16 @@ "use client"; import Link from "next/link"; -import { useEntitySetContext } from "../../../components/EntitySetProvider"; +import { useEntitySetContext } from "components/EntitySetProvider"; import { ActionButton } from "components/ActionBar/ActionButton"; import { useSearchParams } from "next/navigation"; -import { useIdentityData } from "../../../components/IdentityProvider"; +import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; import { addLeafletToHome } from "actions/addLeafletToHome"; -import { useSmoker } from "../../../components/Toast"; -import { AddToHomeSmall } from "../../../components/Icons/AddToHomeSmall"; -import { HomeSmall } from "../../../components/Icons/HomeSmall"; +import { useSmoker } from "components/Toast"; +import { AddToHomeSmall } from "components/Icons/AddToHomeSmall"; +import { HomeSmall } from "components/Icons/HomeSmall"; import { produce } from "immer"; -import { addDocToHome } from "app/(home-pages)/(writer)/home/storage"; +import { addDocToHome } from "app/(app)/(home-pages)/(writer)/home/storage"; import { mutate as swrMutate } from "swr"; export function HomeButton() { @@ -52,6 +52,8 @@ export const AddToHomeButton = (props: { primary?: boolean }) => { archived: null, permission_tokens: { ...permission_token, + title: null, + description: null, leaflets_to_documents: [], leaflets_in_publications: [], }, diff --git a/app/[leaflet_id]/actions/PublishButton.tsx b/app/(app)/[leaflet_id]/actions/PublishButton.tsx similarity index 99% rename from app/[leaflet_id]/actions/PublishButton.tsx rename to app/(app)/[leaflet_id]/actions/PublishButton.tsx index 03e67857..a6df591d 100644 --- a/app/[leaflet_id]/actions/PublishButton.tsx +++ b/app/(app)/[leaflet_id]/actions/PublishButton.tsx @@ -1,6 +1,6 @@ "use client"; import { publishToPublication } from "actions/publishToPublication"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { ActionButton } from "components/ActionBar/ActionButton"; import { PubIcon, diff --git a/app/[leaflet_id]/actions/ShareOptions/DomainOptions.tsx b/app/(app)/[leaflet_id]/actions/ShareOptions/DomainOptions.tsx similarity index 100% rename from app/[leaflet_id]/actions/ShareOptions/DomainOptions.tsx rename to app/(app)/[leaflet_id]/actions/ShareOptions/DomainOptions.tsx diff --git a/app/[leaflet_id]/actions/ShareOptions/getShareLink.ts b/app/(app)/[leaflet_id]/actions/ShareOptions/getShareLink.ts similarity index 100% rename from app/[leaflet_id]/actions/ShareOptions/getShareLink.ts rename to app/(app)/[leaflet_id]/actions/ShareOptions/getShareLink.ts diff --git a/app/[leaflet_id]/actions/ShareOptions/index.tsx b/app/(app)/[leaflet_id]/actions/ShareOptions/index.tsx similarity index 99% rename from app/[leaflet_id]/actions/ShareOptions/index.tsx rename to app/(app)/[leaflet_id]/actions/ShareOptions/index.tsx index cd614893..e95c5561 100644 --- a/app/[leaflet_id]/actions/ShareOptions/index.tsx +++ b/app/(app)/[leaflet_id]/actions/ShareOptions/index.tsx @@ -17,7 +17,7 @@ import { ShareSmall } from "components/Icons/ShareSmall"; import { getPublicationURL, getDocumentURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { AtUri } from "@atproto/syntax"; import { useIsMobile } from "src/hooks/isMobile"; import { LoginModal } from "components/LoginButton"; diff --git a/app/[leaflet_id]/icon.tsx b/app/(app)/[leaflet_id]/icon.tsx similarity index 99% rename from app/[leaflet_id]/icon.tsx rename to app/(app)/[leaflet_id]/icon.tsx index 15a6a548..b725be93 100644 --- a/app/[leaflet_id]/icon.tsx +++ b/app/(app)/[leaflet_id]/icon.tsx @@ -1,7 +1,7 @@ import { ImageResponse } from "next/og"; import type { Fact } from "src/replicache"; import type { Attribute } from "src/replicache/attributes"; -import { Database } from "../../supabase/database.types"; +import { Database } from "supabase/database.types"; import { createServerClient } from "@supabase/ssr"; import { parseHSBToRGB } from "src/utils/parseHSB"; diff --git a/app/[leaflet_id]/opengraph-image.tsx b/app/(app)/[leaflet_id]/opengraph-image.tsx similarity index 100% rename from app/[leaflet_id]/opengraph-image.tsx rename to app/(app)/[leaflet_id]/opengraph-image.tsx diff --git a/app/[leaflet_id]/page.tsx b/app/(app)/[leaflet_id]/page.tsx similarity index 100% rename from app/[leaflet_id]/page.tsx rename to app/(app)/[leaflet_id]/page.tsx diff --git a/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx b/app/(app)/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx similarity index 99% rename from app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx rename to app/(app)/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx index 793aafb0..777a0059 100644 --- a/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx +++ b/app/(app)/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx @@ -9,7 +9,7 @@ import { keymap } from "prosemirror-keymap"; import { history, undo, redo } from "prosemirror-history"; import { inputRules, InputRule } from "prosemirror-inputrules"; import { autolink } from "components/Blocks/TextBlock/autolink-plugin"; -import { IOSBS } from "app/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox"; +import { IOSBS } from "app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox"; import { schema } from "components/Blocks/TextBlock/schema"; import { Mention, MentionAutocomplete } from "components/Mention"; diff --git a/app/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx b/app/(app)/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx similarity index 98% rename from app/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx rename to app/(app)/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx index df421612..9f547e53 100644 --- a/app/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx +++ b/app/(app)/[leaflet_id]/publish/PublishIllustration/PublishIllustration.tsx @@ -14,7 +14,7 @@ import { Star2, Star3, } from "./Stars"; -import { usePublicationData } from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +import { usePublicationData } from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; // TODO diff --git a/app/[leaflet_id]/publish/PublishIllustration/Stars.tsx b/app/(app)/[leaflet_id]/publish/PublishIllustration/Stars.tsx similarity index 100% rename from app/[leaflet_id]/publish/PublishIllustration/Stars.tsx rename to app/(app)/[leaflet_id]/publish/PublishIllustration/Stars.tsx diff --git a/app/[leaflet_id]/publish/PublishPost.tsx b/app/(app)/[leaflet_id]/publish/PublishPost.tsx similarity index 99% rename from app/[leaflet_id]/publish/PublishPost.tsx rename to app/(app)/[leaflet_id]/publish/PublishPost.tsx index 0d947bcc..3f11dec7 100644 --- a/app/[leaflet_id]/publish/PublishPost.tsx +++ b/app/(app)/[leaflet_id]/publish/PublishPost.tsx @@ -16,7 +16,7 @@ import { useReplicache } from "src/replicache"; import { useSubscribe } from "src/replicache/useSubscribe"; import { editorStateToFacetedText } from "./BskyPostEditorProsemirror"; import { EditorState } from "prosemirror-state"; -import { TagSelector } from "../../../components/Tags"; +import { TagSelector } from "components/Tags"; import { LooseLeafSmall } from "components/Icons/LooseleafSmall"; import { PubIcon } from "components/ActionBar/Publications"; import { OAuthErrorMessage, isOAuthSessionError } from "components/OAuthError"; @@ -34,7 +34,7 @@ import { PublicationBackgroundProvider, } from "components/ThemeManager/PublicationThemeProvider"; import { useEntity } from "src/replicache"; -import { LeafletContent } from "app/(home-pages)/(writer)/home/LeafletList/LeafletContent"; +import { LeafletContent } from "app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletContent"; type Props = { title: string; diff --git a/app/[leaflet_id]/publish/ShareOptions.tsx b/app/(app)/[leaflet_id]/publish/ShareOptions.tsx similarity index 100% rename from app/[leaflet_id]/publish/ShareOptions.tsx rename to app/(app)/[leaflet_id]/publish/ShareOptions.tsx diff --git a/app/[leaflet_id]/publish/page.tsx b/app/(app)/[leaflet_id]/publish/page.tsx similarity index 100% rename from app/[leaflet_id]/publish/page.tsx rename to app/(app)/[leaflet_id]/publish/page.tsx diff --git a/app/[leaflet_id]/publish/publishBskyPost.ts b/app/(app)/[leaflet_id]/publish/publishBskyPost.ts similarity index 100% rename from app/[leaflet_id]/publish/publishBskyPost.ts rename to app/(app)/[leaflet_id]/publish/publishBskyPost.ts diff --git a/app/checkout/pro/ProCheckoutLogin.tsx b/app/(app)/checkout/pro/ProCheckoutLogin.tsx similarity index 100% rename from app/checkout/pro/ProCheckoutLogin.tsx rename to app/(app)/checkout/pro/ProCheckoutLogin.tsx diff --git a/app/checkout/pro/ProCheckoutTrigger.tsx b/app/(app)/checkout/pro/ProCheckoutTrigger.tsx similarity index 100% rename from app/checkout/pro/ProCheckoutTrigger.tsx rename to app/(app)/checkout/pro/ProCheckoutTrigger.tsx diff --git a/app/checkout/pro/page.tsx b/app/(app)/checkout/pro/page.tsx similarity index 100% rename from app/checkout/pro/page.tsx rename to app/(app)/checkout/pro/page.tsx diff --git a/app/(app)/layout.tsx b/app/(app)/layout.tsx new file mode 100644 index 00000000..8c2729a5 --- /dev/null +++ b/app/(app)/layout.tsx @@ -0,0 +1,32 @@ +import { headers } from "next/headers"; +import { Suspense } from "react"; +import { IdentityProviderServer } from "components/IdentityProviderServer"; +import { RequestHeadersProvider } from "components/Providers/RequestHeadersProvider"; +import { RouteUIStateManager } from "components/RouteUIStateManger"; +import { SubscriptionSuccessModal } from "components/SubscriptionSuccessModal"; + +export default async function AppLayout({ + children, +}: { + children: React.ReactNode; +}) { + let headersList = await headers(); + let ipLocation = headersList.get("X-Vercel-IP-Country"); + let acceptLanguage = headersList.get("accept-language"); + let ipTimezone = headersList.get("X-Vercel-IP-Timezone"); + return ( + + + {children} + + + + + + + ); +} diff --git a/app/lish/[did]/[publication]/.well-known/site.standard.publication/route.ts b/app/(app)/lish/[did]/[publication]/.well-known/site.standard.publication/route.ts similarity index 100% rename from app/lish/[did]/[publication]/.well-known/site.standard.publication/route.ts rename to app/(app)/lish/[did]/[publication]/.well-known/site.standard.publication/route.ts diff --git a/app/lish/[did]/[publication]/LocalizedDate.tsx b/app/(app)/lish/[did]/[publication]/LocalizedDate.tsx similarity index 100% rename from app/lish/[did]/[publication]/LocalizedDate.tsx rename to app/(app)/lish/[did]/[publication]/LocalizedDate.tsx diff --git a/app/lish/[did]/[publication]/PublicationAuthor.tsx b/app/(app)/lish/[did]/[publication]/PublicationAuthor.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationAuthor.tsx rename to app/(app)/lish/[did]/[publication]/PublicationAuthor.tsx diff --git a/app/lish/[did]/[publication]/PublicationContent.tsx b/app/(app)/lish/[did]/[publication]/PublicationContent.tsx similarity index 98% rename from app/lish/[did]/[publication]/PublicationContent.tsx rename to app/(app)/lish/[did]/[publication]/PublicationContent.tsx index ab814557..137f8383 100644 --- a/app/lish/[did]/[publication]/PublicationContent.tsx +++ b/app/(app)/lish/[did]/[publication]/PublicationContent.tsx @@ -12,7 +12,7 @@ import { import { FontLoader } from "components/FontLoader"; import { SpeedyLink } from "components/SpeedyLink"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { SubscribeInput } from "components/Subscribe/SubscribeButton"; import { PublicationPostsList, diff --git a/app/lish/[did]/[publication]/PublicationFullHeader.tsx b/app/(app)/lish/[did]/[publication]/PublicationFullHeader.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationFullHeader.tsx rename to app/(app)/lish/[did]/[publication]/PublicationFullHeader.tsx diff --git a/app/lish/[did]/[publication]/PublicationHeader.tsx b/app/(app)/lish/[did]/[publication]/PublicationHeader.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationHeader.tsx rename to app/(app)/lish/[did]/[publication]/PublicationHeader.tsx diff --git a/app/lish/[did]/[publication]/PublicationHomeLayout.tsx b/app/(app)/lish/[did]/[publication]/PublicationHomeLayout.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationHomeLayout.tsx rename to app/(app)/lish/[did]/[publication]/PublicationHomeLayout.tsx diff --git a/app/lish/[did]/[publication]/PublicationNav.tsx b/app/(app)/lish/[did]/[publication]/PublicationNav.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationNav.tsx rename to app/(app)/lish/[did]/[publication]/PublicationNav.tsx diff --git a/app/lish/[did]/[publication]/PublicationPostItem.tsx b/app/(app)/lish/[did]/[publication]/PublicationPostItem.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationPostItem.tsx rename to app/(app)/lish/[did]/[publication]/PublicationPostItem.tsx diff --git a/app/lish/[did]/[publication]/PublicationPostsList.tsx b/app/(app)/lish/[did]/[publication]/PublicationPostsList.tsx similarity index 98% rename from app/lish/[did]/[publication]/PublicationPostsList.tsx rename to app/(app)/lish/[did]/[publication]/PublicationPostsList.tsx index 7fc52f06..d7d9c795 100644 --- a/app/lish/[did]/[publication]/PublicationPostsList.tsx +++ b/app/(app)/lish/[did]/[publication]/PublicationPostsList.tsx @@ -1,6 +1,6 @@ import React from "react"; import { AtUri } from "@atproto/api"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { InteractionPreview } from "components/InteractionsPreview"; import { LocalizedDate } from "./LocalizedDate"; import { PublicationPostItem } from "./PublicationContent"; diff --git a/app/lish/[did]/[publication]/PublicationStickyHeader.tsx b/app/(app)/lish/[did]/[publication]/PublicationStickyHeader.tsx similarity index 100% rename from app/lish/[did]/[publication]/PublicationStickyHeader.tsx rename to app/(app)/lish/[did]/[publication]/PublicationStickyHeader.tsx diff --git a/app/lish/[did]/[publication]/UpgradeModal.tsx b/app/(app)/lish/[did]/[publication]/UpgradeModal.tsx similarity index 100% rename from app/lish/[did]/[publication]/UpgradeModal.tsx rename to app/(app)/lish/[did]/[publication]/UpgradeModal.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/BaseTextBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PubCodeBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishBskyPostBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPageBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/PublishedPollBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/StaticMathBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/TextBlock.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Blocks/TextBlockCore.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/BlueskyQuotesPage.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/CanvasPage.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/CanvasPage.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/CanvasPage.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/CanvasPage.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx similarity index 98% rename from app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx index df7fc566..036d83b2 100644 --- a/app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/DocumentPageRenderer.tsx @@ -18,7 +18,7 @@ import { LeafletContentProvider } from "contexts/LeafletContentContext"; import { FontLoader } from "components/FontLoader"; import { mergePreferences } from "src/utils/mergePreferences"; import { PublicationNav } from "../PublicationNav"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; export async function DocumentPageRenderer({ did, diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/FootnoteCollectorContext.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/FootnoteCollectorContext.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Footnotes/FootnoteCollectorContext.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/FootnoteCollectorContext.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotePopover.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotePopover.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotePopover.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotePopover.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/recommendAction.ts b/app/(app)/lish/[did]/[publication]/[rkey]/Interactions/recommendAction.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/Interactions/recommendAction.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/Interactions/recommendAction.ts diff --git a/app/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PostContent.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/PostContent.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PostContent.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx similarity index 96% rename from app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx index e6b6f9e3..1b7852a1 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx @@ -1,5 +1,5 @@ "use client"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { Interactions, getQuoteCount, @@ -11,7 +11,7 @@ import { useIdentityData } from "components/IdentityProvider"; import { EditTiny } from "components/Icons/EditTiny"; import { SpeedyLink } from "components/SpeedyLink"; import { useLocalizedDate } from "src/hooks/useLocalizedDate"; -import Post from "app/p/[didOrHandle]/[rkey]/l-quote/[quote]/page"; +import Post from "app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/page"; import { Separator } from "components/Layout"; import { ProfilePopover } from "components/ProfilePopover"; diff --git a/app/lish/[did]/[publication]/[rkey]/PostLinks.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PostLinks.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/PostLinks.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PostLinks.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/PostPages.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PostPages.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/PostPages.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PostPages.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx similarity index 95% rename from app/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx index 3127c575..48d0f190 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx @@ -1,5 +1,5 @@ "use client"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { AtUri } from "@atproto/api"; import { useDocument } from "contexts/DocumentContext"; import { SpeedyLink } from "components/SpeedyLink"; diff --git a/app/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx similarity index 98% rename from app/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx index 2c2bcfdd..e6200ca6 100644 --- a/app/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/PublicationPageRenderer.tsx @@ -27,7 +27,7 @@ import { PublicationHeader } from "../PublicationHeader"; import { PublicationHomeLayout } from "../PublicationHomeLayout"; import { PublicationStickyHeader } from "../PublicationStickyHeader"; import { PublicationFullHeader } from "../PublicationFullHeader"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { collectAndFetchBlockResources } from "./collectAndFetchBlockResources"; diff --git a/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/StaticPostContent.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx similarity index 99% rename from app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx index d750b70e..4005c0ee 100644 --- a/app/lish/[did]/[publication]/[rkey]/ThreadPage.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/ThreadPage.tsx @@ -25,7 +25,7 @@ import { prefetchThread, } from "./PostLinks"; import { useDocument } from "contexts/DocumentContext"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { QuoteContent } from "./Interactions/Quotes"; import { decodeQuotePosition, diff --git a/app/lish/[did]/[publication]/[rkey]/collectAndFetchBlockResources.ts b/app/(app)/lish/[did]/[publication]/[rkey]/collectAndFetchBlockResources.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/collectAndFetchBlockResources.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/collectAndFetchBlockResources.ts diff --git a/app/lish/[did]/[publication]/[rkey]/extractBlocksByType.ts b/app/(app)/lish/[did]/[publication]/[rkey]/extractBlocksByType.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/extractBlocksByType.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/extractBlocksByType.ts diff --git a/app/lish/[did]/[publication]/[rkey]/extractCodeBlocks.ts b/app/(app)/lish/[did]/[publication]/[rkey]/extractCodeBlocks.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/extractCodeBlocks.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/extractCodeBlocks.ts diff --git a/app/lish/[did]/[publication]/[rkey]/fetchPollData.ts b/app/(app)/lish/[did]/[publication]/[rkey]/fetchPollData.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/fetchPollData.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/fetchPollData.ts diff --git a/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts b/app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData.ts similarity index 98% rename from app/lish/[did]/[publication]/[rkey]/getPostPageData.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData.ts index 2110fb31..7491b021 100644 --- a/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts +++ b/app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData.ts @@ -6,7 +6,7 @@ import { } from "src/utils/normalizeRecords"; import { PubLeafletPublication, SiteStandardPublication } from "lexicons/api"; import { documentUriFilter } from "src/utils/uriHelpers"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export async function getPostPageData(did: string, rkey: string) { let { data: documents } = await supabaseServerClient diff --git a/app/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts b/app/(app)/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts similarity index 91% rename from app/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts index 0233bdac..1de70cbd 100644 --- a/app/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts +++ b/app/(app)/lish/[did]/[publication]/[rkey]/getVoterIdentities.ts @@ -1,6 +1,6 @@ "use server"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; export type VoterIdentity = { did: string; diff --git a/app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/opengraph-image.ts b/app/(app)/lish/[did]/[publication]/[rkey]/l-quote/[quote]/opengraph-image.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/opengraph-image.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/l-quote/[quote]/opengraph-image.ts diff --git a/app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx similarity index 58% rename from app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx index 91335db9..a94aadd4 100644 --- a/app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx +++ b/app/(app)/lish/[did]/[publication]/[rkey]/l-quote/[quote]/page.tsx @@ -1,8 +1,8 @@ import PostPage, { generateMetadata, -} from "app/lish/[did]/[publication]/[rkey]/page"; +} from "app/(app)/lish/[did]/[publication]/[rkey]/page"; -export { generateMetadata } from "app/lish/[did]/[publication]/[rkey]/page"; +export { generateMetadata } from "app/(app)/lish/[did]/[publication]/[rkey]/page"; export default async function Post(props: { params: Promise<{ publication: string; did: string; rkey: string }>; }) { diff --git a/app/lish/[did]/[publication]/[rkey]/opengraph-image.ts b/app/(app)/lish/[did]/[publication]/[rkey]/opengraph-image.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/opengraph-image.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/opengraph-image.ts diff --git a/app/lish/[did]/[publication]/[rkey]/page.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/page.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/page.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/postPageState.ts b/app/(app)/lish/[did]/[publication]/[rkey]/postPageState.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/postPageState.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/postPageState.ts diff --git a/app/lish/[did]/[publication]/[rkey]/quotePosition.ts b/app/(app)/lish/[did]/[publication]/[rkey]/quotePosition.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/quotePosition.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/quotePosition.ts diff --git a/app/lish/[did]/[publication]/[rkey]/useHighlight.tsx b/app/(app)/lish/[did]/[publication]/[rkey]/useHighlight.tsx similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/useHighlight.tsx rename to app/(app)/lish/[did]/[publication]/[rkey]/useHighlight.tsx diff --git a/app/lish/[did]/[publication]/[rkey]/voteOnPublishedPoll.ts b/app/(app)/lish/[did]/[publication]/[rkey]/voteOnPublishedPoll.ts similarity index 100% rename from app/lish/[did]/[publication]/[rkey]/voteOnPublishedPoll.ts rename to app/(app)/lish/[did]/[publication]/[rkey]/voteOnPublishedPoll.ts diff --git a/app/lish/[did]/[publication]/atom/route.ts b/app/(app)/lish/[did]/[publication]/atom/route.ts similarity index 100% rename from app/lish/[did]/[publication]/atom/route.ts rename to app/(app)/lish/[did]/[publication]/atom/route.ts diff --git a/app/lish/[did]/[publication]/dashboard/Actions.tsx b/app/(app)/lish/[did]/[publication]/dashboard/Actions.tsx similarity index 96% rename from app/lish/[did]/[publication]/dashboard/Actions.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/Actions.tsx index bd2cc862..ff082f4d 100644 --- a/app/lish/[did]/[publication]/dashboard/Actions.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/Actions.tsx @@ -4,7 +4,7 @@ import { NewDraftActionButton } from "./NewDraftButton"; import { ActionButton } from "components/ActionBar/ActionButton"; import { ShareSmall } from "components/Icons/ShareSmall"; import { Menu, MenuItem } from "components/Menu"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { usePublicationData } from "./PublicationSWRProvider"; import { useSmoker } from "components/Toast"; import { useIsMobile } from "src/hooks/isMobile"; diff --git a/app/lish/[did]/[publication]/dashboard/DraftList.tsx b/app/(app)/lish/[did]/[publication]/dashboard/DraftList.tsx similarity index 90% rename from app/lish/[did]/[publication]/dashboard/DraftList.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/DraftList.tsx index ddce3c10..5a0e143d 100644 --- a/app/lish/[did]/[publication]/dashboard/DraftList.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/DraftList.tsx @@ -5,7 +5,7 @@ import { usePublicationData, useNormalizedPublicationRecord, } from "./PublicationSWRProvider"; -import { LeafletList } from "app/(home-pages)/(writer)/home/HomeLayout"; +import { LeafletList } from "app/(app)/(home-pages)/(writer)/home/HomeLayout"; export function DraftList(props: { searchValue: string; @@ -15,7 +15,7 @@ export function DraftList(props: { // Normalize the publication record - skip rendering if unrecognized format const normalizedPubRecord = useNormalizedPublicationRecord(); if (!pub_data?.publication) return null; - const { drafts, leaflet_data } = pub_data; + const { drafts } = pub_data; const { leaflets_in_publications, ...publication } = pub_data.publication; if (!normalizedPubRecord) return null; @@ -41,7 +41,6 @@ export function DraftList(props: { ], }, }))} - initialFacts={leaflet_data.facts || {}} titles={{ ...drafts.reduce( (acc, draft) => { diff --git a/app/lish/[did]/[publication]/dashboard/DraftsTab.tsx b/app/(app)/lish/[did]/[publication]/dashboard/DraftsTab.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/DraftsTab.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/DraftsTab.tsx diff --git a/app/lish/[did]/[publication]/dashboard/EditPagesNavLink.tsx b/app/(app)/lish/[did]/[publication]/dashboard/EditPagesNavLink.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/EditPagesNavLink.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/EditPagesNavLink.tsx diff --git a/app/lish/[did]/[publication]/dashboard/NewDraftButton.tsx b/app/(app)/lish/[did]/[publication]/dashboard/NewDraftButton.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/NewDraftButton.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/NewDraftButton.tsx diff --git a/app/lish/[did]/[publication]/dashboard/PublicationSWRProvider.tsx b/app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/PublicationSWRProvider.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider.tsx diff --git a/app/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx b/app/(app)/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx similarity index 99% rename from app/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx index 809a9808..420865cf 100644 --- a/app/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/PublicationSubscribers.tsx @@ -1,7 +1,7 @@ "use client"; import { usePublicationData } from "./PublicationSWRProvider"; import { ButtonPrimary } from "components/Buttons"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { useSmoker } from "components/Toast"; import { Menu, MenuItem } from "components/Menu"; import { Separator } from "components/Layout"; diff --git a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx b/app/(app)/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx similarity index 98% rename from app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx index 4f81b24f..ea8cfc3d 100644 --- a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx @@ -13,11 +13,11 @@ import { useParams } from "next/navigation"; import { getPublicationURL, getDocumentURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { SpeedyLink } from "components/SpeedyLink"; import { InteractionPreview } from "components/InteractionsPreview"; import { useLocalizedDate } from "src/hooks/useLocalizedDate"; -import { LeafletOptions } from "app/(home-pages)/(writer)/home/LeafletList/LeafletOptions"; +import { LeafletOptions } from "app/(app)/(home-pages)/(writer)/home/LeafletList/LeafletOptions"; import { StaticLeafletDataContext } from "components/PageSWRDataProvider"; export function PublishedPostsList(props: { diff --git a/app/lish/[did]/[publication]/dashboard/analytics/ChartTooltip.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/ChartTooltip.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/ChartTooltip.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/ChartTooltip.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/PublicationAnalytics.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/PublicationAnalytics.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/PublicationAnalytics.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/PublicationAnalytics.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/Skeletons.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/Skeletons.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/Skeletons.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/Skeletons.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/SubscribersChart.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/SubscribersChart.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/SubscribersChart.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/SubscribersChart.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/TrafficChart.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/TrafficChart.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/TrafficChart.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/TrafficChart.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/dates.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/dates.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/dates.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/dates.tsx diff --git a/app/lish/[did]/[publication]/dashboard/analytics/page.tsx b/app/(app)/lish/[did]/[publication]/dashboard/analytics/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/analytics/page.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/analytics/page.tsx diff --git a/app/lish/[did]/[publication]/dashboard/deleteDraft.ts b/app/(app)/lish/[did]/[publication]/dashboard/deleteDraft.ts similarity index 100% rename from app/lish/[did]/[publication]/dashboard/deleteDraft.ts rename to app/(app)/lish/[did]/[publication]/dashboard/deleteDraft.ts diff --git a/app/lish/[did]/[publication]/dashboard/deletePost.ts b/app/(app)/lish/[did]/[publication]/dashboard/deletePost.ts similarity index 100% rename from app/lish/[did]/[publication]/dashboard/deletePost.ts rename to app/(app)/lish/[did]/[publication]/dashboard/deletePost.ts diff --git a/app/lish/[did]/[publication]/dashboard/layout.tsx b/app/(app)/lish/[did]/[publication]/dashboard/layout.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/layout.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/layout.tsx diff --git a/app/lish/[did]/[publication]/dashboard/page.tsx b/app/(app)/lish/[did]/[publication]/dashboard/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/page.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/page.tsx diff --git a/app/lish/[did]/[publication]/dashboard/posts/page.tsx b/app/(app)/lish/[did]/[publication]/dashboard/posts/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/posts/page.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/posts/page.tsx diff --git a/app/lish/[did]/[publication]/dashboard/settings/GeneralSettings.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/GeneralSettings.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/GeneralSettings.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/GeneralSettings.tsx diff --git a/app/lish/[did]/[publication]/dashboard/settings/PostSettings.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/PostSettings.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/PostSettings.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/PostSettings.tsx diff --git a/app/lish/[did]/[publication]/dashboard/settings/ProSettings.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/ProSettings.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/ProSettings.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/ProSettings.tsx diff --git a/app/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx similarity index 99% rename from app/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx index 78ac94f5..15bc7973 100644 --- a/app/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/settings/PubDomainSettings.tsx @@ -16,7 +16,7 @@ import { usePublicationData, useNormalizedPublicationRecord, } from "../PublicationSWRProvider"; -import { updatePublicationBasePath } from "app/lish/createPub/updatePublication"; +import { updatePublicationBasePath } from "app/(app)/lish/createPub/updatePublication"; import { assignDomainToPublication, removeDomainAssignment, diff --git a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx similarity index 99% rename from app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx index 34b608bf..f8b8d1f9 100644 --- a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx +++ b/app/(app)/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx @@ -9,7 +9,7 @@ import { usePublicationData, useNormalizedPublicationRecord, } from "../PublicationSWRProvider"; -import { updatePublication } from "app/lish/createPub/updatePublication"; +import { updatePublication } from "app/(app)/lish/createPub/updatePublication"; import { PubDomainSettings } from "./PubDomainSettings"; import { GeneralSettings } from "./GeneralSettings"; import { PostSettings } from "./PostSettings"; diff --git a/app/lish/[did]/[publication]/dashboard/settings/ThemeSettings.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/ThemeSettings.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/ThemeSettings.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/ThemeSettings.tsx diff --git a/app/lish/[did]/[publication]/dashboard/settings/deletePublication.ts b/app/(app)/lish/[did]/[publication]/dashboard/settings/deletePublication.ts similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/deletePublication.ts rename to app/(app)/lish/[did]/[publication]/dashboard/settings/deletePublication.ts diff --git a/app/lish/[did]/[publication]/dashboard/settings/page.tsx b/app/(app)/lish/[did]/[publication]/dashboard/settings/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/settings/page.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/settings/page.tsx diff --git a/app/lish/[did]/[publication]/dashboard/subs/page.tsx b/app/(app)/lish/[did]/[publication]/dashboard/subs/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/dashboard/subs/page.tsx rename to app/(app)/lish/[did]/[publication]/dashboard/subs/page.tsx diff --git a/app/lish/[did]/[publication]/edit/[[...route]]/PublicationEditHeader.tsx b/app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationEditHeader.tsx similarity index 100% rename from app/lish/[did]/[publication]/edit/[[...route]]/PublicationEditHeader.tsx rename to app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationEditHeader.tsx diff --git a/app/lish/[did]/[publication]/edit/[[...route]]/PublicationPageLeaflet.tsx b/app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationPageLeaflet.tsx similarity index 100% rename from app/lish/[did]/[publication]/edit/[[...route]]/PublicationPageLeaflet.tsx rename to app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationPageLeaflet.tsx diff --git a/app/lish/[did]/[publication]/edit/[[...route]]/PublicationPagesNav.tsx b/app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationPagesNav.tsx similarity index 100% rename from app/lish/[did]/[publication]/edit/[[...route]]/PublicationPagesNav.tsx rename to app/(app)/lish/[did]/[publication]/edit/[[...route]]/PublicationPagesNav.tsx diff --git a/app/lish/[did]/[publication]/edit/[[...route]]/layout.tsx b/app/(app)/lish/[did]/[publication]/edit/[[...route]]/layout.tsx similarity index 100% rename from app/lish/[did]/[publication]/edit/[[...route]]/layout.tsx rename to app/(app)/lish/[did]/[publication]/edit/[[...route]]/layout.tsx diff --git a/app/lish/[did]/[publication]/edit/[[...route]]/page.tsx b/app/(app)/lish/[did]/[publication]/edit/[[...route]]/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/edit/[[...route]]/page.tsx rename to app/(app)/lish/[did]/[publication]/edit/[[...route]]/page.tsx diff --git a/app/lish/[did]/[publication]/generateFeed.ts b/app/(app)/lish/[did]/[publication]/generateFeed.ts similarity index 98% rename from app/lish/[did]/[publication]/generateFeed.ts rename to app/(app)/lish/[did]/[publication]/generateFeed.ts index abe30c65..b1d5e73c 100644 --- a/app/lish/[did]/[publication]/generateFeed.ts +++ b/app/(app)/lish/[did]/[publication]/generateFeed.ts @@ -11,7 +11,7 @@ import { hasLeafletContent, } from "src/utils/normalizeRecords"; import { publicationNameOrUriFilter } from "src/utils/uriHelpers"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; export async function generateFeed( did: string, diff --git a/app/lish/[did]/[publication]/icon/route.ts b/app/(app)/lish/[did]/[publication]/icon/route.ts similarity index 100% rename from app/lish/[did]/[publication]/icon/route.ts rename to app/(app)/lish/[did]/[publication]/icon/route.ts diff --git a/app/lish/[did]/[publication]/json/route.ts b/app/(app)/lish/[did]/[publication]/json/route.ts similarity index 100% rename from app/lish/[did]/[publication]/json/route.ts rename to app/(app)/lish/[did]/[publication]/json/route.ts diff --git a/app/lish/[did]/[publication]/layout.tsx b/app/(app)/lish/[did]/[publication]/layout.tsx similarity index 100% rename from app/lish/[did]/[publication]/layout.tsx rename to app/(app)/lish/[did]/[publication]/layout.tsx diff --git a/app/lish/[did]/[publication]/opengraph-image.ts b/app/(app)/lish/[did]/[publication]/opengraph-image.ts similarity index 100% rename from app/lish/[did]/[publication]/opengraph-image.ts rename to app/(app)/lish/[did]/[publication]/opengraph-image.ts diff --git a/app/lish/[did]/[publication]/page.tsx b/app/(app)/lish/[did]/[publication]/page.tsx similarity index 98% rename from app/lish/[did]/[publication]/page.tsx rename to app/(app)/lish/[did]/[publication]/page.tsx index e20844dc..2642de53 100644 --- a/app/lish/[did]/[publication]/page.tsx +++ b/app/(app)/lish/[did]/[publication]/page.tsx @@ -2,7 +2,7 @@ import { supabaseServerClient } from "supabase/serverClient"; import { getPublicationURL, getDocumentURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { BskyAgent } from "@atproto/api"; import { publicationNameOrUriFilter } from "src/utils/uriHelpers"; import React from "react"; diff --git a/app/lish/[did]/[publication]/rss/route.ts b/app/(app)/lish/[did]/[publication]/rss/route.ts similarity index 100% rename from app/lish/[did]/[publication]/rss/route.ts rename to app/(app)/lish/[did]/[publication]/rss/route.ts diff --git a/app/lish/[did]/[publication]/sortPublicationPages.ts b/app/(app)/lish/[did]/[publication]/sortPublicationPages.ts similarity index 100% rename from app/lish/[did]/[publication]/sortPublicationPages.ts rename to app/(app)/lish/[did]/[publication]/sortPublicationPages.ts diff --git a/app/lish/[did]/[publication]/subscribeSuccess/page.tsx b/app/(app)/lish/[did]/[publication]/subscribeSuccess/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/subscribeSuccess/page.tsx rename to app/(app)/lish/[did]/[publication]/subscribeSuccess/page.tsx diff --git a/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx b/app/(app)/lish/[did]/[publication]/theme-settings/PostPreview.tsx similarity index 95% rename from app/lish/[did]/[publication]/theme-settings/PostPreview.tsx rename to app/(app)/lish/[did]/[publication]/theme-settings/PostPreview.tsx index eea2b08d..350ad265 100644 --- a/app/lish/[did]/[publication]/theme-settings/PostPreview.tsx +++ b/app/(app)/lish/[did]/[publication]/theme-settings/PostPreview.tsx @@ -1,6 +1,6 @@ "use client"; -import { LinearDocumentPage } from "app/lish/[did]/[publication]/[rkey]/LinearDocumentPage"; +import { LinearDocumentPage } from "app/(app)/lish/[did]/[publication]/[rkey]/LinearDocumentPage"; import { LeafletContentProvider } from "contexts/LeafletContentContext"; import { DocumentProvider, @@ -9,7 +9,7 @@ import { import { useIdentityData } from "components/IdentityProvider"; import type { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import type { PubLeafletPagesLinearDocument } from "lexicons/api"; -import type { PostPageData } from "app/lish/[did]/[publication]/[rkey]/getPostPageData"; +import type { PostPageData } from "app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData"; import type { DocumentContextValue } from "contexts/DocumentContext"; import { usePublicationData, diff --git a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx b/app/(app)/lish/[did]/[publication]/theme-settings/PubPreview.tsx similarity index 97% rename from app/lish/[did]/[publication]/theme-settings/PubPreview.tsx rename to app/(app)/lish/[did]/[publication]/theme-settings/PubPreview.tsx index 27887ef4..a1316aa5 100644 --- a/app/lish/[did]/[publication]/theme-settings/PubPreview.tsx +++ b/app/(app)/lish/[did]/[publication]/theme-settings/PubPreview.tsx @@ -3,7 +3,7 @@ import { usePublicationData, useNormalizedPublicationRecord, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; import { useIdentityData } from "components/IdentityProvider"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import { PublicationContent } from "../PublicationContent"; diff --git a/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx b/app/(app)/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx similarity index 100% rename from app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx rename to app/(app)/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx diff --git a/app/lish/[did]/[publication]/theme-settings/page.tsx b/app/(app)/lish/[did]/[publication]/theme-settings/page.tsx similarity index 100% rename from app/lish/[did]/[publication]/theme-settings/page.tsx rename to app/(app)/lish/[did]/[publication]/theme-settings/page.tsx diff --git a/app/lish/[did]/[publication]/theme-settings/postPreviewFakeBlocks.ts b/app/(app)/lish/[did]/[publication]/theme-settings/postPreviewFakeBlocks.ts similarity index 100% rename from app/lish/[did]/[publication]/theme-settings/postPreviewFakeBlocks.ts rename to app/(app)/lish/[did]/[publication]/theme-settings/postPreviewFakeBlocks.ts diff --git a/app/lish/[did]/[publication]/tryRenderPublicationPage.tsx b/app/(app)/lish/[did]/[publication]/tryRenderPublicationPage.tsx similarity index 100% rename from app/lish/[did]/[publication]/tryRenderPublicationPage.tsx rename to app/(app)/lish/[did]/[publication]/tryRenderPublicationPage.tsx diff --git a/app/lish/addFeed.tsx b/app/(app)/lish/addFeed.tsx similarity index 100% rename from app/lish/addFeed.tsx rename to app/(app)/lish/addFeed.tsx diff --git a/app/lish/createPub/CreatePubForm.tsx b/app/(app)/lish/createPub/CreatePubForm.tsx similarity index 100% rename from app/lish/createPub/CreatePubForm.tsx rename to app/(app)/lish/createPub/CreatePubForm.tsx diff --git a/app/lish/createPub/UpdatePubForm.tsx b/app/(app)/lish/createPub/UpdatePubForm.tsx similarity index 100% rename from app/lish/createPub/UpdatePubForm.tsx rename to app/(app)/lish/createPub/UpdatePubForm.tsx diff --git a/app/lish/createPub/createPublication.ts b/app/(app)/lish/createPub/createPublication.ts similarity index 100% rename from app/lish/createPub/createPublication.ts rename to app/(app)/lish/createPub/createPublication.ts diff --git a/app/lish/createPub/getPublicationURL.ts b/app/(app)/lish/createPub/getPublicationURL.ts similarity index 100% rename from app/lish/createPub/getPublicationURL.ts rename to app/(app)/lish/createPub/getPublicationURL.ts diff --git a/app/lish/createPub/page.tsx b/app/(app)/lish/createPub/page.tsx similarity index 100% rename from app/lish/createPub/page.tsx rename to app/(app)/lish/createPub/page.tsx diff --git a/app/lish/createPub/updatePublication.ts b/app/(app)/lish/createPub/updatePublication.ts similarity index 100% rename from app/lish/createPub/updatePublication.ts rename to app/(app)/lish/createPub/updatePublication.ts diff --git a/app/lish/feeds/[...path]/route.ts b/app/(app)/lish/feeds/[...path]/route.ts similarity index 100% rename from app/lish/feeds/[...path]/route.ts rename to app/(app)/lish/feeds/[...path]/route.ts diff --git a/app/lish/sorry-boris/fixFeeds.ts b/app/(app)/lish/sorry-boris/fixFeeds.ts similarity index 100% rename from app/lish/sorry-boris/fixFeeds.ts rename to app/(app)/lish/sorry-boris/fixFeeds.ts diff --git a/app/lish/sorry-boris/fixFeedsButton.tsx b/app/(app)/lish/sorry-boris/fixFeedsButton.tsx similarity index 100% rename from app/lish/sorry-boris/fixFeedsButton.tsx rename to app/(app)/lish/sorry-boris/fixFeedsButton.tsx diff --git a/app/lish/sorry-boris/page.tsx b/app/(app)/lish/sorry-boris/page.tsx similarity index 100% rename from app/lish/sorry-boris/page.tsx rename to app/(app)/lish/sorry-boris/page.tsx diff --git a/app/lish/subscribeToPublication.ts b/app/(app)/lish/subscribeToPublication.ts similarity index 100% rename from app/lish/subscribeToPublication.ts rename to app/(app)/lish/subscribeToPublication.ts diff --git a/app/lish/uri/[uri]/route.ts b/app/(app)/lish/uri/[uri]/route.ts similarity index 100% rename from app/lish/uri/[uri]/route.ts rename to app/(app)/lish/uri/[uri]/route.ts diff --git a/app/lish/url/[url]/route.tsx b/app/(app)/lish/url/[url]/route.tsx similarity index 100% rename from app/lish/url/[url]/route.tsx rename to app/(app)/lish/url/[url]/route.tsx diff --git a/app/merge-accounts/page.tsx b/app/(app)/merge-accounts/page.tsx similarity index 100% rename from app/merge-accounts/page.tsx rename to app/(app)/merge-accounts/page.tsx diff --git a/app/new/route.ts b/app/(app)/new/route.ts similarity index 100% rename from app/new/route.ts rename to app/(app)/new/route.ts diff --git a/app/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts b/app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts similarity index 87% rename from app/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts rename to app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts index 7d8af8ff..0329e9e3 100644 --- a/app/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts +++ b/app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/opengraph-image.ts @@ -1,5 +1,5 @@ import { getMicroLinkOgImage } from "src/utils/getMicroLinkOgImage"; -import { decodeQuotePosition } from "app/lish/[did]/[publication]/[rkey]/quotePosition"; +import { decodeQuotePosition } from "app/(app)/lish/[did]/[publication]/[rkey]/quotePosition"; export const runtime = "edge"; export const revalidate = 60; diff --git a/app/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx b/app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx similarity index 51% rename from app/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx rename to app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx index ccabe15e..59414165 100644 --- a/app/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx +++ b/app/(app)/p/[didOrHandle]/[rkey]/l-quote/[quote]/page.tsx @@ -1,6 +1,6 @@ -import PostPage from "app/p/[didOrHandle]/[rkey]/page"; +import PostPage from "app/(app)/p/[didOrHandle]/[rkey]/page"; -export { generateMetadata } from "app/p/[didOrHandle]/[rkey]/page"; +export { generateMetadata } from "app/(app)/p/[didOrHandle]/[rkey]/page"; export default async function Post(props: { params: Promise<{ didOrHandle: string; rkey: string }>; }) { diff --git a/app/p/[didOrHandle]/[rkey]/opengraph-image.ts b/app/(app)/p/[didOrHandle]/[rkey]/opengraph-image.ts similarity index 97% rename from app/p/[didOrHandle]/[rkey]/opengraph-image.ts rename to app/(app)/p/[didOrHandle]/[rkey]/opengraph-image.ts index 2cd0a78e..95d713c4 100644 --- a/app/p/[didOrHandle]/[rkey]/opengraph-image.ts +++ b/app/(app)/p/[didOrHandle]/[rkey]/opengraph-image.ts @@ -1,7 +1,7 @@ import { getMicroLinkOgImage } from "src/utils/getMicroLinkOgImage"; import { supabaseServerClient } from "supabase/serverClient"; import { jsonToLex } from "@atproto/lexicon"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { fetchAtprotoBlob } from "app/api/atproto_images/route"; import { normalizeDocumentRecord } from "src/utils/normalizeRecords"; import { documentUriFilter } from "src/utils/uriHelpers"; diff --git a/app/p/[didOrHandle]/[rkey]/page.tsx b/app/(app)/p/[didOrHandle]/[rkey]/page.tsx similarity index 93% rename from app/p/[didOrHandle]/[rkey]/page.tsx rename to app/(app)/p/[didOrHandle]/[rkey]/page.tsx index 000f64ba..e1316f84 100644 --- a/app/p/[didOrHandle]/[rkey]/page.tsx +++ b/app/(app)/p/[didOrHandle]/[rkey]/page.tsx @@ -1,7 +1,7 @@ import { supabaseServerClient } from "supabase/serverClient"; import { Metadata } from "next"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; -import { DocumentPageRenderer } from "app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; +import { DocumentPageRenderer } from "app/(app)/lish/[did]/[publication]/[rkey]/DocumentPageRenderer"; import { NotFoundLayout } from "components/PageLayouts/NotFoundLayout"; import { normalizeDocumentRecord } from "src/utils/normalizeRecords"; import { documentUriFilter } from "src/utils/uriHelpers"; diff --git a/app/(home-pages)/(writer)/home/page.tsx b/app/(home-pages)/(writer)/home/page.tsx deleted file mode 100644 index 45163cd9..00000000 --- a/app/(home-pages)/(writer)/home/page.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { getIdentityData } from "actions/getIdentityData"; -import { getFactsFromHomeLeaflets } from "app/api/rpc/[command]/getFactsFromHomeLeaflets"; -import { supabaseServerClient } from "supabase/serverClient"; - -import { HomeContent } from "./HomeLayout"; - -export default async function Home() { - let auth_res = await getIdentityData(); - - let [allLeafletFacts] = await Promise.all([ - auth_res - ? getFactsFromHomeLeaflets.handler( - { - tokens: auth_res.permission_token_on_homepage.map( - (r) => r.permission_tokens.root_entity, - ), - }, - { supabase: supabaseServerClient }, - ) - : undefined, - ]); - - let home_docs_initialFacts = allLeafletFacts?.result || {}; - - return ( - { - let title = - tok.permission_tokens.leaflets_in_publications[0]?.title || - tok.permission_tokens.leaflets_to_documents[0]?.title; - if (title) acc[tok.permission_tokens.root_entity] = title; - return acc; - }, - {} as { [k: string]: string }, - ), - }} - entityID={auth_res?.home_leaflet?.root_entity || null} - initialFacts={home_docs_initialFacts.facts || {}} - /> - ); -} diff --git a/app/(home-pages)/(writer)/looseleafs/page.tsx b/app/(home-pages)/(writer)/looseleafs/page.tsx deleted file mode 100644 index 462e8e99..00000000 --- a/app/(home-pages)/(writer)/looseleafs/page.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { getIdentityData } from "actions/getIdentityData"; -import { getFactsFromHomeLeaflets } from "app/api/rpc/[command]/getFactsFromHomeLeaflets"; -import { supabaseServerClient } from "supabase/serverClient"; -import { LooseleafsContent } from "./LooseleafsLayout"; - -export default async function Home() { - let auth_res = await getIdentityData(); - - let [allLeafletFacts] = await Promise.all([ - auth_res - ? getFactsFromHomeLeaflets.handler( - { - tokens: auth_res.permission_token_on_homepage.map( - (r) => r.permission_tokens.root_entity, - ), - }, - { supabase: supabaseServerClient }, - ) - : undefined, - ]); - - let home_docs_initialFacts = allLeafletFacts?.result || {}; - - return ( - { - let title = - tok.permission_tokens.leaflets_in_publications[0]?.title || - tok.permission_tokens.leaflets_to_documents[0]?.title; - if (title) acc[tok.permission_tokens.root_entity] = title; - return acc; - }, - {} as { [k: string]: string }, - ), - }} - initialFacts={home_docs_initialFacts.facts || {}} - /> - ); -} diff --git a/app/(home-pages)/page.tsx b/app/(home-pages)/page.tsx deleted file mode 100644 index 1922786b..00000000 --- a/app/(home-pages)/page.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Metadata } from "next"; -import { cookies } from "next/headers"; -import { redirect } from "next/navigation"; -import { AboutPage } from "../about/AboutPage"; - -export const metadata: Metadata = { - title: "Leaflet — social publishing on the Atmosphere", - description: - "A simple and powerful platform for social publishing — blogs, newsletters, and more!", -}; - -export default async function RootPage() { - const cookieStore = await cookies(); - const hasAuth = - cookieStore.has("auth_token") || cookieStore.has("external_auth_token"); - - if (!hasAuth) return ; - - const navState = cookieStore.get("nav-state")?.value; - if (navState === "reader") redirect("/reader"); - - redirect("/home"); -} diff --git a/app/about/Examples.tsx b/app/about/Examples.tsx index 6a981097..a6f483b3 100644 --- a/app/about/Examples.tsx +++ b/app/about/Examples.tsx @@ -1,8 +1,8 @@ import { GoToArrow } from "components/Icons/GoToArrow"; import { supabaseServerClient } from "supabase/serverClient"; import { normalizePublicationRecord } from "src/utils/normalizeRecords"; -import { PubListing } from "app/(home-pages)/p/[didOrHandle]/PubListing"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { PubListing } from "app/(app)/(home-pages)/p/[didOrHandle]/PubListing"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { SpeedyLink } from "components/SpeedyLink"; const pubs = [ diff --git a/app/about/LandingCTA.tsx b/app/about/LandingCTA.tsx index 4ef728b9..5d51f1f5 100644 --- a/app/about/LandingCTA.tsx +++ b/app/about/LandingCTA.tsx @@ -1,15 +1,17 @@ "use client"; import Link from "next/link"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { LoginModal } from "components/LoginButton"; import { ButtonPrimary, ButtonSecondary } from "components/Buttons"; import { Input } from "components/Input"; -import { useIdentityData } from "components/IdentityProvider"; +import { getIdentityData } from "actions/getIdentityData"; export function LandingCTA() { let [loginOpen, setLoginOpen] = useState(false); - let { identity } = useIdentityData(); - let signedIn = !!identity?.atp_did; + let [signedIn, setSignedIn] = useState(false); + useEffect(() => { + getIdentityData().then((identity) => setSignedIn(!!identity?.atp_did)); + }, []); return (
{signedIn ? ( diff --git a/app/about/page.tsx b/app/about/page.tsx index fb74a6d9..8f664b9a 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -6,6 +6,8 @@ export const metadata = { "A simple and powerful platform for social publishing — blogs, newsletters, and more!", }; -export default async function About() { +export const revalidate = 3600; + +export default function About() { return ; } diff --git a/app/api/inngest/functions/index_post_mention.ts b/app/api/inngest/functions/index_post_mention.ts index 0763fd9c..e34965a9 100644 --- a/app/api/inngest/functions/index_post_mention.ts +++ b/app/api/inngest/functions/index_post_mention.ts @@ -8,7 +8,7 @@ import { pingIdentityToUpdateNotification, } from "src/notifications"; import { v7 } from "uuid"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { documentUriFilter } from "src/utils/uriHelpers"; export const index_post_mention = inngest.createFunction( diff --git a/app/api/inngest/functions/sync_document_metadata.ts b/app/api/inngest/functions/sync_document_metadata.ts index 7765faa9..908a7209 100644 --- a/app/api/inngest/functions/sync_document_metadata.ts +++ b/app/api/inngest/functions/sync_document_metadata.ts @@ -1,7 +1,7 @@ import { inngest, events } from "../client"; import { supabaseServerClient } from "supabase/serverClient"; import { AtpAgent, AtUri } from "@atproto/api"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import type { Json } from "supabase/database.types"; // 1m, 2m, 4m, 8m, 16m, 32m, 1h, 2h, 4h, 8h, 8h, 8h (~37h total) diff --git a/app/api/oauth/[route]/route.ts b/app/api/oauth/[route]/route.ts index 0afbd016..e97aaf8c 100644 --- a/app/api/oauth/[route]/route.ts +++ b/app/api/oauth/[route]/route.ts @@ -1,7 +1,7 @@ import { backfillAtprotoSubscriptionsForIdentity, subscribeToPublication, -} from "app/lish/subscribeToPublication"; +} from "app/(app)/lish/subscribeToPublication"; import { cookies } from "next/headers"; import { redirect } from "next/navigation"; import { NextRequest, NextResponse } from "next/server"; diff --git a/app/api/rpc/[command]/getFactsForRoots.ts b/app/api/rpc/[command]/getFactsForRoots.ts new file mode 100644 index 00000000..8d98953b --- /dev/null +++ b/app/api/rpc/[command]/getFactsForRoots.ts @@ -0,0 +1,23 @@ +import { z } from "zod"; +import type { Fact } from "src/replicache"; +import type { Attribute } from "src/replicache/attributes"; +import { makeRoute } from "../lib"; +import type { Env } from "./route"; + +export const getFactsForRoots = makeRoute({ + route: "getFactsForRoots", + input: z.object({ + roots: z.array(z.string()), + }), + handler: async ({ roots }, { supabase }: Pick) => { + const { data } = await supabase.rpc("get_facts_for_roots", { + max_depth: 3, + roots, + }); + const facts: { [root: string]: Fact[] } = {}; + for (const f of data ?? []) { + (facts[f.root_id] ??= []).push(f as unknown as Fact); + } + return { result: { facts } }; + }, +}); diff --git a/app/api/rpc/[command]/getFactsFromHomeLeaflets.ts b/app/api/rpc/[command]/getFactsFromHomeLeaflets.ts deleted file mode 100644 index 0b953c72..00000000 --- a/app/api/rpc/[command]/getFactsFromHomeLeaflets.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { z } from "zod"; -import type { Fact } from "src/replicache"; -import type { Attribute } from "src/replicache/attributes"; -import { makeRoute } from "../lib"; -import type { Env } from "./route"; -import { scanIndexLocal } from "src/replicache/utils"; -import * as base64 from "base64-js"; -import { YJSFragmentToString } from "src/utils/yjsFragmentToString"; -import { applyUpdate, Doc } from "yjs"; - -export const getFactsFromHomeLeaflets = makeRoute({ - route: "getFactsFromHomeLeaflets", - input: z.object({ - tokens: z.array(z.string()), - }), - handler: async ({ tokens }, { supabase }: Pick) => { - let all_facts = await supabase.rpc("get_facts_for_roots", { - max_depth: 3, - roots: tokens, - }); - - if (all_facts.data) { - let titles = {} as { [key: string]: string }; - - let facts = all_facts.data.reduce( - (acc, fact) => { - if (!acc[fact.root_id]) acc[fact.root_id] = []; - acc[fact.root_id].push(fact as unknown as Fact); - return acc; - }, - {} as { [key: string]: Fact[] }, - ); - for (let token of tokens) { - let scan = scanIndexLocal(facts[token] || []); - let [root] = scan.eav(token, "root/page"); - let rootEntity = root?.data.value || token; - - // Check page type to determine which blocks to look up - let [pageType] = scan.eav(rootEntity, "page/type"); - let isCanvas = pageType?.data.value === "canvas"; - - // Get blocks and sort by position - let rawBlocks = isCanvas - ? scan.eav(rootEntity, "canvas/block").sort((a, b) => { - if (a.data.position.y === b.data.position.y) - return a.data.position.x - b.data.position.x; - return a.data.position.y - b.data.position.y; - }) - : scan.eav(rootEntity, "card/block").sort((a, b) => { - if (a.data.position === b.data.position) - return a.id > b.id ? 1 : -1; - return a.data.position > b.data.position ? 1 : -1; - }); - - // Map to get type and filter for text/heading - let blocks = rawBlocks - .map((b) => { - let type = scan.eav(b.data.value, "block/type")[0]; - if ( - !type || - (type.data.value !== "text" && type.data.value !== "heading") - ) - return null; - return b.data; - }) - .filter((b): b is NonNullable => b !== null); - - let title = blocks[0]; - - if (!title) titles[token] = "Untitled"; - else { - let [content] = scan.eav(title.value, "block/text"); - if (!content) titles[token] = "Untitled"; - else { - let doc = new Doc(); - const update = base64.toByteArray(content.data.value); - applyUpdate(doc, update); - let nodes = doc.getXmlElement("prosemirror").toArray(); - let stringValue = YJSFragmentToString(nodes[0]); - titles[token] = stringValue; - } - } - } - return { - result: { facts, titles }, - }; - } - - return { result: {} }; - }, -}); diff --git a/app/api/rpc/[command]/get_document_interactions.ts b/app/api/rpc/[command]/get_document_interactions.ts index da5bf774..24d6fae2 100644 --- a/app/api/rpc/[command]/get_document_interactions.ts +++ b/app/api/rpc/[command]/get_document_interactions.ts @@ -1,8 +1,8 @@ import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; -import { getConstellationBacklinks } from "app/lish/[did]/[publication]/[rkey]/getPostPageData"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getConstellationBacklinks } from "app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { normalizeDocumentRecord, normalizePublicationRecord, diff --git a/app/api/rpc/[command]/get_hot_feed.ts b/app/api/rpc/[command]/get_hot_feed.ts index c7811086..6825a898 100644 --- a/app/api/rpc/[command]/get_hot_feed.ts +++ b/app/api/rpc/[command]/get_hot_feed.ts @@ -1,8 +1,8 @@ import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; -import { getHotFeed } from "app/(home-pages)/reader/getHotFeed"; -import type { Post } from "app/(home-pages)/reader/getReaderFeed"; +import { getHotFeed } from "app/(app)/(home-pages)/reader/getHotFeed"; +import type { Post } from "app/(app)/(home-pages)/reader/getReaderFeed"; export type GetHotFeedReturnType = Awaited< ReturnType<(typeof get_hot_feed)["handler"]> diff --git a/app/api/rpc/[command]/get_profile_data.ts b/app/api/rpc/[command]/get_profile_data.ts index f1b40b8b..eb069f86 100644 --- a/app/api/rpc/[command]/get_profile_data.ts +++ b/app/api/rpc/[command]/get_profile_data.ts @@ -1,7 +1,7 @@ import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { supabaseServerClient } from "supabase/serverClient"; import { Agent } from "@atproto/api"; import { getIdentityData } from "actions/getIdentityData"; diff --git a/app/api/rpc/[command]/get_publication_data.ts b/app/api/rpc/[command]/get_publication_data.ts index e682963c..aa329b3f 100644 --- a/app/api/rpc/[command]/get_publication_data.ts +++ b/app/api/rpc/[command]/get_publication_data.ts @@ -2,7 +2,6 @@ import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; import { AtUri } from "@atproto/syntax"; -import { getFactsFromHomeLeaflets } from "./getFactsFromHomeLeaflets"; import { normalizeDocumentRecord } from "src/utils/normalizeRecords"; import { ids } from "lexicons/api/lexicons"; @@ -69,20 +68,6 @@ export const get_publication_data = makeRoute({ .limit(1) .single(); - let leaflet_data = await getFactsFromHomeLeaflets.handler( - { - tokens: [ - ...(publication?.leaflets_in_publications.map( - (l) => l.permission_tokens?.root_entity!, - ) || []), - ...(publication?.publication_pages.map( - (p) => p.permission_tokens?.root_entity!, - ) || []), - ].filter(Boolean), - }, - { supabase }, - ); - // Pre-normalize documents from documents_in_publications const documents = (publication?.documents_in_publications || []) .map((dip) => { @@ -140,7 +125,6 @@ export const get_publication_data = makeRoute({ documents, drafts, pages, - leaflet_data: leaflet_data.result, }, }; }, diff --git a/app/api/rpc/[command]/route.ts b/app/api/rpc/[command]/route.ts index eccbae45..a1c86ec6 100644 --- a/app/api/rpc/[command]/route.ts +++ b/app/api/rpc/[command]/route.ts @@ -3,7 +3,7 @@ import { push } from "./push"; import { createClient } from "@supabase/supabase-js"; import { Database } from "supabase/database.types"; import { pull } from "./pull"; -import { getFactsFromHomeLeaflets } from "./getFactsFromHomeLeaflets"; +import { getFactsForRoots } from "./getFactsForRoots"; import { Vercel } from "@vercel/sdk"; import { get_domain_status, @@ -41,7 +41,7 @@ export type Routes = typeof Routes; let Routes = [ push, pull, - getFactsFromHomeLeaflets, + getFactsForRoots, get_domain_status, get_leaflet_subdomain_status, get_leaflet_data, diff --git a/app/api/rpc/[command]/search_publication_documents.ts b/app/api/rpc/[command]/search_publication_documents.ts index a52be5f6..7be59c7f 100644 --- a/app/api/rpc/[command]/search_publication_documents.ts +++ b/app/api/rpc/[command]/search_publication_documents.ts @@ -2,7 +2,7 @@ import { AtUri } from "@atproto/api"; import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { normalizeDocumentRecord } from "src/utils/normalizeRecords"; export type SearchPublicationDocumentsReturnType = Awaited< diff --git a/app/api/rpc/[command]/search_publication_names.ts b/app/api/rpc/[command]/search_publication_names.ts index e5ab9ed7..d480b4d7 100644 --- a/app/api/rpc/[command]/search_publication_names.ts +++ b/app/api/rpc/[command]/search_publication_names.ts @@ -1,7 +1,7 @@ import { z } from "zod"; import { makeRoute } from "../lib"; import type { Env } from "./route"; -import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { deduplicateByUri } from "src/utils/deduplicateRecords"; export type SearchPublicationNamesReturnType = Awaited< diff --git a/app/layout.tsx b/app/layout.tsx index 0b31dcdd..3a175e1b 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -5,12 +5,6 @@ import { Analytics } from "@vercel/analytics/react"; import "./globals.css"; import localFont from "next/font/local"; import { PopUpProvider } from "components/Toast"; -import { IdentityProviderServer } from "components/IdentityProviderServer"; -import { headers } from "next/headers"; -import { RequestHeadersProvider } from "components/Providers/RequestHeadersProvider"; -import { RouteUIStateManager } from "components/RouteUIStateManger"; -import { SubscriptionSuccessModal } from "components/SubscriptionSuccessModal"; -import { Suspense } from "react"; export const metadata = { title: "Leaflet", @@ -53,15 +47,11 @@ const quattro = localFont({ variable: "--font-quattro", }); -export default async function RootLayout({ +export default function RootLayout({ children, }: { children: React.ReactNode; }) { - let headersList = await headers(); - let ipLocation = headersList.get("X-Vercel-IP-Country"); - let acceptLanguage = headersList.get("accept-language"); - let ipTimezone = headersList.get("X-Vercel-IP-Timezone"); return ( @@ -82,19 +72,7 @@ export default async function RootLayout({ - - - {children} - - - - - - + {children} diff --git a/app/legal/page.tsx b/app/legal/page.tsx index cdcb869d..023f6540 100644 --- a/app/legal/page.tsx +++ b/app/legal/page.tsx @@ -1,9 +1,12 @@ +import { Suspense } from "react"; import { LegalContent } from "./content"; export default function Legal() { return (
- + + +
); } diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 00000000..28ee1cb3 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,14 @@ +import type { Metadata } from "next"; +import { AboutPage } from "./about/AboutPage"; + +export const metadata: Metadata = { + title: "Leaflet — social publishing on the Atmosphere", + description: + "A simple and powerful platform for social publishing — blogs, newsletters, and more!", +}; + +export const revalidate = 3600; + +export default function RootPage() { + return ; +} diff --git a/components/ActionBar/ProfileButton.tsx b/components/ActionBar/ProfileButton.tsx index 7095c51c..f102762d 100644 --- a/components/ActionBar/ProfileButton.tsx +++ b/components/ActionBar/ProfileButton.tsx @@ -10,8 +10,8 @@ import { mutate } from "swr"; import { SpeedyLink } from "components/SpeedyLink"; import { Popover } from "components/Popover"; import { Modal } from "components/Modal"; -import { InlineUpgradeToPro } from "app/lish/[did]/[publication]/UpgradeModal"; -import { ManageProSubscription } from "app/lish/[did]/[publication]/dashboard/settings/ProSettings"; +import { InlineUpgradeToPro } from "app/(app)/lish/[did]/[publication]/UpgradeModal"; +import { ManageProSubscription } from "app/(app)/lish/[did]/[publication]/dashboard/settings/ProSettings"; import { ManageDomains } from "components/Domains/ManageDomains"; import { WebSmall } from "components/Icons/WebSmall"; import { useIsPro, useCanSeePro } from "src/hooks/useEntitlement"; diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx index b542d670..8fbfd3a3 100644 --- a/components/ActionBar/Publications.tsx +++ b/components/ActionBar/Publications.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { useIdentityData } from "components/IdentityProvider"; import { theme } from "tailwind.config"; -import { getBasePublicationURL } from "app/lish/createPub/getPublicationURL"; +import { getBasePublicationURL } from "app/(app)/lish/createPub/getPublicationURL"; import { Json } from "supabase/database.types"; import { AtUri } from "@atproto/syntax"; import { ActionButton } from "./ActionButton"; @@ -16,7 +16,7 @@ import { ButtonPrimary, ButtonSecondary } from "components/Buttons"; import { LooseLeafSmall } from "components/Icons/LooseleafSmall"; import { LoginModal } from "components/LoginButton"; import useSWR from "swr"; -import { getHomeDocs } from "app/(home-pages)/(writer)/home/storage"; +import { getHomeDocs } from "app/(app)/(home-pages)/(writer)/home/storage"; export const PublicationButtons = (props: { className?: string }) => { let { identity } = useIdentityData(); diff --git a/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx b/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx index e9bc72f8..ecd4c4f6 100644 --- a/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx +++ b/components/Blocks/BlueskyPostBlock/BlueskyEmbed.tsx @@ -14,7 +14,7 @@ import { Avatar } from "components/Avatar"; import { OpenPage, openPage, -} from "app/lish/[did]/[publication]/[rkey]/PostPages"; +} from "app/(app)/lish/[did]/[publication]/[rkey]/PostPages"; import { BlueskyVideoPlayer } from "./BlueskyVideoPlayer"; export const BlueskyEmbed = (props: { diff --git a/components/Blocks/BlueskyPostBlock/index.tsx b/components/Blocks/BlueskyPostBlock/index.tsx index 050a3c27..f1fee141 100644 --- a/components/Blocks/BlueskyPostBlock/index.tsx +++ b/components/Blocks/BlueskyPostBlock/index.tsx @@ -9,7 +9,7 @@ import { AppBskyFeedDefs } from "@atproto/api"; import { PostNotAvailable } from "./BlueskyEmbed"; import { BlueskyPostEmpty } from "./BlueskyEmpty"; -import { BskyPostContent } from "app/lish/[did]/[publication]/[rkey]/BskyPostContent"; +import { BskyPostContent } from "app/(app)/lish/[did]/[publication]/[rkey]/BskyPostContent"; import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; export const BlueskyPostBlock = (props: BlockProps & { preview?: boolean }) => { diff --git a/components/Blocks/PostsListBlock.tsx b/components/Blocks/PostsListBlock.tsx index 4aa66c19..ac6b798a 100644 --- a/components/Blocks/PostsListBlock.tsx +++ b/components/Blocks/PostsListBlock.tsx @@ -5,8 +5,8 @@ import { BlockProps, BlockLayout } from "./Block"; import { usePublicationData, useNormalizedPublicationRecord, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; -import { PublicationPostsList } from "app/lish/[did]/[publication]/PublicationPostsList"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +import { PublicationPostsList } from "app/(app)/lish/[did]/[publication]/PublicationPostsList"; import { Popover } from "components/Popover"; import { Toggle } from "components/Toggle"; import { ToggleGroup } from "components/ToggleGroup"; diff --git a/components/Blocks/StandardSitePostBlock/StandardSitePostItem.tsx b/components/Blocks/StandardSitePostBlock/StandardSitePostItem.tsx index ac9083a3..ce7225b3 100644 --- a/components/Blocks/StandardSitePostBlock/StandardSitePostItem.tsx +++ b/components/Blocks/StandardSitePostBlock/StandardSitePostItem.tsx @@ -5,12 +5,12 @@ import { PublicationPostItemSmall, PublicationPostItemMedium, PublicationPostItemLarge, -} from "app/lish/[did]/[publication]/PublicationPostItem"; -import { LocalizedDate } from "app/lish/[did]/[publication]/LocalizedDate"; +} from "app/(app)/lish/[did]/[publication]/PublicationPostItem"; +import { LocalizedDate } from "app/(app)/lish/[did]/[publication]/LocalizedDate"; import { getDocumentURL, getPublicationURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { getFirstParagraph } from "src/utils/getFirstParagraph"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { useStandardSitePost } from "components/StandardSitePostDataProvider"; diff --git a/components/Blocks/TextBlock/index.tsx b/components/Blocks/TextBlock/index.tsx index d157bdfb..b3b532e3 100644 --- a/components/Blocks/TextBlock/index.tsx +++ b/components/Blocks/TextBlock/index.tsx @@ -30,7 +30,7 @@ import { blockTextSize } from "src/utils/blockTextSize"; import { getAspectRatio } from "src/utils/aspectRatio"; import { Mention, MentionAutocomplete } from "components/Mention"; -import { addMentionToEditor } from "app/[leaflet_id]/publish/BskyPostEditorProsemirror"; +import { addMentionToEditor } from "app/(app)/[leaflet_id]/publish/BskyPostEditorProsemirror"; import { v7 } from "uuid"; import { generateKeyBetween } from "fractional-indexing"; diff --git a/components/DesktopFooter.tsx b/components/DesktopFooter.tsx index 976b47b7..e0184344 100644 --- a/components/DesktopFooter.tsx +++ b/components/DesktopFooter.tsx @@ -5,7 +5,7 @@ import { Toolbar } from "./Toolbar"; import { FootnoteToolbar } from "./Toolbar/FootnoteToolbarWrapper"; import { useEntitySetContext } from "./EntitySetProvider"; import { focusBlock } from "src/utils/focusBlock"; -import { hasBlockToolbar } from "app/[leaflet_id]/Footer"; +import { hasBlockToolbar } from "app/(app)/[leaflet_id]/Footer"; import { useEntity } from "src/replicache"; export function DesktopPageFooter(props: { pageID: string }) { diff --git a/components/Domains/PublicationDomains.tsx b/components/Domains/PublicationDomains.tsx index 3cfa3881..ec9d25fe 100644 --- a/components/Domains/PublicationDomains.tsx +++ b/components/Domains/PublicationDomains.tsx @@ -11,8 +11,8 @@ import { ButtonPrimary } from "components/Buttons"; import { usePublicationData, useNormalizedPublicationRecord, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; -import { updatePublicationBasePath } from "app/lish/createPub/updatePublication"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +import { updatePublicationBasePath } from "app/(app)/lish/createPub/updatePublication"; import { assignDomainToPublication, removeDomainAssignment, diff --git a/components/LoginButton.tsx b/components/LoginButton.tsx index 81820aa8..89a82ae9 100644 --- a/components/LoginButton.tsx +++ b/components/LoginButton.tsx @@ -19,7 +19,7 @@ import { confirmEmailAuthToken, } from "actions/emailAuth"; import { loginWithEmailToken } from "actions/login"; -import { getHomeDocs } from "app/(home-pages)/(writer)/home/storage"; +import { getHomeDocs } from "app/(app)/(home-pages)/(writer)/home/storage"; import { mutate } from "swr"; export const LoginModal = (props: { @@ -116,7 +116,10 @@ export const LoginContent = (props: { return; } const localLeaflets = getHomeDocs(); - await loginWithEmailToken(localLeaflets.filter((l) => !l.hidden)); + await loginWithEmailToken( + localLeaflets.filter((l) => !l.hidden), + props.redirectRoute, + ); mutate("identity"); toaster({ content:
Logged in! Welcome!
, diff --git a/components/PageLayouts/NotificationContent.tsx b/components/PageLayouts/NotificationContent.tsx index 81729524..956560bd 100644 --- a/components/PageLayouts/NotificationContent.tsx +++ b/components/PageLayouts/NotificationContent.tsx @@ -1,8 +1,8 @@ "use client"; import { useEffect, useState } from "react"; import { DashboardPageLayout } from "./DashboardPageLayout"; -import { NotificationList } from "app/(home-pages)/(writer)/notifications/NotificationList"; -import { getNotifications } from "app/(home-pages)/(writer)/notifications/getNotifications"; +import { NotificationList } from "app/(app)/(home-pages)/(writer)/notifications/NotificationList"; +import { getNotifications } from "app/(app)/(home-pages)/(writer)/notifications/getNotifications"; import { HydratedNotification } from "src/notifications"; export function NotificationContent() { diff --git a/components/PageSWRDataProvider.tsx b/components/PageSWRDataProvider.tsx index d97b4b08..105b96bd 100644 --- a/components/PageSWRDataProvider.tsx +++ b/components/PageSWRDataProvider.tsx @@ -10,7 +10,7 @@ import { getPublicationMetadataFromLeafletData } from "src/utils/getPublicationM import { getPublicationURL, getDocumentURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { AtUri } from "@atproto/syntax"; import { normalizeDocumentRecord, diff --git a/components/Pages/Page.tsx b/components/Pages/Page.tsx index e314a5e4..f783963e 100644 --- a/components/Pages/Page.tsx +++ b/components/Pages/Page.tsx @@ -16,7 +16,7 @@ import { useCardBorderHidden } from "./useCardBorderHidden"; import { focusPage } from "src/utils/focusPage"; import { PageOptions } from "./PageOptions"; import { CardThemeProvider } from "components/ThemeManager/ThemeProvider"; -import { useDrawerOpen } from "app/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer"; +import { useDrawerOpen } from "app/(app)/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer"; import { usePreserveScroll } from "src/hooks/usePreserveScroll"; import { usePageFootnotes } from "components/Footnotes/usePageFootnotes"; import { FootnoteContext } from "components/Footnotes/FootnoteContext"; diff --git a/components/Pages/PageShareMenu.tsx b/components/Pages/PageShareMenu.tsx index 11174ab4..d6ef16a8 100644 --- a/components/Pages/PageShareMenu.tsx +++ b/components/Pages/PageShareMenu.tsx @@ -2,7 +2,7 @@ import { useLeafletDomains } from "components/PageSWRDataProvider"; import { ShareButton, useReadOnlyShareLink, -} from "app/[leaflet_id]/actions/ShareOptions"; +} from "app/(app)/[leaflet_id]/actions/ShareOptions"; import { useEffect, useState } from "react"; export const PageShareMenu = (props: { entityID: string }) => { diff --git a/components/Pages/PublicationMetadata.tsx b/components/Pages/PublicationMetadata.tsx index db93e85f..1a10e1ad 100644 --- a/components/Pages/PublicationMetadata.tsx +++ b/components/Pages/PublicationMetadata.tsx @@ -8,7 +8,7 @@ import { AtUri } from "@atproto/syntax"; import { getBasePublicationURL, getPublicationURL, -} from "app/lish/createPub/getPublicationURL"; +} from "app/(app)/lish/createPub/getPublicationURL"; import { useSubscribe } from "src/replicache/useSubscribe"; import { useEntitySetContext } from "components/EntitySetProvider"; import { timeAgo } from "src/utils/timeAgo"; @@ -18,7 +18,7 @@ import { TagTiny } from "components/Icons/TagTiny"; import { Popover } from "components/Popover"; import { TagSelector } from "components/Tags"; import { useIdentityData } from "components/IdentityProvider"; -import { PostHeaderLayout } from "app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader"; +import { PostHeaderLayout } from "app/(app)/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader"; import { Backdater } from "./Backdater"; import { RecommendTinyEmpty } from "components/Icons/RecommendTiny"; import { mergePreferences } from "src/utils/mergePreferences"; diff --git a/components/Pages/index.tsx b/components/Pages/index.tsx index 537a769e..e9c663df 100644 --- a/components/Pages/index.tsx +++ b/components/Pages/index.tsx @@ -8,7 +8,7 @@ import { useEntity } from "src/replicache"; import { useCardBorderHidden } from "./useCardBorderHidden"; import { BookendSpacer, SandwichSpacer } from "components/LeafletLayout"; -import { LeafletSidebar } from "app/[leaflet_id]/Sidebar"; +import { LeafletSidebar } from "app/(app)/[leaflet_id]/Sidebar"; import { Page } from "./Page"; import { IframePageView } from "./IframePageView"; import { PageOptionButton } from "./PageOptions"; diff --git a/components/PostListing.tsx b/components/PostListing.tsx index 648ddcad..6452ccdd 100644 --- a/components/PostListing.tsx +++ b/components/PostListing.tsx @@ -9,7 +9,7 @@ import type { NormalizedPublication, } from "src/utils/normalizeRecords"; import { hasLeafletContent } from "lexicons/src/normalize"; -import type { Post } from "app/(home-pages)/reader/getReaderFeed"; +import type { Post } from "app/(app)/(home-pages)/reader/getReaderFeed"; import Link from "next/link"; import { useEffect, useRef, useState } from "react"; @@ -22,7 +22,7 @@ import { ShareTiny } from "./Icons/ShareTiny"; import { useSelectedPostListing } from "src/useSelectedPostState"; import { mergePreferences } from "src/utils/mergePreferences"; import { ExternalLinkTiny } from "./Icons/ExternalLinkTiny"; -import { getDocumentURL } from "app/lish/createPub/getPublicationURL"; +import { getDocumentURL } from "app/(app)/lish/createPub/getPublicationURL"; import { RecommendButton } from "./RecommendButton"; import { getFirstParagraph } from "src/utils/getFirstParagraph"; diff --git a/components/ProfilePopover.tsx b/components/ProfilePopover.tsx index 8c19163c..925f8bfd 100644 --- a/components/ProfilePopover.tsx +++ b/components/ProfilePopover.tsx @@ -3,7 +3,7 @@ import { Popover } from "./Popover"; import useSWR from "swr"; import { callRPC } from "app/api/rpc/client"; import { useRef, useState } from "react"; -import { ProfileHeader } from "app/(home-pages)/p/[didOrHandle]/ProfileHeader"; +import { ProfileHeader } from "app/(app)/(home-pages)/p/[didOrHandle]/ProfileHeader"; import { SpeedyLink } from "./SpeedyLink"; import { Tooltip } from "./Tooltip"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; diff --git a/components/RecommendButton.tsx b/components/RecommendButton.tsx index 2855069c..ee1e686a 100644 --- a/components/RecommendButton.tsx +++ b/components/RecommendButton.tsx @@ -7,7 +7,7 @@ import { RecommendTinyEmpty, RecommendTinyFilled } from "./Icons/RecommendTiny"; import { recommendAction, unrecommendAction, -} from "app/lish/[did]/[publication]/[rkey]/Interactions/recommendAction"; +} from "app/(app)/lish/[did]/[publication]/[rkey]/Interactions/recommendAction"; import { callRPC } from "app/api/rpc/client"; import { useSmoker, useToaster } from "./Toast"; import { OAuthErrorMessage, isOAuthSessionError } from "./OAuthError"; diff --git a/components/Subscribe/HandleSubscribe.tsx b/components/Subscribe/HandleSubscribe.tsx index dfa7df97..343273df 100644 --- a/components/Subscribe/HandleSubscribe.tsx +++ b/components/Subscribe/HandleSubscribe.tsx @@ -4,7 +4,7 @@ import { Popover } from "components/Popover"; import Link from "next/link"; import { useState } from "react"; import { encodeActionToSearchParam } from "app/api/oauth/[route]/afterSignInActions"; -import { subscribeToPublication } from "app/lish/subscribeToPublication"; +import { subscribeToPublication } from "app/(app)/lish/subscribeToPublication"; import { isOAuthSessionError, OAuthErrorMessage } from "components/OAuthError"; import { useToaster } from "components/Toast"; import { DotLoader } from "components/utils/DotLoader"; diff --git a/components/ThemeManager/PubThemeSetter.tsx b/components/ThemeManager/PubThemeSetter.tsx index 381bec2c..71e9ef2a 100644 --- a/components/ThemeManager/PubThemeSetter.tsx +++ b/components/ThemeManager/PubThemeSetter.tsx @@ -1,7 +1,7 @@ import { usePublicationData, useNormalizedPublicationRecord, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; import { useState } from "react"; import { pickers, SectionArrow } from "./ThemeSetter"; import { PubLeafletThemeBackgroundImage } from "lexicons/api"; @@ -9,7 +9,7 @@ import { AtUri } from "@atproto/syntax"; import { useLocalPubTheme } from "./PublicationThemeProvider"; import { BaseThemeProvider, CardBorderHiddenContext } from "./ThemeProvider"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { updatePublicationTheme } from "app/lish/createPub/updatePublication"; +import { updatePublicationTheme } from "app/(app)/lish/createPub/updatePublication"; import { PagePickers } from "./PubPickers/PubTextPickers"; import { BackgroundPicker } from "./PubPickers/PubBackgroundPickers"; import { PubAccentPickers } from "./PubPickers/PubAcccentPickers"; diff --git a/components/ThemeManager/PublicationThemeProvider.tsx b/components/ThemeManager/PublicationThemeProvider.tsx index 165ceaa1..81e92f07 100644 --- a/components/ThemeManager/PublicationThemeProvider.tsx +++ b/components/ThemeManager/PublicationThemeProvider.tsx @@ -8,7 +8,7 @@ import { PubLeafletPublication, PubLeafletThemeColor } from "lexicons/api"; import { usePublicationData, useNormalizedPublicationRecord, -} from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; +} from "app/(app)/lish/[did]/[publication]/dashboard/PublicationSWRProvider"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { PubThemeDefaults } from "./themeDefaults"; diff --git a/components/utils/UpdateLeafletTitle.tsx b/components/utils/UpdateLeafletTitle.tsx index a722e65b..e3777cec 100644 --- a/components/utils/UpdateLeafletTitle.tsx +++ b/components/utils/UpdateLeafletTitle.tsx @@ -1,6 +1,6 @@ "use client"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { useBlocks, useCanvasBlocksWithType, @@ -13,6 +13,7 @@ import { useParams, useRouter, useSearchParams } from "next/navigation"; import { focusBlock } from "src/utils/focusBlock"; import { useIsMobile } from "src/hooks/isMobile"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; +import { useDebouncedEffect } from "src/hooks/useDebouncedEffect"; export function UpdateLeafletTitle(props: { entityID: string }) { let { data: pub } = useLeafletPublicationData(); @@ -24,6 +25,21 @@ export function UpdateLeafletTitle(props: { entityID: string }) { ); let firstBlock = blocks[0]; let title = usePageTitle(entityID); + let { rep, permission_token } = useReplicache(); + let hasWrite = permission_token?.permission_token_rights?.some( + (r) => r.write, + ); + let lastSentTitleRef = useRef(null); + useDebouncedEffect( + () => { + if (!rep || !hasWrite || !title) return; + if (lastSentTitleRef.current === title) return; + lastSentTitleRef.current = title; + rep.mutate.updateLeafletMetadata({ title }); + }, + 500, + [rep, hasWrite, title], + ); useEffect(() => { if (pub?.title) { document.title = pub.title; diff --git a/contexts/DocumentContext.tsx b/contexts/DocumentContext.tsx index d3157d69..4f242417 100644 --- a/contexts/DocumentContext.tsx +++ b/contexts/DocumentContext.tsx @@ -1,6 +1,6 @@ "use client"; import { createContext, useContext } from "react"; -import type { PostPageData } from "app/lish/[did]/[publication]/[rkey]/getPostPageData"; +import type { PostPageData } from "app/(app)/lish/[did]/[publication]/[rkey]/getPostPageData"; // Derive types from PostPageData type NonNullPostPageData = NonNullable; diff --git a/middleware.ts b/middleware.ts index 0d0294d6..26841fa0 100644 --- a/middleware.ts +++ b/middleware.ts @@ -47,12 +47,31 @@ function isBot(req: NextRequest) { if (!ua) return false; return botUserAgentRegex.test(ua); } +function isMainSiteHost(hostname: string): boolean { + return ( + hostname === "leaflet.pub" || + hostname.startsWith("localhost") || + hostname.startsWith("127.0.0.1") || + hostname.endsWith(".vercel.app") + ); +} + export default async function middleware(req: NextRequest) { let hostname = req.headers.get("host")!; if (req.nextUrl.pathname === auth_callback_route) return authCallback(req); if (req.nextUrl.pathname === receive_auth_callback_route) return receiveAuthCallback(req); + if (req.nextUrl.pathname === "/" && isMainSiteHost(hostname)) { + let hasAuth = + req.cookies.has("auth_token") || req.cookies.has("external_auth_token"); + if (hasAuth) { + let navState = req.cookies.get("nav-state")?.value; + let target = navState === "reader" ? "/reader" : "/home"; + return NextResponse.redirect(new URL(target, req.url)); + } + } + if (hostname === "leaflet.pub") return; if (req.nextUrl.pathname === "/not-found") return; let routes: DomainRoutes = null; diff --git a/src/mergeIdentity.ts b/src/mergeIdentity.ts index 4e6ad5cc..020545c9 100644 --- a/src/mergeIdentity.ts +++ b/src/mergeIdentity.ts @@ -11,7 +11,7 @@ import { } from "drizzle/schema"; import { pool } from "supabase/pool"; import { Err, Ok, type Result } from "src/result"; -import { backfillAtprotoSubscriptionsForIdentity } from "app/lish/subscribeToPublication"; +import { backfillAtprotoSubscriptionsForIdentity } from "app/(app)/lish/subscribeToPublication"; export type MergeError = | "merge_not_pending" diff --git a/src/notifications.ts b/src/notifications.ts index be5ae4bb..5d7590ea 100644 --- a/src/notifications.ts +++ b/src/notifications.ts @@ -3,7 +3,7 @@ import { supabaseServerClient } from "supabase/serverClient"; import { Tables, TablesInsert } from "supabase/database.types"; import { AtUri } from "@atproto/syntax"; -import { idResolver } from "app/(home-pages)/reader/idResolver"; +import { idResolver } from "app/(app)/(home-pages)/reader/idResolver"; import { normalizeDocumentRecord, normalizePublicationRecord, diff --git a/src/replicache/mutations.ts b/src/replicache/mutations.ts index 5acfe3f9..1348ea7a 100644 --- a/src/replicache/mutations.ts +++ b/src/replicache/mutations.ts @@ -720,6 +720,32 @@ const updatePublicationDraft: Mutation<{ }); }; +const updateLeafletMetadata: Mutation<{ + title?: string; + description?: string | null; +}> = async (args, ctx) => { + await ctx.runOnServer(async (serverCtx) => { + const updates: { title?: string; description?: string | null } = {}; + if (args.title !== undefined) updates.title = args.title; + if (args.description !== undefined) updates.description = args.description; + if (Object.keys(updates).length === 0) return; + + const { data: writerToken } = await serverCtx.supabase + .from("permission_tokens") + .select("root_entity, permission_token_rights(write)") + .eq("id", ctx.permission_token_id) + .single(); + if (!writerToken) return; + const hasWrite = writerToken.permission_token_rights.some((r) => r.write); + if (!hasWrite) return; + + await serverCtx.supabase + .from("permission_tokens") + .update(updates) + .eq("root_entity", writerToken.root_entity); + }); +}; + const createFootnote: Mutation<{ footnoteEntityID: string; blockID: string; @@ -774,6 +800,7 @@ export const mutations = { addPollOption, removePollOption, updatePublicationDraft, + updateLeafletMetadata, createFootnote, deleteFootnote, }; diff --git a/src/utils/extractTitleFromFacts.ts b/src/utils/extractTitleFromFacts.ts new file mode 100644 index 00000000..c4a4b677 --- /dev/null +++ b/src/utils/extractTitleFromFacts.ts @@ -0,0 +1,53 @@ +import * as base64 from "base64-js"; +import { applyUpdate, Doc } from "yjs"; +import { YJSFragmentToString } from "src/utils/yjsFragmentToString"; +import type { Fact } from "src/replicache"; +import type { Attribute } from "src/replicache/attributes"; +import { scanIndexLocal } from "src/replicache/utils"; + +export function extractTitleFromFacts( + rootToken: string, + facts: Fact[], +): string { + const scan = scanIndexLocal(facts); + const [root] = scan.eav(rootToken, "root/page"); + const rootEntity = root?.data.value || rootToken; + + const [pageType] = scan.eav(rootEntity, "page/type"); + const isCanvas = pageType?.data.value === "canvas"; + + const rawBlocks = isCanvas + ? scan.eav(rootEntity, "canvas/block").sort((a, b) => { + if (a.data.position.y === b.data.position.y) + return a.data.position.x - b.data.position.x; + return a.data.position.y - b.data.position.y; + }) + : scan.eav(rootEntity, "card/block").sort((a, b) => { + if (a.data.position === b.data.position) + return a.id > b.id ? 1 : -1; + return a.data.position > b.data.position ? 1 : -1; + }); + + const blocks = rawBlocks + .map((b) => { + const type = scan.eav(b.data.value, "block/type")[0]; + if ( + !type || + (type.data.value !== "text" && type.data.value !== "heading") + ) + return null; + return b.data; + }) + .filter((b): b is NonNullable => b !== null); + + const firstBlock = blocks[0]; + if (!firstBlock) return "Untitled"; + + const [content] = scan.eav(firstBlock.value, "block/text"); + if (!content) return "Untitled"; + + const doc = new Doc(); + applyUpdate(doc, base64.toByteArray(content.data.value)); + const nodes = doc.getXmlElement("prosemirror").toArray(); + return YJSFragmentToString(nodes[0]) || "Untitled"; +} diff --git a/supabase/database.types.ts b/supabase/database.types.ts index 37fda631..a067b047 100644 --- a/supabase/database.types.ts +++ b/supabase/database.types.ts @@ -893,18 +893,24 @@ export type Database = { permission_tokens: { Row: { blocked_by_admin: boolean | null + description: string | null id: string root_entity: string + title: string | null } Insert: { blocked_by_admin?: boolean | null + description?: string | null id?: string root_entity: string + title?: string | null } Update: { blocked_by_admin?: boolean | null + description?: string | null id?: string root_entity?: string + title?: string | null } Relationships: [ {