From 25f214612eb9b1f32768e5798621b9597e24c35a Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Mon, 7 Aug 2023 09:05:51 +0200 Subject: [PATCH] Refactor next part, updated Form to the new Composer --- src/lib/components/{Login => }/Login.svelte | 0 src/lib/components/Recipies/LearnColor.svelte | 27 --- src/lib/components/Recipies/LearnReady.svelte | 19 -- .../Recipies/machines/formMachine.ts | 35 ---- src/lib/components/Recipies/oForm.svelte | 185 ------------------ src/lib/components/Recipies/oRecipe.svelte | 102 ---------- src/lib/components/examples/Recipies.svelte | 2 +- .../components/refactor/ComposerCharly.svelte | 12 +- .../components/refactor/ComposerForm.svelte | 163 +++++++++++++++ .../components/refactor/ComposerWrap.svelte | 46 ++++- src/lib/core/refactor/Composer.svelte | 2 - src/lib/core/refactor/coreServices.ts | 1 - src/lib/core/refactor/queryLoader.ts | 4 +- src/routes/dashboard/+page.svelte | 6 - src/routes/form/+page.svelte | 39 ---- src/routes/helloearth/+page.svelte | 52 ----- 16 files changed, 211 insertions(+), 484 deletions(-) rename src/lib/components/{Login => }/Login.svelte (100%) delete mode 100644 src/lib/components/Recipies/LearnColor.svelte delete mode 100644 src/lib/components/Recipies/LearnReady.svelte delete mode 100644 src/lib/components/Recipies/machines/formMachine.ts delete mode 100644 src/lib/components/Recipies/oForm.svelte delete mode 100644 src/lib/components/Recipies/oRecipe.svelte create mode 100644 src/lib/components/refactor/ComposerForm.svelte delete mode 100644 src/routes/dashboard/+page.svelte delete mode 100644 src/routes/form/+page.svelte delete mode 100644 src/routes/helloearth/+page.svelte diff --git a/src/lib/components/Login/Login.svelte b/src/lib/components/Login.svelte similarity index 100% rename from src/lib/components/Login/Login.svelte rename to src/lib/components/Login.svelte diff --git a/src/lib/components/Recipies/LearnColor.svelte b/src/lib/components/Recipies/LearnColor.svelte deleted file mode 100644 index ca447b8..0000000 --- a/src/lib/components/Recipies/LearnColor.svelte +++ /dev/null @@ -1,27 +0,0 @@ - - -
- I am the parent, this is my state: {$store.machine.state} -
-
diff --git a/src/lib/components/Recipies/LearnReady.svelte b/src/lib/components/Recipies/LearnReady.svelte deleted file mode 100644 index 3d6d860..0000000 --- a/src/lib/components/Recipies/LearnReady.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - -
- i am the child and this is my state: {$store.machine.state} - -
diff --git a/src/lib/components/Recipies/machines/formMachine.ts b/src/lib/components/Recipies/machines/formMachine.ts deleted file mode 100644 index 9a47887..0000000 --- a/src/lib/components/Recipies/machines/formMachine.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { createMachine } from 'xstate'; - -export const formMachine = createMachine( - { - id: 'validation', - initial: 'notValidated', - context: { - isValidated: false - }, - states: { - notValidated: { - on: { - VALIDATE: { - target: 'isValidated', - actions: 'setValidated' - } - } - }, - isValidated: { - on: { - INVALIDATE: { - target: 'notValidated', - actions: 'setNotValidated' - } - } - } - } - }, - { - actions: { - setValidated: (context) => (context.isValidated = true), - setNotValidated: (context) => (context.isValidated = false) - } - } -); \ No newline at end of file diff --git a/src/lib/components/Recipies/oForm.svelte b/src/lib/components/Recipies/oForm.svelte deleted file mode 100644 index b2056c7..0000000 --- a/src/lib/components/Recipies/oForm.svelte +++ /dev/null @@ -1,185 +0,0 @@ - - -{#if isStoreLoaded} -
- {#if $successMessage} - - {:else} -
- {#each fields as field} -
- {#if $errors[field]} - {$errors[field]} - {:else} - - {/if} - - {#if field === 'about'} -