refactor(frontend): EmptyState + LoadingSkeleton primitives; unified ThoughtForm replaces PostThoughtForm and ReplyForm

This commit is contained in:
2026-05-15 20:01:00 +02:00
parent dadfe04934
commit d450a1d8d8
10 changed files with 203 additions and 253 deletions

View File

@@ -7,7 +7,8 @@ import {
getTopFriends,
Me,
} from "@/lib/api";
import { PostThoughtForm } from "@/components/post-thought-form";
import { ThoughtForm } from "@/components/thought-form";
import { EmptyState } from "@/components/empty-state";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { PopularTags } from "@/components/popular-tags";
@@ -80,7 +81,7 @@ async function FeedPage({
<header className="mb-6">
<h1 className="text-3xl font-bold text-shadow-sm">Your Feed</h1>
</header>
<PostThoughtForm />
<ThoughtForm />
<div className="block lg:hidden space-y-6">
<PopularTags />
@@ -102,9 +103,7 @@ async function FeedPage({
/>
))}
{thoughtThreads.length === 0 && (
<p className="text-center text-muted-foreground pt-8">
Your feed is empty. Follow some users to see their thoughts!
</p>
<EmptyState message="Your feed is empty. Follow some users to see their thoughts!" />
)}
</div>
<PaginationNav

View File

@@ -16,6 +16,7 @@ export async function generateMetadata({
: "Search for people and thoughts on Thoughts",
};
}
import { EmptyState } from "@/components/empty-state";
import { UserListCard } from "@/components/user-list-card";
import { RemoteUserCard } from "@/components/remote-user-card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
@@ -67,9 +68,7 @@ export default async function SearchPage({ searchParams }: SearchPageProps) {
<RemoteUserCard actor={remoteActor} />
</div>
) : (
<p className="text-center text-muted-foreground pt-8">
No user found at {query}
</p>
<EmptyState message={`No user found at ${query}`} />
)
) : results ? (
<Tabs defaultValue="thoughts" className="w-full">
@@ -92,9 +91,7 @@ export default async function SearchPage({ searchParams }: SearchPageProps) {
</TabsContent>
</Tabs>
) : (
<p className="text-center text-muted-foreground pt-8">
No results found or an error occurred.
</p>
<EmptyState message="No results found or an error occurred." />
)}
</main>
</div>

View File

@@ -23,6 +23,7 @@ export async function generateMetadata({
},
};
}
import { EmptyState } from "@/components/empty-state";
import { buildThoughtThreads } from "@/lib/utils";
import { ThoughtThread } from "@/components/thought-thread";
import { notFound } from "next/navigation";
@@ -66,9 +67,7 @@ export default async function TagPage({ params }: TagPageProps) {
/>
))}
{thoughtThreads.length === 0 && (
<p className="text-center text-muted-foreground pt-8">
No thoughts found for this tag.
</p>
<EmptyState message="No thoughts found for this tag." />
)}
</main>
</div>

View File

@@ -44,6 +44,7 @@ export async function generateMetadata({
},
};
}
import { EmptyState } from "@/components/empty-state";
import { UserAvatar } from "@/components/user-avatar";
import { Calendar, Settings } from "lucide-react";
import { Card } from "@/components/ui/card";
@@ -278,14 +279,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
/>
))}
{thoughtThreads.length === 0 && (
<Card
id="profile-card__no-thoughts"
className="flex items-center justify-center h-48"
>
<p className="text-center text-muted-foreground">
This user hasn&apos;t posted any public thoughts yet.
</p>
</Card>
<EmptyState message="This user hasn't posted any public thoughts yet." />
)}
</TabsContent>
{isOwnProfile && (