From d4f177af2a7fa9445a87681497f879739c2a15df Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Mon, 13 Apr 2026 09:54:11 +0200
Subject: [PATCH] fix TypeScript build errors across 7 files
Made-with: Cursor
---
src/components/FlowEditor/nodes/shared/graphUtils.ts | 8 ++++++--
.../CustomActionButton/CustomActionButton.tsx | 2 --
.../UiComponents/Button/UploadButton/UploadButton.tsx | 3 +++
.../UiComponents/LocationInput/LocationInput.tsx | 8 ++++----
src/core/PageManager/pageInterface.ts | 2 +-
src/pages/admin/AdminMandateRolePermissionsPage.tsx | 6 ++++--
src/pages/basedata/PromptsPage.tsx | 11 -----------
7 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/src/components/FlowEditor/nodes/shared/graphUtils.ts b/src/components/FlowEditor/nodes/shared/graphUtils.ts
index 4880bdb..14524c3 100644
--- a/src/components/FlowEditor/nodes/shared/graphUtils.ts
+++ b/src/components/FlowEditor/nodes/shared/graphUtils.ts
@@ -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,
};
});
diff --git a/src/components/FormGenerator/ActionButtons/CustomActionButton/CustomActionButton.tsx b/src/components/FormGenerator/ActionButtons/CustomActionButton/CustomActionButton.tsx
index 8458ab3..b5eaf82 100644
--- a/src/components/FormGenerator/ActionButtons/CustomActionButton/CustomActionButton.tsx
+++ b/src/components/FormGenerator/ActionButtons/CustomActionButton/CustomActionButton.tsx
@@ -1,5 +1,4 @@
import React, { useState } from 'react';
-import { useLanguage } from '../../../../providers/language/LanguageContext';
import styles from '../ActionButton.module.css';
export interface CustomActionButtonProps {
@@ -29,7 +28,6 @@ export function CustomActionButton({
hookData,
idField: _idField = 'id' // Available for future use, kept for API consistency
}: CustomActionButtonProps) {
- const { t } = useLanguage();
const [internalLoading, setInternalLoading] = useState(false);
const [showSuccessFeedback, setShowSuccessFeedback] = useState(false);
const [showErrorFeedback, setShowErrorFeedback] = useState(false);
diff --git a/src/components/UiComponents/Button/UploadButton/UploadButton.tsx b/src/components/UiComponents/Button/UploadButton/UploadButton.tsx
index ec833fd..b25c13f 100644
--- a/src/components/UiComponents/Button/UploadButton/UploadButton.tsx
+++ b/src/components/UiComponents/Button/UploadButton/UploadButton.tsx
@@ -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 = ({
onUpload,
accept = '*/*',
@@ -54,6 +56,7 @@ const UploadButton: React.FC = ({
}
};
+ const t = _useT();
const isDisabled = disabled || loading || isUploading;
return (
diff --git a/src/components/UiComponents/LocationInput/LocationInput.tsx b/src/components/UiComponents/LocationInput/LocationInput.tsx
index 0b11ed5..ebc6796 100644
--- a/src/components/UiComponents/LocationInput/LocationInput.tsx
+++ b/src/components/UiComponents/LocationInput/LocationInput.tsx
@@ -28,8 +28,8 @@ const LocationInput: React.FC = ({
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 = ({
void | Promise;
}
-type TranslationFunction = (key: string, fallback?: string) => string;
+type TranslationFunction = (key: string, params?: Record) => string;
/**
* Resolve display text from a page name (i18n key) via the translation function.
diff --git a/src/pages/admin/AdminMandateRolePermissionsPage.tsx b/src/pages/admin/AdminMandateRolePermissionsPage.tsx
index 5117382..09e208f 100644
--- a/src/pages/admin/AdminMandateRolePermissionsPage.tsx
+++ b/src/pages/admin/AdminMandateRolePermissionsPage.tsx
@@ -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 | undefined): string => {
+ if (!value) return '';
+ if (typeof value === 'string') return value;
+ return Object.values(value).find(v => !!v) || '';
};
// Toggle role expansion
diff --git a/src/pages/basedata/PromptsPage.tsx b/src/pages/basedata/PromptsPage.tsx
index 9465ee3..4a97e3e 100644
--- a/src/pages/basedata/PromptsPage.tsx
+++ b/src/pages/basedata/PromptsPage.tsx
@@ -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);