diff --git a/src/js/Content/Features/Community/EditGuide/FCustomTags.svelte b/src/js/Content/Features/Community/EditGuide/FCustomTags.svelte index f2ab18d6b..cbe7f7e47 100644 --- a/src/js/Content/Features/Community/EditGuide/FCustomTags.svelte +++ b/src/js/Content/Features/Community/EditGuide/FCustomTags.svelte @@ -9,6 +9,7 @@ import RequestData from "@Content/Modules/RequestData"; import {onMount} from "svelte"; import AddTagForm from "./Components/AddTagForm.svelte"; + import CustomModal from "@Core/Modals/CustomModal"; let customTags: Set = new Set(); // Use Set to enforce unique tags @@ -42,29 +43,19 @@ let form: AddTagForm|undefined; let tag: string = ""; - const observer = new MutationObserver(() => { - const modal = document.querySelector("#as_tag_form"); - if (modal) { + const response = await CustomModal({ + title: L(__customTags), + modalFn: (target) => { form = new AddTagForm({ - target: modal, + target, props: {tag} }); form.$on("change", () => { tag = form!.tag; }); - observer.disconnect(); + return form; } }); - observer.observe(document.body, { - childList: true - }); - - const response = await SteamFacade.showConfirmDialog( - L(__customTags), - `
` - ); - - form?.$destroy(); if (response === "OK") { if (tag.trim() === "") { diff --git a/src/js/Content/Features/Store/Common/UserNotes/UserNotes.ts b/src/js/Content/Features/Store/Common/UserNotes/UserNotes.ts index 88d951920..e1b125691 100644 --- a/src/js/Content/Features/Store/Common/UserNotes/UserNotes.ts +++ b/src/js/Content/Features/Store/Common/UserNotes/UserNotes.ts @@ -20,7 +20,7 @@ import Settings from "@Options/Data/Settings"; import ITADApiFacade from "@Content/Modules/Facades/ITADApiFacade"; import SteamFacade from "@Content/Modules/Facades/SteamFacade"; import NotesForm from "./NotesForm.svelte"; -import CustomModal from "@Core/CustomModal"; +import CustomModal from "@Core/Modals/CustomModal"; export default class UserNotes { diff --git a/src/js/Content/Features/Store/Wishlist/Components/ExportWishlistForm.svelte b/src/js/Content/Features/Store/Wishlist/Components/ExportWishlistForm.svelte index 60a0aaf5e..b0fc969c3 100644 --- a/src/js/Content/Features/Store/Wishlist/Components/ExportWishlistForm.svelte +++ b/src/js/Content/Features/Store/Wishlist/Components/ExportWishlistForm.svelte @@ -40,40 +40,45 @@ -
-

{L(__export_type)}

-
- - +
+
+

{L(__export_type)}

+
+ + +
-
-{#if type === "text"} -
-

{L(__export_format)}

-
- -
- {#each ["%title%", "%id%", "%appid%", "%url%", "%release_date%", "%price%", "%discount%", "%base_price%", "%type%", "%note%"] as str, index} - {#if index > 0}, {/if} - - {/each} + {#if type === "text"} +
+

{L(__export_format)}

+
+ +
+ {#each ["%title%", "%id%", "%appid%", "%url%", "%release_date%", "%price%", "%discount%", "%base_price%", "%type%", "%note%"] as str, index} + {#if index > 0}, {/if} + + {/each} +
-
-{/if} + {/if} +
\ No newline at end of file + diff --git a/src/js/Content/Features/Store/Wishlist/FExportWishlist.ts b/src/js/Content/Features/Store/Wishlist/FExportWishlist.ts index 7405496e9..075f2e11b 100644 --- a/src/js/Content/Features/Store/Wishlist/FExportWishlist.ts +++ b/src/js/Content/Features/Store/Wishlist/FExportWishlist.ts @@ -8,6 +8,7 @@ import SteamFacade from "@Content/Modules/Facades/SteamFacade"; import UserNotes from "@Content/Features/Store/Common/UserNotes/UserNotes"; import Clipboard from "@Content/Modules/Clipboard"; import ExportWishlistForm from "@Content/Features/Store/Wishlist/Components/ExportWishlistForm.svelte"; +import CustomModal from "@Core/Modals/CustomModal"; type WishlistData = Array<[string, { name: string, @@ -122,11 +123,15 @@ export default class FExportWishlist extends Feature { let form: ExportWishlistForm|undefined; - const observer = new MutationObserver(() => { - const modal = document.querySelector("#as_export_form"); - if (modal) { + const response = await CustomModal({ + title: L(__export_wishlist), + options: { + okButton: L(__export_download), + secondaryActionButton: L(__export_copyClipboard) + }, + modalFn: (target) => { form = new ExportWishlistForm({ - target: modal, + target, props: { type: this.type, format: this.format @@ -136,22 +141,9 @@ export default class FExportWishlist extends Feature { this.format = form!.format; this.type = form!.type; }); - observer.disconnect(); + return form; } }); - observer.observe(document.body, { - childList: true - }); - - const response = await SteamFacade.showConfirmDialog( - L(__export_wishlist), - `
`, - { - okButton: L(__export_download), - secondaryActionButton: L(__export_copyClipboard) - }); - - form?.$destroy(); if (response === "CANCEL") { return; diff --git a/src/js/Core/CustomModal.ts b/src/js/Core/Modals/CustomModal.ts similarity index 100% rename from src/js/Core/CustomModal.ts rename to src/js/Core/Modals/CustomModal.ts