-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd2f4b0
commit befdb63
Showing
121 changed files
with
3,157 additions
and
2,274 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
2 changes: 1 addition & 1 deletion
2
...tjs/src/app/_components/auth-showcase.tsx → .../nextjs/src/_components/auth-showcase.tsx
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
File renamed without changes.
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,65 @@ | ||
import Link from "next/link"; | ||
|
||
import { auth } from "@acme/auth"; | ||
import { Avatar, AvatarFallback, AvatarImage } from "@acme/ui/avatar"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuGroup, | ||
DropdownMenuItem, | ||
DropdownMenuLabel, | ||
DropdownMenuSeparator, | ||
DropdownMenuTrigger, | ||
} from "@acme/ui/dropdown-menu"; | ||
|
||
import { SignOut } from "~/_components/auth"; | ||
import { getAvatarFallback } from "~/_utils/common"; | ||
import routes from "~/_utils/routes"; | ||
import Logo from "./logo"; | ||
|
||
/* <Header /> | ||
============================================================================= */ | ||
const Header = async () => { | ||
const session = await auth(); | ||
|
||
return ( | ||
<header className="mb-4 shadow-md"> | ||
<div className="container flex items-center justify-between py-4"> | ||
<Link href={routes.home}> | ||
<Logo /> | ||
</Link> | ||
{session && ( | ||
<div className="flex items-center gap-3"> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger> | ||
<Avatar> | ||
<AvatarImage src={session.user.image ?? ""} /> | ||
<AvatarFallback> | ||
{getAvatarFallback(session.user.name ?? "")} | ||
</AvatarFallback> | ||
</Avatar> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent> | ||
<DropdownMenuLabel>{session.user.name}</DropdownMenuLabel> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuGroup> | ||
<DropdownMenuItem>Profile</DropdownMenuItem> | ||
<DropdownMenuItem>Billing</DropdownMenuItem> | ||
<DropdownMenuItem>Settings</DropdownMenuItem> | ||
<DropdownMenuItem>New Team</DropdownMenuItem> | ||
</DropdownMenuGroup> | ||
<DropdownMenuSeparator /> | ||
|
||
<DropdownMenuItem asChild> | ||
<SignOut>Log out</SignOut> | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</div> | ||
)} | ||
</div> | ||
</header> | ||
); | ||
}; | ||
|
||
export default Header; |
File renamed without changes.
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
127 changes: 127 additions & 0 deletions
127
apps/nextjs/src/_components/modals/CreateWorkspacesModal/CreateWorkspacesModal.tsx
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,127 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
|
||
import { cn } from "@acme/ui"; | ||
import { Button } from "@acme/ui/button"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from "@acme/ui/dialog"; | ||
import { | ||
Form, | ||
FormControl, | ||
FormField, | ||
FormItem, | ||
FormLabel, | ||
FormMessage, | ||
useForm, | ||
} from "@acme/ui/form"; | ||
import { Icons } from "@acme/ui/icons"; | ||
import { Input } from "@acme/ui/input"; | ||
import { toast } from "@acme/ui/toast"; | ||
import { CreateWorkspaceSchema } from "@acme/validators"; | ||
|
||
import { ACCEPTED_MIME_TYPES, MAX_FILE_SIZE } from "~/_utils/constants"; | ||
import { api } from "~/trpc/react"; | ||
|
||
/* Props - <CreateWorkspacesModal /> | ||
============================================================================= */ | ||
interface Props { | ||
className?: string; | ||
} | ||
|
||
/* <CreateWorkspacesModal /> | ||
============================================================================= */ | ||
export function CreateWorkspacesModal({ className }: Props) { | ||
const form = useForm({ | ||
schema: CreateWorkspaceSchema, | ||
defaultValues: { | ||
name: "", | ||
image: undefined, | ||
}, | ||
}); | ||
|
||
const utils = api.useUtils(); | ||
const createWorkspace = api.workspace.create.useMutation({ | ||
async onSuccess() { | ||
toast.success("Your workspace has been created!"); | ||
|
||
await utils.workspace.invalidate(); | ||
}, | ||
onError: (err) => { | ||
toast.error( | ||
err?.data?.code === "UNAUTHORIZED" | ||
? "You must be logged in to create workspace" | ||
: "Failed to create workspace", | ||
); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Dialog> | ||
<DialogTrigger asChild> | ||
<Button className={cn(className)}> | ||
<Icons.Plus size={16} className="mr-2" /> Add new workspace | ||
</Button> | ||
</DialogTrigger> | ||
|
||
<DialogContent> | ||
<DialogHeader> | ||
<DialogTitle>Create new workspace</DialogTitle> | ||
</DialogHeader> | ||
<Form {...form}> | ||
<form | ||
className="flex w-full max-w-md flex-col gap-4" | ||
onSubmit={form.handleSubmit(async (data) => { | ||
createWorkspace.mutate(data); | ||
})} | ||
> | ||
<FormField | ||
control={form.control} | ||
name="name" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Name:</FormLabel> | ||
<FormControl> | ||
<Input {...field} placeholder="Name" /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="image" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Picture:</FormLabel> | ||
<FormControl> | ||
<Input | ||
type="file" | ||
size={MAX_FILE_SIZE} | ||
accept={ACCEPTED_MIME_TYPES.join(",")} | ||
{...field} | ||
/> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<DialogFooter className="sm:justify-start"> | ||
<Button type="submit" disabled={createWorkspace.isPending}> | ||
Create workspace | ||
</Button> | ||
</DialogFooter> | ||
</form> | ||
</Form> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
Oops, something went wrong.