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, inputs: io.inputs,
outputs, outputs,
parameters: n.parameters ?? {}, parameters: n.parameters ?? {},
inputPorts: nt?.inputPorts, inputPorts: nt?.inputPorts
outputPorts: nt?.outputPorts, ? 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 React, { useState } from 'react';
import { useLanguage } from '../../../../providers/language/LanguageContext';
import styles from '../ActionButton.module.css'; import styles from '../ActionButton.module.css';
export interface CustomActionButtonProps<T = any> { export interface CustomActionButtonProps<T = any> {
@ -29,7 +28,6 @@ export function CustomActionButton<T = any>({
hookData, hookData,
idField: _idField = 'id' // Available for future use, kept for API consistency idField: _idField = 'id' // Available for future use, kept for API consistency
}: CustomActionButtonProps<T>) { }: CustomActionButtonProps<T>) {
const { t } = useLanguage();
const [internalLoading, setInternalLoading] = useState(false); const [internalLoading, setInternalLoading] = useState(false);
const [showSuccessFeedback, setShowSuccessFeedback] = useState(false); const [showSuccessFeedback, setShowSuccessFeedback] = useState(false);
const [showErrorFeedback, setShowErrorFeedback] = useState(false); const [showErrorFeedback, setShowErrorFeedback] = useState(false);

View file

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

View file

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

View file

@ -31,7 +31,7 @@ export interface GenericPageData {
onUnload?: () => void | Promise<void>; 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. * 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]); }, [selectedMandateId, scopeFilter, fetchRoles]);
const getTextValue = (value: string | undefined): string => { const getTextValue = (value: string | Record<string, string> | undefined): string => {
return value || ''; if (!value) return '';
if (typeof value === 'string') return value;
return Object.values(value).find(v => !!v) || '';
}; };
// Toggle role expansion // 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) // Handle delete single prompt (confirmation handled by DeleteActionButton)
const handleDelete = async (prompt: Prompt) => { const handleDelete = async (prompt: Prompt) => {
const success = await handlePromptDelete(prompt.id); const success = await handlePromptDelete(prompt.id);