diff --git a/src/lib/components/TranslationApproval.svelte b/src/lib/components/TranslationApproval.svelte index 8bcf56a5..9bb990e8 100644 --- a/src/lib/components/TranslationApproval.svelte +++ b/src/lib/components/TranslationApproval.svelte @@ -2,10 +2,8 @@ import { createEventDispatcher } from 'svelte'; import type { TranslatedRecipeType } from '$types/types'; import TranslationFieldComparison from './TranslationFieldComparison.svelte'; - import EditableIngredients from './EditableIngredients.svelte'; - import EditableInstructions from './EditableInstructions.svelte'; - import IngredientsPage from './IngredientsPage.svelte'; - import InstructionsPage from './InstructionsPage.svelte'; + import CreateIngredientList from './CreateIngredientList.svelte'; + import CreateStepList from './CreateStepList.svelte'; export let germanData: any; export let englishData: TranslatedRecipeType | null = null; @@ -100,21 +98,45 @@ } } - // Handle ingredients changes - function handleIngredientsChange(event: CustomEvent) { - if (editableEnglish) { - editableEnglish.ingredients = event.detail.ingredients; - editableEnglish = editableEnglish; // Trigger reactivity - } - } - - // Handle instructions changes - function handleInstructionsChange(event: CustomEvent) { - if (editableEnglish) { - editableEnglish.instructions = event.detail.instructions; - editableEnglish = editableEnglish; // Trigger reactivity - } - } + // Create add_info object for CreateStepList that references editableEnglish properties + // This allows CreateStepList to modify the values directly + $: englishAddInfo = editableEnglish ? { + get preparation() { return editableEnglish.preparation || ''; }, + set preparation(value) { editableEnglish.preparation = value; }, + fermentation: { + get bulk() { return editableEnglish.fermentation?.bulk || ''; }, + set bulk(value) { + if (!editableEnglish.fermentation) editableEnglish.fermentation = { bulk: '', final: '' }; + editableEnglish.fermentation.bulk = value; + }, + get final() { return editableEnglish.fermentation?.final || ''; }, + set final(value) { + if (!editableEnglish.fermentation) editableEnglish.fermentation = { bulk: '', final: '' }; + editableEnglish.fermentation.final = value; + }, + }, + baking: { + get length() { return editableEnglish.baking?.length || ''; }, + set length(value) { + if (!editableEnglish.baking) editableEnglish.baking = { length: '', temperature: '', mode: '' }; + editableEnglish.baking.length = value; + }, + get temperature() { return editableEnglish.baking?.temperature || ''; }, + set temperature(value) { + if (!editableEnglish.baking) editableEnglish.baking = { length: '', temperature: '', mode: '' }; + editableEnglish.baking.temperature = value; + }, + get mode() { return editableEnglish.baking?.mode || ''; }, + set mode(value) { + if (!editableEnglish.baking) editableEnglish.baking = { length: '', temperature: '', mode: '' }; + editableEnglish.baking.mode = value; + }, + }, + get total_time() { return editableEnglish.total_time || ''; }, + set total_time(value) { editableEnglish.total_time = value; }, + get cooking() { return editableEnglish.cooking || ''; }, + set cooking(value) { editableEnglish.cooking = value; }, + } : null; // Handle approval function handleApprove() { @@ -229,12 +251,31 @@ } .translation-preview { - max-width: 800px; + max-width: 1000px; margin: 1.5rem auto; } .field-section { margin-bottom: 1.5rem; + max-width: 800px; + margin-left: auto; + margin-right: auto; +} + +.list-wrapper { + margin-inline: auto; + display: flex; + flex-direction: row; + max-width: 1000px; + gap: 2rem; + justify-content: center; + margin-bottom: 2rem; +} + +@media screen and (max-width: 700px) { + .list-wrapper { + flex-direction: column; + } } .column-header { @@ -529,118 +570,19 @@ button:disabled { {/if} - {#if editableEnglish?.preparation !== undefined} -
- -
- {/if} - - {#if editableEnglish?.cooking !== undefined} -
- -
- {/if} - - {#if editableEnglish?.total_time !== undefined} -
- -
- {/if} - - {#if editableEnglish?.baking} -
-

Baking

- - - -
- {/if} - - {#if editableEnglish?.fermentation} -
-

Fermentation

- - -
- {/if} - - - {#if editableEnglish?.ingredients && editableEnglish.ingredients.length > 0} -
-

Ingredients

- -
- {/if} - - - {#if editableEnglish?.instructions && editableEnglish.instructions.length > 0} -
-

Instructions

- + + {#if editableEnglish?.ingredients || editableEnglish?.instructions} +
+
+ {#if editableEnglish?.ingredients} + + {/if} +
+
+ {#if editableEnglish?.instructions && englishAddInfo} + + {/if} +
{/if}