From 7956361044589910b9cb14ef9bc97cecf070e967 Mon Sep 17 00:00:00 2001 From: SpookyDervish Date: Fri, 6 Feb 2026 07:45:04 +1100 Subject: [PATCH] you can navigate using the repo name and owner name lol --- assets/repo_view_screen.tcss | 4 ++++ main.py | 4 ++++ screens/repo_view_screen.py | 2 +- screens/search_screen.py | 5 +---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/assets/repo_view_screen.tcss b/assets/repo_view_screen.tcss index e701b7c..e333a74 100644 --- a/assets/repo_view_screen.tcss +++ b/assets/repo_view_screen.tcss @@ -5,6 +5,10 @@ height: 100%; content-align: left middle; width: auto; + + link-style: none; + link-style-hover: underline; + link-background-hover: transparent; } diff --git a/main.py b/main.py index a7549d3..7d311ed 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,14 @@ from textual.app import App, ComposeResult from screens.welcome_screen import WelcomeScreen +from screens.repo_view_screen import RepoViewScreen class TuiGithub(App): GITEA_HOST = "https://chookspace.com/" + def action_view_repo(self, author: str, repo_name: str): + self.switch_screen(RepoViewScreen(author, repo_name)) + def on_compose(self): self.push_screen(WelcomeScreen()) diff --git a/screens/repo_view_screen.py b/screens/repo_view_screen.py index 5ae9bac..acef69f 100644 --- a/screens/repo_view_screen.py +++ b/screens/repo_view_screen.py @@ -306,7 +306,7 @@ class RepoViewScreen(Screen): with VerticalGroup(id="top"): with HorizontalGroup(): - yield Static(f" {self.owner_name}/[b]{self.repo_name}[/]", id="title") + yield Static(f" [@click=app.view_user('{self.owner_name}')]{self.owner_name}[/]/[b @click=app.view_repo('{self.owner_name}','{self.repo_name}')]{self.repo_name}[/]", id="title") with Right(id="buttons"): yield Button(f"\uf005 Star [d]({data["stars_count"]})", variant="warning", flat=True) yield Button(f"\uf418 Fork [d]({data["forks_count"]})", variant="primary", flat=True) diff --git a/screens/search_screen.py b/screens/search_screen.py index a233645..cb9aa7d 100644 --- a/screens/search_screen.py +++ b/screens/search_screen.py @@ -45,7 +45,7 @@ class SearchResult(HorizontalGroup): def compose(self) -> ComposeResult: updated_string = time_delta(datetime.now() - self.updated_at) - yield Static(f"[@click='view_user({self.author["id"]})']{self.author["login"]}[/] / [@click='screen.view_repo(\"{self.author["login"]}\",\"{self.repo_name}\")']{self.repo_name}[/]{' [d]\[[cyan]fork[/]]' if self.is_fork else ''}\n{self.description}\n[d]Updated {updated_string} ago") + yield Static(f"[@click='app.view_user({self.author["id"]})']{self.author["login"]}[/] / [@click='app.view_repo(\"{self.author["login"]}\",\"{self.repo_name}\")']{self.repo_name}[/]{' [d]\[[cyan]fork[/]]' if self.is_fork else ''}\n{self.description}\n[d]Updated {updated_string} ago") class SearchScreen(Screen): DEFAULT_CSS = """ @@ -68,9 +68,6 @@ class SearchScreen(Screen): super().__init__() self.selects_changed = [] # just used to prevent some issues - - def action_view_repo(self, author: str, repo_name: str): - self.app.switch_screen(RepoViewScreen(author, repo_name)) @work(exclusive=True) async def action_search_query(self):