feat: migrate recipe editor

- using eventbus in recipe editor
- migrate to logging instead of console log
- fix case swap not saved, value not update after change, topping slot bug

Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
pakintada@gmail.com 2026-06-19 17:27:28 +07:00
parent 270faf6b34
commit f0619c5a10
65 changed files with 1600 additions and 557 deletions

View file

@ -1,4 +1,5 @@
<script lang="ts">
<script lang="ts">import { logger } from '$lib/core/utils/logger';
import { onMount } from 'svelte';
import Button from '$lib/components/ui/button/button.svelte';
import { Input } from '$lib/components/ui/input';
@ -220,7 +221,7 @@
addNotification(`INFO:Recipe loaded from ${recipePath}`);
return;
} catch (error) {
console.error('failed to parse recipe json', recipePath, error);
logger.error('failed to parse recipe json', recipePath, error);
addNotification(`ERR:Invalid recipe JSON from ${recipePath}`);
}
}
@ -348,7 +349,7 @@
if (materialIndex < 0) setNextAvailableId();
showMaterialForm = false;
} catch (error: any) {
console.error('failed to save material', error);
logger.error('failed to save material', error);
addNotification(`ERR:Failed to save material: ${error?.message ?? error}`);
} finally {
saving = false;
@ -427,7 +428,7 @@
deleteConfirmOpen = false;
pendingDeleteMaterial = null;
} catch (error: any) {
console.error('failed to delete material', error);
logger.error('failed to delete material', error);
addNotification(`ERR:Failed to delete material: ${error?.message ?? error}`);
} finally {
saving = false;