refactor: migrate modals to use StackRouter, removed ComponentStack

temp reworked modals to use stackrouter, modals are now *chefs kiss*, removed compstack completely
This commit is contained in:
Aleksi Lassila
2026-02-09 18:44:44 +02:00
parent 0e08aa2d6f
commit a4f9ab71a6
15 changed files with 82 additions and 444 deletions

View File

@@ -324,6 +324,17 @@ export function useStackRouter({
}
};
const push = <TProps extends Record<string, unknown> = Record<string, unknown>>(
opts: CreateCompStackPage<TProps>
) => {
const currentGroup = groups[historyState.end];
if (!currentGroup) {
throw new Error('No group to push to');
}
currentGroup.push(opts);
updateVisibleStack();
};
const back = () => {
if (historyState.end === 0) return;
@@ -333,6 +344,7 @@ export function useStackRouter({
return {
subscribe: visibleStack.subscribe,
navigate,
push,
back,
handlePopState
};