diff --git a/actions/deleteLeaflet.ts b/actions/deleteLeaflet.ts
index 5584a325..ec46bbc0 100644
--- a/actions/deleteLeaflet.ts
+++ b/actions/deleteLeaflet.ts
@@ -9,6 +9,8 @@ import {
import { eq } from "drizzle-orm";
import { PermissionToken } from "src/replicache";
import { pool } from "supabase/pool";
+import { getIdentityData } from "./getIdentityData";
+import { supabaseServerClient } from "supabase/serverClient";
export async function deleteLeaflet(permission_token: PermissionToken) {
const client = await pool.connect();
@@ -34,3 +36,27 @@ export async function deleteLeaflet(permission_token: PermissionToken) {
client.release();
return;
}
+
+export async function archivePost(token: string) {
+ let identity = await getIdentityData();
+ if (!identity) throw new Error("No Identity");
+
+ await supabaseServerClient
+ .from("permission_token_on_homepage")
+ .update({ archived: true })
+ .eq("token", token)
+ .eq("identity", identity.id);
+ return;
+}
+
+export async function unarchivePost(token: string) {
+ let identity = await getIdentityData();
+ if (!identity) throw new Error("No Identity");
+
+ await supabaseServerClient
+ .from("permission_token_on_homepage")
+ .update({ archived: false })
+ .eq("token", token)
+ .eq("identity", identity.id);
+ return;
+}
diff --git a/app/(home-pages)/home/LeafletList/LeafletInfo.tsx b/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
index 7d44d013..b1c50611 100644
--- a/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
+++ b/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
@@ -25,7 +25,6 @@ export const LeafletInfo = (props: {
}) => {
let [prefetch, setPrefetch] = useState(false);
let prettyCreatedAt = props.added_at ? timeAgo(props.added_at) : "";
-
let prettyPublishedAt = props.publishedAt ? timeAgo(props.publishedAt) : "";
return (
@@ -79,6 +78,9 @@ export const LeafletInfo = (props: {
) : (
{prettyCreatedAt}
)}
+ {props.archived && (
+ archived
+ )}
{props.isTemplate && props.display === "grid" ? (
diff --git a/app/(home-pages)/home/LeafletList/LeafletOptions.tsx b/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
index 63191ff8..7d952704 100644
--- a/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
+++ b/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
@@ -1,31 +1,30 @@
"use client";
import { Menu, MenuItem } from "components/Layout";
-import { useReplicache, type PermissionToken } from "src/replicache";
-import { hideDoc } from "../storage";
import { useState } from "react";
import { ButtonPrimary, ButtonTertiary } from "components/Buttons";
import { useTemplateState } from "../Actions/CreateNewButton";
import { useSmoker, useToaster } from "components/Toast";
-import { removeLeafletFromHome } from "actions/removeLeafletFromHome";
-import { useIdentityData } from "components/IdentityProvider";
-import { HideSmall } from "components/Icons/HideSmall";
-import { MoreOptionsTiny } from "components/Icons/MoreOptionsTiny";
import { TemplateRemoveSmall } from "components/Icons/TemplateRemoveSmall";
import { TemplateSmall } from "components/Icons/TemplateSmall";
import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny";
import { DeleteSmall } from "components/Icons/DeleteSmall";
-import { deleteLeaflet } from "actions/deleteLeaflet";
+import {
+ archivePost,
+ deleteLeaflet,
+ unarchivePost,
+} from "actions/deleteLeaflet";
import { ArchiveSmall } from "components/Icons/ArchiveSmall";
import { UnpublishSmall } from "components/Icons/UnpublishSmall";
import {
deletePost,
unpublishPost,
} from "app/lish/[did]/[publication]/dashboard/deletePost";
-import { usePublicationData } from "app/lish/[did]/[publication]/dashboard/PublicationSWRProvider";
import { ShareButton } from "components/ShareOptions";
import { ShareSmall } from "components/Icons/ShareSmall";
+import { PermissionToken } from "src/replicache";
+
export const LeafletOptions = (props: {
leaflet: PermissionToken;
isTemplate?: boolean;
@@ -97,7 +96,9 @@ const DefaultOptions = (props: {
leaflet: PermissionToken;
isTemplate: boolean | undefined;
shareLink: string;
+ archived?: boolean | null;
}) => {
+ let toaster = useToaster();
return (
<>
-