Skip to content

feat: create and modify organization groups #13887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 22, 2024
Prev Previous commit
Next Next commit
do the thing here too
  • Loading branch information
aslilac committed Jul 17, 2024
commit b252a50ba84fdd565f8b70eaaa64de57ef0c40d6
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import { isApiValidationError } from "api/errors";
import type { CreateGroupRequest } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { FormFooter } from "components/FormFooter/FormFooter";
import { FullPageForm } from "components/FullPageForm/FullPageForm";
import { IconField } from "components/IconField/IconField";
import { Margins } from "components/Margins/Margins";
import { Stack } from "components/Stack/Stack";
import { getFormHelpers, onChangeTrimmed } from "utils/formUtils";
import {

Check failure on line 11 in site/src/pages/ManagementSettingsPage/GroupsPage/CreateGroupPageView.tsx

View workflow job for this annotation

GitHub Actions / lint

`components/Form/Form` import should occur before import of `components/IconField/IconField`

Check failure on line 11 in site/src/pages/ManagementSettingsPage/GroupsPage/CreateGroupPageView.tsx

View workflow job for this annotation

GitHub Actions / lint

`components/Form/Form` import should occur before import of `components/IconField/IconField`
FormFields,
FormFooter,
FormSection,
HorizontalForm,
} from "components/Form/Form";

const validationSchema = Yup.object({
name: Yup.string().required().label("Name"),
Expand Down Expand Up @@ -47,39 +49,40 @@
const onCancel = () => navigate(-1);

return (
<Margins>
<FullPageForm title="Create group">
<form onSubmit={form.handleSubmit}>
<Stack spacing={2.5}>
{Boolean(error) && !isApiValidationError(error) && (
<ErrorAlert error={error} />
)}
<HorizontalForm onSubmit={form.handleSubmit}>
<FormSection
title="Group settings"
description="Set a name and avatar for this group."
>
<FormFields>
{Boolean(error) && !isApiValidationError(error) && (
<ErrorAlert error={error} />
)}

<TextField
{...getFieldHelpers("name")}
autoFocus
fullWidth
label="Name"
/>
<TextField
{...getFieldHelpers("display_name", {
helperText: "Optional: keep empty to default to the name.",
})}
fullWidth
label="Display Name"
/>
<IconField
{...getFieldHelpers("avatar_url")}
onChange={onChangeTrimmed(form)}
fullWidth
label="Avatar URL"
onPickEmoji={(value) => form.setFieldValue("avatar_url", value)}
/>
</Stack>
<FormFooter onCancel={onCancel} isLoading={isLoading} />
</form>
</FullPageForm>
</Margins>
<TextField
{...getFieldHelpers("name")}
autoFocus
fullWidth
label="Name"
/>
<TextField
{...getFieldHelpers("display_name", {
helperText: "Optional: keep empty to default to the name.",
})}
fullWidth
label="Display Name"
/>
<IconField
{...getFieldHelpers("avatar_url")}
onChange={onChangeTrimmed(form)}
fullWidth
label="Avatar URL"
onPickEmoji={(value) => form.setFieldValue("avatar_url", value)}
/>
</FormFields>
</FormSection>
<FormFooter onCancel={onCancel} isLoading={isLoading} />
</HorizontalForm>
);
};
export default CreateGroupPageView;
Loading