Repository navigation
feat(profile): add /profile/[did] route #44
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
Changes from 2 commits
0a13c3a
ee54b30
5cd2a7a
9c0a380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { Metadata } from "next"; | ||
| import HomeClient from "@/components/landing/home-client"; | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: "Profile", | ||
| description: "Certified profile and account overview.", | ||
| robots: { index: false, follow: false }, | ||
| }; | ||
|
|
||
| export default function ProfilePage() { | ||
| return <HomeClient />; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,15 +14,15 @@ import { useOrg } from "@/lib/groups/org-context"; | |
| import { useOrgProfile } from "@/hooks/use-org-profile"; | ||
| import { Menu, X, ChevronDown, LogOut } from "lucide-react"; | ||
|
|
||
| const PERSONAL_NAV_LINKS = [ | ||
| { href: "/", label: "Profile" }, | ||
| const PERSONAL_NAV_LINKS = (profileHref: string) => [ | ||
| { href: profileHref, label: "Profile" }, | ||
| { href: "/groups", label: "Groups" }, | ||
| { href: "/connected-apps", label: "Apps" }, | ||
| { href: "/settings", label: "Settings" }, | ||
| ]; | ||
|
|
||
| const ORG_NAV_LINKS = [ | ||
| { href: "/", label: "Profile" }, | ||
| const ORG_NAV_LINKS = (profileHref: string) => [ | ||
| { href: profileHref, label: "Profile" }, | ||
| { href: "/connected-apps", label: "Apps" }, | ||
| { href: "/settings", label: "Settings" }, | ||
| ]; | ||
|
|
@@ -145,7 +145,10 @@ const Navbar: React.FC = () => { | |
| }, [sheetExpanded]); | ||
|
|
||
| // Derive display state from org context | ||
| const navLinks = activeOrg ? ORG_NAV_LINKS : PERSONAL_NAV_LINKS; | ||
| const profileDid = activeOrg?.groupDid || did; | ||
| const profileHref = profileDid ? `/profile/${encodeURIComponent(profileDid)}` : "/"; | ||
| const selfProfileHref = did ? `/profile/${encodeURIComponent(did)}` : "/"; | ||
| const navLinks = activeOrg ? ORG_NAV_LINKS(profileHref) : PERSONAL_NAV_LINKS(profileHref); | ||
| const displayName = activeOrg | ||
| ? (activeOrg.displayName || activeOrg.handle) | ||
| : profile?.displayName; | ||
|
|
@@ -169,6 +172,9 @@ const Navbar: React.FC = () => { | |
|
|
||
| const isActive = (href: string) => { | ||
| if (href === "/") return pathname === "/" || pathname === "/settings/edit-profile"; | ||
| if (href.startsWith("/profile/")) { | ||
| return pathname === "/" || pathname.startsWith("/profile/") || pathname === "/settings/edit-profile"; | ||
| } | ||
|
Comment on lines
173
to
+177
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep “Profile” active on org edit-profile screens. When org mode clicks Edit, 🤖 Prompt for AI Agents |
||
| return pathname.startsWith(href); | ||
| }; | ||
|
|
||
|
|
@@ -216,7 +222,7 @@ const Navbar: React.FC = () => { | |
| <button | ||
| role="menuitem" | ||
| className={`account-switcher__item ${!activeOrg ? "account-switcher__item--active" : ""}`} | ||
| onClick={() => { switchOrg(null); setSwitcherOpen(false); router.push("/"); }} | ||
| onClick={() => { switchOrg(null); setSwitcherOpen(false); router.push(selfProfileHref); }} | ||
| > | ||
| <Avatar | ||
| src={avatarUrl || undefined} | ||
|
|
@@ -253,7 +259,7 @@ const Navbar: React.FC = () => { | |
| onClick={() => { | ||
| switchOrg(org); | ||
| setSwitcherOpen(false); | ||
| router.push("/"); | ||
| router.push(`/profile/${encodeURIComponent(org.groupDid)}`); | ||
| }} | ||
| > | ||
| <Avatar | ||
|
|
@@ -306,7 +312,7 @@ const Navbar: React.FC = () => { | |
| <button | ||
| role="menuitem" | ||
| className={`account-switcher__item ${!activeOrg ? "account-switcher__item--active" : ""}`} | ||
| onClick={() => { switchOrg(null); setSwitcherOpen(false); router.push("/"); }} | ||
| onClick={() => { switchOrg(null); setSwitcherOpen(false); router.push(selfProfileHref); }} | ||
| > | ||
| <Avatar | ||
| src={avatarUrl || undefined} | ||
|
|
@@ -343,7 +349,7 @@ const Navbar: React.FC = () => { | |
| onClick={() => { | ||
| switchOrg(org); | ||
| setSwitcherOpen(false); | ||
| router.push("/"); | ||
| router.push(`/profile/${encodeURIComponent(org.groupDid)}`); | ||
| }} | ||
| > | ||
| <Avatar | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.