Skip to content

Commit 4f9649f

Browse files
committed
Merge branch 'feature/authjs' of github.com:shapehq/shape-docs into feature/authjs
2 parents 8958793 + b44ceb7 commit 4f9649f

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/features/admin/view/Actions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { z } from 'zod'
66

77
const sendInviteSchema = z.object({
88
email: z.string().email(),
9-
projects: z.string().transform(v => v.trim().split(","))
9+
projects: z.string().min(1).transform(v => v.trim().split(","))
1010
})
1111

1212
export interface SendInviteResult {
@@ -25,7 +25,7 @@ export const sendInvite = async (prevState: any, formData: FormData): Promise<Se
2525

2626
if (!validatedFields.success) {
2727
return {
28-
error: 'Validation failed',
28+
error: validatedFields.error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '),
2929
success: false,
3030
}
3131
}

src/features/admin/view/AdminPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Box, ButtonGroup, Chip, Paper, TableBody, TableCell, TableContainer, Ta
33
import Table from "@mui/material/Table"
44
import { InviteGuestForm } from "./InviteGuestForm"
55
import { RemoveGuestForm } from "./RemoveGuestForm"
6+
import { EditGuestForm } from "./EditGuestForm"
67

78
const AdminPage = async () => {
89
const guests = await guestRepository.getAll()
@@ -42,6 +43,7 @@ const AdminPage = async () => {
4243
<TableCell>{row.projects.join(", ")}</TableCell>
4344
<TableCell>
4445
<ButtonGroup variant="outlined">
46+
<EditGuestForm />
4547
<RemoveGuestForm email={row.email} />
4648
</ButtonGroup>
4749
</TableCell>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use client'
2+
3+
import { Button } from "@mui/material";
4+
5+
export const EditGuestForm = () => {
6+
return (
7+
<form>
8+
<Button>Edit</Button>
9+
</form>
10+
)
11+
}

0 commit comments

Comments
 (0)