diff --git a/src/lib/components/Recipies/feedback.md b/src/lib/components/Recipies/feedback.md new file mode 100644 index 0000000..e69de29 diff --git a/src/lib/components/Recipies/machines/authMachine.ts b/src/lib/components/Recipies/machines/authMachine.ts new file mode 100644 index 0000000..ab95a35 --- /dev/null +++ b/src/lib/components/Recipies/machines/authMachine.ts @@ -0,0 +1,88 @@ +// src/lib/components/Recipies/machines/authMachine.ts +import { createMachine } from 'xstate'; + +export const authMachine = createMachine( + { + id: 'auth', + initial: 'notAuthenticated', + states: { + notAuthenticated: { + meta: { + title: 'Welcome!', + buttons: [ + { + type: 'START', + label: 'Login', + disabled: false + } + ] + }, + on: { + START: { + target: 'signIn', + actions: 'startSignIn' + } + } + }, + signIn: { + meta: { + title: 'Sign In', + composite: { + id: 'signInForm', + component: 'oForm' + }, + buttons: [ + { + type: 'BACK', + label: 'Back', + disabled: true + }, + { + type: 'NEXT', + label: 'Authenticate', + disabled: false + } + ] + }, + on: { + BACK: 'notAuthenticated', + NEXT: { + target: 'authenticated', + actions: 'authenticate' + } + } + }, + authenticated: { + meta: { + title: 'Authenticated', + buttons: [ + { + type: 'LOGOUT', + label: 'Logout', + disabled: false + } + ] + }, + on: { + LOGOUT: { + target: 'notAuthenticated', + actions: 'logout' + } + } + } + } + }, + { + actions: { + startSignIn: (context, event) => { + console.log('Starting sign in process...'); + }, + authenticate: (context, event) => { + console.log('Authenticating...'); + }, + logout: (context, event) => { + console.log('Logging out...'); + } + } + } +) \ No newline at end of file diff --git a/src/lib/components/Recipies/oForm.svelte b/src/lib/components/Recipies/oForm.svelte new file mode 100644 index 0000000..0e14700 --- /dev/null +++ b/src/lib/components/Recipies/oForm.svelte @@ -0,0 +1,168 @@ + + +{#if isStoreLoaded} +
+ {#if $successMessage} + + {:else} +
+ {#each fields as field} +
+ {#if $errors[field]} + {$errors[field]} + {:else} + + {/if} + + {#if field === 'about'} +