Fix frontend TypeScript compilation errors

- Fix process.env.NODE_ENV in ApplicationInfo.tsx (use import.meta.env.DEV)
- Remove unused variables and imports in Profile.tsx, ProfileSettings.tsx, RoleManagement.tsx, UserManagement.tsx, UserSettings.tsx
- Fix FormData type issue in UserSettings.tsx (use React.FormEvent<HTMLFormElement>)
This commit is contained in:
2026-01-15 03:30:11 +01:00
parent ff46da842f
commit c60fbe8821
6 changed files with 29 additions and 29 deletions

View File

@@ -1176,7 +1176,7 @@ function InfoRow({ label, value, referenceValue, infoDescription, jiraHost }: {
const description = infoDescription || referenceValue?.description || null;
// Debug: log referenceValue info for fields that should have descriptions
if (referenceValue && process.env.NODE_ENV === 'development') {
if (referenceValue && import.meta.env.DEV) {
}
return (

View File

@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import { useAuthStore } from '../stores/authStore';
// import { useAuthStore } from '../stores/authStore'; // Unused for now
const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3001';
@@ -14,7 +14,7 @@ interface Profile {
}
export default function Profile() {
const { user } = useAuthStore();
// const { user } = useAuthStore(); // Unused for now
const [profile, setProfile] = useState<Profile | null>(null);
const [isLoading, setIsLoading] = useState(true);
const [isSaving, setIsSaving] = useState(false);

View File

@@ -280,14 +280,14 @@ export default function ProfileSettings() {
return profile?.username.substring(0, 2).toUpperCase() || 'U';
};
const formatDate = (dateString: string | null) => {
if (!dateString) return 'Nog niet ingelogd';
return new Date(dateString).toLocaleDateString('nl-NL', {
year: 'numeric',
month: 'long',
day: 'numeric',
});
};
// const formatDate = (dateString: string | null) => {
// if (!dateString) return 'Nog niet ingelogd';
// return new Date(dateString).toLocaleDateString('nl-NL', {
// year: 'numeric',
// month: 'long',
// day: 'numeric',
// });
// };
if (isLoading) {
return (

View File

@@ -92,21 +92,21 @@ export default function RoleManagement() {
}
};
const handleUpdateRole = async (roleId: number, name: string, description: string) => {
try {
const response = await fetch(`${API_BASE}/api/roles/${roleId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ name, description: description || null }),
});
// const handleUpdateRole = async (roleId: number, name: string, description: string) => {
// try {
// const response = await fetch(`${API_BASE}/api/roles/${roleId}`, {
// method: 'PUT',
// headers: { 'Content-Type': 'application/json' },
// credentials: 'include',
// body: JSON.stringify({ name, description: description || null }),
// });
if (!response.ok) throw new Error('Failed to update role');
fetchRoles();
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to update role');
}
};
// if (!response.ok) throw new Error('Failed to update role');
// fetchRoles();
// } catch (err) {
// setError(err instanceof Error ? err.message : 'Failed to update role');
// }
// };
const handleDeleteRole = async (roleId: number) => {
if (!confirm('Are you sure you want to delete this role?')) return;

View File

@@ -32,7 +32,7 @@ export default function UserManagement() {
const [showPasswordModal, setShowPasswordModal] = useState(false);
const [selectedUser, setSelectedUser] = useState<User | null>(null);
const [searchTerm, setSearchTerm] = useState('');
const [expandedUser, setExpandedUser] = useState<number | null>(null);
// const [expandedUser, setExpandedUser] = useState<number | null>(null); // Unused for now
const [actionMenuOpen, setActionMenuOpen] = useState<number | null>(null);
const hasManageUsers = useHasPermission('manage_users');

View File

@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import { useAuthStore } from '../stores/authStore';
// import { useAuthStore } from '../stores/authStore'; // Unused for now
const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3001';
@@ -13,7 +13,7 @@ interface UserSettings {
}
export default function UserSettings() {
const { user } = useAuthStore();
// const { user } = useAuthStore(); // Unused for now
const [settings, setSettings] = useState<UserSettings>({
jira_pat: null,
ai_enabled: false,
@@ -69,7 +69,7 @@ export default function UserSettings() {
}
};
const handleSave = async (e: React.FormEvent) => {
const handleSave = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setIsSaving(true);
setError(null);