diff --git a/src/components/pages/landing-page.tsx b/src/components/pages/landing-page.tsx
index 2115222..129da63 100644
--- a/src/components/pages/landing-page.tsx
+++ b/src/components/pages/landing-page.tsx
@@ -1,15 +1,14 @@
import React from "react";
+import { TrendingPosts } from "@/components/trending-posts";
+import { api, HydrateClient } from "@/trpc/server";
+
+const LandingPage: React.FC = async () => {
+ void api.post.getTrending.prefetch();
-const LandingPage: React.FC = () => {
return (
-
-
-
- Contains
- Gifs
-
-
-
+
+
+
);
};
diff --git a/src/components/pages/post/post-actions.tsx b/src/components/pages/post/post-actions.tsx
index 5b2ae9e..eefddf4 100644
--- a/src/components/pages/post/post-actions.tsx
+++ b/src/components/pages/post/post-actions.tsx
@@ -19,16 +19,22 @@ const PostActions: React.FC = ({ post }) => {
await vote.mutateAsync({ slug: post.slug, up: true });
voteCount.refetch();
}}
- icon={}
+ icon={}
/>
- {voteCount.data ? voteCount.data.toString() : "Loading..."}
+
+ {voteCount.data ? (
+ voteCount.data.toString()
+ ) : (
+
+ )}
+
{
await vote.mutateAsync({ slug: post.slug, up: false });
voteCount.refetch();
}}
- icon={}
+ icon={}
/>
= ({ post }) => {
await vote.mutateAsync({ slug: post.slug, up: false });
voteCount.refetch();
}}
- icon={}
+ icon={}
/>
);
diff --git a/src/server/api/routers/post.ts b/src/server/api/routers/post.ts
index 43f15fd..533a26c 100644
--- a/src/server/api/routers/post.ts
+++ b/src/server/api/routers/post.ts
@@ -18,7 +18,7 @@ export const postRouter = createTRPCRouter({
.execute(sql`SELECT SUM(CASE WHEN up = TRUE THEN 1 ELSE -1 END)
FROM public.votes v
WHERE v.post_id = (SELECT id FROM posts WHERE slug = ${input.slug})`);
- return count[0]?.sum ?? 0;
+ return count[0]?.sum ?? '0';
}),
getBySlug: publicProcedure
.input(z.object({ slug: z.string() }))