Files
task-stream/libs/web/tracker/application/src/lib/facades/home.facade.ts
Josep Piguillem f448207e88 refactor(web): page state with its page, the root keeps the shell's
Only what the header needs from the start stays at the root: the
session, my projects for the command palette, the inbox and push for
the bell, and their adapters. The home page's facades (my work, the
rest of the home, my views, the calendar), Explore's and the proposal
form's are provided by their routes, whose injectors keep them for
when you come back. The other adapters come with the tracker's routes,
now loaded lazily.

The web libs declare "sideEffects": false, so a chunk carries what it
uses and not everything an index.ts exports: main goes from 1.31 MB
to 432 kB of the same initial total, which is still held up by @pi/ui
(one module, with all of Material) and the GraphQL documents, both
needed by the header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 08:34:17 +02:00

41 lines
1.7 KiB
TypeScript

import { inject, Injectable, Provider } from '@angular/core';
import { injectDispatch } from '@ngrx/signals/events';
import { homePageEvents } from '../events/home.events';
import { HomeStore } from '../stores/home.store';
/** "My work" on the home page: my tickets, waiting for QA, upcoming releases. */
@Injectable()
export class HomeFacade {
private readonly store = inject(HomeStore);
private readonly dispatch = injectDispatch(homePageEvents);
/** My open tickets (most recently updated first) and how many there are. */
readonly mine = this.store.mine;
readonly mineTotal = this.store.mineTotal;
/** The same, grouped by category (in progress, QA, pending), QA failures first. */
readonly mineByCategory = this.store.mineByCategory;
readonly qaFailed = this.store.qaFailed;
/** Tickets of my projects in a QA-category status (anyone's). */
readonly awaitingQa = this.store.awaitingQa;
readonly awaitingQaTotal = this.store.awaitingQaTotal;
/** Open tickets I follow, whoever works on them. */
readonly following = this.store.following;
readonly followingTotal = this.store.followingTotal;
/** Planned releases of my projects, soonest first. */
readonly releases = this.store.releases;
/** False until the first load: show skeletons, not empty states. */
readonly loaded = this.store.loaded;
readonly loading = this.store.loading;
readonly error = this.store.error;
/** Loads my work; call again to refresh (e.g. when the tab regains focus). */
load(): void {
this.dispatch.opened();
}
}
/** «Mi trabajo» on the home page: provided by the route that shows it, not the root. */
export function provideHomeFacade(): Provider[] {
return [HomeStore, HomeFacade];
}