diff options
Diffstat (limited to 'src/routes/+page.svelte')
| -rw-r--r-- | src/routes/+page.svelte | 103 |
1 files changed, 54 insertions, 49 deletions
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 0aaf887d..9d2ba213 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -12,11 +12,11 @@ import { t } from '$lib/translations'; import { close } from '$lib/socket'; - import { onMount } from 'svelte'; + import { onDestroy, onMount } from 'svelte'; export let data; - let { locations, user } = data; - let update = (data) => ({ locations, user } = data); + let { faqs, locations, user } = data; + let update = (data) => ({ faqs, locations, user } = data); $: update(data); let howItWorks; @@ -24,7 +24,6 @@ let about; let log = console.log; - let faqs = {}; const howItWorksSteps = [ { image: 'hand', stepID: 'step1' }, @@ -32,9 +31,9 @@ { image: 'smile', stepID: 'step3' } ]; - onMount(async () => { - faqs = (await import('../locales/en.json')).default.faq; + let loaded; + onMount(async () => { close(); try { @@ -42,62 +41,68 @@ } catch (e) { console.log(e); } + + loaded = true; }); + + onDestroy(() => (loaded = false)); </script> <svelte:head> <script src="https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js"></script> </svelte:head> -<LandingHeader {howItWorks} {faq} {about} {user} /> - -<main class="space-y-40 py-20 md:py-32 lg:py-36 xl:py-40 px-5 md:px-0"> - <LandingHero {user} /> - <LandingInfoCard - image="lightning-qr" - title={$t('landing.info1.title')} - description={$t('landing.info1.description')} - /> +{#if loaded} + <LandingHeader {howItWorks} {faq} {about} {user} /> - <LandingInfoCard image="phone-checkout" title={$t('landing.info2.title')} order="reverse"> - {$t('landing.info2.description1')} - <br /><br /> - {$t('landing.info2.description2')} - <br /><br /> - {@html $t('landing.info2.description3')} - </LandingInfoCard> - - <div> + <main class="space-y-40 py-20 md:py-32 lg:py-36 xl:py-40 px-5 md:px-0"> + <LandingHero {user} /> <LandingInfoCard - image="customize" - title={$t('landing.info3.title')} - description={$t('landing.info3.description')} + image="lightning-qr" + title={$t('landing.info1.title')} + description={$t('landing.info1.description')} /> - <div bind:this={howItWorks} /> - <div id="about" /> - </div> - <div> - <h3 class="text-5xl font-medium mb-10 text-center">{$t('howItWorks.header')}</h3> - <div class="grid lg:grid-cols-3 space-y-10 lg:space-y-0 text-center"> - {#each howItWorksSteps as step} - <HowItWorksCard image={step.image} stepID={step.stepID} /> - {/each} + <LandingInfoCard image="phone-checkout" title={$t('landing.info2.title')} order="reverse"> + {$t('landing.info2.description1')} + <br /><br /> + {$t('landing.info2.description2')} + <br /><br /> + {@html $t('landing.info2.description3')} + </LandingInfoCard> + + <div> + <LandingInfoCard + image="customize" + title={$t('landing.info3.title')} + description={$t('landing.info3.description')} + /> + <div bind:this={howItWorks} /> + <div id="about" /> + </div> + + <div> + <h3 class="text-5xl font-medium mb-10 text-center">{$t('howItWorks.header')}</h3> + <div class="grid lg:grid-cols-3 space-y-10 lg:space-y-0 text-center"> + {#each howItWorksSteps as step} + <HowItWorksCard image={step.image} stepID={step.stepID} /> + {/each} + </div> + <div bind:this={faq} /> </div> - <div bind:this={faq} /> - </div> - <div> - <div class="space-y-10"> - <h3 class="text-5xl font-medium text-center pt-40 -mt-40" id="faq">{$t('faq.header')}</h3> - {#each Object.keys(faqs).filter((f) => f !== 'header') as faqID} - <FaqCard questionID={faqID} /> - {/each} + <div> + <div class="space-y-10"> + <h3 class="text-5xl font-medium text-center pt-40 -mt-40" id="faq">{$t('faq.header')}</h3> + {#each faqs as f} + <FaqCard questionID={f} /> + {/each} + </div> + <div bind:this={about} /> </div> - <div bind:this={about} /> - </div> - <About {locations} /> -</main> + <About {locations} /> + </main> -<Footer /> + <Footer /> +{/if} |
