diff --git a/components/Dashboard/PostCard.jsx b/components/Dashboard/PostCard.jsx index 41ce07e3..8a015f62 100644 --- a/components/Dashboard/PostCard.jsx +++ b/components/Dashboard/PostCard.jsx @@ -95,7 +95,7 @@ const PostCard = ({ post, refetch, user, edit }) => {

{` ยท `}
{post.type == "article" && post.tools?.length ? ( -
+
Interview
) : post.type ? ( diff --git a/components/EditorNav.js b/components/EditorNav.js index aadec5a3..e9f1490a 100644 --- a/components/EditorNav.js +++ b/components/EditorNav.js @@ -12,7 +12,7 @@ const NavigationMenuMobile = dynamic(() => import("./navbar-menu-mobile"), { ssr: false, }); -export default function EditorNav({ activeNav, postStatus }) { +export default function EditorNav({ activeNav, postStatus, tool, post }) { const { user, isLoading } = useUser({ redirectIfFound: false, }); @@ -94,7 +94,7 @@ export default function EditorNav({ activeNav, postStatus }) {
+ {tool ? ( +
+
+ Interview +
+
+ ) : null}
{statusComponent}
{/* Undo/redo */}
@@ -150,6 +157,7 @@ export default function EditorNav({ activeNav, postStatus }) {
+ ); } diff --git a/pages/toolbox/post/[id]/interview/[slug].js b/pages/toolbox/post/[id]/interview/[slug].js index bc7e9770..ae7eddf8 100644 --- a/pages/toolbox/post/[id]/interview/[slug].js +++ b/pages/toolbox/post/[id]/interview/[slug].js @@ -12,6 +12,7 @@ import useUpdate from "@/components/Editor/editorHooks/editPost/useUpdate"; import { useConfirmTabClose } from "@/components/Editor/useConfirmTabClose"; import EditorNav from "@/components/EditorNav"; import { addTwitterScript } from "@/components/Editor/editorHooks/libs/addTwitterScript"; +import { getToolById } from "@/lib/api"; const Spinner = dynamic(() => import("@/components/atom/Spinner/Spinner")); @@ -26,7 +27,7 @@ const Spinner = dynamic(() => import("@/components/atom/Spinner/Spinner")); * @param {*} props * @returns */ -export default function EditPostPage(props) { +export default function EditPostPage({ tool }) { const { user } = useUser({ redirectTo: "/onboard", redirectIfFound: false, @@ -78,7 +79,7 @@ export default function EditPostPage(props) { }); //update the postObject from useLoad hook - if(updatedPostObject) { + if (updatedPostObject) { setPostObject(updatedPostObject); //confirm no unsaved changes setHasUnsavedChanges(false); @@ -102,7 +103,7 @@ export default function EditPostPage(props) { postObject: postObject, }); - if(updatedPostObject) { + if (updatedPostObject) { setPostObject(updatedPostObject); } @@ -129,9 +130,26 @@ export default function EditPostPage(props) { return ( <> - +
+ {tool?.attributes?.logo?.data?.attributes?.url ? ( +
+
+ Prototypr Logo +
+
+ {tool?.attributes?.title}: Creator Story +
+
+
+
+ ) : null}
{/* {!user && } */} @@ -173,3 +191,29 @@ export default function EditPostPage(props) { ); } + +export async function getStaticProps({ params, preview = null, locale }) { + let data; + try { + data = await getToolById(params.id, preview); + } catch (error) { + console.error("Failed to get tool:", error); + return { + notFound: true, + }; + } + + let tool = data?.posts?.data[0] || null; + return { + props: { + tool: tool || null, + }, + }; +} + +export async function getStaticPaths() { + return { + paths: [], + fallback: "blocking", + }; +} diff --git a/pages/toolbox/post/[id]/interview/index.js b/pages/toolbox/post/[id]/interview/index.js index 90484ae3..7d95a5ba 100644 --- a/pages/toolbox/post/[id]/interview/index.js +++ b/pages/toolbox/post/[id]/interview/index.js @@ -114,7 +114,7 @@ export default function InterviewEditor({ tool }) { return ( <> - +