mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
18eeb16aa0
The currency converter, the world clocks, the collection lists, the plugin widgets and card badges and the card date format each existed once per dashboard. They now live in useCurrencyConverter, useDashboardTimezones, useCollectionLists, useDashboardPlugins and dashboardModel; the phone keeps aborting a pending rate request through an option.
23 lines
934 B
TypeScript
23 lines
934 B
TypeScript
import { usePluginStore } from '../../store/pluginStore';
|
|
import { useTripCardBadges } from '../Plugins/TripCardBadges';
|
|
|
|
/**
|
|
* What plugins add to the dashboard: the widgets for the side column (hero widgets
|
|
* mount on the spotlight, place-detail/day-detail/reservation-detail ones inside the
|
|
* planner, so none of those) and the badges on the trip cards. The badges cost one
|
|
* fetch for all cards and only run while at least one plugin is active.
|
|
*/
|
|
export function useDashboardPlugins(tripIds: number[]) {
|
|
const widgetPlugins = usePluginStore((s) => s.plugins).filter(
|
|
(p) =>
|
|
p.type === 'widget' &&
|
|
p.slot !== 'hero' &&
|
|
p.slot !== 'place-detail' &&
|
|
p.slot !== 'day-detail' &&
|
|
p.slot !== 'reservation-detail'
|
|
);
|
|
const anyPluginActive = usePluginStore((s) => s.plugins).length > 0;
|
|
const badgesFor = useTripCardBadges(tripIds, anyPluginActive);
|
|
return { widgetPlugins, badgesFor };
|
|
}
|