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:
@@ -9,6 +9,7 @@ import { useAuthStore } from '../stores/authStore';
|
||||
import { formatDateTime, formatRial } from '../lib/utils';
|
||||
import StatusBadge from '../components/ui/StatusBadge';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
import BackButton from '../components/ui/BackButton';
|
||||
import Modal from '../components/ui/Modal';
|
||||
|
||||
interface SettlementDetail {
|
||||
@@ -139,9 +140,7 @@ export default function SettlementDetailPage() {
|
||||
<div className="fade-in">
|
||||
<div className="card-title-row" style={{ marginBottom: 'var(--gap)' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
<button className="btn ghost sm" onClick={() => navigate('/admin/settlements')} style={{ padding: '6px 10px' }}>
|
||||
<ArrowRightIcon style={{ width: 15, height: 15 }} /> تسویهحسابها
|
||||
</button>
|
||||
<BackButton fallback="/admin/settlements" />
|
||||
<div>
|
||||
<h1 className="section-title">جزئیات تسویه</h1>
|
||||
<div className="muted" style={{ fontSize: 13 }}>{s.representation_name}</div>
|
||||
|
||||
Reference in New Issue
Block a user