fix permissions
This commit is contained in:
@@ -4,17 +4,10 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { issuesApi } from '../../services/issues';
|
||||
|
||||
const STATUS_CHIPS = [
|
||||
{ key: 'offen' as const, label: 'Offen', color: 'info' as const },
|
||||
{ key: 'in_bearbeitung' as const, label: 'In Bearbeitung', color: 'warning' as const },
|
||||
{ key: 'erledigt' as const, label: 'Erledigt', color: 'success' as const },
|
||||
{ key: 'abgelehnt' as const, label: 'Abgelehnt', color: 'error' as const },
|
||||
];
|
||||
|
||||
function IssueOverviewWidget() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { data, isLoading, isError } = useQuery({
|
||||
const { data = [], isLoading, isError } = useQuery({
|
||||
queryKey: ['issues-widget-summary'],
|
||||
queryFn: issuesApi.getWidgetSummary,
|
||||
refetchInterval: 5 * 60 * 1000,
|
||||
@@ -45,9 +38,9 @@ function IssueOverviewWidget() {
|
||||
);
|
||||
}
|
||||
|
||||
const visibleChips = STATUS_CHIPS.filter((s) => data && data[s.key] > 0);
|
||||
const visibleCounts = data.filter((s) => s.count > 0);
|
||||
|
||||
if (visibleChips.length === 0) {
|
||||
if (visibleCounts.length === 0) {
|
||||
return (
|
||||
<Card sx={{ cursor: 'pointer' }} onClick={() => navigate('/issues')}>
|
||||
<CardContent>
|
||||
@@ -69,11 +62,11 @@ function IssueOverviewWidget() {
|
||||
<BugReport fontSize="small" color="action" />
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
||||
{visibleChips.map((s) => (
|
||||
{visibleCounts.map((s) => (
|
||||
<Chip
|
||||
key={s.key}
|
||||
label={`${data![s.key]} ${s.label}`}
|
||||
color={s.color}
|
||||
key={s.schluessel}
|
||||
label={`${s.count} ${s.bezeichnung}`}
|
||||
color={s.farbe as any}
|
||||
size="small"
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -201,7 +201,7 @@ function Sidebar({ mobileOpen, onMobileClose }: SidebarProps) {
|
||||
issuesSubItems.push({ text: 'Alle Issues', path: '/issues?tab=2' });
|
||||
}
|
||||
if (hasPermission('issues:edit_settings')) {
|
||||
issuesSubItems.push({ text: 'Kategorien', path: `/issues?tab=${issuesSubItems.length}` });
|
||||
issuesSubItems.push({ text: 'Einstellungen', path: `/issues?tab=${issuesSubItems.length}` });
|
||||
}
|
||||
|
||||
const items = baseNavigationItems
|
||||
|
||||
Reference in New Issue
Block a user