mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-26 10:45:12 +02:00
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:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user