Skip to content

Settings page : Ticket number not defined #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
1 change: 1 addition & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client"

import React, {useState} from "react"
import {Button} from "@/components/ui/button"
import {useSession} from "@/auth/session"
import {useRouter} from "next/navigation"
Expand Down
11 changes: 4 additions & 7 deletions app/profile/[slug]/ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {CommentFilledIcon, MintFilledIcon} from "@/components/ui/icons"
import React from "react"
import {NftType} from "@/domain/types"
import {Button} from "@/components/ui/button"
import {DotsHorizontalIcon} from "@radix-ui/react-icons"
import {cn} from "@/lib/utils"
import {Pacifico} from "next/font/google"
import Link from "next/link"
import {createRedirectQueryParam} from "@/utils/url"
import {Separator} from "@/components/ui/separator"
import {FollowUnfollowTextButton, ProfileStatisticsSectionSubAccess, ViewerUserType} from "../types"
import {SettingsPopover} from "@/components/section/SettingsPopover"

export const dynamic = "force-dynamic"

Expand Down Expand Up @@ -175,9 +175,7 @@ function SmallScreenProfileSection({
<div className="flex flex-col justify-between mt-2 ml-8">
<div className="flex items-center">
<h2 className="text-lg font-medium">{username}</h2>
<Link className="ml-4 mt-1" href="/">
<DotsHorizontalIcon className="size-5"/>
</Link>
<SettingsPopover/>
</div>
<div className="flex gap-2">
{
Expand Down Expand Up @@ -282,9 +280,8 @@ function MediumScreenProfileSection({
{
secondButton()
}
<Link className="mt-1 ml-2.5" href="/">
<DotsHorizontalIcon className="size-5"/>
</Link>
<SettingsPopover/>

</div>
<div className="font-semibold text-sm mt-4">{displayName}</div>

Expand Down
49 changes: 40 additions & 9 deletions app/settings/components/sidebar-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
"use client"

import Link from "next/link"

import {cn} from "@/lib/utils"
import {buttonVariants} from "@/components/ui/button"
import React from "react"

interface SidebarNavProps extends React.HTMLAttributes<HTMLElement> {
items: {
buttonVariant: any
href: string
title: string
}[]
}

export function SidebarNav({className, items, ...props}: SidebarNavProps) {
type ButtonType =
"link"
| "default"
| "destructive"
| "outline"
| "secondary"
| "ghost"
| "tertiary"
| null
| undefined;

const sidebarNavItems: {
title: string,
href: string,
buttonVariant: ButtonType,
}[] = [
{
title: "Log out",
href: "/logout",
buttonVariant: "outline",
},
{
title: "Change profile",
href: "/change-profile",
buttonVariant: "outline",
}, {
title: "Switch theme",
href: "/switch-mode",
buttonVariant: "outline",
},
{
title: "Settings",
href: "/settings",
buttonVariant: "outline",
},
]

export function SidebarNav({className, ...props}: SidebarNavProps) {
return (
<nav
className={cn(
"flex flex-col space-x-0 space-y-1",
"flex flex-col",
className
)}
{...props}
>
{items.map((item) => (
{sidebarNavItems.map((item) => (
<Link
key={item.href}
href={item.href}
Expand Down
42 changes: 7 additions & 35 deletions app/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,16 @@
"use client"

import React from "react"
import {SidebarNav} from "./components/sidebar-nav"


const sidebarNavItems = [
{
title: "TEA BAGs list",
href: "/tea-bags",
buttonVariant: "secondary",
},
{
title: "Reset password",
href: "/forgot-password",
buttonVariant: "secondary",
},
{
title: "Reset email",
href: "/reset-email",
buttonVariant: "secondary",
},
{
title: "Log out",
href: "/logout",
buttonVariant: "secondary",
},
{
title: "Edite profile",
href: "/settings/profile",
buttonVariant: "outline",
}, {
title: "Delete account",
href: "/delete-account",
buttonVariant: "destructive",
},
]


export default async function SettingsProfilePage() {
export default function SettingsProfilePage() {
return (
<aside className="w-full">
<SidebarNav items={sidebarNavItems}/>
<SidebarNav className="gap-1"/>
</aside>
)
}



27 changes: 27 additions & 0 deletions src/components/section/SettingsPopover.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use client"
import React from "react"
import {Popover, PopoverContent, PopoverTrigger} from "@/components/ui/popover"
import {PopoverArrow, PopoverPortal} from "@radix-ui/react-popover"
import {SidebarNav} from "../../../app/settings/components/sidebar-nav"
import {MenuIcon} from "lucide-react"


export function SettingsPopover() {
return (
<Popover>
<PopoverTrigger asChild>
<button className="IconButton p-5" aria-label="Update dimensions">
<MenuIcon/>
</button>
</PopoverTrigger>
<PopoverPortal>
<PopoverContent className="PopoverContent" sideOffset={5}>
<div style={{display: "flex", flexDirection: "column", gap: 1}}>
<SidebarNav className="gap-1"/>
</div>
<PopoverArrow className="PopoverArrow"/>
</PopoverContent>
</PopoverPortal>
</Popover>
)
}
54 changes: 25 additions & 29 deletions src/components/section/navigation/navigation-footer.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,45 @@
import {Separator} from "@/components/ui/separator"
import {HomeIcon, MenuIcon, PlusIcon, SearchIcon, SendIcon, UserIcon} from "lucide-react"
import {HomeIcon, PlusIcon, SearchIcon, SendIcon, UserIcon} from "lucide-react"
import React from "react"
import {SelectedNavigation} from "@/components/section/navigation/index"
import Link from "next/link"
import {cn} from "@/lib/utils"

interface NavigationFooterProps {
className?: string,
selectedNavigation: SelectedNavigation,
className?: string,
selectedNavigation: SelectedNavigation,
username: string,
avatarUrl: string,
}

export function NavigationFooter({className, selectedNavigation, username, avatarUrl}: NavigationFooterProps) {
return (
<section className={className}>
<Separator/>
<footer className="h-12 flex justify-evenly items-center">
<Link href="/home">
<HomeIcon className={cn(selectedNavigation === "home" && "text-primary")} size={26}/>
</Link>
<Link href="/search">
<SearchIcon className={cn(selectedNavigation === "search" && "text-primary")} size={26}/>
</Link>
<Link href="/new">
<PlusIcon className={cn(selectedNavigation === "new" && "text-primary")} size={30}/>
</Link>
<Link href="/messages">
<SendIcon className={cn(selectedNavigation === "messages" && "text-primary")} size={24}/>
</Link>
<Link className="grid items-center" href="/me">
return (
<section className={className}>
<Separator/>
<footer className="h-12 flex justify-evenly items-center">
<Link href="/home">
<HomeIcon className={cn(selectedNavigation === "home" && "text-primary")} size={26}/>
</Link>
<Link href="/search">
<SearchIcon className={cn(selectedNavigation === "search" && "text-primary")} size={26}/>
</Link>
<Link href="/new">
<PlusIcon className={cn(selectedNavigation === "new" && "text-primary")} size={30}/>
</Link>
<Link href="/messages">
<SendIcon className={cn(selectedNavigation === "messages" && "text-primary")} size={24}/>
</Link>
<Link className="grid items-center" href="/me">
<img
className={cn("rounded-full border-2 absolute size-8", selectedNavigation === "own_profile" && "border-primary")}
crossOrigin="anonymous"
draggable={false}
src={avatarUrl}
alt={`profile avatar of ${username}`}
/>
<UserIcon className={selectedNavigation === "own_profile" ? "text-primary" : ""} size={26}/>
</Link>
<Link href="/settings">
<MenuIcon className={selectedNavigation === "settings" ? "text-primary": ""} size={26}/>
</Link>

</footer>
</section>
)
<UserIcon className={selectedNavigation === "own_profile" ? "text-primary" : ""} size={26}/>
</Link>
</footer>
</section>
)
}
Loading