enh: model editor reset image

This commit is contained in:
Timothy Jaeryang Baek 2024-11-23 23:26:11 -08:00
parent c465a37597
commit e67fdce727

View File

@ -317,6 +317,7 @@
info.meta.profile_image_url = compressedSrc; info.meta.profile_image_url = compressedSrc;
inputFiles = null; inputFiles = null;
filesInputElement.value = '';
}; };
}; };
@ -345,7 +346,7 @@
<div class="self-center md:self-start flex justify-center my-2 flex-shrink-0"> <div class="self-center md:self-start flex justify-center my-2 flex-shrink-0">
<div class="self-center"> <div class="self-center">
<button <button
class="rounded-2xl flex flex-shrink-0 items-center {info.meta.profile_image_url !== class="rounded-xl flex flex-shrink-0 items-center {info.meta.profile_image_url !==
'/static/favicon.png' '/static/favicon.png'
? 'bg-transparent' ? 'bg-transparent'
: 'bg-white'} shadow-xl group relative" : 'bg-white'} shadow-xl group relative"
@ -358,13 +359,13 @@
<img <img
src={info.meta.profile_image_url} src={info.meta.profile_image_url}
alt="model profile" alt="model profile"
class="rounded-lg size-72 md:size-60 object-cover shrink-0" class="rounded-xl size-72 md:size-60 object-cover shrink-0"
/> />
{:else} {:else}
<img <img
src="/static/favicon.png" src="/static/favicon.png"
alt="model profile" alt="model profile"
class=" rounded-lg size-72 md:size-60 object-cover shrink-0" class=" rounded-xl size-72 md:size-60 object-cover shrink-0"
/> />
{/if} {/if}
@ -393,6 +394,18 @@
class="absolute top-0 bottom-0 left-0 right-0 bg-white dark:bg-black rounded-lg opacity-0 group-hover:opacity-20 transition" class="absolute top-0 bottom-0 left-0 right-0 bg-white dark:bg-black rounded-lg opacity-0 group-hover:opacity-20 transition"
></div> ></div>
</button> </button>
<div class="flex w-full mt-1 justify-end">
<button
class="px-2 py-1 text-gray-500 rounded-lg text-xs"
on:click={() => {
info.meta.profile_image_url = '/static/favicon.png';
}}
type="button"
>
Reset Image</button
>
</div>
</div> </div>
</div> </div>