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:
hamed
2026-07-29 20:26:51 +03:30
parent e6267080b2
commit e0e8fbd1e4
31 changed files with 224 additions and 82 deletions
@@ -7,6 +7,7 @@ import { api } from '../lib/api';
import type { ApiResponse } from '../lib/api';
import type { MySubscriptionData } from '../types';
import { formatRial, formatDate } from '../lib/utils';
import BackButton from '../components/ui/BackButton';
import { PLAN_FEATURE_LABELS, planMetaOf } from './SubscriptionPage';
interface PaymentDetails {
@@ -61,6 +62,10 @@ export default function PaymentSuccessPage() {
return (
<div className="fade-in" style={{ maxWidth: 860, margin: '0 auto', padding: '8px 0 40px' }}>
<div style={{ marginBottom: 14 }}>
<BackButton fallback="/admin/subscription" />
</div>
{/* ── Success header ── */}
<div style={{ textAlign: 'center', marginBottom: 24 }}>
<div style={{