This commit is contained in:
Jordi Enric
2024-10-28 23:24:46 +01:00
parent 901b512a0d
commit 828330f28b
5 changed files with 18 additions and 17 deletions
@@ -131,7 +131,8 @@ const EditorSettings = (props: Props) => {
const ogImageUrl = `/api/public/og?title=${props.title}&emoji=${props.blogEmoji}&url=${props.blogTitle}`;
const { data: categories, isLoading: isCategoriesLoading } = useCategories();
const { data: categories, isLoading: isCategoriesLoading } =
useCategories(blogId);
const { mutate: createCategory } = useCreateCategory();
function EditorSettingsSection({ children }: { children: React.ReactNode }) {
@@ -29,7 +29,6 @@ import { Sheet, SheetContent, SheetTrigger } from "../ui/sheet";
import EditorSettings from "./EditorSettings";
import TiptapLink from "@tiptap/extension-link";
import Placeholder from "@tiptap/extension-placeholder";
import { useSubscriptionQuery } from "@/queries/subscription";
import { toast } from "sonner";
import { Database } from "@/types/supabase";
import { useBlogTags } from "./Editor.queries";
@@ -102,7 +101,8 @@ export const ZendoEditor = (props: Props) => {
const [published, setPublished] = React.useState(
props.post?.published || false
);
const { data: categories, isLoading: categoriesLoading } = useCategories();
const { data: categories, isLoading: categoriesLoading } =
useCategories(blogId);
const selectedCategory = categories?.find(
(c) => c.id === getValues("category_id")
);
@@ -26,7 +26,6 @@ import {
import { useBlogId } from "@/hooks/use-blog-id";
import AppLayout, { Section } from "@/layouts/AppLayout";
import {
useCategories,
useCategoriesWithPostCount,
useCreateCategory,
useDeleteCategoryMutation,
@@ -2,7 +2,6 @@ import { useRouter } from "next/router";
import { ZendoEditor } from "@/components/Editor/ZendoEditor";
import { toast } from "sonner";
import { createSupabaseBrowserClient } from "@/lib/supabase";
import { useCategories } from "@/queries/categories";
export default function CreatePost() {
const router = useRouter();
+14 -12
View File
@@ -172,18 +172,20 @@ export default function BlogPosts() {
/>
);
})}
<div className="flex items-center justify-end gap-4 p-4 text-center font-mono text-xs text-zinc-500">
Showing {posts.pages.flatMap((page) => page).length} posts
<Button
size="xs"
variant="outline"
onClick={() => {
fetchNextPage();
}}
>
Load more
</Button>
</div>
{posts.pages.flatMap((page) => page).length > 0 && (
<div className="flex items-center justify-end gap-4 p-4 text-center font-mono text-xs text-zinc-500">
Showing {posts.pages.flatMap((page) => page).length} posts
<Button
size="xs"
variant="outline"
onClick={() => {
fetchNextPage();
}}
>
Load more
</Button>
</div>
)}
</Section>
</AppLayout>
);