feat(frontend): add weather icons and redesign calendar header
Backend changes: - Add LOCATION configuration option to Settings - Add /api/system/config endpoint to expose public config - Implement location priority: config > geolocation > default Frontend changes: - Install and integrate weather-icons npm package (Erik Flowers) - Redesign calendar header with date/time on left, weather/location on right - Display weather icon using CSS classes instead of SVG components - Fetch location from backend API on component mount - Use configured location name (from .env) instead of geocoded result Layout: - Left: month/year + current time - Right: city name + weather description + weather icon
This commit is contained in:
@@ -61,6 +61,9 @@ class Settings(BaseSettings):
|
||||
DAILY_PLAN_TIME: str = "00:00"
|
||||
FORUM_SCAN_INTERVAL_MINUTES: int = 30
|
||||
|
||||
# === 位置配置 ===
|
||||
LOCATION: str = "Location"
|
||||
|
||||
# === CORS ===
|
||||
CORS_ORIGINS: list[str] = ["http://localhost:5173", "http://localhost:3000"]
|
||||
|
||||
|
||||
@@ -7,3 +7,9 @@ router = APIRouter(prefix='/api/system', tags=['system'])
|
||||
@router.get('/status')
|
||||
async def get_system_status():
|
||||
return SystemService().get_status()
|
||||
|
||||
|
||||
@router.get('/config')
|
||||
async def get_system_config():
|
||||
"""Get public system configuration."""
|
||||
return SystemService().get_config()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from datetime import datetime, UTC
|
||||
from time import monotonic
|
||||
import os
|
||||
import platform
|
||||
import socket
|
||||
import subprocess
|
||||
@@ -15,6 +16,11 @@ class SystemService:
|
||||
_last_net_bytes_recv: int | None = None
|
||||
_last_net_sample_at: float | None = None
|
||||
|
||||
def __init__(self):
|
||||
# Import settings here to avoid circular imports
|
||||
from app.config import settings
|
||||
self._settings = settings
|
||||
|
||||
def _get_network_rates(self) -> tuple[float, float]:
|
||||
counters = psutil.net_io_counters()
|
||||
now = monotonic()
|
||||
@@ -127,3 +133,9 @@ class SystemService:
|
||||
**gpu_status,
|
||||
'timestamp': datetime.now(UTC).isoformat(),
|
||||
}
|
||||
|
||||
def get_config(self) -> dict:
|
||||
"""Get public system configuration."""
|
||||
return {
|
||||
'location': self._settings.LOCATION,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user