add scrolls for multitoggles

This commit is contained in:
kwaroran
2024-07-06 01:03:33 +09:00
parent 21618b14c3
commit fdddc0c5a6
2 changed files with 89 additions and 22 deletions

View File

@@ -9,6 +9,10 @@
import TriggerList from "src/lib/SideBars/Scripts/TriggerList.svelte";
import Check from "src/lib/UI/GUI/CheckInput.svelte";
import Help from "src/lib/Others/Help.svelte";
import TextAreaInput from "src/lib/UI/GUI/TextAreaInput.svelte";
import Button from "src/lib/UI/GUI/Button.svelte";
import { openURL } from "src/ts/storage/globalApi";
import { hubURL } from "src/ts/characterCards";
export let currentModule:RisuModule
@@ -145,10 +149,54 @@
{#if (Array.isArray(currentModule.trigger))}
<span class="mt-8 text-xl">{language.triggerScript}</span>
<TriggerList bind:value={currentModule.trigger} lowLevelAble={currentModule.lowLevelAccess} />
<button on:click={() => {addTrigger()}} class="hover:text-textcolor cursor-pointer">
<PlusIcon />
</button>
<div class="flex items-start mt-2 gap-2">
<button class="bg-bgcolor py-1 rounded-md text-sm px-2" class:ring-1={
currentModule?.trigger?.[0]?.effect?.[0]?.type !== 'triggercode' &&
currentModule?.trigger?.[0]?.effect?.[0]?.type !== 'triggerlua'
} on:click|stopPropagation={async () => {
const codeType = currentModule?.trigger?.[0]?.effect?.[0]?.type
if(codeType === 'triggercode' || codeType === 'triggerlua'){
const codeTrigger = currentModule?.trigger?.[0]?.effect?.[0]?.code
if(codeTrigger){
const t = await alertConfirm(language.triggerSwitchWarn)
if(!t){
return
}
}
currentModule.trigger = []
}
}}>{language.blockMode}</button>
<button class="bg-bgcolor py-1 rounded-md text-sm px-2" class:ring-1={currentModule?.trigger?.[0]?.effect?.[0]?.type === 'triggerlua'} on:click|stopPropagation={async () => {
if(currentModule?.trigger?.[0]?.effect?.[0]?.type !== 'triggerlua'){
if(currentModule?.trigger && currentModule?.trigger.length > 0){
const t = await alertConfirm(language.triggerSwitchWarn)
if(!t){
return
}
}
currentModule.trigger = [{
comment: "",
type: "start",
conditions: [],
effect: [{
type: "triggerlua",
code: ""
}]
}]
}
}}>Lua</button>
</div>
{#if currentModule?.trigger?.[0]?.effect?.[0]?.type === 'triggerlua'}
<TextAreaInput margin="both" autocomplete="off" bind:value={currentModule.trigger[0].effect[0].code}></TextAreaInput>
<Button on:click={() => {
openURL(hubURL + '/redirect/docs/lua')
}}>{language.helpBlock}</Button>
{:else}
<TriggerList bind:value={currentModule.trigger} lowLevelAble={currentModule.lowLevelAccess} />
<button on:click={() => {addTrigger()}} class="hover:text-textcolor cursor-pointer">
<PlusIcon />
</button>
{/if}
<div class="flex items-center mt-4">
<Check bind:check={currentModule.lowLevelAccess} name={language.lowLevelAccess}/>