fix(frontend): remove unused variables causing tsc build failure
Remove unused `auth` prop from AdminPage (and its call site in App.tsx) and unused `maxDate` variable in PlannerPage. Both triggered TS6133 under noUnusedLocals, causing `npm run build` to exit with code 2 in Docker.
This commit is contained in:
@@ -40,7 +40,7 @@ export default function App() {
|
|||||||
<Route path="/" element={<PlannerPage auth={auth} onLogout={handleLogout} />} />
|
<Route path="/" element={<PlannerPage auth={auth} onLogout={handleLogout} />} />
|
||||||
<Route
|
<Route
|
||||||
path="/admin"
|
path="/admin"
|
||||||
element={auth.isAdmin ? <AdminPage auth={auth} onLogout={handleLogout} /> : <Navigate to="/" replace />}
|
element={auth.isAdmin ? <AdminPage onLogout={handleLogout} /> : <Navigate to="/" replace />}
|
||||||
/>
|
/>
|
||||||
<Route path="*" element={<Navigate to="/" replace />} />
|
<Route path="*" element={<Navigate to="/" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { api } from '../api/client';
|
import { api } from '../api/client';
|
||||||
import type { AdminUser, AuthResponse } from '../api/types';
|
import type { AdminUser } from '../api/types';
|
||||||
|
|
||||||
const PURPLE = '#5b4fc7';
|
const PURPLE = '#5b4fc7';
|
||||||
const PURPLE_DEEP = '#3f33a8';
|
const PURPLE_DEEP = '#3f33a8';
|
||||||
@@ -10,7 +10,6 @@ const SAGE_DEEP = '#a9bb96';
|
|||||||
const PAPER = '#f4f3ee';
|
const PAPER = '#f4f3ee';
|
||||||
|
|
||||||
interface AdminPageProps {
|
interface AdminPageProps {
|
||||||
auth: AuthResponse;
|
|
||||||
onLogout: () => void;
|
onLogout: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ function monogram(name: string): string {
|
|||||||
return name.split(' ').map((n) => n[0]).join('').slice(0, 2).toUpperCase();
|
return name.split(' ').map((n) => n[0]).join('').slice(0, 2).toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AdminPage({ auth, onLogout }: AdminPageProps) {
|
export function AdminPage({ onLogout }: AdminPageProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [users, setUsers] = useState<AdminUser[]>([]);
|
const [users, setUsers] = useState<AdminUser[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export function PlannerPage({ auth, onLogout }: PlannerPageProps) {
|
|||||||
|
|
||||||
const today = toIsoDate(new Date());
|
const today = toIsoDate(new Date());
|
||||||
const MAX_OFFSET = 13;
|
const MAX_OFFSET = 13;
|
||||||
const maxDate = offsetDate(today, MAX_OFFSET);
|
|
||||||
|
|
||||||
const [selectedDate, setSelectedDate] = useState(today);
|
const [selectedDate, setSelectedDate] = useState(today);
|
||||||
const [schedule, setSchedule] = useState<WorkplaceScheduleItem[]>([]);
|
const [schedule, setSchedule] = useState<WorkplaceScheduleItem[]>([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user