From 91c01b76c082944d3617d22f4788d4654b4ce878 Mon Sep 17 00:00:00 2001 From: rajeevrajeshuni Date: Sat, 29 Nov 2025 23:13:48 +0530 Subject: [PATCH] more cleanup of styles --- cognee/cli/tui/add_screen.py | 5 ++-- cognee/cli/tui/cognify_screen.py | 5 ++-- cognee/cli/tui/common_styles.py | 34 +++++++++++++++++---- cognee/cli/tui/config_screen.py | 25 +++++++--------- cognee/cli/tui/delete_screen.py | 12 ++------ cognee/cli/tui/home_screen.py | 51 ++++++++------------------------ cognee/cli/tui/search_screen.py | 18 ++--------- 7 files changed, 64 insertions(+), 86 deletions(-) diff --git a/cognee/cli/tui/add_screen.py b/cognee/cli/tui/add_screen.py index 66ca7a7b4..5c4f31eb8 100644 --- a/cognee/cli/tui/add_screen.py +++ b/cognee/cli/tui/add_screen.py @@ -29,8 +29,9 @@ class AddTUIScreen(BaseTUIScreen): self.is_processing = False def compose_content(self) -> ComposeResult: - with Container(classes="tui-content-container"): - yield Label("Add Data to Cognee", classes="tui-title") + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("📥 Add Data to Cognee", classes="tui-title-bordered") with Vertical(classes="tui-form"): yield Label("Data (text, file path, URL, or S3 path):", classes="tui-label-spaced") yield TextArea( diff --git a/cognee/cli/tui/cognify_screen.py b/cognee/cli/tui/cognify_screen.py index 5d33377ea..cc5a7610c 100644 --- a/cognee/cli/tui/cognify_screen.py +++ b/cognee/cli/tui/cognify_screen.py @@ -39,8 +39,9 @@ class CognifyTUIScreen(BaseTUIScreen): self.is_processing = False def compose_content(self) -> ComposeResult: - with Container(classes="tui-content-container"): - yield Label("⚡ Cognify Data", classes="tui-title") + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("⚡ Cognify Data", classes="tui-title-bordered") with Vertical(classes="tui-form"): yield Label("Dataset Name (optional, leave empty for all):", classes="tui-label-spaced") yield Input( diff --git a/cognee/cli/tui/common_styles.py b/cognee/cli/tui/common_styles.py index a71949e1a..95a4ddd8e 100644 --- a/cognee/cli/tui/common_styles.py +++ b/cognee/cli/tui/common_styles.py @@ -12,12 +12,40 @@ Screen { padding: 1; } +.tui-bordered-wrapper { + border: solid $primary; +} + .tui-content-container { height: auto; padding: 1; content-align: center middle; } +/* Main container wrapper - used across all screens */ +.tui-main-container { + height: 100%; + background: $surface; +} + +/* Title wrapper - centers title elements */ +.tui-title-wrapper { + width: 100%; + height: auto; + align: center middle; + content-align: center middle; +} + +/* Styled title with border */ +.tui-title-bordered { + text-align: center; + width: auto; + color: $accent; + text-style: bold; + padding: 0 10; + border: solid $accent; +} + .tui-form { width: 100%; height: auto; @@ -26,12 +54,6 @@ Screen { background: $surface; } -.tui-form-compact { - border: solid $primary; - padding: 1; - background: $surface; -} - /* Common title styles */ .tui-title { text-align: center; diff --git a/cognee/cli/tui/config_screen.py b/cognee/cli/tui/config_screen.py index 9b0780fe5..e75c4d29b 100644 --- a/cognee/cli/tui/config_screen.py +++ b/cognee/cli/tui/config_screen.py @@ -78,11 +78,6 @@ class ConfigTUIScreen(BaseTUIScreen): ] CSS = BaseTUIScreen.CSS + """ - #config-container { - height: 100%; - border: solid $primary; - } - DataTable { height: 1fr; text-align: center; @@ -128,15 +123,17 @@ class ConfigTUIScreen(BaseTUIScreen): self.editing_key = None # Track which key is being edited def compose_content(self) -> ComposeResult: - with Container(id="config-container"): - yield Static("⚙️ Change Config", classes="tui-title") - table = DataTable() - table.cursor_type = "row" - table.zebra_stripes = True - yield table - with Container(id="inline-edit-container"): - yield Label("", id="edit-label") - yield Input(placeholder="Enter new value", id="inline-input") + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("⚙️ Change Config", classes="tui-title-bordered") + with Container(classes="tui-bordered-wrapper"): + table = DataTable() + table.cursor_type = "row" + table.zebra_stripes = True + yield table + with Container(id="inline-edit-container"): + yield Label("", id="edit-label") + yield Input(placeholder="Enter new value", id="inline-input") def compose_footer(self) -> ComposeResult: yield Static( diff --git a/cognee/cli/tui/delete_screen.py b/cognee/cli/tui/delete_screen.py index 69701cf69..19dece6ce 100644 --- a/cognee/cli/tui/delete_screen.py +++ b/cognee/cli/tui/delete_screen.py @@ -19,12 +19,6 @@ class DeleteTUIScreen(BaseTUIScreen): ] CSS = BaseTUIScreen.CSS + """ - #delete-container { - height: auto; - padding: 2; - align: center top; - } - #delete-form { width: 80; } @@ -41,10 +35,10 @@ class DeleteTUIScreen(BaseTUIScreen): self.is_processing = False def compose_content(self) -> ComposeResult: - with Container(id="delete-container"): + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("🗑 Delete Data", classes="tui-title-bordered") with Vertical(id="delete-form", classes="tui-form"): - yield Label("🗑️ Delete Data", classes="tui-title") - with Vertical(classes="tui-input-group"): yield Label("Dataset Name (optional):", classes="tui-label") yield Input( diff --git a/cognee/cli/tui/home_screen.py b/cognee/cli/tui/home_screen.py index b7ea94db0..e841a7f66 100644 --- a/cognee/cli/tui/home_screen.py +++ b/cognee/cli/tui/home_screen.py @@ -35,32 +35,6 @@ class HomeScreen(BaseTUIScreen): ] CSS = BaseTUIScreen.CSS + """ - #main-container { - height: 100%; - border: solid $primary; - background: $surface; - padding: 1; - } - - #title-wrapper { - width: 100%; - height: auto; - align: center middle; - content-align: center middle; - padding-bottom: 1; - } - - #title { - text-align: center; - width: auto; - color: $accent; - text-style: bold; - padding: 0 10; - border: solid $accent; - margin-bottom: 2; - } - - ListView > ListItem { width: 100%; padding: 0; @@ -141,18 +115,19 @@ class HomeScreen(BaseTUIScreen): self.current_index = 0 def compose_content(self) -> ComposeResult: - with Container(id="main-container"): - with Container(id="title-wrapper"): - yield Static("Select Command", id="title") - yield ListView( - make_item("📥", "add", "Add data to cognee"), - make_item("🔍", "search", "Search data in cognee"), - make_item("⚡", "cognify", "Process data in cognee"), - make_item("🗑️", "delete", "Delete data from cognee"), - make_item("⚙️", "config", "Configure cognee settings"), - id="menu-list", - classes="menu-list", - ) + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("Select Command", classes="tui-title-bordered") + with Container(classes="tui-bordered-wrapper"): + yield ListView( + make_item("📥", "add", "Add data to cognee"), + make_item("🔍", "search", "Search data in cognee"), + make_item("⚡", "cognify", "Process data in cognee"), + make_item("🗑️", "delete", "Delete data from cognee"), + make_item("⚙️", "config", "Configure cognee settings"), + id="menu-list", + classes="menu-list", + ) def compose_footer(self) -> ComposeResult: yield Static( diff --git a/cognee/cli/tui/search_screen.py b/cognee/cli/tui/search_screen.py index 2ba42e673..fa23e084d 100644 --- a/cognee/cli/tui/search_screen.py +++ b/cognee/cli/tui/search_screen.py @@ -17,19 +17,6 @@ class SearchTUIScreen(BaseTUIScreen): ] CSS = BaseTUIScreen.CSS + """ - #search-container { - height: 100%; - padding: 1; - } - - #form-title { - text-align: center; - text-style: bold; - color: $accent; - margin-bottom: 2; - width: 100%; - } - #search-form { height: auto; border: solid $primary; @@ -69,8 +56,9 @@ class SearchTUIScreen(BaseTUIScreen): self.is_searching = False def compose_content(self) -> ComposeResult: - with Container(id="search-container"): - yield Label("🔍 Search Data", id="form-title") + with Container(classes="tui-main-container"): + with Container(classes="tui-title-wrapper"): + yield Static("🔍 Search Data", classes="tui-title-bordered") with Vertical(id="search-form"): yield Label("Query:", classes="tui-label-spaced") yield Input(placeholder="Enter your search query...", id="query-input")