From 1319d1f215717cf32102544329974806b66f6c9e Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 28 Oct 2024 15:41:24 -0500 Subject: [PATCH] add editable channel prompts --- src/lib/common/InPlaceEdit.svelte | 71 +++++++---- src/lib/common/nav-bar/NavItem.svelte | 48 +++++++- src/lib/helpers/types/agentTypes.js | 1 + src/routes/page/agent/[agentId]/+page.svelte | 19 ++- .../agent/[agentId]/agent-overview.svelte | 2 +- .../page/agent/[agentId]/agent-prompt.svelte | 115 +++++++++++++++--- 6 files changed, 210 insertions(+), 46 deletions(-) diff --git a/src/lib/common/InPlaceEdit.svelte b/src/lib/common/InPlaceEdit.svelte index a5993bb4..2eed2a9a 100644 --- a/src/lib/common/InPlaceEdit.svelte +++ b/src/lib/common/InPlaceEdit.svelte @@ -1,46 +1,73 @@ {#if editing} -
- -
+ +
submit()} on:keydown={e => keydown(e)}> + submit()} + /> +
{:else} -
- {value} -
+ + +
edit()}> + {#if !!value?.trim()} + {value} + {:else} + {placeholder} + {/if} +
{/if} \ No newline at end of file diff --git a/src/lib/common/nav-bar/NavItem.svelte b/src/lib/common/nav-bar/NavItem.svelte index 45ca2293..8ebed829 100644 --- a/src/lib/common/nav-bar/NavItem.svelte +++ b/src/lib/common/nav-bar/NavItem.svelte @@ -1,4 +1,6 @@
  • @@ -78,8 +101,27 @@ disabled={disabled} on:click={(e) => handleTabClick(e)} > - {navBtnText} + {#if allowEdit} + + {:else} +
    +
    {navBtnText}
    +
    + {/if} + + {#if allowDelete} + + + +
    + handleTabDelete(e)} + /> +
    +
    + {/if}