Fully working sonarr integration

This commit is contained in:
Aleksi Lassila
2023-07-24 00:19:39 +03:00
parent 51a7ab630a
commit 77153a96c5
20 changed files with 355 additions and 385 deletions

View File

@@ -10,6 +10,10 @@ function createModalStack() {
...store,
push: (symbol: Symbol) => {
store.update((s) => {
if (s.stack.includes(symbol)) {
return s;
}
s.stack.push(symbol);
s.top = symbol;
return s;
@@ -26,3 +30,19 @@ function createModalStack() {
}
export const modalStack = createModalStack();
export type ModalProps = ReturnType<typeof createModalProps>;
export function createModalProps(onClose: () => void) {
const id = Symbol();
function close() {
onClose(); // ORDER MATTERS HERE
modalStack.remove(id);
}
return {
close,
id
};
}