-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from communitycenter/discord-confirmation
Feature: Add pop-up before joining Discord
- Loading branch information
Showing
9 changed files
with
171 additions
and
44 deletions.
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
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,71 @@ | ||
import Link from "next/link"; | ||
|
||
import Image from "next/image"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Checkbox } from "@/components/ui/checkbox"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
} from "@/components/ui/dialog"; | ||
import { useState } from "react"; | ||
|
||
interface Props { | ||
open: boolean; | ||
setOpen: (open: boolean) => void; | ||
} | ||
|
||
export const LoginDialog = ({ open, setOpen }: Props) => { | ||
const [joinDiscord, setJoinDiscord] = useState(true); | ||
return ( | ||
<Dialog open={open} onOpenChange={setOpen}> | ||
<DialogContent> | ||
<div className="flex justify-center"> | ||
<Image src="/discord.png" alt={"Heart icon"} width={48} height={48} /> | ||
</div> | ||
<DialogHeader> | ||
<DialogDescription> | ||
stardew.app uses Discord to sync your saves, preferences, and stats | ||
across devices - nothing else! | ||
</DialogDescription> | ||
<DialogDescription> | ||
<div className="items-top flex space-x-2 pt-2 text-left"> | ||
<Checkbox | ||
id="ccdiscord" | ||
defaultChecked={joinDiscord} | ||
onCheckedChange={(checked) => setJoinDiscord(Boolean(checked))} | ||
/> | ||
<div className="grid gap-1.5 leading-none"> | ||
<label | ||
htmlFor="ccdiscord" | ||
className="text-sm font-medium leading-none text-black peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-white" | ||
> | ||
Join the Community Center Discord | ||
</label> | ||
<p className="text-muted-foreground text-sm"> | ||
We occasionally post updates, information and more in our | ||
Discord server. You can leave at any time, no hard feelings! | ||
</p> | ||
</div> | ||
</div> | ||
</DialogDescription> | ||
</DialogHeader> | ||
<DialogFooter className="gap-3 sm:gap-0"> | ||
<Button> | ||
<Link | ||
href={{ | ||
pathname: "/api/oauth", | ||
query: { discord: joinDiscord }, | ||
}} | ||
> | ||
Log In With Discord | ||
</Link> | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
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,28 @@ | ||
import * as React from "react" | ||
import * as CheckboxPrimitive from "@radix-ui/react-checkbox" | ||
import { CheckIcon } from "@radix-ui/react-icons" | ||
|
||
import { cn } from "@/lib/utils" | ||
|
||
const Checkbox = React.forwardRef< | ||
React.ElementRef<typeof CheckboxPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> | ||
>(({ className, ...props }, ref) => ( | ||
<CheckboxPrimitive.Root | ||
ref={ref} | ||
className={cn( | ||
"peer h-4 w-4 shrink-0 rounded-sm border border-neutral-200 border-neutral-900 shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-neutral-900 data-[state=checked]:text-neutral-50 dark:border-neutral-800 dark:border-neutral-50 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=checked]:text-neutral-900", | ||
className | ||
)} | ||
{...props} | ||
> | ||
<CheckboxPrimitive.Indicator | ||
className={cn("flex items-center justify-center text-current")} | ||
> | ||
<CheckIcon className="h-4 w-4" /> | ||
</CheckboxPrimitive.Indicator> | ||
</CheckboxPrimitive.Root> | ||
)) | ||
Checkbox.displayName = CheckboxPrimitive.Root.displayName | ||
|
||
export { Checkbox } |
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
Oops, something went wrong.