Solve lint errors

This commit is contained in:
2025-07-17 07:04:01 +00:00
parent 4e525e4bae
commit a1d6d83488
4 changed files with 28 additions and 21 deletions

View File

@@ -23,13 +23,20 @@ const sidebarItems = [
{ name: 'Termine', path: '/termine', icon: Calendar }, { name: 'Termine', path: '/termine', icon: Calendar },
{ name: 'Ressourcen', path: '/ressourcen', icon: Boxes }, { name: 'Ressourcen', path: '/ressourcen', icon: Boxes },
{ name: 'Raumgruppen', path: '/infoscr_groups', icon: MonitorDotIcon }, { name: 'Raumgruppen', path: '/infoscr_groups', icon: MonitorDotIcon },
{ name: 'Infoscreens', path: '/clients', icon: Monitor }, { name: 'Infoscreen-Clients', path: '/clients', icon: Monitor },
{ name: 'Erweiterungsmodus', path: '/setup', icon: Wrench }, { name: 'Erweiterungsmodus', path: '/setup', icon: Wrench },
{ name: 'Medien', path: '/medien', icon: Image }, { name: 'Medien', path: '/medien', icon: Image },
{ name: 'Benutzer', path: '/benutzer', icon: User }, { name: 'Benutzer', path: '/benutzer', icon: User },
{ name: 'Einstellungen', path: '/einstellungen', icon: Settings }, { name: 'Einstellungen', path: '/einstellungen', icon: Settings },
]; ];
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { fetchClientsWithoutDescription } from './apiClients';
// ENV aus .env holen (Platzhalter, im echten Projekt über process.env oder API)
const ENV = import.meta.env.VITE_ENV || 'development';
const Layout: React.FC = () => { const Layout: React.FC = () => {
const [collapsed, setCollapsed] = useState(false); const [collapsed, setCollapsed] = useState(false);
@@ -121,12 +128,6 @@ const Layout: React.FC = () => {
); );
}; };
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { fetchClientsWithoutDescription } from './apiClients';
// ENV aus .env holen (Platzhalter, im echten Projekt über process.env oder API)
const ENV = import.meta.env.VITE_ENV || 'development';
function useLoginCheck() { function useLoginCheck() {
const [isLoggedIn, setIsLoggedIn] = useState(false); const [isLoggedIn, setIsLoggedIn] = useState(false);

View File

@@ -77,7 +77,7 @@ const SetupMode: React.FC = () => {
<ColumnDirective <ColumnDirective
headerText="Beschreibung" headerText="Beschreibung"
width="220" width="220"
template={props => ( template={(props: Client) => (
<TextBoxComponent <TextBoxComponent
value={descriptions[props.uuid] || ''} value={descriptions[props.uuid] || ''}
placeholder="Beschreibung eingeben" placeholder="Beschreibung eingeben"
@@ -88,7 +88,7 @@ const SetupMode: React.FC = () => {
<ColumnDirective <ColumnDirective
headerText="Aktion" headerText="Aktion"
width="120" width="120"
template={props => ( template={(props: Client) => (
<ButtonComponent <ButtonComponent
content="Speichern" content="Speichern"
disabled={!descriptions[props.uuid]} disabled={!descriptions[props.uuid]}

View File

@@ -103,10 +103,8 @@ const Appointments: React.FC = () => {
useEffect(() => { useEffect(() => {
fetchGroups() fetchGroups()
.then(data => { .then(data => {
// Nur Gruppen mit id berücksichtigen (nicht zugeordnet ignorieren) // Nur Gruppen mit id != 1 berücksichtigen (nicht zugeordnet ignorieren)
const filtered = Array.isArray(data) const filtered = Array.isArray(data) ? data.filter(g => g.id && g.name && g.id !== 1) : [];
? data.filter(g => g.id && g.name && g.name !== 'nicht zugeordnet')
: [];
setGroups(filtered); setGroups(filtered);
if (filtered.length > 0) setSelectedGroupId(filtered[0].id); if (filtered.length > 0) setSelectedGroupId(filtered[0].id);
}) })
@@ -167,13 +165,13 @@ const Appointments: React.FC = () => {
<CustomEventModal <CustomEventModal
open={modalOpen} open={modalOpen}
onClose={() => setModalOpen(false)} onClose={() => setModalOpen(false)}
onSave={async eventData => { onSave={async () => {
setModalOpen(false); setModalOpen(false);
console.log('onSave wird aufgerufen'); console.log('onSave wird aufgerufen');
if (selectedGroupId) { if (selectedGroupId) {
const data = await fetchEvents(selectedGroupId); const data = await fetchEvents(selectedGroupId);
console.log('Events nach Save:', data); console.log('Events nach Save:', data);
const mapped: Event[] = data.map(e => ({ const mapped: Event[] = data.map((e: RawEvent) => ({
Id: e.Id, Id: e.Id,
Subject: e.Subject, Subject: e.Subject,
StartTime: new Date(e.StartTime.endsWith('Z') ? e.StartTime : e.StartTime + 'Z'), StartTime: new Date(e.StartTime.endsWith('Z') ? e.StartTime : e.StartTime + 'Z'),
@@ -229,7 +227,7 @@ const Appointments: React.FC = () => {
if (selectedGroupId) { if (selectedGroupId) {
fetchEvents(selectedGroupId) fetchEvents(selectedGroupId)
.then((data: RawEvent[]) => { .then((data: RawEvent[]) => {
const mapped: Event[] = data.map(e => ({ const mapped: Event[] = data.map((e: RawEvent) => ({
Id: e.Id, Id: e.Id,
Subject: e.Subject, Subject: e.Subject,
StartTime: new Date(e.StartTime), StartTime: new Date(e.StartTime),

View File

@@ -22,9 +22,9 @@ type CustomEventData = {
type CustomEventModalProps = { type CustomEventModalProps = {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
onSave: (eventData: any) => void; onSave: (eventData: CustomEventData) => void;
initialData?: any; initialData?: Partial<CustomEventData>;
groupName: string | { id: string | null; name: string }; // <- angepasst groupName: string | { id: string | null; name: string };
}; };
const weekdayOptions = [ const weekdayOptions = [
@@ -128,7 +128,7 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
const group_id = typeof groupName === 'object' && groupName !== null ? groupName.id : groupName; const group_id = typeof groupName === 'object' && groupName !== null ? groupName.id : groupName;
// Daten für das Backend zusammenstellen // Daten für das Backend zusammenstellen
const payload: any = { const payload: CustomEventData & { [key: string]: unknown } = {
group_id, group_id,
title, title,
description, description,
@@ -152,6 +152,14 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
endTime.getMinutes() endTime.getMinutes()
).toISOString() ).toISOString()
: null, : null,
type,
startDate,
startTime,
endTime,
repeat,
weekdays,
repeatUntil,
skipHolidays,
event_type: type, event_type: type,
is_active: 1, is_active: 1,
created_by: 1, created_by: 1,
@@ -173,7 +181,7 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
body: JSON.stringify(payload), body: JSON.stringify(payload),
}); });
if (res.ok) { if (res.ok) {
onSave(payload); // <--- HIER ergänzen! onSave(payload);
onClose(); onClose();
} else { } else {
const err = await res.json(); const err = await res.json();