Spaces:
Running
Running
feat: add confirmation popup before deleting content (#1534)
Browse files* feat: add confirmation popup before deleting content
* fix: lint
src/routes/settings/(nav)/assistants/[assistantId]/+page.svelte
CHANGED
@@ -121,9 +121,17 @@
|
|
121 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
122 |
</a>
|
123 |
<form method="POST" action="?/delete" use:enhance>
|
124 |
-
<button
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
>
|
|
|
|
|
127 |
</form>
|
128 |
{:else}
|
129 |
<form method="POST" action="?/unsubscribe" use:enhance>
|
@@ -155,9 +163,17 @@
|
|
155 |
{#if data?.user?.isAdmin}
|
156 |
{#if !assistant?.createdByMe}
|
157 |
<form method="POST" action="?/delete" use:enhance>
|
158 |
-
<button
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
>
|
|
|
|
|
161 |
</form>
|
162 |
{/if}
|
163 |
{#if assistant?.review === ReviewStatus.PRIVATE}
|
|
|
121 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
122 |
</a>
|
123 |
<form method="POST" action="?/delete" use:enhance>
|
124 |
+
<button
|
125 |
+
type="submit"
|
126 |
+
class="flex items-center underline"
|
127 |
+
on:click={(event) => {
|
128 |
+
if (!confirm("Are you sure you want to delete this assistant?")) {
|
129 |
+
event.preventDefault();
|
130 |
+
}
|
131 |
+
}}
|
132 |
>
|
133 |
+
<CarbonTrash class="mr-1.5 inline text-xs" />Delete
|
134 |
+
</button>
|
135 |
</form>
|
136 |
{:else}
|
137 |
<form method="POST" action="?/unsubscribe" use:enhance>
|
|
|
163 |
{#if data?.user?.isAdmin}
|
164 |
{#if !assistant?.createdByMe}
|
165 |
<form method="POST" action="?/delete" use:enhance>
|
166 |
+
<button
|
167 |
+
type="submit"
|
168 |
+
class="flex items-center text-red-600 underline"
|
169 |
+
on:click={(event) => {
|
170 |
+
if (!confirm("Are you sure you want to delete this assistant?")) {
|
171 |
+
event.preventDefault();
|
172 |
+
}
|
173 |
+
}}
|
174 |
>
|
175 |
+
<CarbonTrash class="mr-1.5 inline text-xs" />Delete
|
176 |
+
</button>
|
177 |
</form>
|
178 |
{/if}
|
179 |
{#if assistant?.review === ReviewStatus.PRIVATE}
|
src/routes/tools/[toolId]/+page.svelte
CHANGED
@@ -136,9 +136,17 @@
|
|
136 |
};
|
137 |
}}
|
138 |
>
|
139 |
-
<button
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
>
|
|
|
|
|
142 |
</form>
|
143 |
{:else if !!data.tool?.baseUrl}
|
144 |
<a href="{base}/tools/{data.tool?._id}/edit" class="underline">
|
@@ -168,9 +176,17 @@
|
|
168 |
{#if data?.user?.isAdmin}
|
169 |
{#if !data.tool?.createdByMe}
|
170 |
<form method="POST" action="?/delete" use:enhance>
|
171 |
-
<button
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
>
|
|
|
|
|
174 |
</form>
|
175 |
{/if}
|
176 |
{#if data.tool?.review === ReviewStatus.PRIVATE}
|
|
|
136 |
};
|
137 |
}}
|
138 |
>
|
139 |
+
<button
|
140 |
+
type="submit"
|
141 |
+
class="flex items-center underline"
|
142 |
+
on:click={(event) => {
|
143 |
+
if (!confirm("Are you sure you want to delete this tool?")) {
|
144 |
+
event.preventDefault();
|
145 |
+
}
|
146 |
+
}}
|
147 |
>
|
148 |
+
<CarbonTrash class="mr-1.5 inline text-xs" />Delete
|
149 |
+
</button>
|
150 |
</form>
|
151 |
{:else if !!data.tool?.baseUrl}
|
152 |
<a href="{base}/tools/{data.tool?._id}/edit" class="underline">
|
|
|
176 |
{#if data?.user?.isAdmin}
|
177 |
{#if !data.tool?.createdByMe}
|
178 |
<form method="POST" action="?/delete" use:enhance>
|
179 |
+
<button
|
180 |
+
type="submit"
|
181 |
+
class="flex items-center text-red-600 underline"
|
182 |
+
on:click={(event) => {
|
183 |
+
if (!confirm("Are you sure you want to delete this tool?")) {
|
184 |
+
event.preventDefault();
|
185 |
+
}
|
186 |
+
}}
|
187 |
>
|
188 |
+
<CarbonTrash class="mr-1.5 inline text-xs" />Delete
|
189 |
+
</button>
|
190 |
</form>
|
191 |
{/if}
|
192 |
{#if data.tool?.review === ReviewStatus.PRIVATE}
|