Skip to content

Commit

Permalink
logic fix for showing new channel
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTranqui committed Apr 20, 2024
1 parent 4d25bee commit 9607560
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
26 changes: 17 additions & 9 deletions apps/site/components/client/ChannelDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,24 @@ export function ChannelDialog({ trigger, hideTrigger }: ChannelDialogProps) {

return (
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
{!authenticated || !username || `/${username}` !== pathname ? (
<Button
className={hideTrigger ? 'hidden' : ''}
variant="link"
onClick={login}
>
<Typography>+&nbsp;Channel</Typography>
</Button>
{/*
Logic for showing trigger:
- hide trigger variable is used for optionally hiding trigger in header on mobile
- always show trigger on desktop (hide trigger == false)
- if user not authed, prompt log in, if not, prompt new channel
*/}
{!hideTrigger ? (
<>
{!authenticated || !username ? (
<Button variant="link" onClick={login}>
<Typography>+&nbsp;Channel</Typography>
</Button>
) : (
trigger
)}
</>
) : (
trigger
<>{`/${username}` !== pathname ? <></> : trigger}</>
)}
<DialogPortal>
<DialogContent
Expand Down
3 changes: 3 additions & 0 deletions apps/site/components/client/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ export function Header() {
hideTrigger={false}
trigger={
<DialogTrigger>
{/* <Button variant="link"> */}
<Typography className="hover:underline hover:underline-offset-2 transition-all">
{/* <Typography className=""> */}
+&nbsp;Channel
</Typography>
{/* </Button> */}
</DialogTrigger>
}
/>
Expand Down

0 comments on commit 9607560

Please sign in to comment.