-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from tuanchauict/change-project-management-di…
…alog Observe change from other opening tab and create Alert dialog
- Loading branch information
Showing
14 changed files
with
131 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2025, tuanchauict | ||
*/ | ||
|
||
import Dialog from "$ui/modal/common/Dialog.svelte"; | ||
|
||
export type ActionButtonModel = { | ||
text: string; | ||
onClick: () => void; | ||
} | ||
|
||
export type AlertDialogModel = { | ||
title?: string; | ||
message?: string; | ||
dismissOnClickingOutside?: boolean; | ||
primaryAction?: ActionButtonModel; | ||
secondaryAction?: ActionButtonModel; | ||
onDismiss?: () => void; | ||
} | ||
|
||
export function AlertDialog(props: AlertDialogModel) { | ||
const primaryAction = props.primaryAction ? { | ||
text: props.primaryAction.text, | ||
onClick: () => { | ||
props.primaryAction!.onClick(); | ||
dialog.$destroy(); | ||
}, | ||
} : undefined; | ||
const secondaryAction = props.secondaryAction ? { | ||
text: props.secondaryAction.text, | ||
onClick: () => { | ||
props.secondaryAction!.onClick(); | ||
dialog.$destroy(); | ||
}, | ||
} : undefined; | ||
|
||
const dialog = new Dialog({ | ||
target: document.querySelector('#alert')!, | ||
props: { | ||
model: { | ||
...props, | ||
primaryAction, | ||
secondaryAction, | ||
onDismiss: () => { | ||
props.onDismiss?.(); | ||
dialog.$destroy(); | ||
} | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.