add hidechaticon
This commit is contained in:
@@ -668,4 +668,5 @@ export const languageEnglish = {
|
||||
codeMode: "Code",
|
||||
blockMode: "Block",
|
||||
helpBlock: "Help",
|
||||
hideChatIcon: "Hide Icon UI",
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
import { alertConfirm, alertError, alertRequestData } from "../../ts/alert";
|
||||
import { language } from "../../lang";
|
||||
import { DataBase, type MessageGenerationInfo } from "../../ts/storage/database";
|
||||
import { CurrentCharacter, CurrentChat, CurrentVariablePointer } from "../../ts/stores";
|
||||
import { CurrentCharacter, CurrentChat, CurrentVariablePointer, HideIconStore } from "../../ts/stores";
|
||||
import { translateHTML } from "../../ts/translator/translator";
|
||||
import { risuChatParser } from "src/ts/process/scripts";
|
||||
import { get } from "svelte/store";
|
||||
@@ -144,7 +144,7 @@
|
||||
</script>
|
||||
<div class="flex max-w-full justify-center risu-chat" style={isLastMemory ? `border-top:${$DataBase.memoryLimitThickness}px solid rgba(98, 114, 164, 0.7);` : ''}>
|
||||
<div class="text-textcolor mt-1 ml-4 mr-4 mb-1 p-2 bg-transparent flex-grow border-t-gray-900 border-opacity-30 border-transparent flexium items-start max-w-full" >
|
||||
{#if !blankMessage}
|
||||
{#if !blankMessage && !$HideIconStore}
|
||||
{#if $CurrentCharacter?.chaId === "§playground"}
|
||||
<div class="shadow-lg border-textcolor2 border mt-2 flex justify-center items-center text-textcolor2" style={`height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons}>
|
||||
|
||||
@@ -202,4 +202,8 @@
|
||||
<Check bind:check={currentModule.lowLevelAccess} name={language.lowLevelAccess}/>
|
||||
<span> <Help key="lowLevelAccess" name={language.lowLevelAccess}/></span>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={currentModule.hideIcon} name={language.hideChatIcon}/>
|
||||
</div>
|
||||
@@ -966,6 +966,10 @@
|
||||
<span> <Help key="lowLevelAccess" name={language.lowLevelAccess}/></span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={currentChar.data.hideChatIcon} name={language.hideChatIcon}/>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={currentChar.data.utilityBot} name={language.utilityBot}/>
|
||||
<span> <Help key="utilityBot" name={language.utilityBot}/></span>
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface RisuModule{
|
||||
trigger?: triggerscript[]
|
||||
id: string
|
||||
lowLevelAccess?: boolean
|
||||
hideIcon?: boolean
|
||||
}
|
||||
|
||||
export async function exportModule(module:RisuModule){
|
||||
|
||||
@@ -826,6 +826,7 @@ export interface character{
|
||||
}>
|
||||
defaultVariables?:string
|
||||
lowLevelAccess?:boolean
|
||||
hideChatIcon?:boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -873,6 +874,7 @@ export interface groupChat{
|
||||
nickname?:string
|
||||
defaultVariables?:string
|
||||
lowLevelAccess?:boolean
|
||||
hideChatIcon?:boolean
|
||||
}
|
||||
|
||||
export interface botPreset{
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DataBase, type Chat, type character, type groupChat } from "./storage/d
|
||||
import { isEqual } from "lodash";
|
||||
import type { simpleCharacterArgument } from "./parser";
|
||||
import { sleep } from "./util";
|
||||
import { getModules } from "./process/modules";
|
||||
|
||||
function updateSize(){
|
||||
SizeStore.set({
|
||||
@@ -39,6 +40,11 @@ export const CurrentVariablePointer = writable({} as {[key:string]: string|numbe
|
||||
export const OpenRealmStore = writable(false)
|
||||
export const ShowRealmFrameStore = writable('')
|
||||
export const PlaygroundStore = writable(0)
|
||||
export const HideIconStore = writable(false)
|
||||
let lastGlobalEnabledModules: string[] = []
|
||||
let lastChatEnabledModules: string[] = []
|
||||
let moduleHideIcon = false
|
||||
let characterHideIcon = false
|
||||
|
||||
function createSimpleCharacter(char:character|groupChat){
|
||||
if((!char) || char.type === 'group'){
|
||||
@@ -133,6 +139,11 @@ async function preInit(){
|
||||
if(data.showMemoryLimit !== get(CurrentShowMemoryLimit)){
|
||||
CurrentShowMemoryLimit.set(data.showMemoryLimit)
|
||||
}
|
||||
if(!isEqual(data.enabledModules, lastGlobalEnabledModules)){
|
||||
lastGlobalEnabledModules = data.enabledModules
|
||||
onModuleUpdate()
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
selectedCharID.subscribe((id) => {
|
||||
@@ -144,6 +155,11 @@ async function preInit(){
|
||||
updateCurrentChat()
|
||||
let db = get(DataBase)
|
||||
let charId = get(selectedCharID)
|
||||
if(char.hideChatIcon !== characterHideIcon){
|
||||
characterHideIcon = char.hideChatIcon
|
||||
HideIconStore.set(characterHideIcon || moduleHideIcon)
|
||||
}
|
||||
|
||||
if(charId === -1 || charId > db.characters.length){
|
||||
return
|
||||
}
|
||||
@@ -165,6 +181,12 @@ async function preInit(){
|
||||
}
|
||||
}
|
||||
|
||||
if(!isEqual(lastChatEnabledModules, chat?.modules)){
|
||||
lastChatEnabledModules = chat?.modules
|
||||
onModuleUpdate()
|
||||
return
|
||||
}
|
||||
|
||||
const variablePointer = get(CurrentVariablePointer)
|
||||
const currentState = structuredClone(chat?.scriptstate)
|
||||
|
||||
@@ -174,6 +196,20 @@ async function preInit(){
|
||||
})
|
||||
}
|
||||
|
||||
function onModuleUpdate(){
|
||||
const m = getModules([
|
||||
...lastGlobalEnabledModules, ...lastChatEnabledModules
|
||||
])
|
||||
|
||||
let moduleHideIcon = false
|
||||
m.forEach((module) => {
|
||||
if(module.hideIcon){
|
||||
moduleHideIcon = true
|
||||
}
|
||||
})
|
||||
|
||||
HideIconStore.set(characterHideIcon || moduleHideIcon)
|
||||
}
|
||||
|
||||
updateSize()
|
||||
window.addEventListener("resize", updateSize);
|
||||
|
||||
Reference in New Issue
Block a user