154 lines
7.0 KiB
Svelte
154 lines
7.0 KiB
Svelte
<script lang="ts">
|
|
import { DynamicGUI, settingsOpen, sideBarStore, ShowRealmFrameStore, openPresetList, openPersonaList, MobileGUI, CustomGUISettingMenuStore, loadedStore, alertStore, LoadingStatusState } from './ts/stores.svelte';
|
|
import Sidebar from './lib/SideBars/Sidebar.svelte';
|
|
import { DBState } from './ts/stores.svelte';
|
|
import ChatScreen from './lib/ChatScreens/ChatScreen.svelte';
|
|
import AlertComp from './lib/Others/AlertComp.svelte';
|
|
import RealmPopUp from './lib/UI/Realm/RealmPopUp.svelte';
|
|
import GridChars from './lib/Others/GridCatalog.svelte';
|
|
import WelcomeRisu from './lib/Others/WelcomeRisu.svelte';
|
|
import Settings from './lib/Setting/Settings.svelte';
|
|
import { showRealmInfoStore, importCharacterProcess } from './ts/characterCards';
|
|
import RealmFrame from './lib/UI/Realm/RealmFrame.svelte';
|
|
import SavePopupIconComp from './lib/Others/SavePopupIcon.svelte';
|
|
import Botpreset from './lib/Setting/botpreset.svelte';
|
|
import ListedPersona from './lib/Setting/listedPersona.svelte';
|
|
import MobileHeader from './lib/Mobile/MobileHeader.svelte';
|
|
import MobileBody from './lib/Mobile/MobileBody.svelte';
|
|
import MobileFooter from './lib/Mobile/MobileFooter.svelte';
|
|
import CustomGUISettingMenu from './lib/Setting/Pages/CustomGUISettingMenu.svelte';
|
|
import { checkCharOrder } from './ts/globalApi.svelte';
|
|
|
|
|
|
let didFirstSetup: boolean = $derived(DBState.db?.didFirstSetup)
|
|
let gridOpen = $state(false)
|
|
let aprilFools = $state(new Date().getMonth() === 3 && new Date().getDate() === 1)
|
|
let aprilFoolsPage = $state(0)
|
|
</script>
|
|
|
|
<main class="flex bg-bg w-full h-full max-w-100vw text-textcolor" ondragover={(e) => {
|
|
e.preventDefault()
|
|
e.dataTransfer.dropEffect = 'link'
|
|
}} ondrop={async (e) => {
|
|
e.preventDefault()
|
|
const file = e.dataTransfer.files[0]
|
|
if (file) {
|
|
await importCharacterProcess({
|
|
name: file.name,
|
|
data: file
|
|
})
|
|
checkCharOrder()
|
|
}
|
|
}}>
|
|
{#if aprilFools}
|
|
|
|
<div class="bg-[#212121] w-full h-screen min-h-screen text-black flex relative">
|
|
<div class="w-full max-w-3xl mx-auto py-8 px-4 flex justify-center items-center">
|
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
<div class="flex flex-col w-full items-center text-[#bbbbbb]">
|
|
{#if aprilFoolsPage === 0}
|
|
<h1 class="text-3xl text-white font-bold mb-6">What can I help you?</h1>
|
|
<textarea class="resize-none w-full placeholder-[#bbbbbb] bg-[#303030] rounded-3xl h-[110px] py-4 px-6 mb-6" placeholder="Ask me" onkeydown={(e) => {
|
|
if(e.key === 'Enter'){
|
|
aprilFoolsPage = 1
|
|
}
|
|
}}></textarea>
|
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
<div class="flex gap-1.5" onclick={() => {
|
|
aprilFoolsPage = 1
|
|
}}>
|
|
<button class="rounded-full border border-[#bbbbbb15] px-4 py-2">
|
|
<span class="text-[#bbbbbb]">🔍</span>
|
|
Search
|
|
</button>
|
|
<button class="rounded-full border border-[#bbbbbb15] px-4 py-2">
|
|
<span class="text-[#bbbbbb]">🎮</span>
|
|
Games
|
|
</button>
|
|
<button class="rounded-full border border-[#bbbbbb15] px-4 py-2">
|
|
<span class="text-[#bbbbbb]">🎨</span>
|
|
Roleplay
|
|
</button>
|
|
<button class="rounded-full border border-[#bbbbbb15] px-4 py-2">
|
|
More
|
|
</button>
|
|
</div>
|
|
{:else}
|
|
<h1 class="text-3xl text-white font-bold mb-6">
|
|
Happy April Fools!
|
|
</h1>
|
|
<p class="text-[#bbbbbb] mb-6">
|
|
<!-- svelte-ignore a11y_missing_attribute -->
|
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
Go <a class="text-blue-500 cursor-pointer" onclick={() => {
|
|
aprilFoolsPage = 0
|
|
aprilFools = false
|
|
}}>
|
|
Back to normal
|
|
</a>
|
|
</p>
|
|
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
<span class="absolute top-4 left-4 font-bold text-[#bbbbbb] text-md md:text-lg">RisyGTP-9</span>
|
|
</div>
|
|
{:else if !$loadedStore}
|
|
<div class="w-full h-full flex justify-center items-center text-textcolor text-xl bg-gray-900 flex-col">
|
|
<div class="flex flex-row items-center">
|
|
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-textcolor" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
|
</svg>
|
|
<span>Loading...</span>
|
|
</div>
|
|
|
|
<span class="text-sm mt-2 text-textcolor2">{LoadingStatusState.text}</span>
|
|
</div>
|
|
{:else if $CustomGUISettingMenuStore}
|
|
<CustomGUISettingMenu />
|
|
{:else if !didFirstSetup}
|
|
<WelcomeRisu />
|
|
{:else if $settingsOpen}
|
|
<Settings />
|
|
{:else if $MobileGUI}
|
|
<div class="w-full h-full flex flex-col">
|
|
<MobileHeader />
|
|
<MobileBody />
|
|
<MobileFooter />
|
|
</div>
|
|
{:else}
|
|
{#if gridOpen}
|
|
<GridChars endGrid={() => {gridOpen = false}} />
|
|
{:else}
|
|
{#if (!$DynamicGUI)}
|
|
<Sidebar openGrid={() => {gridOpen = true}} hidden={!$sideBarStore} />
|
|
{:else}
|
|
<div class="top-0 w-full h-full left-0 z-30 flex flex-row items-center" class:fixed={$sideBarStore} class:hidden={!$sideBarStore} >
|
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
<Sidebar openGrid={() => {gridOpen = true}} hidden={false} />
|
|
|
|
|
|
|
|
</div>
|
|
{/if}
|
|
<ChatScreen />
|
|
{/if}
|
|
{/if}
|
|
{#if $alertStore.type !== 'none'}
|
|
<AlertComp />
|
|
{/if}
|
|
{#if $showRealmInfoStore}
|
|
<RealmPopUp bind:openedData={$showRealmInfoStore} />
|
|
{/if}
|
|
{#if $ShowRealmFrameStore}
|
|
<RealmFrame />
|
|
{/if}
|
|
{#if $openPresetList}
|
|
<Botpreset close={() => {$openPresetList = false}} />
|
|
{/if}
|
|
{#if $openPersonaList}
|
|
<ListedPersona close={() => {$openPersonaList = false}} />
|
|
{/if}
|
|
<SavePopupIconComp />
|
|
</main> |