Dashboard geändert
Dieser Commit ist enthalten in:
@ -20,7 +20,7 @@ export default function Dashboard() {
|
|||||||
availableEmployees: 0,
|
availableEmployees: 0,
|
||||||
})
|
})
|
||||||
const [employees, setEmployees] = useState<any[]>([])
|
const [employees, setEmployees] = useState<any[]>([])
|
||||||
const [trendWindow, setTrendWindow] = useState<'today' | 7 | 30>('today')
|
// removed trends
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchStats()
|
fetchStats()
|
||||||
@ -74,31 +74,7 @@ export default function Dashboard() {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// Trends: Top-Kompetenzen im Zeitraum (basierend auf aktualisierten Profilen)
|
// trends removed
|
||||||
const topSkills = useMemo(() => {
|
|
||||||
if (!employees.length) return [] as { name: string; count: number }[]
|
|
||||||
const since = new Date()
|
|
||||||
if (trendWindow === 'today') {
|
|
||||||
since.setHours(0, 0, 0, 0)
|
|
||||||
} else {
|
|
||||||
since.setDate(since.getDate() - trendWindow)
|
|
||||||
}
|
|
||||||
const recent = employees.filter((e: any) => {
|
|
||||||
const updated = new Date(e.updatedAt)
|
|
||||||
return !isNaN(updated.getTime()) && updated > since
|
|
||||||
})
|
|
||||||
const counts = new Map<string, number>()
|
|
||||||
for (const emp of recent) {
|
|
||||||
const skills = (emp.skills || []) as { name?: string; id: string }[]
|
|
||||||
for (const s of skills) {
|
|
||||||
const key = (s && (s as any).name) || (s && (s as any).id) || 'Unbenannt'
|
|
||||||
counts.set(key, (counts.get(key) || 0) + 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const arr = Array.from(counts.entries()).map(([name, count]) => ({ name, count }))
|
|
||||||
arr.sort((a, b) => b.count - a.count)
|
|
||||||
return arr.slice(0, 5)
|
|
||||||
}, [employees, trendWindow])
|
|
||||||
|
|
||||||
// Profilqualität (mein Profil): Kontakt & Dienststelle + ob Skills vorhanden
|
// Profilqualität (mein Profil): Kontakt & Dienststelle + ob Skills vorhanden
|
||||||
const me = useMemo(() => {
|
const me = useMemo(() => {
|
||||||
@ -156,46 +132,6 @@ export default function Dashboard() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||||
{/* Trends */}
|
|
||||||
<div className="card">
|
|
||||||
<div className="flex items-center justify-between mb-4">
|
|
||||||
<h2 className="text-title-card font-poppins font-semibold text-primary">Trends</h2>
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<button
|
|
||||||
className={`px-3 py-1 rounded-input border border-border-default text-body ${trendWindow === 'today' ? 'bg-bg-accent text-primary-blue' : 'bg-white dark:bg-dark-bg-secondary'}`}
|
|
||||||
onClick={() => setTrendWindow('today')}
|
|
||||||
>
|
|
||||||
Heute
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`px-3 py-1 rounded-input border border-border-default text-body ${trendWindow === 7 ? 'bg-bg-accent text-primary-blue' : 'bg-white dark:bg-dark-bg-secondary'}`}
|
|
||||||
onClick={() => setTrendWindow(7)}
|
|
||||||
>
|
|
||||||
7 Tage
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`px-3 py-1 rounded-input border border-border-default text-body ${trendWindow === 30 ? 'bg-bg-accent text-primary-blue' : 'bg-white dark:bg-dark-bg-secondary'}`}
|
|
||||||
onClick={() => setTrendWindow(30)}
|
|
||||||
>
|
|
||||||
30 Tage
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="space-y-2">
|
|
||||||
{topSkills.length === 0 ? (
|
|
||||||
<p className="text-tertiary">Keine Daten im ausgewählten Zeitraum.</p>
|
|
||||||
) : (
|
|
||||||
topSkills.map((s, idx) => (
|
|
||||||
<div key={s.name + idx} className="flex items-center justify-between border-b border-border-default dark:border-dark-border py-2">
|
|
||||||
<span className="text-secondary">{s.name}</span>
|
|
||||||
<span className="text-tertiary">{s.count} Profile</span>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
<p className="text-help text-tertiary mt-2">Basis: Profile mit Aktualisierung im Zeitraum.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Profilqualität */}
|
{/* Profilqualität */}
|
||||||
<div className="card">
|
<div className="card">
|
||||||
<h2 className="text-title-card font-poppins font-semibold text-primary mb-4">Profilqualität</h2>
|
<h2 className="text-title-card font-poppins font-semibold text-primary mb-4">Profilqualität</h2>
|
||||||
@ -253,17 +189,6 @@ export default function Dashboard() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="card">
|
|
||||||
<h2 className="text-title-card font-poppins font-semibold text-primary mb-4">
|
|
||||||
Letzte Aktivitäten
|
|
||||||
</h2>
|
|
||||||
<div className="space-y-2">
|
|
||||||
<p className="text-sm text-tertiary">
|
|
||||||
Keine aktuellen Aktivitäten
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren