From d264375c20ade7d86f84d6b5f4fddf185fe1adcd Mon Sep 17 00:00:00 2001 From: Graeme Fulton Date: Fri, 7 Jun 2024 16:25:30 -0400 Subject: [PATCH] interview draft --- components/Dashboard/PostCard.jsx | 96 ++++++++++++------- components/Editor/Editor.js | 2 +- .../libs/templates/interviewTemplate.js | 2 +- .../Editor/editorHooks/newPost/useLoad.js | 2 +- components/toolbox/AuthorCard.js | 2 +- lib/queries/creatorArticlesQuery.js | 1 + lib/queries/getUserRelatedPostsFromPostId.js | 8 +- lib/queries/userArticlesQuery.js | 1 + pages/toolbox/[slug].js | 1 - pages/toolbox/post/[id]/interview/index.js | 55 ++++++++++- 10 files changed, 119 insertions(+), 51 deletions(-) diff --git a/components/Dashboard/PostCard.jsx b/components/Dashboard/PostCard.jsx index 603dad39..41ce07e3 100644 --- a/components/Dashboard/PostCard.jsx +++ b/components/Dashboard/PostCard.jsx @@ -67,17 +67,22 @@ const PostCard = ({ post, refetch, user, edit }) => { } }; + return (

{post.title}

@@ -89,7 +94,11 @@ const PostCard = ({ post, refetch, user, edit }) => { {format(new Date(post.date), "LLLL d, yyyy")}

{` · `}
- {post.type ? ( + {post.type == "article" && post.tools?.length ? ( +
+ Interview +
+ ) : post.type ? (
{post.type}
@@ -97,6 +106,22 @@ const PostCard = ({ post, refetch, user, edit }) => { "" )} + {post.type == "article" && post.tools?.length ? ( + <> +
{` · `}
+
+ + + +
+ + ) : ( + "" + )} + {post.status !== "publish" && post.status !== "draft" && ( <>
{` · `}
@@ -154,7 +179,7 @@ const PostCard = ({ post, refetch, user, edit }) => {
)} - {(post.type == "tool" && edit!==false) ? ( + {post.type == "tool" && edit !== false ? (
); diff --git a/components/Editor/Editor.js b/components/Editor/Editor.js index c797f457..d076c3e9 100644 --- a/components/Editor/Editor.js +++ b/components/Editor/Editor.js @@ -124,7 +124,7 @@ const Editor = ({ // }), Placeholder.configure({ showOnlyCurrent: false, - includeChildren: true, + includeChildren: false, placeholder: ({ node }) => { if (node.type.name === "heading") { return "Title"; diff --git a/components/Editor/editorHooks/libs/templates/interviewTemplate.js b/components/Editor/editorHooks/libs/templates/interviewTemplate.js index c44a6e53..f62e8246 100644 --- a/components/Editor/editorHooks/libs/templates/interviewTemplate.js +++ b/components/Editor/editorHooks/libs/templates/interviewTemplate.js @@ -273,7 +273,7 @@ export const getInterViewTemplate = ({ productName }) => { content: [ { type: "text", - text: "Q. Who is it for, and how are you discovering your first users?", + text: `Q. Who is ${productName} for, and how are you discovering your first users?`, }, ], }, diff --git a/components/Editor/editorHooks/newPost/useLoad.js b/components/Editor/editorHooks/newPost/useLoad.js index 9df7a11c..f85b054b 100644 --- a/components/Editor/editorHooks/newPost/useLoad.js +++ b/components/Editor/editorHooks/newPost/useLoad.js @@ -40,7 +40,7 @@ const useLoad = ({user, interview, productName}) => { //it's a new post setInitialContent(false) if(interview){ - setInitialContent(getInterViewTemplate({productName:'Prototypr Publisher'})); + setInitialContent(getInterViewTemplate({productName:productName})); } setLoading(false); } diff --git a/components/toolbox/AuthorCard.js b/components/toolbox/AuthorCard.js index 3f3682b6..8f803b73 100644 --- a/components/toolbox/AuthorCard.js +++ b/components/toolbox/AuthorCard.js @@ -58,7 +58,7 @@ export default function AuthorCard({
- {size=='small'&&

Curated by

} + {size=='small'&&

Posted by

}

+

+ +
+
+ ) + } + return ( <> @@ -121,3 +140,29 @@ export default function InterviewEditor() { ); } + +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', + }; +} \ No newline at end of file