Skip to content

feat: Implement dynamic /[username] public profile route#100

Open
khushal1512 wants to merge 3 commits into
StabilityNexus:mainfrom
khushal1512:main
Open

feat: Implement dynamic /[username] public profile route#100
khushal1512 wants to merge 3 commits into
StabilityNexus:mainfrom
khushal1512:main

Conversation

@khushal1512

@khushal1512 khushal1512 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Addressed Issues:

#94

Screenshots/Recordings:

The deployed changes can be seen here: https://identity-tokens-evm-frontend-nzbz.vercel.app/khushalagarwal

TODO: If applicable, add screenshots or recordings that demonstrate the interface before and after the changes.

  • This PR covers teh /[username] public profile UI
  • The Create Identity Modal is deferred until wallet connection is handled.
  • Currently the "Create Identity" depends on Smart Contract Changes. Once the logic is finalized there, I will build out the concrete Identity creation modal and the onboarding flow.

Additional Notes:

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features

    • Public profiles now feature a dashboard layout with sidebar navigation
    • User metrics and token information are displayed on profile pages
    • Token management actions (endorse, revoke) are available on user profiles
  • Style

    • Updated navigation behavior and styling for profile pages

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
identity-tokens-evm-frontend Ready Ready Preview, Comment Jun 8, 2026 5:00am

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Public profile page is converted from server-rendered to client-side dashboard layout. A new UserTokenList component displays user tokens with action callbacks. The navbar conditionally hides its title on profile routes. The page uses client-side params and renders dashboard metrics and token lists. The layout wraps everything in a dashboard shell with sidebar and navbar.

Changes

Dashboard User Profile Page

Layer / File(s) Summary
UserTokenList component
components/dashboard/UserTokenList.tsx
New client component renders tokens section with conditional empty state or TokenCard list; optional callbacks (onRevoke, onEndorse, onViewAll) are wired to each token by id.
DashboardNavBar route-aware title rendering
components/layout/DashboardNavBar.tsx
Navbar adds knownRoutes list and computes isUserProfile flag from pathname; page title is conditionally rendered only for non-profile routes.
UsernamePage client component with dashboard content
app/[username]/page.tsx
Page is converted to client component using useParams; renders DashboardMetrics and UserTokenList with mockUserTokens, wiring token action handlers (onRevoke, onEndorse).
PublicProfileLayout dashboard shell structure
app/[username]/layout.tsx
Layout is updated from single section wrapper to full dashboard layout with DashboardSidebar and DashboardNavbar imports, flex container structure, and scrollable main area.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • StabilityNexus/IdentityTokens-EVM-Frontend#69: The new token-listing UI (UserTokenList wiring TokenCard actions) and dashboard navbar title logic directly overlap with PR #69's core dashboard navigation and token/TokenList/TokenCard component implementations.

Suggested labels

Typescript Lang

Poem

