"use client"; import Link from "next/link"; import { useIdentityData } from "components/IdentityProvider"; import { theme } from "tailwind.config"; import { getBasePublicationURL } from "app/lish/createPub/getPublicationURL"; import { Json } from "supabase/database.types"; import { PubLeafletPublication } from "lexicons/api"; import { AtUri } from "@atproto/syntax"; import { ActionButton } from "./ActionButton"; import { SpeedyLink } from "components/SpeedyLink"; import { PublishSmall } from "components/Icons/PublishSmall"; import { Popover } from "components/Popover"; import { BlueskyLogin } from "app/login/LoginForm"; import { ButtonPrimary } from "components/Buttons"; import { useIsMobile } from "src/hooks/isMobile"; import { useState } from "react"; export const PublicationButtons = (props: { currentPubUri: string | undefined; }) => { let { identity } = useIdentityData(); // don't show pub list button if not logged in or no pub list // we show a "start a pub" banner instead if (!identity || !identity.atp_did || identity.publications.length === 0) return ; return (
{identity.publications?.map((d) => { return ( ); })} New
); }; export const PublicationOption = (props: { uri: string; name: string; record: Json; asActionButton?: boolean; current?: boolean; }) => { let record = props.record as PubLeafletPublication.Record | null; if (!record) return; return ( {props.asActionButton ? ( } nav className={props.current ? "bg-bg-page! border-border!" : ""} /> ) : ( <>
{record.name}
)}
); }; const PubListEmpty = () => { let { identity } = useIdentityData(); let isMobile = useIsMobile(); let [state, setState] = useState<"default" | "info">("default"); if (isMobile && state == "default") return ( } nav subtext="Start a blog on ATProto!" onClick={() => { setState("info"); }} /> ); if (isMobile && state === "info") return ; else return ( } nav subtext="Start a blog on ATProto!" /> } > ); }; const PublishPopoverContent = () => { let { identity } = useIdentityData(); return (
Publish on AT Proto
{identity && identity.atp_did ? ( // has ATProto account and no pubs <>
Start a new publication
on AT Proto
Start a Publication! ) : ( // no ATProto account and no pubs <>
Link a Bluesky account to start a new publication on AT Proto
)}
); }; export const PubIcon = (props: { record: PubLeafletPublication.Record; uri: string; small?: boolean; large?: boolean; className?: string; }) => { if (!props.record) return; let iconSizeClassName = `${props.small ? "w-4 h-4" : props.large ? "w-12 h-12" : "w-6 h-6"} rounded-full`; return props.record.icon ? (
{`${props.record.name}
) : (
{props.record?.name.slice(0, 1).toUpperCase()}
); }; export const PubListEmptyIllo = () => { return ( ); };