Skip to content

Commit

Permalink
Merge pull request #599 from 1ifeworld/0xTranqui/newchannel-home-fix
Browse files Browse the repository at this point in the history
logic fix for showing new channel
  • Loading branch information
0xTranqui authored Apr 20, 2024
2 parents 4d25bee + 5bc490e commit c65c71a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 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
20 changes: 19 additions & 1 deletion apps/site/components/client/MenuDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ export function MenuDialog() {
</DialogClose>
</DialogHeader>
<Stack className="h-full w-full pt-[52px] items-start gap-y-6">
<DialogClose asChild>
<Button
variant="link"
className="w-full h-5 justify-start rounded-none"
onClick={() => setDialogOpen(false)}
>
<Link href={'/'} className="rounded-none flex w-full">
<Flex className="w-full justify-between items-center">
<Typography className="text-primary-foreground">
Home
</Typography>
<Typography className="text-secondary-foreground text-[14px]">
</Typography>
</Flex>
</Link>
</Button>
</DialogClose>
<DialogClose asChild>
<Button
variant="link"
Expand Down Expand Up @@ -90,7 +108,7 @@ export function MenuDialog() {
</DialogClose>
{!authenticated ? (
<>
<Separator orientation="vertical" className="h-4 border-none" />
<Separator orientation="vertical" className="h-4 border-none bg-0" />
<DialogClose asChild>
<Button
variant="link"
Expand Down

0 comments on commit c65c71a

Please sign in to comment.