fix(journal): drop broken WeatherCard from journal screen

The WeatherCard widget expected a flat shape (`current_temp`,
`condition`, `today_high`, ...) but the prep payload sends raw
OpenMeteo data nested under `forecast_json` per location. Every
field read as null, so the card pinned to the top of the journal
chat showed "null°" and "null/null" — visual noise covering up
the prep prose.

The prep prose itself already mentions weather plainly ("Weather at
home will reach a high of 15.9° with a 0% chance of precipitation"),
so the visual card is redundant. Removing it eliminates the bug
without losing any actual info; the weather data is still in
metadata.sections.weather if a future reader needs it.

Also deletes the unused widget file.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 10:54:22 -04:00
parent 76aff4ea9e
commit a77b71e0e2
2 changed files with 5 additions and 216 deletions
+5 -31
View File
@@ -10,7 +10,6 @@ import '../../providers/journal_provider.dart';
import '../../providers/voice_provider.dart';
import '../../widgets/chat_message_bubble.dart';
import '../../widgets/voice_mic_button.dart';
import '../../widgets/weather_card.dart';
import 'journal_history_screen.dart';
class JournalScreen extends ConsumerStatefulWidget {
@@ -366,9 +365,10 @@ class _JournalScreenState extends ConsumerState<JournalScreen>
}
}
/// Renders a single journal message. For the daily-prep assistant message,
/// also renders a WeatherCard above the bubble (weather lives in the
/// nested metadata.sections.weather payload).
/// Renders a single journal message. The daily-prep prose itself already
/// covers weather ("Weather at home will reach a high of 15.9° ..."), so
/// the journal screen leaves rendering to the message bubble — no separate
/// weather card on top.
class _JournalMessageItem extends StatelessWidget {
final Message message;
@@ -376,33 +376,7 @@ class _JournalMessageItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final meta = message.metadata;
final isAssistant = message.role == MessageRole.assistant;
final isPrep = isAssistant &&
meta != null &&
meta['kind'] == 'daily_prep';
Map<String, dynamic>? weatherData;
if (isPrep) {
// The journal prep stores its structured data under metadata.sections.
final sections = meta['sections'] as Map<String, dynamic>?;
final weather = sections?['weather'];
if (weather is List && weather.isNotEmpty) {
// Show the first location's weather card. The widget expects a
// single location dict; we pass the first one through.
weatherData = weather.first as Map<String, dynamic>?;
} else if (weather is Map) {
weatherData = weather as Map<String, dynamic>;
}
}
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (weatherData != null) WeatherCard(weather: weatherData),
ChatMessageBubble(message: message),
],
);
return ChatMessageBubble(message: message);
}
}