Autodocs frontend
Frontend module for the Alcancía application.
This module provides the user interface for interacting with the Alcancía REST API. It includes modal screens, forms, and a table for displaying transactions, as well as methods for communicating with the backend API.
Classes:
Name | Description |
---|---|
- ModalLoading |
A modal screen that displays a loading indicator. |
- ModalError |
A modal screen that displays an error message. |
- ModalForm |
A modal screen for user input (deposit or withdraw). |
- TransactionsTable |
A table for displaying transaction history. |
- Alcancia |
The main application class for the frontend. |
Functions:
Name | Description |
---|---|
- run_app |
Runs the Alcancía application. |
TransactionType = Literal['deposit', 'withdraw']
module-attribute
#
The type of transaction. Can be either 'deposit' or 'withdraw'.
Alcancia
#
Bases: App
The main application class for the Alcancía frontend.
This class manages the user interface and communicates with the backend API.
api_get_transactions()
async
#
Fetch the current balance and transactions from the backend.
api_put_transaction(txn_variant, amount)
async
#
Send a transaction (deposit or withdraw) to the backend.
compose()
#
Compose the main application layout.
hacer_deposito()
#
Handle the deposit button press.
hacer_retiro()
#
Handle the withdraw button press.
on_mount()
async
#
Run tasks when the application is mounted.
update_balance(value)
#
Update the displayed balance.
update_transactions(transactions)
#
Update the displayed transaction history.
ModalError
#
ModalForm
#
Bases: ModalScreen[Decimal | None]
A modal screen for user input (deposit or withdraw).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variant
|
TransactionType
|
The type of transaction ('deposit' or 'withdraw'). |
required |
saldo
|
Decimal
|
The current balance of the Alcancía. |
required |
ModalLoading
#
Bases: ModalScreen
A modal screen that displays a loading indicator.
This screen is shown while the application is waiting for a response from the backend.
compose()
#
Compose the loading modal screen.
TransactionsTable
#
Bases: DataTable
A table for displaying transaction history.
Attributes:
Name | Type | Description |
---|---|---|
BORDER_TITLE |
str
|
The title of the table border. |
BORDER_SUBTITLE |
str
|
The subtitle of the table border. |
run_app()
#
Run the Alcancía application.