+
- {identity && }
{identity?.atp_did ? (
<>
- {compactOnMobile && }
>
) : (
diff --git a/components/ActionBar/NavigationButtons.tsx b/components/ActionBar/NavigationButtons.tsx
index e66362b6..6fe18163 100644
--- a/components/ActionBar/NavigationButtons.tsx
+++ b/components/ActionBar/NavigationButtons.tsx
@@ -30,7 +30,7 @@ export const HomeButton = (props: {
nav
icon={}
label="Write"
- className={`${props.current ? "bg-bg-page! border-border-light!" : ""} ${props.className}`}
+ className={`${props.current ? "bg-bg-page! border-border-light!" : ""} w-full! ${props.className}`}
/>
);
diff --git a/components/ActionBar/PublicationNavigation.tsx b/components/ActionBar/PublicationNavigation.tsx
new file mode 100644
index 00000000..60fbf6c0
--- /dev/null
+++ b/components/ActionBar/PublicationNavigation.tsx
@@ -0,0 +1,148 @@
+"use client";
+import { useIdentityData } from "components/IdentityProvider";
+import { getBasePublicationURL } from "app/lish/createPub/getPublicationURL";
+import {
+ normalizePublicationRecord,
+ type NormalizedPublication,
+} from "src/utils/normalizeRecords";
+import { SpeedyLink } from "components/SpeedyLink";
+import { Popover } from "components/Popover";
+import { ButtonPrimary } from "components/Buttons";
+import { LooseLeafSmall } from "components/Icons/LooseleafSmall";
+import { HomeButton, type navPages } from "./NavigationButtons";
+import { HomeSmall } from "components/Icons/HomeSmall";
+import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny";
+import { PubIcon, PublicationButtons } from "./Publications";
+import { HomeTiny } from "components/Icons/HomeTiny";
+import { LooseleafTiny } from "components/Icons/LooseleafTiny";
+import { Separator } from "components/Layout";
+import { Menu, MenuItem } from "components/Menu";
+import { AddTiny } from "components/Icons/AddTiny";
+
+export const PublicationNavigation = (props: {
+ currentPage: navPages;
+ currentPubUri?: string;
+}) => {
+ let { identity } = useIdentityData();
+
+ if (!identity) return;
+
+ let hasLooseleafs = !!identity?.permission_token_on_homepage.find(
+ (f) =>
+ f.permission_tokens.leaflets_to_documents &&
+ f.permission_tokens.leaflets_to_documents[0]?.document,
+ );
+
+ let pubCount = identity?.publications.length ?? 0;
+ let onlyOnePub = pubCount === 1 && hasLooseleafs;
+ let onlyLooseleafs = pubCount === 0 && hasLooseleafs;
+ let className =
+ "font-bold text-secondary flex gap-2 items-center grow min-w-0 text-sm h-[34px] px-2 accent-container";
+
+ // if not publications or looseleafs
+ if (!identity.publications && !hasLooseleafs) {
+ return (
+
+
+ Create a Publication!
+
+
+ );
+ }
+
+ switch (props.currentPage) {
+ case "looseleafs":
+ case "pub":
+ if (onlyLooseleafs || onlyOnePub)
+ return (
+ <>
+
+
+ Home
+
+ >
+ );
+ break;
+ case "home": {
+ if (onlyLooseleafs || onlyOnePub) {
+ let pub = identity.publications[0];
+ return (
+
+
}>
+
+
+
+
+
+ {onlyLooseleafs ? (
+
+ Looseleafs
+
+ ) : (
+
+
+ {pub.name}
+
+ )}
+
+ );
+ }
+ break;
+ }
+ }
+
+ return (
+
+ ({
+ record: normalizePublicationRecord(pub.record),
+ uri: pub.uri,
+ }))}
+ />{" "}
+ Publications
+
+ }
+ className="pt-1 px-2!"
+ >
+
+
+
+
+ );
+};
+
+function PubIcons(props: {
+ publications: { record: NormalizedPublication | null; uri: string }[];
+}) {
+ if (props.publications.length < 1) return null;
+ return (
+
+ {props.publications.map((pub, index) => {
+ if (index <= 2)
+ return (
+
+ );
+ })}
+
+ );
+}
diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx
index 6515bb8f..409ef811 100644
--- a/components/ActionBar/Publications.tsx
+++ b/components/ActionBar/Publications.tsx
@@ -15,15 +15,11 @@ import { SpeedyLink } from "components/SpeedyLink";
import { PublishSmall } from "components/Icons/PublishSmall";
import { Popover } from "components/Popover";
import { BlueskyLogin } from "app/login/LoginForm";
-import { ButtonPrimary, ButtonSecondary } from "components/Buttons";
+import { ButtonSecondary } from "components/Buttons";
import { useIsMobile } from "src/hooks/isMobile";
import { useState } from "react";
import { LooseLeafSmall } from "components/Icons/LooseleafSmall";
-import { HomeButton, type navPages } from "./NavigationButtons";
-import { AddTiny } from "components/Icons/AddTiny";
-import { HomeSmall } from "components/Icons/HomeSmall";
-import { HomeTiny } from "components/Icons/HomeTiny";
-import { LooseleafTiny } from "components/Icons/LooseleafTiny";
+import { type navPages } from "./NavigationButtons";
export const PublicationButtons = (props: {
currentPage: navPages;
@@ -59,7 +55,7 @@ export const PublicationButtons = (props: {
label="Looseleafs"
icon={
}
nav
- className={`${
+ className={`w-full! ${
props.currentPage === "looseleafs"
? "bg-bg-page! border-border!"
: ""
@@ -122,7 +118,7 @@ export const PublicationOption = (props: {
label={record.name}
icon={
}
nav
- className={`${props.current ? "bg-bg-page! border-border!" : ""} ${props.className}`}
+ className={`w-full! ${props.current ? "bg-bg-page! border-border!" : ""} ${props.className}`}
/>
);
@@ -239,121 +235,6 @@ export const PubIcon = (props: {
);
};
-export const PublicationNavigation = (props: {
- currentPage: navPages;
- currentPubUri?: string;
-}) => {
- let { identity } = useIdentityData();
-
- if (!identity) return;
-
- let hasLooseleafs = !!identity?.permission_token_on_homepage.find(
- (f) =>
- f.permission_tokens.leaflets_to_documents &&
- f.permission_tokens.leaflets_to_documents[0]?.document,
- );
-
- let pubCount = identity?.publications.length ?? 0;
- let onlyOnePub = pubCount === 1 && !hasLooseleafs;
- let onlyLooseleafs = pubCount === 0 && hasLooseleafs;
-
- function getTriggerIcons() {
- if (identity && pubCount >= 1) {
- return (
-
- {identity.publications.map((pub, index) => {
- if (index <= 2)
- return (
-
- );
- })}
-
- );
- }
- if (identity && hasLooseleafs) {
- return (
-
-
-
- );
- } else
- return (
-
-
- Create a Publication!
-
-
- );
- }
-
- // Single pub, no looseleafs - just link to that pub
- if (onlyOnePub && identity) {
- let pub = identity.publications[0];
- if (props.currentPage === "pub")
- return (
-
- Home
-
- );
- return (
-
- {pub.name}
-
-
- );
- }
-
- // Only looseleafs, no pubs - just link to looseleafs
- if (onlyLooseleafs) {
- if (props.currentPage === "looseleafs")
- return (
-
- Home
-
- );
- return (
-
-
- Looseleafs
-
-
- );
- }
-
- return (
-
{getTriggerIcons()}