diff --git a/jam-ui/README.md b/jam-ui/README.md index 9ca2e5d0f..4906f3b5f 100644 --- a/jam-ui/README.md +++ b/jam-ui/README.md @@ -38,3 +38,19 @@ npm run start This will open it in a borwser window at http://beta.jamkazam.local:3000. Of course for it to work you also need Rails (web) app and websocket app (websocket-gateway) running. +## Working with JamTracks + +if you have the latest from develop, you can go: +``` +cd cicd +npm install +./export_personal_jamtracks.sh +./generate.js +open http://beta.jamkazam.local:4000/backing-tracks/ac-dc/back-in-black.html +``` + +You can also do none of the above, and go straight to: +http://beta.jamkazam.local:4000/public/backing-tracks/ac-dc/back-in-black + +I tried to make it so the SPA has 'secret routes' to these pages, which is convenient for us dev & testing +but also tried to make it convenient to run the cicd approach of actually generating separate pages for each landing page (which is what those 5 steps cover) diff --git a/jam-ui/src/components/auth/JKRegistrationForm.js b/jam-ui/src/components/auth/JKRegistrationForm.js index 03ac4f577..1a85c1272 100644 --- a/jam-ui/src/components/auth/JKRegistrationForm.js +++ b/jam-ui/src/components/auth/JKRegistrationForm.js @@ -64,12 +64,18 @@ const JKRegistrationForm = ({ hasLabel, jamTrack, jamTrackArtistName }) => { } } + console.log('currentUser', currentUser); + console.log('jamTrack', jamTrack); + console.log('jamTrackArtistName', jamTrackArtistName); if (currentUser) { if(jamTrack){ + console.log('adding jamtrack to cart'); addJamTrackToCart(); }else if(jamTrackArtistName){ + console.log('redirecting to jamtracks artist landing'); history.push(`/jamtracks?artist=${jamTrackArtistName}`); }else{ + console.log('redirecting to downloads'); history.push('/public/downloads'); } } diff --git a/jam-ui/src/components/auth/basic/JKRegistration.js b/jam-ui/src/components/auth/basic/JKRegistration.js index a54e03a8c..d4d5162b6 100644 --- a/jam-ui/src/components/auth/basic/JKRegistration.js +++ b/jam-ui/src/components/auth/basic/JKRegistration.js @@ -33,7 +33,9 @@ const Registration = () => { try { const response = await getJamTrackBySlug({ slug }); const jamTrack = await response.json(); + console.log('jamTrack', jamTrack); setJamTrack(jamTrack); + setJamTrackArtistName(jamTrack.original_artist); setLoading(false); } catch (error) { console.error(error); diff --git a/jam-ui/src/components/jamtracks/JKJamTracksLandingBody.js b/jam-ui/src/components/jamtracks/JKJamTracksLandingBody.js index 01f4e679e..3e9f68a0a 100644 --- a/jam-ui/src/components/jamtracks/JKJamTracksLandingBody.js +++ b/jam-ui/src/components/jamtracks/JKJamTracksLandingBody.js @@ -23,7 +23,7 @@ const awesome9 = '/img/landing/jamtracks/Top 10 Image - Number 9.webp'; const BodyComponent = ({ id = "1", plan_code = "jamtrack-acdc-backinblack", - slug = "ac-dc-back-in-black", + slug = "acdc-back-in-black", artist = "AC/DC (defaulted)", song = "Back in Black (defaulted)", provided_jam_track = null diff --git a/jam-ui/src/components/navbar/JKProfileDropdown.js b/jam-ui/src/components/navbar/JKProfileDropdown.js index e2cc4d753..3e417e0dd 100644 --- a/jam-ui/src/components/navbar/JKProfileDropdown.js +++ b/jam-ui/src/components/navbar/JKProfileDropdown.js @@ -23,12 +23,24 @@ const ProfileDropdown = () => { const handleLogout = async event => { event.preventDefault(); + const cookieDomain = `.${process.env.REACT_APP_ORIGIN}`; + console.log('handleLogout: cookie: ', cookieDomain); removeCookie('remember_token', { - domain: `.${process.env.REACT_APP_ORIGIN}` + domain: cookieDomain, + path: '/' }); setCurrentUser(null); + // This will cause the server to remove the cookie TOO (overkill), + // but this code has a side effect because something, somewhere, + // client-side history pushes to /auth/login because of this function. + // ... await logout(); + // But I don't want to count on that side effect (defensive against future changes), so I force a page location hit here window.location.href = "/auth/login"; + // And here's the final bit; force a full page refresh ANYWAY. + // This is the only way we seem to really clear + // 'login state' cleanly at this point + window.location.reload(); }; return ( diff --git a/web/app/views/jam_tracks/show.rabl b/web/app/views/jam_tracks/show.rabl index 00d64f8a1..c2fb8aabd 100644 --- a/web/app/views/jam_tracks/show.rabl +++ b/web/app/views/jam_tracks/show.rabl @@ -1,3 +1,3 @@ object @jam_track -attributes :id, :name \ No newline at end of file +attributes :id, :name, :original_artist \ No newline at end of file