diff --git a/src/app/(main)/invite/InviteForm.module.css b/src/app/(main)/invite/InviteForm.module.css new file mode 100644 index 0000000000..bdd5a56456 --- /dev/null +++ b/src/app/(main)/invite/InviteForm.module.css @@ -0,0 +1,22 @@ +.container { + margin: 0 auto; + max-width: 400px; + padding: 20px; +} + +.form { + background: var(--base50); + border-radius: 8px; + padding: 20px; +} + +@media screen and (max-width: 768px) { + .container { + margin: 0; + padding: 10px; + } + + .form { + padding: 15px; + } +} diff --git a/src/app/(main)/invite/InviteForm.tsx b/src/app/(main)/invite/InviteForm.tsx new file mode 100644 index 0000000000..a6cb5de1ef --- /dev/null +++ b/src/app/(main)/invite/InviteForm.tsx @@ -0,0 +1,57 @@ +'use client'; +import { Form, FormRow, FormInput, FormButtons, TextField, Button } from 'react-basics'; +import { useApi, useMessages, useModified } from '@/components/hooks'; +import styles from './InviteForm.module.css'; +import { useRouter, useSearchParams } from 'next/navigation'; + +export function InviteForm() { + const searchParams = useSearchParams(); + const router = useRouter(); + const accessCode = searchParams.get('accessCode'); + const { formatMessage, labels } = useMessages(); + const { post, useMutation } = useApi(); + + const { mutate, error } = useMutation({ + mutationFn: (data: any) => post('/teams/join', data), + }); + + const { touch } = useModified(); + + const handleSubmit = async (data: any) => { + mutate(data, { + onSuccess: async () => { + touch('teams:members'); + }, + }); + }; + const onClose = () => { + router.replace('/dashboard'); + }; + return ( +
+
+
+ + + + + + + + + +
+
+
+ ); +} diff --git a/src/app/(main)/invite/InvitePage.tsx b/src/app/(main)/invite/InvitePage.tsx new file mode 100644 index 0000000000..6b6f949d30 --- /dev/null +++ b/src/app/(main)/invite/InvitePage.tsx @@ -0,0 +1,11 @@ +'use client'; + +import { InviteForm } from './InviteForm'; + +export default function InvitePage() { + return ( +
+ +
+ ); +} diff --git a/src/app/(main)/invite/page.tsx b/src/app/(main)/invite/page.tsx new file mode 100644 index 0000000000..47b9b1e457 --- /dev/null +++ b/src/app/(main)/invite/page.tsx @@ -0,0 +1,10 @@ +import { Metadata } from 'next'; +import InvitePage from './InvitePage'; + +export const metadata: Metadata = { + title: 'Join team', +}; + +export default function () { + return ; +} diff --git a/src/app/(main)/teams/[teamId]/settings/team/TeamEditForm.tsx b/src/app/(main)/teams/[teamId]/settings/team/TeamEditForm.tsx index ac158fa709..83c9cfee70 100644 --- a/src/app/(main)/teams/[teamId]/settings/team/TeamEditForm.tsx +++ b/src/app/(main)/teams/[teamId]/settings/team/TeamEditForm.tsx @@ -71,6 +71,15 @@ export function TeamEditForm({ teamId, allowEdit }: { teamId: string; allowEdit? )} + + + + + {allowEdit && ( {formatMessage(labels.save)} diff --git a/src/components/messages.ts b/src/components/messages.ts index 27086b49d7..68c05c0e35 100644 --- a/src/components/messages.ts +++ b/src/components/messages.ts @@ -33,6 +33,7 @@ export const labels = defineMessages({ member: { id: 'label.member', defaultMessage: 'Member' }, members: { id: 'label.members', defaultMessage: 'Members' }, accessCode: { id: 'label.access-code', defaultMessage: 'Access code' }, + invitationLink: { id: 'label.invitation-link', defaultMessage: 'Invitation link' }, teamId: { id: 'label.team-id', defaultMessage: 'Team ID' }, team: { id: 'label.team', defaultMessage: 'Team' }, teamName: { id: 'label.team-name', defaultMessage: 'Team name' }, diff --git a/src/lang/en-US.json b/src/lang/en-US.json index 8fe3314592..cfc361e148 100644 --- a/src/lang/en-US.json +++ b/src/lang/en-US.json @@ -235,6 +235,7 @@ "label.websites": "Websites", "label.window": "Window", "label.yesterday": "Yesterday", + "label.invitation-link": "Invitation link", "message.action-confirmation": "Type {confirmation} in the box below to confirm.", "message.active-users": "{x} current {x, plural, one {visitor} other {visitors}}", "message.collected-data": "Collected data", diff --git a/src/lang/zh-CN.json b/src/lang/zh-CN.json index 6892f2e591..18ade4b367 100644 --- a/src/lang/zh-CN.json +++ b/src/lang/zh-CN.json @@ -236,6 +236,7 @@ "label.websites": "网站", "label.window": "窗口", "label.yesterday": "昨天", + "label.invitation-link": "邀请链接", "message.action-confirmation": "请在下方输入框中输入 {confirmation} 以确认操作。", "message.active-users": "当前在线 {x} 位访客", "message.collected-data": "已收集的数据",