refactor(api): review-row-Erstellung extrahieren + QW-Fixes
- makeInitialReviewRows() in lib/reviews.ts: eliminiert 45 Zeilen Duplikat aus cards.ts, decks-generate.ts und tools.ts - /distractors: Query-Param cardId → card_id (snake_case-Konsistenz) - cards/new: Image-Occlusion-Preview zeigt hochgeladenes Bild statt statischen Platzhalter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a883ba87b6
commit
b182bac2fb
7 changed files with 64 additions and 67 deletions
|
|
@ -34,7 +34,7 @@ export function fetchDistractors(
|
|||
opts: { cardId?: string; count?: number; field?: string } = {},
|
||||
) {
|
||||
const params = new URLSearchParams();
|
||||
if (opts.cardId) params.set('cardId', opts.cardId);
|
||||
if (opts.cardId) params.set('card_id', opts.cardId);
|
||||
if (opts.count) params.set('count', String(opts.count));
|
||||
if (opts.field) params.set('field', opts.field);
|
||||
const qs = params.size ? `?${params}` : '';
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
} from '@cards/domain';
|
||||
import { createCard } from '$lib/api/cards.ts';
|
||||
import { listDecks, getDeck } from '$lib/api/decks.ts';
|
||||
import { API_BASE } from '$lib/api/client.ts';
|
||||
import { devUser } from '$lib/auth/dev-stub.svelte.ts';
|
||||
import { renderMarkdown } from '$lib/markdown.ts';
|
||||
import { toasts } from '$lib/stores/toasts.svelte.ts';
|
||||
|
|
@ -360,14 +361,22 @@
|
|||
{#snippet children()}
|
||||
<div class="preview-inner">
|
||||
{#if cardType === 'image-occlusion'}
|
||||
<div class="preview-placeholder">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<circle cx="8.5" cy="8.5" r="1.5" />
|
||||
<path d="m21 15-5-5L5 21" />
|
||||
</svg>
|
||||
<span>Bildvorschau nicht verfügbar</span>
|
||||
</div>
|
||||
{#if imageRef}
|
||||
<img
|
||||
src="{API_BASE}/api/v1/media/{imageRef}"
|
||||
alt="Occlusion-Bild"
|
||||
class="preview-occlusion-img"
|
||||
/>
|
||||
{:else}
|
||||
<div class="preview-placeholder">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<circle cx="8.5" cy="8.5" r="1.5" />
|
||||
<path d="m21 15-5-5L5 21" />
|
||||
</svg>
|
||||
<span>Noch kein Bild gewählt</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{:else if cardType === 'audio-front'}
|
||||
<div class="preview-audio">
|
||||
|
|
@ -990,4 +999,11 @@
|
|||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview-occlusion-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue