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

This commit is contained in:
2026-05-04 13:50:01 +02:00
parent ca1d371ad4
commit fe6055a38d
2 changed files with 13 additions and 2 deletions
+11 -1
View File
@@ -12,6 +12,7 @@ import {
SunOutlined,
MoonOutlined,
AppstoreOutlined,
GlobalOutlined,
} from '@ant-design/icons';
import { useAuth } from '../auth/AuthContext';
import { useTheme } from '../theme/ThemeContext';
@@ -27,6 +28,7 @@ type MenuItemDef = {
label: string;
permission?: Permission;
countKey?: keyof StatsCounts;
externalUrl?: string;
};
const allMenuItems: MenuItemDef[] = [
@@ -35,6 +37,7 @@ const allMenuItems: MenuItemDef[] = [
{ 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: '/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 },
];
@@ -148,7 +151,14 @@ export default function AppLayout() {
mode="inline"
selectedKeys={[selectedKey]}
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 }}
/>
@@ -19,7 +19,8 @@ export default function MailpostfachPage() {
const [searchText, setSearchText] = useState(() => sessionStorage.getItem('mailSearch') || '');
const [statusFilter, setStatusFilter] = useState<number | 'all'>(() => {
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();