open-sauced / landing-page

This is the new landing page for open sauced
https://opensauced.pizza
33 stars 30 forks source link

Bug: no "Log in" button #135

Open LauraLangdon opened 1 year ago

LauraLangdon commented 1 year ago

Describe the bug

When an existing user navigates to https://opensauced.pizza, they can only log in by clicking "Connect with GitHub", which appears to restart the signup process.

Steps to reproduce

  1. Go to https://opensauced.pizza
  2. In the upper right corner of the page, there's a "Connect with GitHub" button, but no "Log in" button

Browsers

Chrome, Firefox, Safari, Other (add additional context)

Additional context (Is this in dev or production?)

Arc browser

Code of Conduct

Contributing Docs

bdougie commented 1 year ago

I think we can add a drop down that includes log in for folks. https://posthog.com has something like this.

Screen Shot 2023-08-02 at 7 19 04 AM

Solution

  1. Check for the opensauced auth cookie, similar to how the AI extension does - https://github.com/open-sauced/ai/blob/beta/src/utils/checkAuthentication.ts
  2. Show connect with github or Login based on the existence of the cookie.
dev-phantom commented 1 year ago

I think we can add a drop down that includes log in for folks. https://posthog.com has something like this.

Screen Shot 2023-08-02 at 7 19 04 AM

Solution

  1. Check for the opensauced auth cookie, similar to how the AI extension does - https://github.com/open-sauced/ai/blob/beta/src/utils/checkAuthentication.ts
  2. Show connect with github or Login based on the existence of the cookie.

One way this could be achieved is by storing the providerToken from the useSupabaseAuth() hook in the insight repository to local storage or a cookie. This would make it accessible globally, allowing it to be fetched from the landing page.

Upon the user's arrival on the site, we would then check for the availability of the providerToken. Here's the code to accomplish this: // Check if providerToken is available in local storage if (localStorage.getItem('providerToken')) { // The providerToken is available console.log('Provider token is available in local storage.'); } else { // The providerToken is not available console.log('Provider token is not available in local storage.'); } Depending on whether the providerToken is available or not, the button text would change accordingly:

If the providerToken is available, the button will display Sign In. If the providerToken is not available, the button will display Connect with GitHub.

a0m0rajab commented 1 year ago

for this we can go to simpler solution and use conditional rendering, where we redirect the person to a page in insights:

and we will change the copy to "Use The App",

I think this might have a simpler approach and less complex.

dev-phantom commented 1 year ago

for this we can go to simpler solution and use conditional rendering, where we redirect the person to a page in insights:

  • if they are logged in, then we will show feed,
  • if not we will show sign up.

and we will change the copy to "Use The App",

I think this might have a simpler approach and less complex.

This is a nice idea but supabase authentication was not setup in this repo it was setup in the insights repo. So the only way to use this is if we setup supabase on this repo or pass the providerToken from the insights: start page in the insight repo to a localstorage hence allowing it to be accessible in the landing-page repo

a0m0rajab commented 1 year ago

Yeah, I mean that we do not need to setup supabase here, we can just rely on the insight repo and do the logic there. Here we can just change the copy.

a0m0rajab commented 1 year ago

or we can just redirect them to: https://insights.opensauced.pizza/

dev-phantom commented 1 year ago

or we can just redirect them to: https://insights.opensauced.pizza/

Currently on the landing page we have a similar logic

dev-phantom commented 1 year ago

Yeah, I mean that we do not need to setup supabase here, we can just rely on the insight repo and do the logic there. Here we can just change the copy.

So should I open a feat request issue on the insight page to store the provider token to the local storage?