fix TypeScript build errors across 7 files

Made-with: Cursor
This commit is contained in:
ValueOn AG 2026-04-13 09:54:11 +02:00
parent feecb80b70
commit d4f177af2a
7 changed files with 18 additions and 22 deletions

View file

@ -38,8 +38,12 @@ export function fromApiGraph(
inputs: io.inputs,
outputs,
parameters: n.parameters ?? {},
inputPorts: nt?.inputPorts,
outputPorts: nt?.outputPorts,
inputPorts: nt?.inputPorts
? Object.entries(nt.inputPorts).map(([, v]) => ({ name: '', schema: '', accepts: (v as { accepts?: string[] }).accepts }))
: undefined,
outputPorts: nt?.outputPorts
? Object.entries(nt.outputPorts).map(([, v]) => ({ name: '', schema: (v as { schema?: string }).schema ?? '' }))
: undefined,
};
});

View file

@ -1,5 +1,4 @@
import React, { useState } from 'react';
import { useLanguage } from '../../../../providers/language/LanguageContext';
import styles from '../ActionButton.module.css';
export interface CustomActionButtonProps<T = any> {
@ -29,7 +28,6 @@ export function CustomActionButton<T = any>({
hookData,
idField: _idField = 'id' // Available for future use, kept for API consistency
}: CustomActionButtonProps<T>) {
const { t } = useLanguage();
const [internalLoading, setInternalLoading] = useState(false);
const [showSuccessFeedback, setShowSuccessFeedback] = useState(false);
const [showErrorFeedback, setShowErrorFeedback] = useState(false);

View file

@ -3,6 +3,8 @@ import { UploadButtonProps } from '../ButtonTypes';
import Button from '../Button';
import { useLanguage } from '../../../../providers/language/LanguageContext';
const _useT = () => useLanguage().t;
const UploadButton: React.FC<UploadButtonProps> = ({
onUpload,
accept = '*/*',
@ -54,6 +56,7 @@ const UploadButton: React.FC<UploadButtonProps> = ({
}
};
const t = _useT();
const isDisabled = disabled || loading || isUploading;
return (

View file

@ -28,8 +28,8 @@ const LocationInput: React.FC<LocationInputProps> = ({
disabled = false
}) => {
const { t } = useLanguage();
const resolvedPlaceholder = placeholder ?? t('Kanton, Gemeinde, Adresse oder Parzelle');
const resolvedLabel = label ?? t('Standort');
const _placeholder = placeholder ?? t('Kanton, Gemeinde, Adresse oder Parzelle');
const _label = label ?? t('Standort');
const [isRequestingLocation, setIsRequestingLocation] = useState(false);
const handleUseCurrentLocation = async () => {
@ -48,8 +48,8 @@ const LocationInput: React.FC<LocationInputProps> = ({
<TextField
value={value}
onChange={onChange}
placeholder={placeholder}
label={label}
placeholder={_placeholder}
label={_label}
error={error}
helperText={helperText}
disabled={disabled}

View file

@ -31,7 +31,7 @@ export interface GenericPageData {
onUnload?: () => void | Promise<void>;
}
type TranslationFunction = (key: string, fallback?: string) => string;
type TranslationFunction = (key: string, params?: Record<string, string | number | boolean | null | undefined>) => string;
/**
* Resolve display text from a page name (i18n key) via the translation function.

View file

@ -126,8 +126,10 @@ export const AdminMandateRolePermissionsPage: React.FC = () => {
}
}, [selectedMandateId, scopeFilter, fetchRoles]);
const getTextValue = (value: string | undefined): string => {
return value || '';
const getTextValue = (value: string | Record<string, string> | undefined): string => {
if (!value) return '';
if (typeof value === 'string') return value;
return Object.values(value).find(v => !!v) || '';
};
// Toggle role expansion

View file

@ -131,17 +131,6 @@ export const PromptsPage: React.FC = () => {
}
};
// Handle duplicate prompt
const handleDuplicate = async (prompt: Prompt) => {
const result = await handlePromptCreate({
name: t('Kopie von {name}', { name: prompt.name || t('Prompt') }),
content: prompt.content || ''
});
if (result?.success) {
refetch();
}
};
// Handle delete single prompt (confirmation handled by DeleteActionButton)
const handleDelete = async (prompt: Prompt) => {
const success = await handlePromptDelete(prompt.id);