Skip to content

Commit

Permalink
pass down handle for /{handle} route
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Jan 10, 2025
1 parent f046ce6 commit a8d1662
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions daras_ai_v2/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ def get_meta_tags_for_profile(user: AppUser):
)


def user_profile_page(request: Request, user: AppUser):
def user_profile_page(request: Request, user: AppUser, handle: Handle | None):
with gui.div(className="mt-3"):
user_profile_header(request, user)
user_profile_header(request, user=user, handle=handle)
gui.html("\n<hr>\n")
user_profile_main_content(user)


def user_profile_header(request: Request, user: AppUser):
def user_profile_header(request: Request, user: AppUser, handle: Handle | None):
if user.banner_url:
with _banner_image_div(user.banner_url, className="my-3"):
pass
Expand Down Expand Up @@ -104,9 +104,9 @@ def user_profile_header(request: Request, user: AppUser):
):
gui.html(f"{icons.edit} Edit Profile")

if handle := user.get_handle():
if handle:
with gui.tag("p", className="lead text-secondary mb-0"):
gui.html(escape_html(handle and handle.name or ""))
gui.html(escape_html(handle.name))

if user.bio:
with gui.div(className="mt-2 text-secondary"):
Expand Down
2 changes: 1 addition & 1 deletion routers/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def render_handle_page(request: Request, name: str):

if user:
with page_wrapper(request):
user_profile_page(request, user)
user_profile_page(request, user=user, handle=handle)
return dict(meta=get_meta_tags_for_profile(user))
elif handle.has_redirect:
return RedirectResponse(
Expand Down

0 comments on commit a8d1662

Please sign in to comment.