package com.hyperling.weather import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.* import androidx.compose.ui.Modifier @Composable fun App() { // Initialize platform-specific storage and environment (JVM/Desktop vs Android) val platformInit = remember { getPlatformInit() } LaunchedEffect(platformInit) { platformInit.initialize() } MaterialTheme { MainScreen(modifier = Modifier.fillMaxSize()) } } @Composable fun MainScreen(modifier: Modifier = Modifier) { val viewModel = remember { MainViewModel() } // Initialize ViewModel by loading existing locations LaunchedEffect(Unit) { viewModel.init() } Box(modifier = modifier) { CelticWheel( viewModel = viewModel, onLocationClick = { loc -> viewModel.startEditing(loc) }, sizeInDp = 360 ) // If editing a location, show the Editor overlay if (viewModel.editingLocation != null) { LocationEditor( entry = viewModel.editingLocation, onDismiss = { viewModel.cancelEditing() }, onSave = { loc -> viewModel.saveLocation(loc) viewModel.cancelEditing() viewModel.fetchAllWeather() // Refresh data after saving } ) } // Loading indicator (optional visual cue) if (viewModel.loading) { androidx.compose.material3.CircularProgressIndicator( modifier = Modifier.align(androidx.compose.ui.Alignment.Center), color = SeasonColors.Accent ) } } }