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:
@@ -1176,7 +1176,7 @@ function InfoRow({ label, value, referenceValue, infoDescription, jiraHost }: {
|
|||||||
const description = infoDescription || referenceValue?.description || null;
|
const description = infoDescription || referenceValue?.description || null;
|
||||||
|
|
||||||
// Debug: log referenceValue info for fields that should have descriptions
|
// Debug: log referenceValue info for fields that should have descriptions
|
||||||
if (referenceValue && process.env.NODE_ENV === 'development') {
|
if (referenceValue && import.meta.env.DEV) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect } from 'react';
|
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';
|
const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3001';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ interface Profile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const { user } = useAuthStore();
|
// const { user } = useAuthStore(); // Unused for now
|
||||||
const [profile, setProfile] = useState<Profile | null>(null);
|
const [profile, setProfile] = useState<Profile | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
|
|||||||
@@ -280,14 +280,14 @@ export default function ProfileSettings() {
|
|||||||
return profile?.username.substring(0, 2).toUpperCase() || 'U';
|
return profile?.username.substring(0, 2).toUpperCase() || 'U';
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (dateString: string | null) => {
|
// const formatDate = (dateString: string | null) => {
|
||||||
if (!dateString) return 'Nog niet ingelogd';
|
// if (!dateString) return 'Nog niet ingelogd';
|
||||||
return new Date(dateString).toLocaleDateString('nl-NL', {
|
// return new Date(dateString).toLocaleDateString('nl-NL', {
|
||||||
year: 'numeric',
|
// year: 'numeric',
|
||||||
month: 'long',
|
// month: 'long',
|
||||||
day: 'numeric',
|
// day: 'numeric',
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -92,21 +92,21 @@ export default function RoleManagement() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateRole = async (roleId: number, name: string, description: string) => {
|
// const handleUpdateRole = async (roleId: number, name: string, description: string) => {
|
||||||
try {
|
// try {
|
||||||
const response = await fetch(`${API_BASE}/api/roles/${roleId}`, {
|
// const response = await fetch(`${API_BASE}/api/roles/${roleId}`, {
|
||||||
method: 'PUT',
|
// method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
// headers: { 'Content-Type': 'application/json' },
|
||||||
credentials: 'include',
|
// credentials: 'include',
|
||||||
body: JSON.stringify({ name, description: description || null }),
|
// body: JSON.stringify({ name, description: description || null }),
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (!response.ok) throw new Error('Failed to update role');
|
// if (!response.ok) throw new Error('Failed to update role');
|
||||||
fetchRoles();
|
// fetchRoles();
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Failed to update role');
|
// setError(err instanceof Error ? err.message : 'Failed to update role');
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const handleDeleteRole = async (roleId: number) => {
|
const handleDeleteRole = async (roleId: number) => {
|
||||||
if (!confirm('Are you sure you want to delete this role?')) return;
|
if (!confirm('Are you sure you want to delete this role?')) return;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default function UserManagement() {
|
|||||||
const [showPasswordModal, setShowPasswordModal] = useState(false);
|
const [showPasswordModal, setShowPasswordModal] = useState(false);
|
||||||
const [selectedUser, setSelectedUser] = useState<User | null>(null);
|
const [selectedUser, setSelectedUser] = useState<User | null>(null);
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
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 [actionMenuOpen, setActionMenuOpen] = useState<number | null>(null);
|
||||||
|
|
||||||
const hasManageUsers = useHasPermission('manage_users');
|
const hasManageUsers = useHasPermission('manage_users');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect } from 'react';
|
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';
|
const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3001';
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ interface UserSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function UserSettings() {
|
export default function UserSettings() {
|
||||||
const { user } = useAuthStore();
|
// const { user } = useAuthStore(); // Unused for now
|
||||||
const [settings, setSettings] = useState<UserSettings>({
|
const [settings, setSettings] = useState<UserSettings>({
|
||||||
jira_pat: null,
|
jira_pat: null,
|
||||||
ai_enabled: false,
|
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();
|
e.preventDefault();
|
||||||
setIsSaving(true);
|
setIsSaving(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user