Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

feat: highlight streak in heatmap subtitle

laurenspriemdd9d9d95b90c
diff --git a/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart b/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart
index edf35849aa..413c750ee6 100644
--- a/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart
+++ b/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart
@@ -304,13 +304,27 @@ class StatsCandidateBuilder extends WrappedCandidateBuilder {
return value == 1 ? "$formatted day" : "$formatted days";
}
- final List<String> detailChips = _cleanChips(<String>[
- if (displayWeekStart != null)
- "Peak week: ${weekStartFormat.format(displayWeekStart)} · ${numberFormat.format(peakWeekCount)}",
- "Longest streak: ${formatDayCount(snapshot.longestStreakDays)}",
- "Longest pause: ${formatDayCount(snapshot.longestGapDays)}",
- "Active days: ${numberFormat.format(snapshot.daysWithCaptures)}",
- ]);
+ final String? peakWeekSummary = displayWeekStart != null
+ ? "Peak week: ${weekStartFormat.format(displayWeekStart)} · ${numberFormat.format(peakWeekCount)}"
+ : null;
+ final String? streakSummary = snapshot.longestStreakDays > 0
+ ? "${numberFormat.format(snapshot.longestStreakDays)}-day streak"
+ : null;
+ final String? activeDaysSummary = snapshot.daysWithCaptures > 0
+ ? "${numberFormat.format(snapshot.daysWithCaptures)} active days"
+ : null;
+
+ const List<String> detailChips = <String>[];
+
+ final List<String> subtitleHighlights = <String>[];
+ if (streakSummary != null) {
+ subtitleHighlights.add(streakSummary);
+ }
+ if (activeDaysSummary != null) {
+ subtitleHighlights.add(activeDaysSummary);
+ }
+ final String subtitleSuffix =
+ subtitleHighlights.isEmpty ? "" : "\n${subtitleHighlights.join(" · ")}";
final Map<String, Object?> meta = <String, Object?>{
"weekdayLabels": snapshot.heatmapWeekdayLabels,
"grid": heatmapData.grid,
@@ -318,12 +332,19 @@ class StatsCandidateBuilder extends WrappedCandidateBuilder {
"maxCount": snapshot.heatmapMaxCount,
"detailChips": detailChips,
};
+ if (peakWeekSummary != null) {
+ meta["peakWeekSummary"] = peakWeekSummary;
+ }
+ if (snapshot.longestGapDays > 0) {
+ meta["longestPauseSummary"] =
+ "Longest pause: ${formatDayCount(snapshot.longestGapDays)}";
+ }
return <WrappedCard>[
WrappedCard(
type: WrappedCardType.statsHeatmap,
title: "Season rhythm",
- subtitle: "Week by week, here's how the year flowed.",
+ subtitle: "Week by week, here's how the year flowed.$subtitleSuffix",
meta: meta,
),
];
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart
index d27f22bdb1..e9d9fae0a7 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart
@@ -1016,7 +1016,7 @@ class _HeatmapCardContent extends StatelessWidget {
textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
),
- const SizedBox(height: 16),
+ const SizedBox(height: 20),
if (grid.isEmpty)
_MediaPlaceholder(
height: 180,
@@ -1094,13 +1094,13 @@ class _YearHeatmap extends StatelessWidget {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
- const double labelColumnWidth = 22;
- const double horizontalSpacing = 0.8;
- const double verticalSpacing = 0.6;
- const double minCellSize = 4;
- const double maxCellWidth = 11;
- const double maxCellHeight = 7.0;
- const double heightCompression = 0.55;
+ const double labelColumnWidth = 24;
+ const double horizontalSpacing = 1.2;
+ const double verticalSpacing = 1.0;
+ const double minCellSize = 5;
+ const double maxCellWidth = 13;
+ const double maxCellHeight = 9.0;
+ const double heightCompression = 0.7;
final double usableWidth = math.max(
0,
@@ -1119,7 +1119,7 @@ class _YearHeatmap extends StatelessWidget {
(cellWidth * columnCount) +
horizontalSpacing * math.max(0, columnCount - 1);
final TextStyle axisStyle =
- textTheme.tinyMuted.copyWith(fontSize: 7.5, height: 1.05);
+ textTheme.tinyMuted.copyWith(fontSize: 8.0, height: 1.1);
return Align(
alignment: Alignment.topCenter,