mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-09-13 16:23:08 +00:00
Second step in the AdminBulkActions decomp. Two new files: - actionTargets.ts (27 lines): SUBSCRIPTION_LEVEL_ACTIONS set + isSubscriptionLevelAction(). The classification is the source of truth shared between FloatingActionBar (renders two grouped menus when multi-tariff is on) and the parent page (gates selection-count semantics + the active-paid count in delete-subscription). - FloatingActionBar.tsx (304 lines): the bottom-dock selection toolbar. Pure presentational — parent owns selection state and supplies onAction (opens the modal with the picked action type) + onToggleAllSubscriptions. The full 11-item action config (icons + label keys + colour classes) lives inside the file as a private ActionConfig array. Parent now imports FloatingActionBar + isSubscriptionLevelAction from the new modules; the inline ActionConfig interface is gone. AdminBulkActions.tsx: 1819 → 1517 lines (-302). Cumulative across the 2-step admin decomp: 2539 → 1517 (-1022, -40%).
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
import type { BulkActionType } from '../../../api/adminBulkActions';
|
|
|
|
// ──────────────────────────────────────────────────────────────────
|
|
// Bulk-action target classification.
|
|
//
|
|
// Some actions operate on user-rows (assign promo group, add balance,
|
|
// delete user); others operate on individual subscription-rows
|
|
// (extend, cancel, change tariff, etc.). The set below is the source
|
|
// of truth shared between FloatingActionBar (renders two grouped
|
|
// menus when multi-tariff is on) and the parent page (gates the
|
|
// selection-count semantics and the active-paid count in delete).
|
|
// ──────────────────────────────────────────────────────────────────
|
|
|
|
export const SUBSCRIPTION_LEVEL_ACTIONS: Set<BulkActionType> = new Set([
|
|
'extend_subscription',
|
|
'add_days',
|
|
'cancel_subscription',
|
|
'activate_subscription',
|
|
'change_tariff',
|
|
'add_traffic',
|
|
'set_devices',
|
|
'delete_subscription',
|
|
]);
|
|
|
|
export function isSubscriptionLevelAction(action: BulkActionType): boolean {
|
|
return SUBSCRIPTION_LEVEL_ACTIONS.has(action);
|
|
}
|