mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-20 18:43:20 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import { type BreadcrumbItem } from '@/types';
|
|
import { Head, useForm } from '@inertiajs/react';
|
|
import { FormEventHandler } from 'react';
|
|
|
|
import { GroupForm } from '@/components/group-form';
|
|
import Heading from '@/components/heading';
|
|
import { Button } from '@/components/ui/button';
|
|
import { useTranslation } from '@/hooks/use-translation';
|
|
import AppLayout from '@/layouts/app-layout';
|
|
|
|
interface GroupFormData {
|
|
[key: string]: string | boolean;
|
|
name: string;
|
|
slug: string;
|
|
description: string;
|
|
public: boolean;
|
|
}
|
|
|
|
export default function GroupsCreate() {
|
|
const { t } = useTranslation();
|
|
|
|
const breadcrumbs: BreadcrumbItem[] = [
|
|
{ title: t('Groups'), href: '/groups' },
|
|
{ title: t('New group'), href: '/groups/create' },
|
|
];
|
|
|
|
const { data, setData, post, processing, errors } = useForm<GroupFormData>({
|
|
name: '',
|
|
slug: '',
|
|
description: '',
|
|
public: false,
|
|
});
|
|
|
|
const submit: FormEventHandler = (e) => {
|
|
e.preventDefault();
|
|
post(route('groups.store'));
|
|
};
|
|
|
|
return (
|
|
<AppLayout breadcrumbs={breadcrumbs}>
|
|
<Head title={t('New group')} />
|
|
|
|
<div className="px-4 py-6">
|
|
<Heading title={t('New group')} description={t('Groups let you assign files to several clients at once')} />
|
|
|
|
<form onSubmit={submit} className="space-y-6">
|
|
<GroupForm
|
|
name={data.name}
|
|
slug={data.slug}
|
|
description={data.description}
|
|
isPublic={data.public}
|
|
onChange={(field, value) => setData(field, value)}
|
|
errors={errors}
|
|
/>
|
|
|
|
<Button type="submit" disabled={processing}>
|
|
{t('Create group')}
|
|
</Button>
|
|
</form>
|
|
</div>
|
|
</AppLayout>
|
|
);
|
|
}
|