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