feat: implement BackButton component for consistent navigation
- Added BackButton component to standardize back navigation across pages. - Integrated BackButton into various pages, replacing custom back buttons for consistency. - Updated PageHeader to accept backTo prop for displaying BackButton when navigating from subpages. - Created useGoBack hook to handle navigation logic, determining whether to go back in history or redirect to a fallback page. - Added tests for BackButton and its integration with PageHeader to ensure expected behavior.
This commit is contained in:
@@ -16,6 +16,7 @@ import { api } from '../lib/api';
|
||||
import type { ApiResponse } from '../lib/api';
|
||||
import { formatDate, formatDateTime } from '../lib/utils';
|
||||
import Modal from '../components/ui/Modal';
|
||||
import BackButton from '../components/ui/BackButton';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
|
||||
// ── Types ─────────────────────────────────────────────────────────────────
|
||||
@@ -333,6 +334,8 @@ export default function UserDetailPage() {
|
||||
return (
|
||||
<div className="animate-slide-up space-y-5">
|
||||
|
||||
<BackButton fallback="/admin/users" />
|
||||
|
||||
{/* ── Breadcrumb / Back ─────────────────────────────────── */}
|
||||
<div className="flex items-center gap-2 text-sm text-[var(--text-2)]">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user