feat: implement settings layout and navigation, add tag and thought pages with API integration
This commit is contained in:
@@ -51,7 +51,7 @@ export function EditProfileForm({ currentUser }: EditProfileFormProps) {
|
||||
router.push(`/users/${currentUser.username}`);
|
||||
router.refresh(); // Ensure fresh data is loaded
|
||||
} catch (err) {
|
||||
toast.error("Failed to update profile.");
|
||||
toast.error(`Failed to update profile. ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,6 @@ import { Button } from "./ui/button";
|
||||
import { UserNav } from "./user-nav";
|
||||
import { MainNav } from "./main-nav";
|
||||
import { ThemeToggle } from "./theme-toggle";
|
||||
import { Wind } from "lucide-react";
|
||||
|
||||
export function Header() {
|
||||
const { token } = useAuth();
|
||||
|
43
thoughts-frontend/components/settings-nav.tsx
Normal file
43
thoughts-frontend/components/settings-nav.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
interface SettingsNavProps extends React.HTMLAttributes<HTMLElement> {
|
||||
items: {
|
||||
href: string;
|
||||
title: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export function SettingsNav({ className, items, ...props }: SettingsNavProps) {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav
|
||||
className={cn(
|
||||
"flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{items.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={cn(
|
||||
buttonVariants({ variant: "ghost" }),
|
||||
pathname === item.href
|
||||
? "bg-muted hover:bg-muted"
|
||||
: "hover:bg-transparent hover:underline",
|
||||
"justify-start"
|
||||
)}
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
@@ -72,6 +72,7 @@ export function ThoughtCard({
|
||||
toast.success("Thought deleted successfully.");
|
||||
router.refresh();
|
||||
} catch (error) {
|
||||
console.error("Failed to delete thought:", error);
|
||||
toast.error("Failed to delete thought.");
|
||||
} finally {
|
||||
setIsAlertOpen(false);
|
||||
|
Reference in New Issue
Block a user