you can navigate using the repo name and owner name lol
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
height: 100%;
|
||||
content-align: left middle;
|
||||
width: auto;
|
||||
|
||||
link-style: none;
|
||||
link-style-hover: underline;
|
||||
link-background-hover: transparent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
4
main.py
4
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())
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user