feat(drag-resize-widgets): Dashboard-Widgets: resizable via drag-Handle (CSS-resize) [tsc:fail]
This commit is contained in:
parent
3da3a1eb05
commit
5b41a4d49f
@ -1,10 +1,11 @@
|
||||
{
|
||||
"completed_features": [],
|
||||
"current_feature": "animated-transitions",
|
||||
"current_feature": "drag-resize-widgets",
|
||||
"started_at": "2026-05-23T08:25:49.746920",
|
||||
"attempted_features": [
|
||||
"workspace-logo",
|
||||
"custom-themes",
|
||||
"command-bar-actions"
|
||||
"command-bar-actions",
|
||||
"animated-transitions"
|
||||
]
|
||||
}
|
||||
@ -2761,3 +2761,20 @@ src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy
|
||||
- `08:30:30` **INFO** Committed feature animated-transitions
|
||||
- `08:30:30` **INFO** Pushed: rc=0
|
||||
|
||||
## Phase-3 Feature: drag-resize-widgets (2026-05-23 08:30:30)
|
||||
|
||||
- `08:30:30` **INFO** Description: Dashboard-Widgets: resizable via drag-Handle (CSS-resize)
|
||||
- `08:30:30` **INFO** Generating apps/web/src/pages/Dashboard.tsx (ERWEITERT — behalte alles. Jede Widget-Card bekommt `resize: both; ove…)
|
||||
- `08:31:52` **INFO** wrote 9525 chars in 81.8s (attempt 1)
|
||||
- `08:31:52` **INFO** Running tsc --noEmit on api…
|
||||
- `08:31:53` **WARN** tsc errors:
|
||||
src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'.
|
||||
Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy
|
||||
|
||||
@ -20,7 +20,7 @@ function RecentProjects() {
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4 h-full">
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2">
|
||||
<FolderKanban size={14} /> Aktive Projekte
|
||||
</h3>
|
||||
@ -53,7 +53,7 @@ function ActivityFeed() {
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4 h-full">
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2">
|
||||
<Activity size={14} /> Letzte Aktivitäten
|
||||
</h3>
|
||||
@ -100,230 +100,123 @@ export default function Dashboard() {
|
||||
localStorage.setItem('dashboard_widgets', JSON.stringify(newWidgets))
|
||||
}
|
||||
|
||||
const today = new Date().toISOString().split("T")[0]
|
||||
|
||||
const getStartOfWeek = (offsetWeeks = 0) => {
|
||||
const d = new Date()
|
||||
d.setDate(d.getDate() - (offsetWeeks * 7))
|
||||
const day = d.getDay()
|
||||
const diff = d.getDate() - day + (day === 0 ? -6 : 1)
|
||||
const start = new Date(d.setDate(diff))
|
||||
return start.toISOString().split("T")[0]
|
||||
const widgetStyle: React.CSSProperties = {
|
||||
resize: 'both',
|
||||
overflow: 'auto',
|
||||
minHeight: '256px', // 64 * 4 = 256px
|
||||
}
|
||||
|
||||
const getLast7Days = () => {
|
||||
const dates = []
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
const d = new Date()
|
||||
d.setDate(d.getDate() - i)
|
||||
dates.push(d.toISOString().split("T")[0])
|
||||
}
|
||||
return dates
|
||||
}
|
||||
|
||||
const weekStart = getStartOfWeek(0)
|
||||
const prevWeekStart = getStartOfWeek(1)
|
||||
const last7DaysDates = getLast7Days()
|
||||
const oldestDate = last7DaysDates[0]
|
||||
|
||||
const { data: user, isLoading: userLoading } = useQuery({
|
||||
queryKey: ["me"],
|
||||
queryFn: () => api.getMe()
|
||||
})
|
||||
|
||||
const { data: todayEntries, isLoading: todayLoading } = useQuery({
|
||||
queryKey: ["timeEntries", "today"],
|
||||
queryFn: () => api.listTimeEntries({ date: today })
|
||||
})
|
||||
|
||||
const { data: weekEntries, isLoading: weekLoading } = useQuery({
|
||||
queryKey: ["timeEntries", "week"],
|
||||
queryFn: () => api.listTimeEntries({ from: weekStart })
|
||||
})
|
||||
|
||||
const { data: chartEntries, isLoading: chartLoading } = useQuery({
|
||||
queryKey: ["timeEntries", "chart"],
|
||||
queryFn: () => api.listTimeEntries({ from: oldestDate })
|
||||
})
|
||||
|
||||
const { data: comparisonEntries } = useQuery({
|
||||
queryKey: ["timeEntries", "comparison"],
|
||||
queryFn: () => api.listTimeEntries({ from: prevWeekStart })
|
||||
})
|
||||
|
||||
const todayTotal = useMemo(() =>
|
||||
todayEntries?.reduce((acc: number, e: any) => acc + parseFloat(e.duration || 0), 0) || 0,
|
||||
[todayEntries])
|
||||
|
||||
const weekTotal = useMemo(() =>
|
||||
weekEntries?.reduce((acc: number, e: any) => acc + parseFloat(e.duration || 0), 0) || 0,
|
||||
[weekEntries])
|
||||
|
||||
const prevWeekTotal = useMemo(() =>
|
||||
comparisonEntries?.reduce((acc: number, e: any) => acc + parseFloat(e.duration || 0), 0) || 0,
|
||||
[comparisonEntries])
|
||||
|
||||
const weekDiff = weekTotal - prevWeekTotal
|
||||
|
||||
const chartData = useMemo(() => {
|
||||
if (!chartEntries) return []
|
||||
return last7DaysDates.map(date => {
|
||||
const dayTotal = chartEntries
|
||||
.filter((e: any) => e.date === date)
|
||||
.reduce((acc: number, e: any) => acc + parseFloat(e.duration || 0), 0)
|
||||
return { date: date.slice(5), hours: dayTotal }
|
||||
})
|
||||
}, [chartEntries])
|
||||
|
||||
if (userLoading) return <div className="p-8 text-center text-gray-500">Lade Dashboard...</div>
|
||||
|
||||
return (
|
||||
<div className="p-6 max-w-7xl mx-auto space-y-8">
|
||||
<header className="flex justify-between items-center">
|
||||
<div className="min-h-screen bg-gray-50 p-6">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<header className="flex justify-between items-center mb-8">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-gray-900">Willkommen zurück, {user?.name}</h1>
|
||||
<p className="text-gray-500">Hier ist die Übersicht deiner Zeitbuchungen.</p>
|
||||
<h1 className="text-2xl font-bold text-gray-900">Dashboard</h1>
|
||||
<p className="text-gray-500">Willkommen zurück, hier ist deine Übersicht.</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => setIsSettingsOpen(true)}
|
||||
className="p-2 text-gray-400 hover:text-indigo-600 transition-colors"
|
||||
onClick={() => setIsSettingsOpen(!isSettingsOpen)}
|
||||
className="p-2 text-gray-500 hover:bg-gray-200 rounded-full transition-colors"
|
||||
>
|
||||
<Settings2 size={20} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => navigate({ to: '/logout' })}
|
||||
className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-red-600 hover:bg-red-50 rounded-lg transition-colors"
|
||||
>
|
||||
<LogOut size={18} /> Abmelden
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
{isSettingsOpen && (
|
||||
<div className="mb-8 p-4 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-wrap gap-4 items-center">
|
||||
<span className="text-sm font-medium text-gray-700">Sichtbare Widgets:</span>
|
||||
{(Object.keys(visibleWidgets) as WidgetId[]).map((id) => (
|
||||
<label key={id} className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={visibleWidgets[id]}
|
||||
onChange={(e) => saveWidgets({...visibleWidgets, [id]: e.target.checked})}
|
||||
className="rounded text-indigo-600"
|
||||
/>
|
||||
{id.replace(/([A-Z])/g, ' $1').trim()}
|
||||
</label>
|
||||
))}
|
||||
<button onClick={() => setIsSettingsOpen(false)} className="ml-auto p-1 hover:bg-gray-100 rounded">
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{visibleWidgets.todayStats && (
|
||||
<div className="bg-white p-6 rounded-2xl border border-gray-200 shadow-sm">
|
||||
<div style={widgetStyle} className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="p-2 bg-indigo-50 text-indigo-600 rounded-lg">
|
||||
<Clock size={20} />
|
||||
</div>
|
||||
<span className="text-xs font-medium text-gray-400 uppercase">Heute</span>
|
||||
</div>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold text-gray-900">{todayTotal.toFixed(2)}h</span>
|
||||
<span className="text-sm text-gray-500">gebucht</span>
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2">
|
||||
<Clock size={14} /> Heute
|
||||
</h3>
|
||||
<TrendingUp size={16} className="text-green-500" />
|
||||
</div>
|
||||
<div className="text-3xl font-bold text-gray-900">7.5h</div>
|
||||
<p className="text-xs text-gray-400 mt-1">+12% im Vergleich zu gestern</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{visibleWidgets.weekStats && (
|
||||
<div className="bg-white p-6 rounded-2xl border border-gray-200 shadow-sm">
|
||||
<div style={widgetStyle} className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="p-2 bg-emerald-50 text-emerald-600 rounded-lg">
|
||||
<Calendar size={20} />
|
||||
</div>
|
||||
<span className="text-xs font-medium text-gray-400 uppercase">Diese Woche</span>
|
||||
</div>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold text-gray-900">{weekTotal.toFixed(2)}h</span>
|
||||
{weekDiff !== 0 && (
|
||||
<div className={`flex items-center text-xs font-medium ${weekDiff > 0 ? 'text-emerald-600' : 'text-rose-600'}`}>
|
||||
{weekDiff > 0 ? <TrendingUp size={12} className="mr-1" /> : <TrendingDown size={12} className="mr-1" />}
|
||||
{Math.abs(weekDiff).toFixed(2)}h
|
||||
</div>
|
||||
)}
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2">
|
||||
<Calendar size={14} /> Diese Woche
|
||||
</h3>
|
||||
<TrendingDown size={16} className="text-red-500" />
|
||||
</div>
|
||||
<div className="text-3xl font-bold text-gray-900">32.0h</div>
|
||||
<p className="text-xs text-gray-400 mt-1">-4% im Vergleich zur Vorwoche</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{visibleWidgets.activeProjects && (
|
||||
<div className="bg-white p-6 rounded-2xl border border-gray-200 shadow-sm">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="p-2 bg-amber-50 text-amber-600 rounded-lg">
|
||||
<FolderKanban size={20} />
|
||||
</div>
|
||||
<span className="text-xs font-medium text-gray-400 uppercase">Projekte</span>
|
||||
</div>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold text-gray-900">
|
||||
{useQuery({ queryKey: ["projects"], queryFn: () => api.listProjects() }).data?.length || 0}
|
||||
</span>
|
||||
<span className="text-sm text-gray-500">aktiv</span>
|
||||
</div>
|
||||
<div style={widgetStyle} className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
||||
<RecentProjects />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
||||
<div className="lg:col-span-2 space-y-8">
|
||||
{visibleWidgets.chart && (
|
||||
<div className="bg-white p-6 rounded-2xl border border-gray-200 shadow-sm">
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-6">Zeitverlauf (7 Tage)</h3>
|
||||
<div className="h-64 w-full">
|
||||
<div style={widgetStyle} className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm lg:col-span-2">
|
||||
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-6 flex items-center gap-2">
|
||||
<TrendingUp size={14} /> Zeitverlauf
|
||||
</h3>
|
||||
<div className="h-full w-full min-h-[200px]">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<BarChart data={chartData}>
|
||||
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#f3f4f6" />
|
||||
<XAxis dataKey="date" axisLine={false} tickLine={false} tick={{ fontSize: 12, fill: '#9ca3af' }} />
|
||||
<YAxis axisLine={false} tickLine={false} tick={{ fontSize: 12, fill: '#9ca3af' }} />
|
||||
<BarChart data={[
|
||||
{ name: 'Mo', hours: 6 },
|
||||
{ name: 'Di', hours: 8 },
|
||||
{ name: 'Mi', hours: 7 },
|
||||
{ name: 'Do', hours: 9 },
|
||||
{ name: 'Fr', hours: 5 },
|
||||
]}>
|
||||
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#f0f0f0" />
|
||||
<XAxis dataKey="name" axisLine={false} tickLine={false} tick={{fontSize: 12, fill: '#9ca3af'}} />
|
||||
<YAxis axisLine={false} tickLine={false} tick={{fontSize: 12, fill: '#9ca3af'}} />
|
||||
<Tooltip
|
||||
cursor={{ fill: '#f9fafb' }}
|
||||
contentStyle={{ borderRadius: '8px', border: 'none', boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)' }}
|
||||
/>
|
||||
<Bar dataKey="hours" fill="#6366f1" radius={[4, 4, 0, 0]} barSize={32} />
|
||||
<Bar dataKey="hours" fill="#6366f1" radius={[4, 4, 0, 0]} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<RecentProjects />
|
||||
</div>
|
||||
|
||||
<div className="space-y-8">
|
||||
{visibleWidgets.activityFeed && <ActivityFeed />}
|
||||
|
||||
<div className="bg-indigo-600 rounded-2xl p-6 text-white shadow-lg shadow-indigo-200">
|
||||
<h3 className="font-bold text-lg mb-2">Exportieren</h3>
|
||||
<p className="text-indigo-100 text-sm mb-4">Lade deine Zeitbuchungen als CSV für die Abrechnung herunter.</p>
|
||||
<button
|
||||
onClick={() => window.open('/api/time-entries/export', '_blank')}
|
||||
className="w-full py-2 bg-white text-indigo-600 rounded-lg font-semibold text-sm flex items-center justify-center gap-2 hover:bg-indigo-50 transition-colors"
|
||||
>
|
||||
<Download size={16} /> CSV Export
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isSettingsOpen && (
|
||||
<div className="fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4">
|
||||
<div className="bg-white rounded-2xl w-full max-w-md p-6 shadow-xl">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<h2 className="text-xl font-bold text-gray-900">Dashboard anpassen</h2>
|
||||
<button onClick={() => setIsSettingsOpen(false)} className="text-gray-400 hover:text-gray-600">
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{(Object.keys(visibleWidgets) as WidgetId[]).map((id) => (
|
||||
<label key={id} className="flex items-center justify-between p-3 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
<span className="text-sm font-medium text-gray-700">
|
||||
{id === 'todayStats' && 'Heutige Statistik'}
|
||||
{id === 'weekStats' && 'Wochenstatistik'}
|
||||
{id === 'activeProjects' && 'Projekt-Counter'}
|
||||
{id === 'chart' && 'Zeit-Chart'}
|
||||
{id === 'activityFeed' && 'Aktivitäts-Feed'}
|
||||
</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={visibleWidgets[id]}
|
||||
onChange={(e) => saveWidgets({ ...visibleWidgets, [id]: e.target.checked })}
|
||||
className="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setIsSettingsOpen(false)}
|
||||
className="w-full mt-8 py-2 bg-indigo-600 text-white rounded-lg font-semibold hover:bg-indigo-700 transition-colors"
|
||||
>
|
||||
Fertig
|
||||
</button>
|
||||
</div>
|
||||
{visibleWidgets.activityFeed && (
|
||||
<div style={widgetStyle} className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
||||
<ActivityFeed />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user