feat: add preset sharing

This commit is contained in:
kwaroran
2024-05-24 11:28:32 +09:00
parent 0ce01d8ca1
commit 96ccc1cdd8
10 changed files with 124 additions and 74 deletions

View File

@@ -24,15 +24,19 @@
let cardExportPassword = ''
let cardLicense = ''
let generationInfoMenuIndex = 0
$: (() => {
$: {
if(btn){
btn.focus()
}
if($alertStore.type !== 'input'){
input = ''
}
})()
if($alertStore.type !== 'cardexport'){
cardExportType = ''
cardExportPassword = ''
cardLicense = ''
}
}
const beautifyJSON = (data:string) =>{
try {
@@ -372,7 +376,7 @@
<div class="bg-darkbg rounded-md p-4 max-w-full flex flex-col w-2xl" on:click|stopPropagation>
<h1 class="font-bold text-2xl w-full">
<span>
Export Character
{language.shareExport}
</span>
<button class="float-right text-textcolor2 hover:text-green-500" on:click={() => {
alertStore.set({
@@ -387,29 +391,27 @@
<XIcon />
</button>
</h1>
<span class="text-textcolor mt-4">Type</span>
<span class="text-textcolor mt-4">{language.type}</span>
{#if cardExportType === ''}
<span class="text-textcolor2 text-sm">{language.ccv2Desc}</span>
{#if $alertStore.submsg !== 'preset'}
<span class="text-textcolor2 text-sm">{language.risupresetDesc}</span>
{:else}
<span class="text-textcolor2 text-sm">{language.ccv2Desc}</span>
{/if}
{:else if cardExportType === 'json'}
<span class="text-textcolor2 text-sm">{language.jsonDesc}</span>
{:else}
<span class="text-textcolor2 text-sm">{language.rccDesc}</span>
<span class="text-textcolor2 text-sm">{language.realmDesc}</span>
{/if}
<div class="flex items-center flex-wrap mt-2">
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V2</button>
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'rcc'} on:click={() => {cardExportType = 'rcc'}}>Risu RCC</button>
{#if $alertStore.submsg === 'preset'}
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Risupreset</button>
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'json'} on:click={() => {cardExportType = 'json'}}>JSON</button>
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'realm'} on:click={() => {cardExportType = 'realm'}}>RisuRealm</button>
{:else}
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V2</button>
{/if}
</div>
{#if cardExportType === 'rcc'}
<span class="text-textcolor mt-4">{language.password}</span>
<span class="text-textcolor2 text-sm">{language.passwordDesc}</span>
<TextInput placeholder="" bind:value={cardExportPassword} />
<span class="text-textcolor mt-4">{language.license}</span>
<span class="text-textcolor2 text-sm">{language.licenseDesc}</span>
<SelectInput bind:value={cardLicense}>
<OptionInput value="">None</OptionInput>
{#each Object.keys(CCLicenseData) as ccl}
<OptionInput value={ccl}>{CCLicenseData[ccl][2]} ({CCLicenseData[ccl][1]})</OptionInput>
{/each}
</SelectInput>
{/if}
<Button className="mt-4" on:click={() => {
alertStore.set({
type: 'none',
@@ -419,7 +421,7 @@
license: cardLicense
})
})
}}>{language.export}</Button>
}}>{cardExportType === 'realm' ? language.shareCloud : language.export}</Button>
</div>
</div>