Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/contexts/TimeTrackingContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useAuth } from "@/hooks/useAuth";
import { createDataService, DataService } from "@/services/dataService";
import { useRealtimeSync } from "@/hooks/useRealtimeSync";
import { generateDailySummary } from "@/utils/timeUtil";
import { toast } from "@/hooks/use-toast";

export interface Task {
id: string;
Expand Down Expand Up @@ -642,7 +643,12 @@ export const TimeTrackingProvider: React.FC<{ children: React.ReactNode }> = ({
});
console.log('✅ Cleared current day state saved');

// TODO: Add user notification of successful archive
// Show success notification to user
toast({
title: "Day Archived Successfully",
description: `${dayRecord.tasks.length} task(s) archived for ${dayRecord.date}`,
duration: 5000
});

} catch (error) {
console.error('❌ CRITICAL ERROR saving archived day:', error);
Expand All @@ -669,9 +675,13 @@ export const TimeTrackingProvider: React.FC<{ children: React.ReactNode }> = ({

console.log('🔄 Restored current day state after failed archive');

// TODO: Show user error notification
// This should display a toast/alert to the user about the archive failure
alert(`Failed to archive day data: ${error.message}\n\nYour current day has been restored. Please try archiving again.`);
// Show error notification to user
toast({
title: "Archive Failed",
description: `Failed to archive day data: ${error instanceof Error ? error.message : 'Unknown error'}. Your current day has been restored. Please try archiving again.`,
variant: "destructive",
duration: 7000
});
}
}
};
Expand Down