diff --git a/app/[leaflet_id]/Actions.tsx b/app/[leaflet_id]/Actions.tsx index bbf8656d..9d6d5df6 100644 --- a/app/[leaflet_id]/Actions.tsx +++ b/app/[leaflet_id]/Actions.tsx @@ -5,12 +5,11 @@ import { } from "app/lish/createPub/getPublicationURL"; import { ActionButton } from "components/ActionBar/ActionButton"; import { GoBackSmall } from "components/Icons/GoBackSmall"; -import { PaintSmall } from "components/Icons/PaintSmall"; import { PublishSmall } from "components/Icons/PublishSmall"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; +import { SpeedyLink } from "components/SpeedyLink"; import { useToaster } from "components/Toast"; import { DotLoader } from "components/utils/DotLoader"; -import Link from "next/link"; import { useParams, useRouter } from "next/navigation"; import { useState } from "react"; import { useReplicache } from "src/replicache"; @@ -26,7 +25,7 @@ export const BackToPubButton = (props: { }; }) => { return ( - @@ -34,7 +33,7 @@ export const BackToPubButton = (props: { icon={} label="To Pub" /> - + ); }; @@ -84,11 +83,11 @@ const UpdateButton = () => { content: (
{pub.doc ? "Updated! " : "Published! "} - link - +
), type: "success", diff --git a/app/home/LeafletPreview.tsx b/app/home/LeafletPreview.tsx index 3c350a73..f1eba178 100644 --- a/app/home/LeafletPreview.tsx +++ b/app/home/LeafletPreview.tsx @@ -29,6 +29,7 @@ import { PublicationMetadata, PublicationMetadataPreview, } from "components/Pages/PublicationMetadata"; +import { SpeedyLink } from "components/SpeedyLink"; export const LeafletPreview = (props: { draft?: boolean; @@ -97,7 +98,10 @@ export const LeafletPreview = (props: { - + ) : ( @@ -249,16 +253,3 @@ const LeafletTemplateIndicator = (props: { isTemplate: boolean }) => { ); }; - -const LeafletPreviewLink = (props: { id: string }) => { - let [prefetch, setPrefetch] = useState(false); - return ( - setPrefetch(true)} - onPointerDown={() => setPrefetch(true)} - prefetch={prefetch} - href={`/${props.id}`} - className={`no-underline sm:hover:no-underline text-primary absolute inset-0 w-full h-full`} - /> - ); -}; diff --git a/app/home/Publications.tsx b/app/home/Publications.tsx index b2074cd9..50a3323e 100644 --- a/app/home/Publications.tsx +++ b/app/home/Publications.tsx @@ -15,6 +15,7 @@ import { PubLeafletPublication } from "lexicons/api"; import { AtUri } from "@atproto/syntax"; import { blobRefToSrc } from "src/utils/blobRefToSrc"; import { PublicationThemeProvider } from "components/ThemeManager/PublicationThemeProvider"; +import { SpeedyLink } from "components/SpeedyLink"; export const MyPublicationList = () => { let { identity } = useIdentityData(); @@ -23,12 +24,12 @@ export const MyPublicationList = () => {
Publications - - +
@@ -65,7 +66,7 @@ function Publication(props: { uri: string; name: string; record: Json }) { let showPageBackground = !!record?.theme?.showPageBackground; return ( - @@ -94,7 +95,7 @@ function Publication(props: { uri: string; name: string; record: Json }) { {props.name} - +
); } diff --git a/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx b/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx index 7d35b88f..c728922a 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx @@ -1,14 +1,12 @@ "use client"; -import Link from "next/link"; import { PubLeafletDocument, PubLeafletPublication } from "lexicons/api"; import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; import { Interactions } from "../Interactions/Interactions"; import { PostPageData } from "../getPostPageData"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import { useIdentityData } from "components/IdentityProvider"; -import { blobRefToSrc } from "src/utils/blobRefToSrc"; -import { AtUri } from "@atproto/syntax"; import { EditTiny } from "components/Icons/EditTiny"; +import { SpeedyLink } from "components/SpeedyLink"; export function PostHeader(props: { data: PostPageData; @@ -40,7 +38,7 @@ export function PostHeader(props: {
- {props.name} - + {identity && identity.atp_did === document.documents_in_publications[0]?.publications diff --git a/app/lish/[did]/[publication]/dashboard/Actions.tsx b/app/lish/[did]/[publication]/dashboard/Actions.tsx index 3b5e84c5..61f3f856 100644 --- a/app/lish/[did]/[publication]/dashboard/Actions.tsx +++ b/app/lish/[did]/[publication]/dashboard/Actions.tsx @@ -9,7 +9,6 @@ import { SettingsSmall } from "components/Icons/SettingsSmall"; import { ShareSmall } from "components/Icons/ShareSmall"; import { Menu } from "components/Layout"; import { MenuItem } from "components/Layout"; -import Link from "next/link"; import { HomeSmall } from "components/Icons/HomeSmall"; import { EditPubForm } from "app/lish/createPub/UpdatePubForm"; import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; @@ -18,19 +17,19 @@ import { useSmoker } from "components/Toast"; import { PaintSmall } from "components/Icons/PaintSmall"; import { PubThemeSetter } from "components/ThemeManager/PubThemeSetter"; import { useIsMobile } from "src/hooks/isMobile"; +import { SpeedyLink } from "components/SpeedyLink"; export const Actions = (props: { publication: string }) => { return ( <> - } label="Go Home" /> - + @@ -38,14 +37,13 @@ export const Actions = (props: { publication: string }) => {
- } label="Go Home" /> - + ); @@ -73,7 +71,7 @@ function PublicationShareButton() { } > {}}> - @@ -81,7 +79,7 @@ function PublicationShareButton() {
View your publication as a reader
- +
{ diff --git a/app/lish/[did]/[publication]/dashboard/DraftList.tsx b/app/lish/[did]/[publication]/dashboard/DraftList.tsx index e4ed4507..1682b75a 100644 --- a/app/lish/[did]/[publication]/dashboard/DraftList.tsx +++ b/app/lish/[did]/[publication]/dashboard/DraftList.tsx @@ -1,15 +1,14 @@ "use client"; -import Link from "next/link"; import { NewDraftSecondaryButton } from "./NewDraftButton"; import React, { useState } from "react"; import { usePublicationData } from "./PublicationSWRProvider"; import { Menu, MenuItem } from "components/Layout"; import { deleteDraft } from "./deleteDraft"; import { DeleteSmall } from "components/Icons/DeleteSmall"; -import { PrimaryKey } from "drizzle-orm/sqlite-core"; import { ButtonPrimary } from "components/Buttons"; import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny"; +import { SpeedyLink } from "components/SpeedyLink"; export function DraftList() { let { data: pub_data } = usePublicationData(); @@ -35,7 +34,7 @@ function Draft(props: { id: string; title: string; description: string }) { let [open, setOpen] = useState(false); return (
- Untitled )}
{props.description}
- + setOpen(o)} diff --git a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx index cff72554..7711db75 100644 --- a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx +++ b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx @@ -1,5 +1,4 @@ "use client"; -import Link from "next/link"; import { AtUri } from "@atproto/syntax"; import { PubLeafletDocument } from "lexicons/api"; import { EditTiny } from "components/Icons/EditTiny"; @@ -10,13 +9,12 @@ import { useParams } from "next/navigation"; import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; import { Menu, MenuItem } from "components/Layout"; import { deletePost } from "./deletePost"; -import { mutate } from "swr"; -import { Button } from "react-aria-components"; import { ButtonPrimary } from "components/Buttons"; import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny"; import { DeleteSmall } from "components/Icons/DeleteSmall"; import { ShareSmall } from "components/Icons/ShareSmall"; import { ShareButton } from "components/ShareOptions"; +import { SpeedyLink } from "components/SpeedyLink"; export function PublishedPostsList() { let { data: publication } = usePublicationData(); @@ -66,9 +64,12 @@ export function PublishedPostsList() {
{leaflet && ( - + - + )}
diff --git a/app/lish/[did]/[publication]/page.tsx b/app/lish/[did]/[publication]/page.tsx index 0f230493..79694a8c 100644 --- a/app/lish/[did]/[publication]/page.tsx +++ b/app/lish/[did]/[publication]/page.tsx @@ -10,6 +10,7 @@ import { PublicationBackgroundProvider, PublicationThemeProvider, } from "components/ThemeManager/PublicationThemeProvider"; +import { SpeedyLink } from "components/SpeedyLink"; export default async function Publication(props: { params: Promise<{ publication: string; did: string }>; @@ -125,7 +126,7 @@ export default async function Publication(props: { return (
- @@ -144,7 +145,7 @@ export default async function Publication(props: { }, )}{" "}

- +

diff --git a/components/SpeedyLink.tsx b/components/SpeedyLink.tsx new file mode 100644 index 00000000..4848ffbb --- /dev/null +++ b/components/SpeedyLink.tsx @@ -0,0 +1,24 @@ +"use client"; +import Link from "next/link"; +import { useState } from "react"; + +export function SpeedyLink(props: { + href: string; + className?: string; + style?: React.CSSProperties; + children?: React.ReactNode; +}) { + let [prefetch, setPrefetch] = useState(false); + return ( + setPrefetch(true)} + onPointerDown={() => setPrefetch(true)} + style={props.style} + prefetch={prefetch} + href={props.href} + className={props.className} + > + {props.children} + + ); +}