v.0.01
This commit is contained in:
12
app/app.py
12
app/app.py
@@ -31,6 +31,12 @@ class AppState(rx.State):
|
||||
error: str = ""
|
||||
show_preview: bool = False
|
||||
preview_content: str = ""
|
||||
|
||||
@rx.var
|
||||
def error_color(self) -> str:
|
||||
if "erfolgreich" in self.error:
|
||||
return "green"
|
||||
return "red"
|
||||
|
||||
def toggle_preview(self):
|
||||
"""Schaltet die Vorschau um."""
|
||||
@@ -65,7 +71,7 @@ class AppState(rx.State):
|
||||
try:
|
||||
with open(os.path.join(OUTPUT_DIR, val), "r", encoding="utf-8") as f:
|
||||
self.output = f.read()
|
||||
self.error = f"Log geladen: {val}"
|
||||
self.error = f"Log erfolgreich geladen: {val}"
|
||||
except Exception as e:
|
||||
self.error = f"Fehler beim Laden des Logs: {str(e)}"
|
||||
|
||||
@@ -210,7 +216,7 @@ def index():
|
||||
),
|
||||
rx.cond(
|
||||
AppState.error,
|
||||
rx.text(AppState.error, color="red"),
|
||||
rx.text(AppState.error, color=AppState.error_color),
|
||||
),
|
||||
spacing="2"
|
||||
),
|
||||
@@ -257,7 +263,7 @@ def index():
|
||||
AppState.error,
|
||||
rx.text(
|
||||
AppState.error,
|
||||
color="red",
|
||||
color=AppState.error_color,
|
||||
margin_top="1em",
|
||||
font_weight="bold"
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user