Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
caichi-t committed Jul 2, 2024
1 parent 4460719 commit 9bd8688
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
3 changes: 1 addition & 2 deletions web/src/components/molecules/Content/Table/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { t } from "i18next";

import { StretchColumn } from "@reearth-cms/components/atoms/ProTable";
import { ContentTableField } from "@reearth-cms/components/molecules/Content/types";
import { FieldType, TypeProperty } from "@reearth-cms/components/molecules/Schema/types";
Expand All @@ -13,6 +11,7 @@ import {
MultipleOperator,
} from "@reearth-cms/components/molecules/View/types";
import { Member } from "@reearth-cms/components/molecules/Workspace/types";
import { t } from "@reearth-cms/i18n";

export type ColorType = "#BFBFBF" | "#52C41A" | "#FA8C16";
export type StateType = "DRAFT" | "PUBLIC" | "REVIEW";
Expand Down
24 changes: 14 additions & 10 deletions web/src/components/molecules/Member/MemberAddModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ const MemberAddModal: React.FC<Props> = ({

const handleSubmit = useCallback(async () => {
if (searchedUserList.length === 0) return;
await onSubmit(
searchedUserList.map(user => ({
userId: user.id,
role: "READER",
})),
);
changeSearchedUser(undefined);
changeSearchedUserList([]);
onClose();
form.resetFields();
try {
await onSubmit(
searchedUserList.map(user => ({
userId: user.id,
role: "READER",
})),
);
changeSearchedUser(undefined);
changeSearchedUserList([]);
onClose();
form.resetFields();
} catch (error) {
console.error(error);
}
}, [form, searchedUserList, changeSearchedUser, changeSearchedUserList, onClose, onSubmit]);

const handleClose = useCallback(() => {
Expand Down
10 changes: 7 additions & 3 deletions web/src/components/molecules/Member/MemberRoleModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ const MemberRoleModal: React.FC<Props> = ({ open, member, loading, onClose, onSu

const handleSubmit = useCallback(async () => {
const values = await form.validateFields();
await onSubmit(member.userId, values.role);
onClose();
form.resetFields();
try {
await onSubmit(member.userId, values.role);
onClose();
form.resetFields();
} catch (error) {
console.error(error);
}
}, [member, form, onSubmit, onClose]);

const handleClose = useCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/molecules/Schema/fieldTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { t } from "i18next";
import { t } from "@reearth-cms/i18n";

import type { FieldType } from "./types";

Expand Down
3 changes: 1 addition & 2 deletions web/src/components/molecules/Workspace/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { t } from "i18next";

import { PublicScope } from "@reearth-cms/components/molecules/Accessibility/types";
import { IntegrationMember } from "@reearth-cms/components/molecules/Integration/types";
import { t } from "@reearth-cms/i18n";

export interface Project {
id: string;
Expand Down
1 change: 1 addition & 0 deletions web/src/i18n/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useTranslation } from "react-i18next";

export { t } from "i18next";
export { Trans } from "react-i18next";
export { default as Provider } from "./provider";
export { localesWithLabel } from "./locale";
Expand Down

0 comments on commit 9bd8688

Please sign in to comment.