you can navigate using the repo name and owner name lol
This commit is contained in:
@@ -5,6 +5,10 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
content-align: left middle;
|
content-align: left middle;
|
||||||
width: auto;
|
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 textual.app import App, ComposeResult
|
||||||
from screens.welcome_screen import WelcomeScreen
|
from screens.welcome_screen import WelcomeScreen
|
||||||
|
from screens.repo_view_screen import RepoViewScreen
|
||||||
|
|
||||||
|
|
||||||
class TuiGithub(App):
|
class TuiGithub(App):
|
||||||
GITEA_HOST = "https://chookspace.com/"
|
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):
|
def on_compose(self):
|
||||||
self.push_screen(WelcomeScreen())
|
self.push_screen(WelcomeScreen())
|
||||||
|
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ class RepoViewScreen(Screen):
|
|||||||
|
|
||||||
with VerticalGroup(id="top"):
|
with VerticalGroup(id="top"):
|
||||||
with HorizontalGroup():
|
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"):
|
with Right(id="buttons"):
|
||||||
yield Button(f"\uf005 Star [d]({data["stars_count"]})", variant="warning", flat=True)
|
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)
|
yield Button(f"\uf418 Fork [d]({data["forks_count"]})", variant="primary", flat=True)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class SearchResult(HorizontalGroup):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
updated_string = time_delta(datetime.now() - self.updated_at)
|
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):
|
class SearchScreen(Screen):
|
||||||
DEFAULT_CSS = """
|
DEFAULT_CSS = """
|
||||||
@@ -69,9 +69,6 @@ class SearchScreen(Screen):
|
|||||||
|
|
||||||
self.selects_changed = [] # just used to prevent some issues
|
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)
|
@work(exclusive=True)
|
||||||
async def action_search_query(self):
|
async def action_search_query(self):
|
||||||
query_input = self.query_one("#query")
|
query_input = self.query_one("#query")
|
||||||
|
|||||||
Reference in New Issue
Block a user