From 9b10f73d094ad8df18d470799584da9eeb6e7d8d Mon Sep 17 00:00:00 2001 From: Ida Dittrich Date: Thu, 29 Jan 2026 10:14:33 +0100 Subject: [PATCH] build errors --- src/api/featuresApi.ts | 8 +++--- .../AccessRules/AccessRulesEditor.tsx | 6 ----- .../AccessRules/AccessRulesTable.tsx | 2 +- .../Button/CreateButton/CreateButton.tsx | 7 +++-- .../Log/LogMessage/LogMessage.tsx | 6 +++++ .../VoiceLanguageSelect.tsx | 5 ---- src/contexts/FileContext.tsx | 9 ++++--- src/hooks/playground/useWorkflowLifecycle.ts | 2 +- src/hooks/useResizablePanels.ts | 2 +- src/pages/basedata/ConnectionsPage.tsx | 26 +++++++++++-------- src/pages/basedata/PromptsPage.tsx | 1 - .../trustee/TrusteePositionDocumentsView.tsx | 4 +-- .../views/trustee/TrusteePositionsView.tsx | 1 - src/pages/workflows/PlaygroundPage.tsx | 5 ++-- src/pages/workflows/WorkflowsPage.tsx | 1 - 15 files changed, 40 insertions(+), 45 deletions(-) diff --git a/src/api/featuresApi.ts b/src/api/featuresApi.ts index 8ee75fc..eac7003 100644 --- a/src/api/featuresApi.ts +++ b/src/api/featuresApi.ts @@ -85,7 +85,7 @@ const MOCK_RESPONSE: FeaturesMyResponse = { mandateId: 'mand-soha', mandateName: 'Soha Treuhand', instanceLabel: 'PamoCreate AG', - userRole: 'admin', + userRoles: ['admin'], permissions: MOCK_PERMISSIONS, }, { @@ -94,7 +94,7 @@ const MOCK_RESPONSE: FeaturesMyResponse = { mandateId: 'mand-soha', mandateName: 'Soha Treuhand', instanceLabel: 'ValueOn AG', - userRole: 'customer', + userRoles: ['customer'], permissions: MOCK_CUSTOMER_PERMISSIONS, }, ], @@ -110,7 +110,7 @@ const MOCK_RESPONSE: FeaturesMyResponse = { mandateId: 'mand-soha', mandateName: 'Soha Treuhand', instanceLabel: 'Beratung Dynamic', - userRole: 'user', + userRoles: ['user'], permissions: MOCK_WORKFLOW_PERMISSIONS, }, ], @@ -133,7 +133,7 @@ const MOCK_RESPONSE: FeaturesMyResponse = { mandateId: 'mand-swiss', mandateName: 'SwissTreu', instanceLabel: 'Firma X', - userRole: 'customer', + userRoles: ['customer'], permissions: MOCK_CUSTOMER_PERMISSIONS, }, ], diff --git a/src/components/AccessRules/AccessRulesEditor.tsx b/src/components/AccessRules/AccessRulesEditor.tsx index 8098eb9..05763ee 100644 --- a/src/components/AccessRules/AccessRulesEditor.tsx +++ b/src/components/AccessRules/AccessRulesEditor.tsx @@ -563,12 +563,6 @@ export const AccessRulesEditor: React.FC = ({ fetchObjects(undefined, featureCode, mandateId); }, [fetchObjects, featureCode, mandateId]); - // Get objects for current tab - const currentContextObjects = useMemo(() => { - if (activeTab === 'JSON') return []; - return catalogObjects[activeTab] || []; - }, [catalogObjects, activeTab]); - // Track changes useEffect(() => { setHasChanges(JSON.stringify(rules) !== JSON.stringify(originalRules)); diff --git a/src/components/AccessRules/AccessRulesTable.tsx b/src/components/AccessRules/AccessRulesTable.tsx index 70a1b95..a83c79f 100644 --- a/src/components/AccessRules/AccessRulesTable.tsx +++ b/src/components/AccessRules/AccessRulesTable.tsx @@ -40,7 +40,7 @@ const hasLevel = (level: AccessLevel | null | undefined, minLevel: 'm' | 'g' | ' * Calculate the new access level when a checkbox is toggled. */ const calculateNewLevel = ( - currentLevel: AccessLevel | null | undefined, + _currentLevel: AccessLevel | null | undefined, targetLevel: 'm' | 'g' | 'a', checked: boolean ): AccessLevel => { diff --git a/src/components/UiComponents/Button/CreateButton/CreateButton.tsx b/src/components/UiComponents/Button/CreateButton/CreateButton.tsx index a718c98..1acae26 100644 --- a/src/components/UiComponents/Button/CreateButton/CreateButton.tsx +++ b/src/components/UiComponents/Button/CreateButton/CreateButton.tsx @@ -4,7 +4,6 @@ import Button from '../Button'; import { Popup } from '../../Popup'; import { FormGeneratorForm, AttributeDefinition } from '../../../FormGenerator/FormGeneratorForm'; import { useLanguage } from '../../../../providers/language/LanguageContext'; -import styles from './CreateButton.module.css'; const CreateButton: React.FC = ({ onCreate, @@ -29,14 +28,14 @@ const CreateButton: React.FC = ({ // Convert CreateButtonFieldConfig to AttributeDefinition format const attributes: AttributeDefinition[] = useMemo(() => { - return fieldsToUse.map(field => { + return fields.map(field => { // Convert options to AttributeOption[] format let options: AttributeDefinition['options'] = undefined; if (field.options) { // If options is an array of strings, convert to AttributeOption format if (Array.isArray(field.options)) { - options = field.options.map(opt => { + options = field.options.map((opt: any) => { if (typeof opt === 'string') { return { value: opt, label: opt }; } @@ -90,7 +89,7 @@ const CreateButton: React.FC = ({ // Initialize form data with default values const initialFormData = useMemo(() => { const data: any = {}; - fieldsToUse.forEach(field => { + fields.forEach(field => { if (field.type === 'multiselect') { // Multiselect fields should default to empty array data[field.key] = field.defaultValue || []; diff --git a/src/components/UiComponents/Log/LogMessage/LogMessage.tsx b/src/components/UiComponents/Log/LogMessage/LogMessage.tsx index a94f46c..d2ee0eb 100644 --- a/src/components/UiComponents/Log/LogMessage/LogMessage.tsx +++ b/src/components/UiComponents/Log/LogMessage/LogMessage.tsx @@ -14,9 +14,11 @@ export interface LogMessageProps { onFileDelete?: (file: WorkflowFile) => Promise; onFileRemove?: (file: WorkflowFile) => Promise; onFileView?: (file: WorkflowFile) => Promise; + onFileDownload?: (file: WorkflowFile) => Promise; deletingFiles?: Set; previewingFiles?: Set; removingFiles?: Set; + downloadingFiles?: Set; workflowId?: string; } @@ -32,9 +34,11 @@ export const LogMessage: React.FC = ({ onFileDelete, onFileRemove, onFileView, + onFileDownload, deletingFiles, previewingFiles, removingFiles, + downloadingFiles, workflowId }) => { return ( @@ -78,9 +82,11 @@ export const LogMessage: React.FC = ({ onFileDelete={onFileDelete} onFileRemove={onFileRemove} onFileView={onFileView} + onFileDownload={onFileDownload} deletingFiles={deletingFiles} previewingFiles={previewingFiles} removingFiles={removingFiles} + downloadingFiles={downloadingFiles} workflowId={workflowId} /> )} diff --git a/src/components/UiComponents/VoiceLanguageSelect/VoiceLanguageSelect.tsx b/src/components/UiComponents/VoiceLanguageSelect/VoiceLanguageSelect.tsx index fd38377..8837a55 100644 --- a/src/components/UiComponents/VoiceLanguageSelect/VoiceLanguageSelect.tsx +++ b/src/components/UiComponents/VoiceLanguageSelect/VoiceLanguageSelect.tsx @@ -71,11 +71,6 @@ export const VoiceLanguageSelect: React.FC = ({ className = '', title = 'Sprache für Spracherkennung', }) => { - const { currentLanguage } = useLanguage(); - - // Get the currently selected language option - const selectedOption = voiceLanguages.find(lang => lang.code === value); - const handleChange = (e: React.ChangeEvent) => { onChange(e.target.value); }; diff --git a/src/contexts/FileContext.tsx b/src/contexts/FileContext.tsx index e9ec26b..e099da7 100644 --- a/src/contexts/FileContext.tsx +++ b/src/contexts/FileContext.tsx @@ -8,7 +8,7 @@ interface FileContextType { refetch: () => Promise; handleFileUpload: (file: File, workflowId?: string) => Promise<{ success: boolean; fileData?: any; error?: string }>; handleFileDelete: (fileId: string, onOptimisticDelete?: () => void) => Promise; - handleFilePreview: (fileId: string, fileName: string, mimeType?: string) => Promise<{ success: boolean; previewUrl?: string | null; blob?: Blob; isJsonContent?: boolean; decodedContent?: string; error?: string }>; + handleFilePreview: (fileId: string, fileName: string, mimeType?: string) => Promise<{ success: boolean; previewUrl?: string | null; blob?: Blob | null; isJsonContent?: boolean; decodedContent?: any; isTextContent?: boolean; error?: string }>; handleFileDownload: (fileId: string, fileName: string) => Promise; uploadingFile: boolean; deletingFiles: Set; @@ -83,8 +83,11 @@ export function FileProvider({ children }: { children: React.ReactNode }) { refetch, handleFileUpload, handleFileDelete, - handleFilePreview, - handleFileDownload, + handleFilePreview: handleFilePreview as FileContextType['handleFilePreview'], + handleFileDownload: async (fileId: string, fileName: string) => { + await handleFileDownload(fileId, fileName); + // Return void (ignore boolean return value) + }, uploadingFile, deletingFiles, previewingFiles, diff --git a/src/hooks/playground/useWorkflowLifecycle.ts b/src/hooks/playground/useWorkflowLifecycle.ts index 6690934..bc2dbc5 100644 --- a/src/hooks/playground/useWorkflowLifecycle.ts +++ b/src/hooks/playground/useWorkflowLifecycle.ts @@ -279,7 +279,7 @@ export function useWorkflowLifecycle() { statsItems.forEach(statItem => { const statData = statItem.item || statItem; - const statId = statData?.id || statItem.id; + const statId = statData?.id || (statItem as any).id; // Skip if already processed if (statId && processedStatIdsRef.current.has(statId)) { diff --git a/src/hooks/useResizablePanels.ts b/src/hooks/useResizablePanels.ts index 9c881d8..3a60e46 100644 --- a/src/hooks/useResizablePanels.ts +++ b/src/hooks/useResizablePanels.ts @@ -32,7 +32,7 @@ interface UseResizablePanelsReturn { /** Reset to default width */ resetToDefault: () => void; /** Container ref to attach to the parent container */ - containerRef: React.RefObject; + containerRef: React.RefObject; } export function useResizablePanels({ diff --git a/src/pages/basedata/ConnectionsPage.tsx b/src/pages/basedata/ConnectionsPage.tsx index 3fc1b6f..d16d260 100644 --- a/src/pages/basedata/ConnectionsPage.tsx +++ b/src/pages/basedata/ConnectionsPage.tsx @@ -6,21 +6,12 @@ */ import React, { useState, useMemo, useEffect } from 'react'; -import { useConnections } from '../../hooks/useConnections'; +import { useConnections, type Connection } from '../../hooks/useConnections'; import { FormGeneratorTable } from '../../components/FormGenerator/FormGeneratorTable'; import { FormGeneratorForm } from '../../components/FormGenerator/FormGeneratorForm'; import { FaSync, FaPlug, FaGoogle, FaMicrosoft, FaLink, FaRedo } from 'react-icons/fa'; import styles from '../admin/Admin.module.css'; -interface Connection { - id: string; - name?: string; - email?: string; - authority: 'google' | 'msft' | string; - status: 'active' | 'inactive' | string; - [key: string]: any; -} - export const ConnectionsPage: React.FC = () => { // Use the consolidated hook const { @@ -85,7 +76,20 @@ export const ConnectionsPage: React.FC = () => { if (!editingConnection) return; // Note: updateConnection is handled through the hook try { - await handleInlineUpdate(editingConnection.id, data, editingConnection); + // Ensure authority is properly typed - filter and validate authority value + const updateData: Partial = { ...data }; + + // Validate and set authority if present + if (data.authority) { + if (data.authority === 'local' || data.authority === 'google' || data.authority === 'msft') { + updateData.authority = data.authority; + } else { + // Remove invalid authority value + delete (updateData as any).authority; + } + } + + await handleInlineUpdate(editingConnection.id, updateData, editingConnection); setEditingConnection(null); refetch(); } catch (error) { diff --git a/src/pages/basedata/PromptsPage.tsx b/src/pages/basedata/PromptsPage.tsx index 57a91be..5dd83c2 100644 --- a/src/pages/basedata/PromptsPage.tsx +++ b/src/pages/basedata/PromptsPage.tsx @@ -40,7 +40,6 @@ export const PromptsPage: React.FC = () => { handlePromptDelete, handleInlineUpdate, deletingPrompts, - creatingPrompt, } = usePromptOperations(); const [showCreateModal, setShowCreateModal] = useState(false); diff --git a/src/pages/views/trustee/TrusteePositionDocumentsView.tsx b/src/pages/views/trustee/TrusteePositionDocumentsView.tsx index d067db6..8ce8a38 100644 --- a/src/pages/views/trustee/TrusteePositionDocumentsView.tsx +++ b/src/pages/views/trustee/TrusteePositionDocumentsView.tsx @@ -34,7 +34,6 @@ export const TrusteePositionDocumentsView: React.FC = () => { handleCreate, handleUpdate, deletingItems, - creatingItem, } = useTrusteePositionDocumentOperations(); // Modal state @@ -213,6 +212,7 @@ export const TrusteePositionDocumentsView: React.FC = () => { ...(canUpdate ? [{ type: 'edit' as const, title: 'Verknüpfung bearbeiten', + onAction: handleEditClick, // Row-level permissions handled automatically by FormGeneratorTable }] : []), ...(canDelete ? [{ @@ -222,8 +222,6 @@ export const TrusteePositionDocumentsView: React.FC = () => { // Row-level permissions handled automatically by FormGeneratorTable }] : []), ]} - attributes={formAttributes} - onEdit={handleEditClick} onDelete={handleDeleteLink} hookData={{ refetch, diff --git a/src/pages/views/trustee/TrusteePositionsView.tsx b/src/pages/views/trustee/TrusteePositionsView.tsx index b16d921..fe3c95a 100644 --- a/src/pages/views/trustee/TrusteePositionsView.tsx +++ b/src/pages/views/trustee/TrusteePositionsView.tsx @@ -36,7 +36,6 @@ export const TrusteePositionsView: React.FC = () => { handleCreate, handleUpdate, deletingItems, - creatingItem, } = useTrusteePositionOperations(); // Modal state diff --git a/src/pages/workflows/PlaygroundPage.tsx b/src/pages/workflows/PlaygroundPage.tsx index fc56a59..1598aea 100644 --- a/src/pages/workflows/PlaygroundPage.tsx +++ b/src/pages/workflows/PlaygroundPage.tsx @@ -14,6 +14,7 @@ import { usePrompts } from '../../hooks/usePrompts'; import { FaComment, FaTasks, FaPaperPlane, FaStop, FaFile, FaPlus, FaMicrophone, FaSquare, FaFileAlt } from 'react-icons/fa'; import { useToast } from '../../contexts/ToastContext'; import { useVoiceLanguage, VoiceLanguageSelect, Messages } from '../../components/UiComponents'; +import type { Message } from '../../components/UiComponents/Messages/MessagesTypes'; import api from '../../api'; import styles from './PlaygroundPage.module.css'; @@ -79,7 +80,6 @@ export const PlaygroundPage: React.FC = () => { // Voice recording state const [isRecording, setIsRecording] = useState(false); const [mediaRecorder, setMediaRecorder] = useState(null); - const [audioChunks, setAudioChunks] = useState([]); // Voice language selection (defaults to user profile language) const { voiceLanguage, setVoiceLanguage } = useVoiceLanguage(); @@ -231,7 +231,6 @@ export const PlaygroundPage: React.FC = () => { recorder.start(); setMediaRecorder(recorder); - setAudioChunks([]); setIsRecording(true); } catch (error: any) { console.error('Error starting recording:', error); @@ -330,7 +329,7 @@ export const PlaygroundPage: React.FC = () => { return ( { handleWorkflowUpdate, handleInlineUpdate, deletingWorkflows, - editingWorkflows, } = useWorkflowOperations(); const [editingWorkflow, setEditingWorkflow] = useState(null);