Add preset related features

This commit is contained in:
Kwaroran
2024-12-26 04:29:14 +09:00
parent c6cc258a50
commit 2672195d92
8 changed files with 78 additions and 30 deletions

View File

@@ -18,7 +18,7 @@
</script>
<div class="absolute w-full h-full z-40 bg-black bg-opacity-50 flex justify-center items-center">
<div class="bg-darkbg p-4 break-any rounded-md flex flex-col max-w-3xl w-96 max-h-full overflow-y-auto">
<div class="bg-darkbg p-4 break-any rounded-md flex flex-col max-w-3xl w-124 max-h-full overflow-y-auto">
<div class="flex items-center text-textcolor mb-4">
<h2 class="mt-0 mb-0">{language.presets}</h2>
<div class="flex-grow flex justify-end">
@@ -27,7 +27,7 @@
</button>
</div>
</div>
{#each DBState.db.botPresets as presets, i}
{#each DBState.db.botPresets as preset, i}
<button onclick={() => {
if(!editMode){
changeToPreset(i)
@@ -38,9 +38,13 @@
<TextInput bind:value={DBState.db.botPresets[i].name} placeholder="string" padding={false}/>
{:else}
{#if i < 9}
<span class="w-2 text-center mr-2 text-textcolor2">{i + 1}</span>
<span class="w-2 text-center mr-2 text-textcolor2">{i + 1}</span>
{/if}
<span>{presets.name}</span>
{#if preset.image}
<img src={DBState.db.botPresets[DBState.db.botPresetsId]?.image} alt="icon" class="mr-2 min-w-6 min-h-6 w-6 h-6 rounded-md" decoding="async"/>
{/if}
<span>{preset.name}</span>
{/if}
<div class="flex-grow flex justify-end">
<div class="text-textcolor2 hover:text-green-500 cursor-pointer mr-2" role="button" tabindex="0" onclick={(e) => {
@@ -77,7 +81,7 @@
alertError(language.errors.onlyOneChat)
return
}
const d = await alertConfirm(`${language.removeConfirm}${presets.name}`)
const d = await alertConfirm(`${language.removeConfirm}${preset.name}`)
if(d){
changeToPreset(0)
let botPresets = DBState.db.botPresets