Remove unused components and models for improved maintainability
- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
This commit is contained in:
20
lib/navigation.ts
Normal file
20
lib/navigation.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import {useNavigate, useParams as useRouterParams, Link, useLocation} from 'react-router-dom';
|
||||
|
||||
function useRouter() {
|
||||
const navigate = useNavigate();
|
||||
return {
|
||||
push: (path: string) => navigate(path),
|
||||
replace: (path: string) => navigate(path, {replace: true}),
|
||||
back: () => navigate(-1),
|
||||
};
|
||||
}
|
||||
|
||||
function useParams<T extends Record<string, string>>(): T {
|
||||
return useRouterParams() as T;
|
||||
}
|
||||
|
||||
function usePathname(): string {
|
||||
return useLocation().pathname;
|
||||
}
|
||||
|
||||
export {Link, useRouter, useParams, usePathname};
|
||||
Reference in New Issue
Block a user