fix: apply module not working

This commit is contained in:
kwaroran
2024-06-05 16:51:30 +09:00
parent 764c2370dd
commit c9d41c1cfa
2 changed files with 14 additions and 8 deletions

View File

@@ -62,27 +62,31 @@
<div class="border-t-1 border-selected"></div> <div class="border-t-1 border-selected"></div>
{/if} {/if}
<div class="pl-3 py-3 text-left flex"> <div class="pl-3 py-3 text-left flex">
{#if $DataBase.enabledModules.includes(rmodule.id)} {#if !alertMode && $DataBase.enabledModules.includes(rmodule.id)}
<span class="text-textcolor2">{rmodule.name}</span> <span class="text-textcolor2">{rmodule.name}</span>
{:else} {:else}
<span class="">{rmodule.name}</span> <span class="">{rmodule.name}</span>
{/if} {/if}
<div class="flex-grow flex justify-end"> <div class="flex-grow flex justify-end">
{#if $DataBase.enabledModules.includes(rmodule.id) && !alertMode}
{#if alertMode}
<button class={"text-textcolor2 mr-2 cursor-pointer hover:text-blue-500 transition-colors"} on:click={async (e) => {
e.stopPropagation()
close(rmodule.id)
}}>
<CheckCircle2Icon size={18}/>
</button>
{:else if $DataBase.enabledModules.includes(rmodule.id)}
<button class="mr-2 text-textcolor2 cursor-not-allowed"> <button class="mr-2 text-textcolor2 cursor-not-allowed">
</button> </button>
{:else} {:else}
<button class={(!$CurrentChat.modules.includes(rmodule.id) && !alertMode) ? <button class={(!$CurrentChat.modules.includes(rmodule.id)) ?
"text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" : "text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" :
"mr-2 cursor-pointer text-blue-500" "mr-2 cursor-pointer text-blue-500"
} on:click={async (e) => { } on:click={async (e) => {
e.stopPropagation() e.stopPropagation()
if(alertMode){
close(rmodule.id)
return
}
if($CurrentChat.modules.includes(rmodule.id)){ if($CurrentChat.modules.includes(rmodule.id)){
$CurrentChat.modules.splice($CurrentChat.modules.indexOf(rmodule.id), 1) $CurrentChat.modules.splice($CurrentChat.modules.indexOf(rmodule.id), 1)
} }

View File

@@ -223,5 +223,7 @@ export async function applyModule() {
} }
} }
CurrentCharacter.set(currentChar)
alertNormal(language.successApplyModule) alertNormal(language.successApplyModule)
} }