feat(gamification): DailyCompletionCount type + showMomentumSparkline setting

Adds the Phase 8 frontend types. New setting defaults to true (sparkline
on for everyone on upgrade) and persists via the existing settings
envelope; no migration needed because missing keys spread over the
defaults object on load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 20:34:57 +01:00
parent 42b423e4f4
commit cb32285ce0
2 changed files with 16 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ const defaults: SettingsState = {
nudgesEnabled: false, nudgesEnabled: false,
nudgesMuted: false, nudgesMuted: false,
nudgesSpeakAloud: false, nudgesSpeakAloud: false,
showMomentumSparkline: true,
}; };
function canUseStorage(): boolean { function canUseStorage(): boolean {

View File

@@ -122,6 +122,12 @@ export interface SettingsState {
* has effect when `nudgesEnabled` is true. * has effect when `nudgesEnabled` is true.
*/ */
nudgesSpeakAloud: boolean; nudgesSpeakAloud: boolean;
/**
* Phase 8. Controls the 7-day momentum sparkline only. The "N today"
* badge on the Tasks header is always on regardless. Default true so
* existing users see the sparkline on upgrade.
*/
showMomentumSparkline: boolean;
} }
export interface Profile { export interface Profile {
@@ -224,6 +230,15 @@ export interface TranscriptMetaPatch {
*/ */
export type EnergyLevel = "high" | "medium" | "brain_dead"; export type EnergyLevel = "high" | "medium" | "brain_dead";
/**
* Phase 8: one bucket in the 7-day completion history fed to the
* momentum sparkline. `day` is "YYYY-MM-DD" local time.
*/
export interface DailyCompletionCount {
day: string; // "YYYY-MM-DD" local
count: number;
}
export interface TaskDto { export interface TaskDto {
id: string; id: string;
text: string; text: string;