From cab6258ac23437a0b40c2a24cf4b72227abbe3a2 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 1 May 2023 13:58:40 +0100 Subject: [PATCH] fix(WIP): desgin review stuff --- src/lib/images/login/cloud-bg-mobile.svg | 626 +++++++++++++++++++++++ src/lib/layout/unauthenticated.svelte | 60 ++- src/routes/card/Card.svelte | 3 +- src/routes/card/[uid]/+page.svelte | 2 +- src/routes/card/[uid]/+page.ts | 23 +- src/routes/card/display.svelte | 50 +- src/routes/card/helpers.ts | 2 - src/routes/console/+layout.svelte | 1 + 8 files changed, 737 insertions(+), 30 deletions(-) create mode 100644 src/lib/images/login/cloud-bg-mobile.svg diff --git a/src/lib/images/login/cloud-bg-mobile.svg b/src/lib/images/login/cloud-bg-mobile.svg new file mode 100644 index 000000000..063ca2201 --- /dev/null +++ b/src/lib/images/login/cloud-bg-mobile.svg @@ -0,0 +1,626 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 677d2dd00..4dfb7117c 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -5,6 +5,7 @@ import Cloud1 from '$lib/images/login/cloud-1.svg'; import Cloud2 from '$lib/images/login/cloud-2.svg'; import AppwriteCloudBg from '$lib/images/login/cloud-bg.svg'; + import AppwriteCloudBgMobile from '$lib/images/login/cloud-bg-mobile.svg'; import LoginDark from '$lib/images/login/login-dark-mode.svg'; import LoginLight from '$lib/images/login/login-light-mode.svg'; import { app } from '$lib/stores/app'; @@ -143,7 +144,8 @@
+ style:--url={`url(${AppwriteCloudBg})`} + style:--url-mobile={`url(${AppwriteCloudBgMobile})`}>
@@ -163,8 +165,14 @@ {/if}
-

-
+

