From bddea5196f0d55c54243f27de045a65361271893 Mon Sep 17 00:00:00 2001 From: Oskar Rough Date: Sun, 21 Apr 2024 14:54:45 +0200 Subject: [PATCH] Rework migration UI --- src/components/site/nav.js | 2 +- src/pages/account/index.js | 4 +- src/pages/auth/login.js | 1 + src/pages/create/channel/import.js | 138 +++++++++++++++++------------ src/styles/defaults.css | 3 + src/styles/layout-themes.css | 5 +- src/styles/variables.css | 2 +- 7 files changed, 94 insertions(+), 61 deletions(-) diff --git a/src/components/site/nav.js b/src/components/site/nav.js index 0a7bb9c..a8fcf09 100644 --- a/src/components/site/nav.js +++ b/src/components/site/nav.js @@ -31,7 +31,7 @@ export default function Nav(props) { {/* {!session && Login} */} {session && ( <> - Account + {/* Account */} {/* Channels */} {userChannels?.length ? ( <> diff --git a/src/pages/account/index.js b/src/pages/account/index.js index 9b23809..ee920fa 100644 --- a/src/pages/account/index.js +++ b/src/pages/account/index.js @@ -10,9 +10,9 @@ export default function Account({dbSession: {database, session, userChannel}}) {
{session?.user?.email}

-

+ {/*

Change password -

+

*/}

Log out

diff --git a/src/pages/auth/login.js b/src/pages/auth/login.js index 7d7a6d4..69dc22e 100644 --- a/src/pages/auth/login.js +++ b/src/pages/auth/login.js @@ -36,6 +36,7 @@ export default function PageLogin(props) { {/*
*/} +

Don't have one yet? Create one on beta.radio4000.com

) : ( <> diff --git a/src/pages/create/channel/import.js b/src/pages/create/channel/import.js index ae9b3bd..65f94a5 100644 --- a/src/pages/create/channel/import.js +++ b/src/pages/create/channel/import.js @@ -39,7 +39,13 @@ export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, sessi const data = await res.json() setMigrationResult(data) - console.log(res.ok, res.status, res.statusText, 'api/import/firebase-realtime response data', data) + console.log( + res.ok, + res.status, + res.statusText, + 'api/import/firebase-realtime response data', + data, + ) if (!res.ok) throw Error(data.message) if (Object.keys(data).length === 0) throw Error('Empty response from migration backend') } catch (error) { @@ -58,78 +64,98 @@ export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, sessi loginMessage = `to import a radio channel from the previous system` } - if (!session) { - return ( - <> -

This tool will help you migrate your old Radio4000 channel to the new system.

-

You will need two accounts: one from the old Radio4000, one from the new. The old could be using Email, Facebook or Google to sign in. The new will always be email.

-

- First, sign in to your NEW Radio4000 account -

- - ) - } + console.log(sessionFirebase?.email, session?.user?.email) - if (!sessionFirebase && !migrationResult) - return ( - <> -

- Now, sign in to your OLD account: -

- - - ) + if (!sessionFirebase) { + return

Loading

+ } return ( <> +

This tool will help you migrate your old Radio4000 channel to the new system.

- ✔ Access to new account: {session.user.email} -
✔ Access to old account: {sessionFirebase.email} + You will need an account for each. You can not use your old Radio4000 account to sign in to + the new.

- {sessionFirebase && !userChannelFirebase && ( -

- This old Radio4000 account has no channel to migrate. -
- You can and forget - about this account. -

- )} + {/* LOGIN STUFF */} - {!migrationResult && userChannelFirebase && ( -
+

Old account

+ {sessionFirebase?.email ? ( + <>

- Ready to import the channel @{userChannelFirebase.slug} into the new Radio4000 system. -

-

- -

- -
+

+ + ) : ( + )} - {migrationResult && !error ? ( +

New account

+ {sessionFirebase?.email && !session?.user?.email ? ( +

+ Sign in to your NEW Radio4000 account +

+ ) : ( <> -

Successfully imported @{userChannelFirebase.slug}!

-

Go to the new Radio4000. Your channel is waiting for you.

-

beta.radio4000.com/{userChannelFirebase.slug}

+

+ {' '} + ✔ {session.user.email} Log out +

- ) : ( - )} - {userChannelFirebase && !session && ( -
- You'll have to - -
+ {/* MIGRATE STUFF */} + + {sessionFirebase?.email && session?.user?.email && ( + <> + {!migrationResult && !userChannelFirebase ? ( +

+ This old Radio4000 account has no channel to migrate. +
+ You can and forget + about this account. +

+ ) : ( +
+

+ Ready to import the radio channel @{userChannelFirebase.slug} into + the new Radio4000 system. +

+

+ +

+
+ )} + + {migrationResult && !error ? ( + <> +

Successfully imported @{userChannelFirebase.slug}!

+

Go to the new Radio4000. Your channel is waiting for you.

+

+ + beta.radio4000.com/{userChannelFirebase.slug} + +

+ + ) : ( + + )} + )} + + {/* {session?.user?.email ?

Has supabase

:

needs supabase

} */} ) } diff --git a/src/styles/defaults.css b/src/styles/defaults.css index 0d4e75b..ccddf8f 100644 --- a/src/styles/defaults.css +++ b/src/styles/defaults.css @@ -134,6 +134,9 @@ button[disabled] { .ButtonReset { all: unset; } +.underline { + text-decoration: underline; +} /* Shared styles between buttons and some text inputs */ button, diff --git a/src/styles/layout-themes.css b/src/styles/layout-themes.css index 1a28631..a201ac8 100644 --- a/src/styles/layout-themes.css +++ b/src/styles/layout-themes.css @@ -14,6 +14,10 @@ --text-color: hsl(180deg 7% 90%); --link-color: var(--text-color); /* --lightgray: hsl(0, 0%, 14%); */ + + menu a[aria-current="page"] { + color: white; + } } /* Layout padding/margin behavior */ @@ -78,4 +82,3 @@ html, border-top: 1px solid var(--darkgray); background: var(--bg-color); } - diff --git a/src/styles/variables.css b/src/styles/variables.css index d84e634..d03989b 100644 --- a/src/styles/variables.css +++ b/src/styles/variables.css @@ -7,7 +7,7 @@ --black: hsl(255, 6%, 12%); --green: hsl(130, 52%, 24%); - --orange: orange; + --orange: var(--purple); --purple: #5e1ae6; --red: hsl(0, 100%, 40%);