feat: add Agrarmonitor external link to sidebar and fix Mailpostfach filter initialization logic
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
SunOutlined,
|
SunOutlined,
|
||||||
MoonOutlined,
|
MoonOutlined,
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
|
GlobalOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useAuth } from '../auth/AuthContext';
|
import { useAuth } from '../auth/AuthContext';
|
||||||
import { useTheme } from '../theme/ThemeContext';
|
import { useTheme } from '../theme/ThemeContext';
|
||||||
@@ -27,6 +28,7 @@ type MenuItemDef = {
|
|||||||
label: string;
|
label: string;
|
||||||
permission?: Permission;
|
permission?: Permission;
|
||||||
countKey?: keyof StatsCounts;
|
countKey?: keyof StatsCounts;
|
||||||
|
externalUrl?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const allMenuItems: MenuItemDef[] = [
|
const allMenuItems: MenuItemDef[] = [
|
||||||
@@ -35,6 +37,7 @@ const allMenuItems: MenuItemDef[] = [
|
|||||||
{ key: '/posteingang', icon: <FileTextOutlined />, label: 'Posteingang', permission: Permission.VIEW_INBOX, countKey: 'posteingang' },
|
{ key: '/posteingang', icon: <FileTextOutlined />, label: 'Posteingang', permission: Permission.VIEW_INBOX, countKey: 'posteingang' },
|
||||||
{ key: '/manuell', icon: <EditOutlined />, label: 'Manuell bearbeiten', permission: Permission.PROCESS_MANUALLY, countKey: 'manuell' },
|
{ key: '/manuell', icon: <EditOutlined />, label: 'Manuell bearbeiten', permission: Permission.PROCESS_MANUALLY, countKey: 'manuell' },
|
||||||
{ key: '/mailpostfach', icon: <MailOutlined />, label: 'Mailpostfach', permission: Permission.VIEW_MAIL, countKey: 'mailpostfach' },
|
{ key: '/mailpostfach', icon: <MailOutlined />, label: 'Mailpostfach', permission: Permission.VIEW_MAIL, countKey: 'mailpostfach' },
|
||||||
|
{ key: 'agrarmonitor', icon: <GlobalOutlined />, label: 'In Agrarmonitor', permission: Permission.PROCESS_MANUALLY, countKey: 'agrarmonitor', externalUrl: 'https://admin7.agrarmonitor.de/dateien/eingang#dateien' },
|
||||||
{ key: '/settings', icon: <SettingOutlined />, label: 'Einstellungen', permission: Permission.MANAGE_SETTINGS },
|
{ key: '/settings', icon: <SettingOutlined />, label: 'Einstellungen', permission: Permission.MANAGE_SETTINGS },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -148,7 +151,14 @@ export default function AppLayout() {
|
|||||||
mode="inline"
|
mode="inline"
|
||||||
selectedKeys={[selectedKey]}
|
selectedKeys={[selectedKey]}
|
||||||
items={menuItems}
|
items={menuItems}
|
||||||
onClick={({ key }) => navigate(key)}
|
onClick={({ key }) => {
|
||||||
|
const item = allMenuItems.find((i) => i.key === key);
|
||||||
|
if (item?.externalUrl) {
|
||||||
|
window.open(item.externalUrl, '_blank', 'noopener,noreferrer');
|
||||||
|
} else {
|
||||||
|
navigate(key);
|
||||||
|
}
|
||||||
|
}}
|
||||||
style={isDark ? { flex: 1 } : { background: 'transparent', flex: 1 }}
|
style={isDark ? { flex: 1 } : { background: 'transparent', flex: 1 }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export default function MailpostfachPage() {
|
|||||||
const [searchText, setSearchText] = useState(() => sessionStorage.getItem('mailSearch') || '');
|
const [searchText, setSearchText] = useState(() => sessionStorage.getItem('mailSearch') || '');
|
||||||
const [statusFilter, setStatusFilter] = useState<number | 'all'>(() => {
|
const [statusFilter, setStatusFilter] = useState<number | 'all'>(() => {
|
||||||
const saved = sessionStorage.getItem('mailStatus');
|
const saved = sessionStorage.getItem('mailStatus');
|
||||||
return saved !== null && saved !== 'all' ? Number(saved) : 'all';
|
if (saved === null) return 0;
|
||||||
|
return saved === 'all' ? 'all' : Number(saved);
|
||||||
});
|
});
|
||||||
const { hasPermission } = useAuth();
|
const { hasPermission } = useAuth();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user