fix(ui): add Edit option to prompts 3-dots menu (#25789)
This commit is contained in:
2 files changed
+34
-1
No files matched your search
@@ -472,6 +472,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<PromptMenu
|
<PromptMenu
|
||||||
|
editHandler={() => {
|
||||||
|
goto(`/workspace/prompts/${prompt.id}`);
|
||||||
|
}}
|
||||||
shareHandler={() => {
|
shareHandler={() => {
|
||||||
shareHandler(prompt);
|
shareHandler(prompt);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
|
export let editHandler: Function;
|
||||||
export let shareHandler: Function;
|
export let shareHandler: Function;
|
||||||
export let cloneHandler: Function;
|
export let cloneHandler: Function;
|
||||||
export let exportHandler: Function;
|
export let exportHandler: Function;
|
||||||
@@ -34,11 +35,37 @@
|
|||||||
|
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<div
|
<div
|
||||||
class="min-w-[170px] rounded-2xl p-1 border border-gray-100 dark:border-gray-800 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg"
|
class="min-w-[170px] rounded-2xl px-1 py-1 border border-gray-100 dark:border-gray-800 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg"
|
||||||
>
|
>
|
||||||
|
<button
|
||||||
|
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
draggable="false"
|
||||||
|
on:click={() => {
|
||||||
|
editHandler();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="w-4 h-4"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<div class="flex items-center">{$i18n.t('Edit')}</div>
|
||||||
|
</button>
|
||||||
|
|
||||||
{#if $config.features.enable_community_sharing}
|
{#if $config.features.enable_community_sharing}
|
||||||
<button
|
<button
|
||||||
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
draggable="false"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
shareHandler();
|
shareHandler();
|
||||||
}}
|
}}
|
||||||
@@ -50,6 +77,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
draggable="false"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
cloneHandler();
|
cloneHandler();
|
||||||
}}
|
}}
|
||||||
@@ -61,6 +89,7 @@
|
|||||||
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.prompts_export}
|
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.prompts_export}
|
||||||
<button
|
<button
|
||||||
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
draggable="false"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
exportHandler();
|
exportHandler();
|
||||||
}}
|
}}
|
||||||
@@ -74,6 +103,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
draggable="false"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
deleteHandler();
|
deleteHandler();
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user