diff --git a/app/(home-pages)/home/Actions/CreateNewButton.tsx b/app/(home-pages)/home/Actions/CreateNewButton.tsx
index 2052af7c..bfd7dfe7 100644
--- a/app/(home-pages)/home/Actions/CreateNewButton.tsx
+++ b/app/(home-pages)/home/Actions/CreateNewButton.tsx
@@ -1,46 +1,15 @@
"use client";
import { createNewLeaflet } from "actions/createNewLeaflet";
-import { createNewLeafletFromTemplate } from "actions/createNewLeafletFromTemplate";
import { ActionButton } from "components/ActionBar/ActionButton";
import { AddTiny } from "components/Icons/AddTiny";
import { BlockCanvasPageSmall } from "components/Icons/BlockCanvasPageSmall";
import { BlockDocPageSmall } from "components/Icons/BlockDocPageSmall";
-import { TemplateSmall } from "components/Icons/TemplateSmall";
import { Menu, MenuItem } from "components/Layout";
import { useIsMobile } from "src/hooks/isMobile";
-import { create } from "zustand";
-import { combine, createJSONStorage, persist } from "zustand/middleware";
-export const useTemplateState = create(
- persist(
- combine(
- {
- templates: [] as { id: string; name: string }[],
- },
- (set) => ({
- removeTemplate: (template: { id: string }) =>
- set((state) => {
- return {
- templates: state.templates.filter((t) => t.id !== template.id),
- };
- }),
- addTemplate: (template: { id: string; name: string }) =>
- set((state) => {
- if (state.templates.find((t) => t.id === template.id)) return state;
- return { templates: [...state.templates, template] };
- }),
- }),
- ),
- {
- name: "home-templates",
- storage: createJSONStorage(() => localStorage),
- },
- ),
-);
export const CreateNewLeafletButton = (props: {}) => {
let isMobile = useIsMobile();
- let templates = useTemplateState((s) => s.templates);
let openNewLeaflet = (id: string) => {
if (isMobile) {
window.location.href = `/${id}?focusFirstBlock`;
@@ -96,23 +65,6 @@ export const CreateNewLeafletButton = (props: {}) => {
- {templates.length > 0 && (
-
- )}
- {templates.map((t) => {
- return (
-
- );
- })}
);
};
diff --git a/app/(home-pages)/home/HomeLayout.tsx b/app/(home-pages)/home/HomeLayout.tsx
index fcd5f6e9..f1f84e4f 100644
--- a/app/(home-pages)/home/HomeLayout.tsx
+++ b/app/(home-pages)/home/HomeLayout.tsx
@@ -21,7 +21,6 @@ import {
} from "components/PageLayouts/DashboardLayout";
import { Actions } from "./Actions/Actions";
import { useCardBorderHidden } from "components/Pages/useCardBorderHidden";
-import { useTemplateState } from "./Actions/CreateNewButton";
import { GetLeafletDataReturnType } from "app/api/rpc/[command]/get_leaflet_data";
import { useState } from "react";
import { useDebouncedEffect } from "src/hooks/useDebouncedEffect";
@@ -69,8 +68,6 @@ export const HomeLayout = (props: {
let { identity } = useIdentityData();
let hasPubs = !identity || identity.publications.length === 0 ? false : true;
- let hasTemplates =
- useTemplateState((s) => s.templates).length === 0 ? false : true;
let hasArchived =
identity &&
identity.permission_token_on_homepage.filter(
@@ -93,7 +90,6 @@ export const HomeLayout = (props: {
setSearchValueAction={setSearchValue}
hasBackgroundImage={hasBackgroundImage}
hasPubs={hasPubs}
- hasTemplates={hasTemplates}
hasArchived={!!hasArchived}
/>
),
@@ -294,19 +290,16 @@ function useSearchedLeaflets(
}
});
- let allTemplates = useTemplateState((s) => s.templates);
let filteredLeaflets = sortedLeaflets.filter(
({ token: leaflet, archived: archived }) => {
let published = !!leaflet.leaflets_in_publications?.find((l) => l.doc);
let drafts = !!leaflet.leaflets_in_publications?.length && !published;
let docs = !leaflet.leaflets_in_publications?.length && !archived;
- let templates = !!allTemplates.find((t) => t.id === leaflet.id);
// If no filters are active, show all
if (
!filter.drafts &&
!filter.published &&
!filter.docs &&
- !filter.templates &&
!filter.archived
)
return archived === false || archived === null || archived == undefined;
@@ -315,7 +308,6 @@ function useSearchedLeaflets(
(filter.drafts && drafts) ||
(filter.published && published) ||
(filter.docs && docs) ||
- (filter.templates && templates) ||
(filter.archived && archived)
);
},
diff --git a/app/(home-pages)/home/LeafletList/LeafletInfo.tsx b/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
index bebdaa44..478f853c 100644
--- a/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
+++ b/app/(home-pages)/home/LeafletList/LeafletInfo.tsx
@@ -3,8 +3,6 @@ import { PermissionToken, useEntity } from "src/replicache";
import { LeafletOptions } from "./LeafletOptions";
import Link from "next/link";
import { use, useState } from "react";
-import { theme } from "tailwind.config";
-import { TemplateSmall } from "components/Icons/TemplateSmall";
import { timeAgo } from "src/utils/timeAgo";
import { usePublishLink } from "components/ShareOptions";
import { Separator } from "components/Layout";
@@ -17,7 +15,6 @@ export const LeafletInfo = (props: {
token: PermissionToken;
leaflet_id: string;
loggedIn: boolean;
- isTemplate: boolean;
className?: string;
display: "grid" | "list";
added_at: string;
@@ -45,15 +42,8 @@ export const LeafletInfo = (props: {
{title}
- {props.isTemplate && props.display === "list" ? (
-
- ) : null}
)}
- {props.isTemplate && props.display === "grid" ? (
-
-
-
- ) : null}
);
};
diff --git a/app/(home-pages)/home/LeafletList/LeafletListItem.tsx b/app/(home-pages)/home/LeafletList/LeafletListItem.tsx
index 1d80e760..9537f81b 100644
--- a/app/(home-pages)/home/LeafletList/LeafletListItem.tsx
+++ b/app/(home-pages)/home/LeafletList/LeafletListItem.tsx
@@ -1,6 +1,5 @@
"use client";
import { PermissionToken } from "src/replicache";
-import { useTemplateState } from "../Actions/CreateNewButton";
import { LeafletListPreview, LeafletGridPreview } from "./LeafletPreview";
import { LeafletInfo } from "./LeafletInfo";
import { useState, useRef, useEffect } from "react";
@@ -23,10 +22,6 @@ export const LeafletListItem = (props: {
isHidden: boolean;
showPreview?: boolean;
}) => {
- let isTemplate = useTemplateState(
- (s) => !!s.templates.find((t) => t.id === props.token.id),
- );
-
let [isOnScreen, setIsOnScreen] = useState(props.index < 16 ? true : false);
let previewRef = useRef(null);
@@ -69,7 +64,7 @@ export const LeafletListItem = (props: {
{props.showPreview && (
)}
-
+
{props.cardBorderHidden && (
diff --git a/app/(home-pages)/home/LeafletList/LeafletOptions.tsx b/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
index 1760afde..6b810d58 100644
--- a/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
+++ b/app/(home-pages)/home/LeafletList/LeafletOptions.tsx
@@ -3,10 +3,7 @@
import { Menu, MenuItem } from "components/Layout";
import { useState } from "react";
import { ButtonPrimary, ButtonTertiary } from "components/Buttons";
-import { useTemplateState } from "../Actions/CreateNewButton";
-import { useSmoker, useToaster } from "components/Toast";
-import { TemplateRemoveSmall } from "components/Icons/TemplateRemoveSmall";
-import { TemplateSmall } from "components/Icons/TemplateSmall";
+import { useToaster } from "components/Toast";
import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny";
import { DeleteSmall } from "components/Icons/DeleteSmall";
import {
@@ -37,14 +34,13 @@ import {
export const LeafletOptions = (props: {
leaflet: PermissionToken;
- isTemplate?: boolean;
draftInPublication?: string;
document_uri?: string;
shareLink: string;
archived?: boolean | null;
loggedIn?: boolean;
}) => {
- let [state, setState] = useState<"normal" | "template" | "areYouSure">(
+ let [state, setState] = useState<"normal" | "areYouSure">(
"normal",
);
let [open, setOpen] = useState(false);
@@ -76,7 +72,6 @@ export const LeafletOptions = (props: {
!props.loggedIn ? (
@@ -88,16 +83,10 @@ export const LeafletOptions = (props: {
/>
) : (
)
- ) : state === "template" ? (
- setOpen(false)}
- />
) : state === "areYouSure" ? (
setState("normal")}
@@ -112,10 +101,9 @@ export const LeafletOptions = (props: {
};
const DefaultOptions = (props: {
- setState: (s: "areYouSure" | "template") => void;
+ setState: (s: "areYouSure") => void;
draftInPublication?: string;
leaflet: PermissionToken;
- isTemplate: boolean | undefined;
shareLink: string;
archived?: boolean | null;
}) => {
@@ -136,12 +124,6 @@ const DefaultOptions = (props: {
id="get-link"
link={`/${props.shareLink}`}
/>
-
-