From 6c7efcee54fd1e20186391b5b699558f1eeef4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 23 Oct 2026 16:47:29 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20sidebar=20pins=20your=20rep?= =?UTF-8?q?ositories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/forge-web/src/views/mod.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/forge-web/src/views/mod.rs b/crates/forge-web/src/views/mod.rs index e612762..cdee35e 100644 --- a/crates/forge-web/src/views/mod.rs +++ b/crates/forge-web/src/views/mod.rs @@ -148,7 +148,19 @@ pub async fn shell( href: repo_href(&repo.owner_name, &repo.name, "", ""), }) .collect(); - let current = nav_key(uri(__cx).path()); + // The viewer's own profile Repositories tab has its own sidebar key, so the pinned link lights up there. + let own_repos_tab = viewer.is_some_and(|(user, _)| { + uri(__cx).path().trim_matches('/') == user.username + && uri(__cx).query().is_some_and(|q| q.split('&').any(|p| p == "tab=repositories")) + }); + let current = if own_repos_tab { + "repositories" + } else { + nav_key(uri(__cx).path()) + }; + let profile_repos_href = viewer + .map(|(user, _)| format!("/{}?tab=repositories", enc(&user.username))) + .unwrap_or_default(); let signed_in = viewer.is_some(); let nav = viewer.map(|(user, session)| { ( @@ -292,7 +304,7 @@ pub async fn shell( if let Some(section) = section_menu { section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live) } else { - side_nav(lang: lang, current: current, unread: unread_menu, repos: side_repos_menu) + side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_menu, repos: side_repos_menu) } @@ -379,7 +391,7 @@ pub async fn shell( if let Some(section) = section { section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live) } else { - side_nav(lang: lang, current: current, unread: unread_aside, repos: side_repos) + side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_aside, repos: side_repos) } } @@ -409,16 +421,19 @@ pub async fn shell( } /// The signed-in global links and the viewer's repos. The sidebar shows it, and so does the phone -/// menu. `current` is the key from `nav_key`; `unread` is the bell count shown next to Notifications. +/// menu. `current` is the key from `nav_key`; `profile_repos_href` is the viewer's own Repositories +/// tab; `unread` is the bell count shown next to Notifications. #[component] async fn side_nav( lang: Lang, current: &str, + profile_repos_href: &str, unread: Option, repos: Vec, ) -> Result { let dashboard = current == "dashboard"; let explore = current == "explore"; + let repositories = current == "repositories"; let notifications = current == "notifications"; let snippets = current == "snippets"; let new_repo = current == "new"; @@ -434,6 +449,10 @@ async fn side_nav( (t(lang, Key::Explore)) + + + (o::t(lang, OK::Repositories)) + (t(lang, Key::Notifications))