fix: resolve TypeScript errors in timer, pagination, undo, and notification components
This commit is contained in:
@@ -5,6 +5,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { NotificationPrefs } from '@/components/notifications/notification-prefs';
|
||||
|
||||
export function SettingsShortcuts() {
|
||||
const { enabled, shortcuts, setEnabled, resetShortcuts } = useKeyboardShortcutsStore();
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from '@/components/ui/alert-dialog';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Calendar, Loader2 } from 'lucide-react';
|
||||
import { Calendar, Clock, Loader2, Play, Square } from 'lucide-react';
|
||||
|
||||
interface TaskDetail {
|
||||
id: string;
|
||||
@@ -209,9 +209,9 @@ export function TaskDetailPanel({
|
||||
const h = Math.floor(seconds / 3600);
|
||||
const m = Math.floor((seconds % 3600) / 60);
|
||||
const s = seconds % 60;
|
||||
if (h > 0) return \`\${h}h \${m}m\`;
|
||||
if (m > 0) return \`\${m}m \${s}s\`;
|
||||
return \`\${s}s\`;
|
||||
if (h > 0) return `${h}h ${m}m`;
|
||||
if (m > 0) return `${m}m ${s}s`;
|
||||
return `${s}s`;
|
||||
}
|
||||
|
||||
async function handleStartTimer() {
|
||||
@@ -229,7 +229,7 @@ export function TaskDetailPanel({
|
||||
}
|
||||
const newTracked = (task.trackedMinutes || 0) + deltaMinutes;
|
||||
try {
|
||||
const response = await fetch(\`/api/domains/\${domainId}/tasks/\${task.id}\`, {
|
||||
const response = await fetch(`/api/domains/${domainId}/tasks/${task.id}`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ trackedMinutes: newTracked }),
|
||||
@@ -237,7 +237,7 @@ export function TaskDetailPanel({
|
||||
if (!response.ok) throw new Error("Unable to save tracked time");
|
||||
setTask({ ...task, trackedMinutes: newTracked });
|
||||
onUpdate();
|
||||
toast.success(\`Tracked \${deltaMinutes} minute\${deltaMinutes !== 1 ? "s" : ""}\`);
|
||||
toast.success(`Tracked ${deltaMinutes} minute${deltaMinutes !== 1 ? "s" : ""}`);
|
||||
} catch {
|
||||
toast.error("Unable to save tracked time");
|
||||
} finally {
|
||||
@@ -365,7 +365,7 @@ export function TaskDetailPanel({
|
||||
<div
|
||||
className="h-full rounded-full bg-primary transition-all"
|
||||
style={{
|
||||
width: \`\${Math.min(100, Math.round(((task.trackedMinutes || 0) / task.estimatedMinutes) * 100))}%\`,
|
||||
width: `${Math.min(100, Math.round(((task.trackedMinutes || 0) / task.estimatedMinutes) * 100))}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Calendar, GripVertical, Plus } from 'lucide-react';
|
||||
import { Calendar, Clock, GripVertical, Plus } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { TaskDetailPanel } from './task-detail-panel';
|
||||
import { useRealtimeContext } from '@/components/realtime-provider';
|
||||
@@ -102,7 +102,7 @@ function TaskCard({
|
||||
{task.estimatedMinutes && (
|
||||
<span
|
||||
className="flex items-center gap-1 text-xs text-muted-foreground"
|
||||
title={}
|
||||
title={`Estimated: ${task.estimatedMinutes}m`}
|
||||
>
|
||||
<Clock className="h-3 w-3" />
|
||||
{task.estimatedMinutes}m
|
||||
|
||||
@@ -73,7 +73,7 @@ export function TasksListView({
|
||||
const LIMIT = 50;
|
||||
const { subscribe } = useRealtimeContext();
|
||||
|
||||
const fetchTasks = useCallback(async (appendOffset) => {
|
||||
const fetchTasks = useCallback(async (appendOffset?: number) => {
|
||||
if (!domainId) return;
|
||||
if (appendOffset === undefined) setLoading(true);
|
||||
else setLoadingMore(true);
|
||||
@@ -337,7 +337,7 @@ export function TasksListView({
|
||||
domainId={domainId}
|
||||
open={!!selectedTask}
|
||||
onOpenChange={(open) => !open && setSelectedTask(null)}
|
||||
onUpdate={fetchTasks}
|
||||
onUpdate={() => fetchTasks()}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { useSidebarStore } from '@/lib/stores/use-sidebar-store';
|
||||
import { useCreateDialogStore } from '@/lib/stores/use-create-dialog-store';
|
||||
import { CommandPalette } from '@/components/command-palette';
|
||||
import { NotificationBell } from '@/components/notifications/notification-bell';
|
||||
|
||||
export function TopBar() {
|
||||
const pathname = usePathname();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user