index.js 740 B

1234567891011121314151617181920212223
  1. import { renderDashboard } from './core.js';
  2. import { getTimeHandler } from '../time/index.js';
  3. import { getPeriodsHandler } from '../period/index.js';
  4. import { getStarSignHandler } from '../star-sign/index.js';
  5. /**
  6. * Dashboard UI Controller.
  7. * Orchestrates data fetching and rendering.
  8. * @returns {string}
  9. */
  10. export const dashboardController = () => {
  11. const timeData = getTimeHandler();
  12. const periodData = getPeriodsHandler();
  13. const starSignData = getStarSignHandler();
  14. const state = {
  15. time: timeData.success ? timeData.data.time : 'Error',
  16. periods: periodData.success ? periodData.data.periods : [],
  17. starSign: starSignData.success ? starSignData.data.starSign : 'Error'
  18. };
  19. return renderDashboard(state);
  20. };