Enhance table header interfaces with optional render methods for improved flexibility; refactor router component structure for better readability and maintainability; ensure newline at end of file in url-routes.ts.

This commit is contained in:
2025-10-30 04:55:37 -04:00
parent cfc46d0a8e
commit d3a4bbe2c9
3 changed files with 31 additions and 6 deletions

View File

@@ -22,14 +22,18 @@ export enum TableHeaderKey {
interface ICommonTableHeader { interface ICommonTableHeader {
[TableHeaderKey.Search]?: { [TableHeaderKey.Search]?: {
searchProps?: string[]; searchProps?: string[];
render?: (key: string) => React.JSX.Element;
}; };
} }
export interface ITableWithPaginationHeader extends ICommonTableHeader { export interface ITableWithPaginationHeader extends ICommonTableHeader {
[TableHeaderKey.AddRow]?: { [TableHeaderKey.AddRow]?: {
openAddRowModal: () => void; openAddRowModal: () => void;
render?: (key: string) => React.JSX.Element;
};
[TableHeaderKey.SelectType]?: ISelectComponent & {
render?: (key: string) => React.JSX.Element;
}; };
[TableHeaderKey.SelectType]?: ISelectComponent;
} }
export interface ITableWithLoadMoreHeader extends ICommonTableHeader { export interface ITableWithLoadMoreHeader extends ICommonTableHeader {

View File

@@ -13,14 +13,35 @@ export default function Router() {
<Header /> <Header />
<Routes> <Routes>
{/* Public routes */} {/* Public routes */}
<Route path="/login" element={<Suspense fallback={null}><LoginForm /></Suspense>} /> <Route
path="/login"
element={
<Suspense fallback={null}>
<LoginForm />
</Suspense>
}
/>
{/* Protected routes */} {/* Protected routes */}
<Route path="/" element={<Navigate to="/channels" replace />} /> <Route path="/" element={<Navigate to="/channels" replace />} />
<Route path="/channels" element={<Suspense fallback={null}><ProtectedRoute component={<ChannelList />} /></Suspense>} /> <Route
<Route path="/channels/:channelId" element={<Suspense fallback={null}><ProtectedRoute component={<ChannelDetail />} /></Suspense>} /> path="/:applicationId/channels"
element={
<Suspense fallback={null}>
<ProtectedRoute component={<ChannelList />} />
</Suspense>
}
/>
<Route
path="/channels/:channelId"
element={
<Suspense fallback={null}>
<ProtectedRoute component={<ChannelDetail />} />
</Suspense>
}
/>
{/* Fallback route */} {/* Fallback route */}
<Route path="*" element={<Navigate to="/login" replace />} /> {/* <Route path="*" element={<Navigate to="/login" replace />} /> */}
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>
); );

View File

@@ -26,4 +26,4 @@ export default {
path: 'dashboard', path: 'dashboard',
icon: faTh icon: faTh
} }
}; };