+ {#if isCloud} + + + {/if} + +

+
@@ -274,13 +282,13 @@ } .mobile-logo { - margin-block-start: 5rem; + margin-block-start: 3rem; margin-block-end: 0.5rem; } .mobile-beta { font-size: 0.75rem; - margin-block-end: 2rem; + margin-block-end: 6rem; > span { background: hsl(var(--color-neutral-120)); @@ -292,7 +300,32 @@ justify-content: center; } + .heading-level-2 { + .cloud-1, + .cloud-2 { + display: none; + } + } + @media (max-width: 767px) { + .heading-level-2 { + position: relative; + .cloud-1, + .cloud-2 { + display: block; + position: absolute; + } + + .cloud-1 { + left: 32px; + top: -40px; + } + + .cloud-2 { + right: 0; + top: 10px; + } + } .main-cloud { background-color: hsl(var(--color-neutral-500)); } @@ -302,8 +335,9 @@ } .is-cloud { - background: var(--url); - background-position: center -150px; + background: var(--url-mobile); + background-position: 0px calc(30px - 5vw); + background-size: 100vw; background-repeat: no-repeat; } @@ -312,4 +346,16 @@ display: none; } } + + @media (min-width: 530px) and (max-width: 767px) { + .heading-level-2 { + .cloud-1 { + display: none; + } + } + + .is-cloud { + background-position: 0px calc(30px - 15vw); + } + } diff --git a/src/routes/card/Card.svelte b/src/routes/card/Card.svelte index 1f7e18564..59c418716 100644 --- a/src/routes/card/Card.svelte +++ b/src/routes/card/Card.svelte @@ -20,6 +20,7 @@ export let active = false; export let isFlipped = false; export let userId: string; + export let frontImgBase64: string | undefined = undefined; let interacting = false; @@ -262,7 +263,7 @@
{/each}
- The front of the card + The front of the card
diff --git a/src/routes/card/[uid]/+page.svelte b/src/routes/card/[uid]/+page.svelte index e3f908620..bd7a0c4a2 100644 --- a/src/routes/card/[uid]/+page.svelte +++ b/src/routes/card/[uid]/+page.svelte @@ -4,4 +4,4 @@ export let data; - + diff --git a/src/routes/card/[uid]/+page.ts b/src/routes/card/[uid]/+page.ts index 77c11504b..03153158f 100644 --- a/src/routes/card/[uid]/+page.ts +++ b/src/routes/card/[uid]/+page.ts @@ -2,19 +2,36 @@ import { VARS } from '$lib/system.js'; import { redirect } from '@sveltejs/kit'; import { getCardImgUrls } from '../helpers.js'; -export const ssr = true; +export const ssr = false; + +function urlContentToDataUri(url) { + return fetch(url) + .then((response) => response.blob()) + .then( + (blob) => + new Promise((callback) => { + const reader = new FileReader(); + reader.onload = function () { + callback(this.result); + }; + reader.readAsDataURL(blob); + }) + ); +} export async function load({ params, url }) { const userId = params.uid; const endpoint = VARS.APPWRITE_ENDPOINT ?? `${url.origin}/v1`; - const { frontImg } = getCardImgUrls(userId, endpoint); + const { frontImg, backImg } = getCardImgUrls(userId, endpoint); const res = await fetch(frontImg); + if (!res.ok) { throw redirect(303, '/'); } return { - userId: params.uid + userId: params.uid, + frontBase64: await urlContentToDataUri(frontImg) }; } diff --git a/src/routes/card/display.svelte b/src/routes/card/display.svelte index d16cc4bd9..dcc27eedc 100644 --- a/src/routes/card/display.svelte +++ b/src/routes/card/display.svelte @@ -14,6 +14,7 @@ export let userId: string; export let variant: 'owner' | 'external'; + export let frontImgBase64: string | undefined = undefined; let triggerConfettiKey = 1; const confettiColors = [ @@ -37,7 +38,7 @@ typeof window !== 'undefined' ? `${window.location.origin}/card/${userId}` : ''; $: embedCode = [ ``, - `\tAppwrite Cloud Card`, + `\tAppwrite Cloud Card`, `` ].join('\n'); $: twitterText = encodeURIComponent( @@ -47,8 +48,7 @@ function copyShareableLink() { copy(shareableLink); addNotification({ - title: 'Link copied', - message: 'Share your card with everyone you know!', + message: 'The link has been copied', type: 'success' }); } @@ -56,8 +56,7 @@ function copyEmbedCode() { copy(embedCode); addNotification({ - title: 'Embed code copied', - message: 'Paste this code to embed your card!', + message: 'Embed code has been copied', type: 'success' }); showEmbedCode = false; @@ -132,12 +131,12 @@ {#if variant === 'external'} Claim your card {/if}
- The front of the card + The front of the card
@@ -184,7 +185,11 @@
{/if} {#if browser} - + {/if}
{#if cardActive} @@ -400,9 +405,9 @@ gap: 0.5rem; position: absolute; - top: 75%; + bottom: 5vh; left: 50%; - translate: -50% -50%; + translate: -50%; transition: opacity 250ms ease; @@ -427,7 +432,24 @@ opacity: 0.5; } + .external-btn-top { + display: none; + } + @media (max-width: 1024px) { + .external-btn-top { + display: flex; + } + + .external-btn-bottom { + display: none !important; + } + + .embed-btn { + order: 2; + border: none !important; + } + .wrapper { display: block; padding-block: 2rem; @@ -491,7 +513,7 @@ flex-wrap: wrap; justify-content: center; - .buttons-list-item { + .buttons-list-item:last-child { border: none !important; } } @@ -509,10 +531,6 @@ } } - .confetti-btn { - display: none; - } - .cbc-wrapper { display: none; } diff --git a/src/routes/card/helpers.ts b/src/routes/card/helpers.ts index aa5904ee1..e59c305f9 100644 --- a/src/routes/card/helpers.ts +++ b/src/routes/card/helpers.ts @@ -1,5 +1,3 @@ -import { VARS } from '$lib/system'; - export function getCardImgUrls(userId: string, endpoint: string) { const resolved = endpoint; diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index c8d8ff27c..07b547369 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -22,6 +22,7 @@ // Check if user already viewed cloud card if (isCloud) { const viewed = localStorage.getItem('cloud-card-viewed'); + console.log('viewed', viewed); if (!viewed) { localStorage.setItem('cloud-card-viewed', 'true'); goto('/card');