Skip to content
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

logic fix for showing new channel #599

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading