annual-receipts
4 years ago
dashboard
4 years ago
donation-history
4 years ago
edit-profile
2 weeks ago
recurring-donations
1 year ago
index.js
4 years ago
index.js
30 lines
| 1 | // Internal dependencies |
| 2 | import {registerAnnualReceiptsTab} from './annual-receipts'; |
| 3 | import {registerDashboardTab} from './dashboard'; |
| 4 | import {registerDonationHistoryTab} from './donation-history'; |
| 5 | import {registerEditProfileTab} from './edit-profile'; |
| 6 | import {registerRecurringDonationsTab} from './recurring-donations'; |
| 7 | import {getWindowData} from '../utils'; |
| 8 | |
| 9 | export const registerDefaultTabs = () => { |
| 10 | // Dashboard Tab should always register |
| 11 | registerDashboardTab(); |
| 12 | |
| 13 | const tabRegistrationMap = { |
| 14 | 'donation-history': registerDonationHistoryTab, |
| 15 | 'annual-receipts': registerAnnualReceiptsTab, |
| 16 | 'recurring-donations': registerRecurringDonationsTab, |
| 17 | }; |
| 18 | |
| 19 | const registeredTabs = getWindowData('registeredTabs'); |
| 20 | |
| 21 | registeredTabs.forEach((tab) => { |
| 22 | if (tabRegistrationMap[tab]) { |
| 23 | tabRegistrationMap[tab](); |
| 24 | } |
| 25 | }); |
| 26 | |
| 27 | // Make sure that Edit Profile tab is registered last |
| 28 | registerEditProfileTab(); |
| 29 | }; |
| 30 |