-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix updateName function #313
Open
chriscarrollsmith
wants to merge
4
commits into
vercel:main
Choose a base branch
from
chriscarrollsmith:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+707
−535
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8f93379
Git ignored VSCode file automatically created by recommended Deno ext…
chriscarrollsmith 4f25b3d
Fixed broken updateName function
chriscarrollsmith e48a6f1
Restored --turbo flag with next@canary
chriscarrollsmith 19ac7af
Added mobile-friendly responsive hamburger menu
chriscarrollsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Required Github OAuth environment variables for developing with a local Supabase instance | ||
SUPABASE_AUTH_EXTERNAL_GITHUB_REDIRECT_URI="http://127.0.0.1:54321/auth/v1/callback" | ||
SUPABASE_AUTH_EXTERNAL_GITHUB_CLIENT_ID= | ||
SUPABASE_AUTH_EXTERNAL_GITHUB_SECRET= | ||
|
||
# Optional OpenAI environment variable for generating SQL queries with Supabase AI | ||
OPENAI_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ yarn-error.log* | |
|
||
# editors | ||
.vscode | ||
*.code-workspace | ||
|
||
# certificates | ||
certificates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use server'; | ||
|
||
import { createClient } from '@/utils/supabase/server'; | ||
import Navbar from './Navbar'; | ||
|
||
export default async function Header() { | ||
const supabase = createClient(); | ||
|
||
const { | ||
data: { user } | ||
} = await supabase.auth.getUser(); | ||
|
||
return ( | ||
<Navbar user={user} /> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use client'; | ||
|
||
import { useState, useEffect } from 'react'; | ||
import Hamburger from 'hamburger-react'; | ||
import Link from 'next/link'; | ||
import SignInOutLink from './SignInOutLink'; | ||
import Logo from '@/components/icons/Logo'; | ||
import s from './Navbar.module.css'; | ||
import { User } from '@supabase/supabase-js'; | ||
|
||
interface NavbarProps { | ||
user: User | null; | ||
} | ||
|
||
export default function Navbar({user}: NavbarProps) { | ||
const [isOpen, setOpen] = useState(false); | ||
|
||
useEffect(() => { | ||
const handleClickOutside = (event: MouseEvent | TouchEvent) => { | ||
let path = event.composedPath ? event.composedPath() : []; | ||
const hamburgerElement = document.querySelector(".hamburger-react"); | ||
|
||
if (hamburgerElement && path.includes(hamburgerElement)) { | ||
return; // Click was inside the Hamburger, so do nothing | ||
} | ||
|
||
const dropdown = document.querySelector(`.${s.dropdownMenu}`) as HTMLElement; | ||
if (dropdown && !dropdown.contains(event.target as Node) && isOpen) { | ||
setOpen(false); | ||
} | ||
}; | ||
|
||
// Listen for mouse and touch events | ||
document.addEventListener('mousedown', handleClickOutside); | ||
document.addEventListener('touchstart', handleClickOutside); | ||
|
||
return () => { | ||
document.removeEventListener('mousedown', handleClickOutside); | ||
document.removeEventListener('touchstart', handleClickOutside); | ||
}; | ||
}, [isOpen]); | ||
|
||
return ( | ||
<nav className={s.root}> | ||
<a href="#skip" className="sr-only focus:not-sr-only"> | ||
Skip to content | ||
</a> | ||
<div className="max-w-6xl px-6 mx-auto"> | ||
<div className="relative flex flex-row justify-between py-4 align-center md:py-6"> | ||
<div className="flex items-center flex-1"> | ||
<Link href="/" className={s.logo} aria-label="Logo"> | ||
<Logo /> | ||
</Link> | ||
<div className="hidden ml-6 space-x-2 lg:block"> | ||
<Link href="/" className={s.link}> | ||
Pricing | ||
</Link> | ||
{user && ( | ||
<Link href="/account" className={s.link}> | ||
Account | ||
</Link> | ||
)} | ||
</div> | ||
<div className="hidden lg:flex justify-end flex-1 space-x-8"> | ||
<SignInOutLink user={user} /> | ||
</div> | ||
</div> | ||
<div className="flex justify-end flex-1 lg:hidden"> | ||
<Hamburger | ||
size={24} | ||
color="#fff" | ||
toggled={isOpen} | ||
toggle={setOpen} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
{isOpen && ( | ||
<div className={s.dropdownMenu}> | ||
<Link href="/" className={s.link}> | ||
Pricing | ||
</Link> | ||
{user && ( | ||
<Link href="/account" className={s.link}> | ||
Account | ||
</Link> | ||
)} | ||
<SignInOutLink user={user} /> | ||
</div> | ||
)} | ||
</nav> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client'; | ||
|
||
import { usePathname, useRouter } from 'next/navigation'; | ||
import { SignOut } from '@/utils/auth-helpers/server'; | ||
import { handleRequest } from '@/utils/auth-helpers/client'; | ||
import s from './Navbar.module.css'; | ||
import Link from 'next/link'; | ||
import { User } from '@supabase/supabase-js'; | ||
|
||
interface SignInOutLinkProps { | ||
user?: User | null; | ||
} | ||
|
||
export default function SignInOutLink({ user }: SignInOutLinkProps) { | ||
const router = useRouter(); | ||
|
||
return user ? ( | ||
<form onSubmit={(e) => handleRequest(e, SignOut, router)}> | ||
<input type="hidden" name="pathName" value={usePathname()} /> | ||
<button type="submit" className={s.link}> | ||
Sign out | ||
</button> | ||
</form> | ||
) : ( | ||
<Link href="/signin" className={s.link}> | ||
Sign In | ||
</Link> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './Header'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg thank you for this note! You just helped me figure out how to sequence my products!