diff --git a/.env.example b/.env.example index 6cbc4c8..471c7af 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ # supabase config -REACT_APP_SUPABASE_URL=https://my-project.supabase.co -REACT_APP_SUPABASE_ANON_KEY=abcdefghijklmnopqrstuvwxyz +REACT_APP_SUPABASE_URL=https://oupgudlkspsmzkmeovlh.supabase.co +REACT_APP_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im91cGd1ZGxrc3BzbXprbWVvdmxoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTM0NTIwNzQsImV4cCI6MjAyOTAyODA3NH0.KAbKFBChJHtxTmOZM2pdeppIyNbcnQkEgSi6RA7OQdo + # radi4000 api REACT_APP_RADIO4000_API_URL=https://api.radio4000.com diff --git a/src/components/site/nav.js b/src/components/site/nav.js index a8fcf09..24370d5 100644 --- a/src/components/site/nav.js +++ b/src/components/site/nav.js @@ -4,8 +4,6 @@ import {DbSessionContext} from 'contexts/db-session' import CommandMenu from 'components/site/command-menu' import createCommands from 'utils/commands' -const {RADIO4000_APP_NAME_MINI} = config - export default function Nav(props) { const navigate = useNavigate() @@ -27,7 +25,7 @@ export default function Nav(props) {
  • - {RADIO4000_APP_NAME_MINI} Migration Tool + Radio4000 migration (v1 → v2) {/* {!session && Login} */} {session && ( <> diff --git a/src/index.css b/src/index.css index 0dab685..d1ed1ce 100644 --- a/src/index.css +++ b/src/index.css @@ -12,6 +12,3 @@ @import url("./styles/command-menu.css"); @import url("./styles/tracks.css"); @import url("./styles/tags.css"); - -/* plugin overwrites */ -@import url("./styles/firebaseui.css"); diff --git a/src/pages/auth/login.js b/src/pages/auth/login.js index 69dc22e..237d0df 100644 --- a/src/pages/auth/login.js +++ b/src/pages/auth/login.js @@ -34,16 +34,17 @@ export default function PageLogin(props) { {/* Log in to Radio4000 */} {/* */} {/*
    */} - - -

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

    + + {/* */} +

    Migration of a v1 radio4000 channel, requires a v2 user account.

    +

    If you don't have one yet,create it then come back here

    - ) : ( + ) : ( <>

    You are logged in.

    - - ) + + ) } function LoginInfo({onResetPassword}) { diff --git a/src/pages/auth/logout.js b/src/pages/auth/logout.js index f9e3b86..6dc696a 100644 --- a/src/pages/auth/logout.js +++ b/src/pages/auth/logout.js @@ -8,7 +8,7 @@ export default function PageLogout({ useEffect(() => { if (session) { signOut().finally(() => { - navigate('/login', { replace: true }) + navigate('/', { replace: true }) }) } navigate('/login', { replace: true }) diff --git a/src/pages/create/channel/import.js b/src/pages/create/channel/import.js index dbf96b4..b72f3de 100644 --- a/src/pages/create/channel/import.js +++ b/src/pages/create/channel/import.js @@ -1,6 +1,7 @@ import React, {useState} from 'react' import {Link} from 'react-router-dom' import FirebaseAuth from 'components/firebase-ui/auth' +import AuthForm from 'components/auth-form' import ErrorDisplay from 'components/error-display' // import LoginRequired from 'components/login-required' @@ -11,7 +12,7 @@ import useUserChannelFirebase from 'hooks/use-user-channel-firebase' // This is not how to do it (?), but we can delay figuring it out until we need Firebase in a second place. startFirebase() -export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, session}}) { +export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, session, signIn}}) { const [loading, setLoading] = useState(false) const [error, setError] = useState(false) const [migrationResult, setMigrationResult] = useState(false) @@ -22,6 +23,18 @@ export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, sessi const tokenSupabase = session?.access_token const tokenFirebase = sessionFirebase?.accessToken + const handleSignIn = async (data) => { + let res + try { + res = await signIn(data) + if (!res.error) { + } + } catch (error) { + console.log('Error login-in', error) + } + return res + } + const startMigration = async () => { setLoading(true) try { @@ -64,40 +77,54 @@ export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, sessi return ( <> -

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

    -

    - You will need an account for each. You can not use your old Radio4000 account to sign in to - the new. -

    - - {/* LOGIN STUFF */} - -

    Old account

    - {sessionFirebase?.email ? ( -

    - ✔ {sessionFirebase.email}{' '} - -

    - ) : ( - - )} - -

    New account

    - {session?.user?.email ? ( -

    - ✔ {session?.user.email} Log out -

    - ) : ( -

    - Sign in to your NEW Radio4000 account -

    - )} - - {/* MIGRATE STUFF */} - {sessionFirebase?.email && session?.user?.email && ( - <> +

    Radio channel migration from v1.radio4000.com to v2.radio4000.com

    +
      +
    1. + Requires 2 existing accounts: a v1 and a v2 account +
    2. +
    3. + Log in v1 and v2 accounts +
    4. +
    5. + Click "import", wait a few seconds, visit your new radio page! +
    6. +
    7. + After migration, log out the 2 account here, and optionally delete your v1 account. +
    8. +
    + + {/* LOGIN STUFF */} + + + +

    Login v1 account

    + {sessionFirebase?.email ? ( +

    + ✔ {sessionFirebase.email}{' '} + +

    + ) : ( + + )} +
    + + +

    Login v2 account

    + {session?.user?.email ? ( +

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

    + ) : ( + + )} +
    + + + {/* MIGRATE STUFF */} + {sessionFirebase?.email && session?.user?.email ? ( + <> {!migrationResult && !userChannelFirebase ? (

    This old Radio4000 account has no channel to migrate. @@ -108,9 +135,11 @@ export default function PageNewChannelImport({dbSession: {radio4000ApiUrl, sessi ) : (

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

    +

    + Import channel @{userChannelFirebase.slug} into radio4000 v2. +