🐰 A profile page finds its gleaming form,
With token lists and dashboards warm,
The sidebar greets, navbar knows the way,
Client-side magic guides the day!
hops happily

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly reflects the main change: implementing the dynamic /[username] public profile route, which is the primary objective across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/`[username]/page.tsx:
- Line 7: The import of TokenData in page.tsx is a type-only import — replace
the current value import with a type-only import for TokenData (from
"`@/components/dashboard/TokenList`") so it reads as a type import; update the
import statement that references TokenData and ensure no runtime usage of
TokenData remains so the compiler/tree-shaker treats it as type-only.

In `@components/dashboard/UserTokenList.tsx`:
- Line 5: Replace the value import of TokenData with a type-only import since
TokenData is used purely as a type annotation; update the import statement that
currently references TokenData in UserTokenList (the line importing from
"./TokenList") to use `import type` so the module loader/tree-shaker treats it
as a type-only dependency.

In `@components/layout/DashboardNavBar.tsx`:
- Around line 23-28: The route-detection logic misuses knownRoutes (full path
strings) against pathname, so nested routes like "/dashboard/settings" are
flagged as profiles; update the logic to compare the first path segment
(firstSegment) against a list of known route segments instead of the full
pathname: change knownRoutes to a list of segment names (e.g.,
"","home","dashboard","discover","settings" or without empty string and handle
"/" separately) and then compute isUserProfile by checking pathname !== "/" &&
!knownRouteSegments.includes(firstSegment) && firstSegment.length > 0, keeping
the existing variables (knownRoutes / firstSegment / isUserProfile / pathname)
for easy location.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8cc977be-693d-49bb-a736-c8070f705b69

📥 Commits

Reviewing files that changed from the base of the PR and between 30f26de and 9b082da.

📒 Files selected for processing (4)
  • app/[username]/layout.tsx
  • app/[username]/page.tsx
  • components/dashboard/UserTokenList.tsx
  • components/layout/DashboardNavBar.tsx

Comment thread app/[username]/page.tsx
import { useParams } from "next/navigation";
import DashboardMetrics from "@/components/dashboard/DashboardMetrics";
import { UserTokenList } from "@/components/dashboard/UserTokenList";
import { TokenData } from "@/components/dashboard/TokenList";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Prefer import type for type-only imports.

TokenData is used only as a type annotation and should be imported with import type for better clarity and tree-shaking.

♻️ Suggested fix
-import { TokenData } from "`@/components/dashboard/TokenList`";
+import type { TokenData } from "`@/components/dashboard/TokenList`";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { TokenData } from "@/components/dashboard/TokenList";
import type { TokenData } from "`@/components/dashboard/TokenList`";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/`[username]/page.tsx at line 7, The import of TokenData in page.tsx is a
type-only import — replace the current value import with a type-only import for
TokenData (from "`@/components/dashboard/TokenList`") so it reads as a type
import; update the import statement that references TokenData and ensure no
runtime usage of TokenData remains so the compiler/tree-shaker treats it as
type-only.

Source: Coding guidelines


import React from "react";
import { TokenCard } from "../cards/TokenCard";
import { TokenData } from "./TokenList";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Prefer import type for type-only imports.

TokenData is used only as a type annotation and should be imported with import type to improve clarity and enable better tree-shaking.

♻️ Suggested fix
-import { TokenData } from "./TokenList";
+import type { TokenData } from "./TokenList";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { TokenData } from "./TokenList";
import type { TokenData } from "./TokenList";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/dashboard/UserTokenList.tsx` at line 5, Replace the value import
of TokenData with a type-only import since TokenData is used purely as a type
annotation; update the import statement that currently references TokenData in
UserTokenList (the line importing from "./TokenList") to use `import type` so
the module loader/tree-shaker treats it as a type-only dependency.

Source: Coding guidelines

Comment on lines +23 to +28
const knownRoutes = ["/", "/home", "/dashboard", "/discover", "/settings"];
const firstSegment = pathname?.split("/").filter(Boolean)[0] ?? "";
const isUserProfile =
pathname !== "/" &&
!knownRoutes.includes(pathname) &&
firstSegment.length > 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Refactor route detection to use path segments for robustness.

The current logic checks the full pathname against knownRoutes, which works for the current flat route structure but would misidentify nested routes (e.g., /dashboard/settings) as user profiles. Checking the first path segment against known route segments would be more maintainable and future-proof.

♻️ Suggested refactor
- const knownRoutes = ["/", "/home", "/dashboard", "/discover", "/settings"];
+ const knownRouteSegments = ["home", "dashboard", "discover", "settings"];
  const firstSegment = pathname?.split("/").filter(Boolean)[0] ?? "";
  const isUserProfile =
    pathname !== "/" &&
-   !knownRoutes.includes(pathname) &&
-   firstSegment.length > 0;
+   firstSegment !== "" &&
+   !knownRouteSegments.includes(firstSegment);

This approach correctly handles both /dashboard and potential future routes like /dashboard/settings.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/layout/DashboardNavBar.tsx` around lines 23 - 28, The
route-detection logic misuses knownRoutes (full path strings) against pathname,
so nested routes like "/dashboard/settings" are flagged as profiles; update the
logic to compare the first path segment (firstSegment) against a list of known
route segments instead of the full pathname: change knownRoutes to a list of
segment names (e.g., "","home","dashboard","discover","settings" or without
empty string and handle "/" separately) and then compute isUserProfile by
checking pathname !== "/" && !knownRouteSegments.includes(firstSegment) &&
firstSegment.length > 0, keeping the existing variables (knownRoutes /
firstSegment / isUserProfile / pathname) for easy location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant