Skip to content

Add username + profile link to sidebar#1138

Open
matmanna wants to merge 20 commits into
hackclub:mainfrom
matmanna:profile-links
Open

Add username + profile link to sidebar#1138
matmanna wants to merge 20 commits into
hackclub:mainfrom
matmanna:profile-links

Conversation

@matmanna
Copy link
Copy Markdown
Member

@matmanna matmanna commented Apr 6, 2026

Before:

image

After:

transitions between

image

and

image

depending on hover state

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 6, 2026

Greptile Summary

This PR adds the current user's username to the sidebar's UserSummary component, displaying it as an animated hover-reveal that links to their public profile page.

  • inertia_controller.rb exposes username in the nav props and settings/base_controller.rb exposes a correctly-formatted profile_url (with @ prefix) for the settings view.
  • UserSummary.svelte derives a local profile path via the existing profiles route helper and wraps the display name in an Inertia <Link> that cross-fades to the @username on hover; the fallback (no username) preserves the original plain-text span.

Confidence Score: 5/5

Safe to merge — the change is additive, null-safe on the frontend, and consistent with existing patterns throughout the codebase.

The username field is optional in both the Ruby hash and the TypeScript type, and the Svelte component gracefully falls back to the original plain-text span when no username is present. The profile path uses the same profiles route helper already used elsewhere, and the hover animation is purely cosmetic with no data-flow risk.

No files require special attention.

Important Files Changed

Filename Overview
app/controllers/inertia_controller.rb Adds username field to the nav current user hash; straightforward and consistent with existing nav prop pattern.
app/controllers/settings/base_controller.rb Adds profile_url with correct @ prefix and proper domain to the settings props; consistent with existing hardcoded URL patterns in the file.
app/javascript/layouts/app/UserSummary.svelte Replaces plain name span with an animated hover effect that reveals the username via a profile link; null-safe, uses correct Svelte 5 $derived rune, and reuses profiles route helper consistently.
app/javascript/types/index.ts Adds optional username field to NavCurrentUser type; correctly typed as string

Sequence Diagram

sequenceDiagram
    participant Rails as InertiaController
    participant Inertia as Inertia Props
    participant Svelte as UserSummary.svelte
    participant Router as profiles.show.path

    Rails->>Inertia: "inertia_nav_current_user {display_name, username, avatar_url, …}"
    Inertia->>Svelte: user prop (NavCurrentUser)
    Svelte->>Router: "profiles.show.path({ username })"
    Router-->>Svelte: "profilePath (e.g. /@alice)"
    Svelte-->>Svelte: if profilePath → render Link else → render plain span
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into profile-links" | Re-trigger Greptile

Comment thread app/javascript/layouts/AppLayout.svelte Outdated
Comment thread app/controllers/inertia_controller.rb
Copy link
Copy Markdown
Member

@skyfallwastaken skyfallwastaken left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Two things:

  • Please fix the merge conflicts
  • It would be nice if you could see the username by hovering over the display name, rather than it always being there

@matmanna matmanna requested a review from skyfallwastaken May 28, 2026 02:53
@matmanna
Copy link
Copy Markdown
Member Author

@skyfallwastaken switched to a transition between the displayname and username based on mouse hover. all merge conflicts + pr checks also look good now!

@matmanna
Copy link
Copy Markdown
Member Author

@greptileai review

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.

2 participants