Skip to content
Snippets Groups Projects
Commit 40b9b763 authored by Jakub Ziebinski's avatar Jakub Ziebinski
Browse files

Add a details button to each account on the dashboard

parent 3e331cd8
No related branches found
No related tags found
2 merge requests!399V1.27.5.12 release,!367Implementation of alarm management
...@@ -41,6 +41,31 @@ DashboardBase { ...@@ -41,6 +41,31 @@ DashboardBase {
AccountInfo { AccountInfo {
width: auto; width: auto;
#account-alarms-and-details {
width: auto;
height: auto;
AlarmDisplay {
align: center middle;
width: 100%;
}
#account-info-container {
width: auto;
height: 1;
EllipsedStatic {
width: 16;
text-align: center;
}
OneLineButton {
width: 9;
min-width: 9;
}
}
}
} }
BalanceStats { BalanceStats {
......
...@@ -2,8 +2,9 @@ from __future__ import annotations ...@@ -2,8 +2,9 @@ from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar, Final, Literal from typing import TYPE_CHECKING, ClassVar, Final, Literal
from textual import on
from textual.binding import Binding from textual.binding import Binding
from textual.containers import Container, Horizontal, ScrollableContainer from textual.containers import Container, Horizontal, ScrollableContainer, Vertical
from textual.widgets import Label, Static from textual.widgets import Label, Static
from clive.__private.core.formatters.data_labels import MISSING_API_LABEL from clive.__private.core.formatters.data_labels import MISSING_API_LABEL
...@@ -14,6 +15,7 @@ from clive.__private.core.formatters.humanize import ( ...@@ -14,6 +15,7 @@ from clive.__private.core.formatters.humanize import (
humanize_percent, humanize_percent,
) )
from clive.__private.storage.accounts import Account, AccountType, WorkingAccount from clive.__private.storage.accounts import Account, AccountType, WorkingAccount
from clive.__private.ui.account_details.account_details import AccountDetails
from clive.__private.ui.config.config import Config from clive.__private.ui.config.config import Config
from clive.__private.ui.get_css import get_relative_css_path from clive.__private.ui.get_css import get_relative_css_path
from clive.__private.ui.operations.operations import Operations from clive.__private.ui.operations.operations import Operations
...@@ -25,6 +27,7 @@ from clive.__private.ui.widgets.clive_widget import CliveWidget ...@@ -25,6 +27,7 @@ from clive.__private.ui.widgets.clive_widget import CliveWidget
from clive.__private.ui.widgets.ellipsed_static import EllipsedStatic from clive.__private.ui.widgets.ellipsed_static import EllipsedStatic
from clive.__private.ui.widgets.header import AlarmDisplay from clive.__private.ui.widgets.header import AlarmDisplay
from clive.__private.ui.widgets.no_content_available import NoContentAvailable from clive.__private.ui.widgets.no_content_available import NoContentAvailable
from clive.__private.ui.widgets.one_line_button import OneLineButton
from clive.models import Asset from clive.models import Asset
if TYPE_CHECKING: if TYPE_CHECKING:
...@@ -145,8 +148,11 @@ class ActivityStats(AccountReferencingWidget): ...@@ -145,8 +148,11 @@ class ActivityStats(AccountReferencingWidget):
class AccountInfo(Container, AccountReferencingWidget): class AccountInfo(Container, AccountReferencingWidget):
def compose(self) -> ComposeResult: def compose(self) -> ComposeResult:
yield EllipsedStatic(f"{self._account.name}") with Vertical(id="account-alarms-and-details"):
yield AlarmDisplay(lambda _: [self._account], id_="account-alarms") with Horizontal(id="account-info-container"):
yield EllipsedStatic(f"{self._account.name}")
yield OneLineButton("Details", id_="details-button")
yield AlarmDisplay(lambda _: [self._account], id_="account-alarms")
yield Static() yield Static()
yield Label("LAST:") yield Label("LAST:")
yield self.create_dynamic_label( yield self.create_dynamic_label(
...@@ -156,6 +162,10 @@ class AccountInfo(Container, AccountReferencingWidget): ...@@ -156,6 +162,10 @@ class AccountInfo(Container, AccountReferencingWidget):
lambda: f"Account update: {humanize_datetime(self._account.data.last_account_update)}", lambda: f"Account update: {humanize_datetime(self._account.data.last_account_update)}",
) )
@on(OneLineButton.Pressed, "#details-button")
def push_account_details_screen(self) -> None:
self.app.push_screen(AccountDetails(self._account))
class AccountRow(AccountReferencingWidget): class AccountRow(AccountReferencingWidget):
def compose(self) -> ComposeResult: def compose(self) -> ComposeResult:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment