Skip to content

Commit

Permalink
welcome view fixes, database call for first time open, fixed spotify …
Browse files Browse the repository at this point in the history
…layout and search calls
  • Loading branch information
cachebag committed Jan 4, 2025
1 parent c36efe0 commit f252fe4
Show file tree
Hide file tree
Showing 9 changed files with 561 additions and 178 deletions.
1 change: 0 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# app.py
from textual.app import App, ComposeResult
from textual.screen import Screen
from .ui.views.nest import NewFileDialog
Expand Down
119 changes: 98 additions & 21 deletions src/config/theme.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ MainMenu {
height: 100%;
overflow: hidden;
padding: 1;
transition: width 0.10s;

}

Expand Down Expand Up @@ -80,8 +79,8 @@ MenuItem:focus {
.main-container {
width: 100%;
height: 100%;
background: $surface-darken-2;
layout: horizontal;
overflow: hidden;
}


Expand Down Expand Up @@ -562,19 +561,23 @@ DashboardCard {
width: auto;
align: right middle;
padding: 0;
text-style: none;
}

.filter-btn:hover {
background: $surface-lighten-1;
color: $text;
height: 2;
}

.filter-btn {
background: transparent;
min-width: 4;
height: 3;
height: 2;
padding: 0 1;
margin-left: 1;
border: none;
}

.filter-btn:hover {
background: $surface-lighten-1;
text-style: none;
}

.filter-btn.active {
Expand Down Expand Up @@ -667,13 +670,6 @@ FilterableDirectoryTree:focus {
height: 100%;
}

.main-container {
width: 100%;
height: 100%;
layout: horizontal;

}

.new-file-btn {
width: 4;
height: 3;
Expand Down Expand Up @@ -1049,14 +1045,15 @@ SpotifyPlayer Horizontal {
background: $surface-darken-2;
padding: 1;
dock: right;
border-left: solid $accent;
}

/* Main Content Area */
.main-content {
width: 1fr;
height: 100%;
padding: 1;
background: $surface-darken-2;
layout: horizontal;
}

/* Ensure the playlists section fills available space */
Expand Down Expand Up @@ -1157,6 +1154,10 @@ SpotifyView {
color: $accent;
}

.track-title:hover {
color: $accent;
}

.result-artist:hover {
background: transparent;
color: $accent;
Expand All @@ -1172,8 +1173,9 @@ SpotifyView {
}

.tracks-scroll {
height: 100%;
border: solid $background;
height: 1fr;
overflow-y: auto;
width: 100%;
}

.result-artist {
Expand Down Expand Up @@ -1265,6 +1267,7 @@ SettingsView {
padding: 1 2;
align: center middle;
layout: grid; /* Add this as well */
overflow: auto;
}

.settings-layout {
Expand All @@ -1284,6 +1287,8 @@ SettingsView {
width: 100%;
height: 100%;
padding: 1 2;
padding-left: 10;
overflow: auto;
}

.setting-button {
Expand Down Expand Up @@ -1344,8 +1349,80 @@ ThemeButton:focus {
grid-size: 2;
grid-columns: 1fr 1fr;
grid-rows: auto;
grid-gutter: 2 1; /* Reduced gutter, horizontal spacing only */
padding: 0; /* Remove padding */
align: center middle; /* Center the entire grid */
margin-right: 44; /* Add right margin to center the grid */
grid-gutter: 2 1;
padding: 0;
align: center middle;
margin-right: 44;
overflow: auto;
}

.playlist-view {
width: 33%;
height: 100%;
dock: left;
border-right: solid $secondary;

}

.recently-played-view {
width: 33%;
dock: right;
height: 100%;
}

.search-view {
width: 100%;
height: 100%;
layout: vertical;
border-right: solid $secondary;
}


.results-section-header {
dock: top;
padding: 1;
background: $surface-darken-2;
color: $text;
text-style: bold;
border-bottom: solid $primary;
}
.search-input {
width: 100%;
height: 3;
padding: 1;
background: $primary 19%;
border: none;
color: $text;
}

.search-input:focus {
background: white 20%;
color: $text;
}

.search-results-area {
width: 100%;
height: 1fr;
}

LoadingScreen {
background: $surface-darken-2;
}

.loading-container {
width: 100%;
height: 100%;
align: center middle;
dock: right;
}

.loading-text {
color: $text;
text-align: center;
margin-bottom: 1;
}

.loading-animation {
color: $accent;
text-align: center;
}
25 changes: 24 additions & 1 deletion src/core/database/tick_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ def _create_tables(self) -> None:
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS settings (
key TEXT PRIMARY KEY,
value TEXT
)
""")

cursor.execute("SELECT id, due_time FROM tasks")
tasks = cursor.fetchall()
Expand All @@ -66,7 +73,23 @@ def add_task(self, title: str, due_date: str, due_time: str, description: str =
""", (title, description, due_date, formatted_time))
conn.commit()
return cursor.lastrowid or 0


def is_first_launch(self) -> bool:
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute("SELECT value FROM settings WHERE key = 'first_launch'")
result = cursor.fetchone()
return result is None

def mark_first_launch_complete(self) -> None:
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute("""
INSERT OR REPLACE INTO settings (key, value)
VALUES ('first_launch', 'completed')
""")
conn.commit()

def get_tasks_for_date(self, date: str) -> List[Dict[str, Any]]:
with sqlite3.connect(self.db_path) as conn:
conn.row_factory = sqlite3.Row
Expand Down
Loading

0 comments on commit f252fe4

Please sign in to comment.