refine: ui, prompt, and desc card
* ui improved * prompt:realisic+noHuman * prompt:editRefinement * fix: map DescriptionCard truncation and truncateAt typo Prevent result/map card overflow with character limits and line-clamp; fix buildMapOrderDescription calling undefined truncateAt. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: 이지은 <ijieun@ijieun-ui-MacBookPro.local> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
<script>
|
||||
// The exhibited artwork — always shown on the left, acting like a step indicator.
|
||||
import Vase from './Vase.svelte';
|
||||
import DescriptionCard from './DescriptionCard.svelte';
|
||||
import ComingSoonTape from './ComingSoonTape.svelte';
|
||||
import MuseumFrame from './MuseumFrame.svelte';
|
||||
import { downloadGeneratedImage } from '$lib/flowerFlow/downloadGeneratedImage.js';
|
||||
import {
|
||||
ARTWORK_SLOT_FLOWER,
|
||||
ARTWORK_SLOT_WRAPPER,
|
||||
ARTWORK_SLOT_CARD
|
||||
} from '$lib/artwork/artworkSlotLayout.js';
|
||||
|
||||
let {
|
||||
title = 'Title',
|
||||
@@ -23,6 +28,8 @@
|
||||
let downloading = $state(false);
|
||||
let downloadError = $state('');
|
||||
|
||||
const frameMode = $derived(imageSrc ? 'bouquet' : 'artwork');
|
||||
|
||||
async function handleDownload() {
|
||||
if (!downloadImage || downloading) return;
|
||||
|
||||
@@ -45,41 +52,27 @@
|
||||
<!--
|
||||
mobile: row · desktop: 꽃 슬롯 높이 고정 → 설명 카드 길이와 무관하게 Y·크기 유지
|
||||
-->
|
||||
<div
|
||||
class="mx-auto flex min-h-0 w-full max-w-100 flex-1 flex-row items-start gap-8 px-6 pt-6 pb-8 lg:flex-col lg:items-center lg:justify-start lg:gap-4 lg:px-6 lg:pt-[calc(50%-5rem)] lg:pb-12"
|
||||
>
|
||||
<div
|
||||
class="flex h-[11rem] shrink-0 items-end justify-center sm:h-[13rem] lg:h-[min(24rem,36vh)] lg:w-full"
|
||||
>
|
||||
{#if imageSrc}
|
||||
<div class="mx-auto flex w-full max-w-24 shrink-0 flex-col items-center sm:max-w-28 lg:max-w-75">
|
||||
<div class="w-full overflow-hidden">
|
||||
<img
|
||||
src={imageSrc}
|
||||
alt="Selected bouquet"
|
||||
class="aspect-[3/4] h-auto w-full object-contain object-center"
|
||||
/>
|
||||
</div>
|
||||
{#if downloadImage}
|
||||
<button
|
||||
type="button"
|
||||
disabled={downloading}
|
||||
onclick={handleDownload}
|
||||
class="mt-2 text-xs text-muted underline-offset-4 hover:text-ink hover:underline disabled:opacity-50"
|
||||
>
|
||||
{downloading ? 'Downloading...' : 'Download image'}
|
||||
</button>
|
||||
{#if downloadError}
|
||||
<p class="mt-1 text-center text-[0.65rem] text-red-600">{downloadError}</p>
|
||||
{/if}
|
||||
<div class={ARTWORK_SLOT_WRAPPER}>
|
||||
<div class={ARTWORK_SLOT_FLOWER}>
|
||||
<div class="mx-auto flex w-full flex-col items-center">
|
||||
<MuseumFrame mode={frameMode} {variant} {imageSrc} imageAlt="Selected bouquet" />
|
||||
{#if imageSrc && downloadImage}
|
||||
<button
|
||||
type="button"
|
||||
disabled={downloading}
|
||||
onclick={handleDownload}
|
||||
class="mt-2 text-xs text-muted underline-offset-4 hover:text-ink hover:underline disabled:opacity-50"
|
||||
>
|
||||
{downloading ? 'Downloading...' : 'Download image'}
|
||||
</button>
|
||||
{#if downloadError}
|
||||
<p class="mt-1 text-center text-[0.65rem] text-red-600">{downloadError}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<Vase {variant} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="min-w-0 shrink-0 lg:flex lg:w-full lg:justify-center">
|
||||
<div class={ARTWORK_SLOT_CARD}>
|
||||
<DescriptionCard {title} {description} mode={cardMode} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</h3>
|
||||
<p
|
||||
class={[
|
||||
'mt-2 text-xs',
|
||||
'mt-2 line-clamp-4 text-xs',
|
||||
mode === 'instruction' ? 'leading-snug text-muted' : 'leading-relaxed text-ink'
|
||||
]}
|
||||
>
|
||||
|
||||
94
src/lib/components/ui/Artwork/MuseumFrame.svelte
Normal file
94
src/lib/components/ui/Artwork/MuseumFrame.svelte
Normal file
@@ -0,0 +1,94 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { browser } from '$app/environment';
|
||||
import { createMuseumFrameSketch } from '$lib/artwork/drawMuseumFrame.js';
|
||||
import {
|
||||
APERTURE_HEIGHT_PCT,
|
||||
APERTURE_LEFT_PCT,
|
||||
APERTURE_TOP_PCT,
|
||||
APERTURE_WIDTH_PCT,
|
||||
ARTWORK_INNER_SCALE,
|
||||
OUTER_ASPECT_RATIO
|
||||
} from '$lib/artwork/museumFrameGeometry.js';
|
||||
import { ARTWORK_FRAME_MAX_W } from '$lib/artwork/artworkSlotLayout.js';
|
||||
import { getArtworkSrc } from './artworkVariants.js';
|
||||
|
||||
let {
|
||||
/** @type {'bouquet' | 'artwork'} */
|
||||
mode = 'artwork',
|
||||
/** @type {import('./artworkVariants.js').ArtworkVariant} */
|
||||
variant = 'create1',
|
||||
imageSrc = null,
|
||||
imageAlt = 'Selected bouquet',
|
||||
/** bouquet 로딩 플레이스홀더 */
|
||||
loading = false
|
||||
} = $props();
|
||||
|
||||
const artworkSrc = $derived(getArtworkSrc(variant));
|
||||
|
||||
/** @type {HTMLElement | null} */
|
||||
let frameHost = $state(null);
|
||||
/** @type {import('p5') | null} */
|
||||
let p5Instance = $state(null);
|
||||
|
||||
onMount(() => {
|
||||
if (!browser || !frameHost) return;
|
||||
|
||||
let cancelled = false;
|
||||
|
||||
createMuseumFrameSketch(frameHost).then((instance) => {
|
||||
if (cancelled) {
|
||||
instance.remove();
|
||||
return;
|
||||
}
|
||||
p5Instance = instance;
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
p5Instance?.remove();
|
||||
p5Instance = null;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mx-auto shrink-0 {ARTWORK_FRAME_MAX_W}">
|
||||
<div class="relative w-full" style:aspect-ratio={OUTER_ASPECT_RATIO}>
|
||||
<!-- 개구부: 꽃다발 또는 아트워크 -->
|
||||
<div
|
||||
class="absolute z-0 flex items-center justify-center overflow-hidden bg-surface"
|
||||
style:left="{APERTURE_LEFT_PCT}%"
|
||||
style:top="{APERTURE_TOP_PCT}%"
|
||||
style:width="{APERTURE_WIDTH_PCT}%"
|
||||
style:height="{APERTURE_HEIGHT_PCT}%"
|
||||
>
|
||||
{#if mode === 'bouquet'}
|
||||
{#if loading}
|
||||
<div class="h-full w-full animate-pulse bg-placeholder"></div>
|
||||
{:else if imageSrc}
|
||||
<img
|
||||
src={imageSrc}
|
||||
alt={imageAlt}
|
||||
class="h-full w-full object-cover object-center"
|
||||
draggable="false"
|
||||
/>
|
||||
{:else}
|
||||
<div class="h-full w-full bg-placeholder"></div>
|
||||
{/if}
|
||||
{:else}
|
||||
{#key variant}
|
||||
<img
|
||||
src={artworkSrc}
|
||||
alt=""
|
||||
class="h-auto max-h-full w-auto object-contain object-center"
|
||||
style:width="{ARTWORK_INNER_SCALE * 100}%"
|
||||
draggable="false"
|
||||
/>
|
||||
{/key}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- p5 액자 링 (고정, 내용과 무관) -->
|
||||
<div bind:this={frameHost} class="absolute inset-0 z-10" aria-hidden="true"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -7,10 +7,11 @@
|
||||
const src = $derived(getArtworkSrc(variant));
|
||||
</script>
|
||||
|
||||
<!-- MuseumFrame artwork 모드에서 크기·위치 제어. 단독 사용 시 fallback. -->
|
||||
<img
|
||||
{src}
|
||||
alt=""
|
||||
class="mx-auto h-auto w-full max-w-24 shrink-0 sm:max-w-28 lg:max-w-75"
|
||||
class="mx-auto h-auto w-full object-contain object-center"
|
||||
width="328"
|
||||
height="443"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user