Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -14,7 +14,7 @@ import NavItem from '@/ui/navbar/components/NavItem';
|
||||
import NavTitle from '@/ui/navbar/components/NavTitle';
|
||||
import SubMenuNavbar from '@/ui/navbar/components/SubMenuNavbar';
|
||||
|
||||
export function SettingsNavbar() {
|
||||
export const SettingsNavbar = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { signOut } = useAuth();
|
||||
@ -76,4 +76,4 @@ export function SettingsNavbar() {
|
||||
<NavItem label="Logout" onClick={handleLogout} Icon={IconLogout} />
|
||||
</SubMenuNavbar>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -10,7 +10,7 @@ import { ConfirmationModal } from '@/ui/modal/components/ConfirmationModal';
|
||||
import { H2Title } from '@/ui/typography/components/H2Title';
|
||||
import { useDeleteUserAccountMutation } from '~/generated/graphql';
|
||||
|
||||
export function DeleteAccount() {
|
||||
export const DeleteAccount = () => {
|
||||
const [isDeleteAccountModalOpen, setIsDeleteAccountModalOpen] =
|
||||
useState(false);
|
||||
|
||||
@ -61,4 +61,4 @@ export function DeleteAccount() {
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
import { H2Title } from '@/ui/typography/components/H2Title';
|
||||
import { useDeleteCurrentWorkspaceMutation } from '~/generated/graphql';
|
||||
|
||||
export function DeleteWorkspace() {
|
||||
export const DeleteWorkspace = () => {
|
||||
const [isDeleteWorkSpaceModalOpen, setIsDeleteWorkSpaceModalOpen] =
|
||||
useState(false);
|
||||
|
||||
@ -58,4 +58,4 @@ export function DeleteWorkspace() {
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@ import { useRecoilValue } from 'recoil';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { TextInputSettings } from '@/ui/input/text/components/TextInputSettings';
|
||||
|
||||
export function EmailField() {
|
||||
export const EmailField = () => {
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
|
||||
return (
|
||||
@ -14,4 +14,4 @@ export function EmailField() {
|
||||
key={'email-' + currentUser?.id}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -23,11 +23,11 @@ type OwnProps = {
|
||||
onLastNameUpdate?: (lastName: string) => void;
|
||||
};
|
||||
|
||||
export function NameFields({
|
||||
export const NameFields = ({
|
||||
autoSave = true,
|
||||
onFirstNameUpdate,
|
||||
onLastNameUpdate,
|
||||
}: OwnProps) {
|
||||
}: OwnProps) => {
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
|
||||
const [firstName, setFirstName] = useState(currentUser?.firstName ?? '');
|
||||
@ -102,4 +102,4 @@ export function NameFields({
|
||||
/>
|
||||
</StyledComboInputContainer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
useUploadProfilePictureMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export function ProfilePictureUploader() {
|
||||
export const ProfilePictureUploader = () => {
|
||||
const [uploadPicture, { loading: isUploading }] =
|
||||
useUploadProfilePictureMutation();
|
||||
const [removePicture] = useRemoveProfilePictureMutation();
|
||||
@ -20,7 +20,7 @@ export function ProfilePictureUploader() {
|
||||
useState<AbortController | null>(null);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
|
||||
async function handleUpload(file: File) {
|
||||
const handleUpload = async (file: File) => {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
@ -47,16 +47,16 @@ export function ProfilePictureUploader() {
|
||||
} catch (error) {
|
||||
setErrorMessage('An error occured while uploading the picture.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async function handleAbort() {
|
||||
const handleAbort = async () => {
|
||||
if (uploadController) {
|
||||
uploadController.abort();
|
||||
setUploadController(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async function handleRemove() {
|
||||
const handleRemove = async () => {
|
||||
await removePicture({
|
||||
variables: {
|
||||
where: {
|
||||
@ -65,7 +65,7 @@ export function ProfilePictureUploader() {
|
||||
},
|
||||
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ImageInput
|
||||
@ -77,4 +77,4 @@ export function ProfilePictureUploader() {
|
||||
errorMessage={errorMessage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -5,14 +5,14 @@ import { Toggle } from '@/ui/input/components/Toggle';
|
||||
import { useSnackBar } from '@/ui/snack-bar/hooks/useSnackBar';
|
||||
import { useUpdateAllowImpersonationMutation } from '~/generated/graphql';
|
||||
|
||||
export function ToggleField() {
|
||||
export const ToggleField = () => {
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
|
||||
const [updateAllowImpersonation] = useUpdateAllowImpersonationMutation();
|
||||
|
||||
async function handleChange(value: boolean) {
|
||||
const handleChange = async (value: boolean) => {
|
||||
try {
|
||||
const { data, errors } = await updateAllowImpersonation({
|
||||
variables: {
|
||||
@ -28,7 +28,7 @@ export function ToggleField() {
|
||||
variant: 'error',
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Toggle
|
||||
@ -36,4 +36,4 @@ export function ToggleField() {
|
||||
onChange={handleChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -22,7 +22,7 @@ type OwnProps = {
|
||||
onNameUpdate?: (name: string) => void;
|
||||
};
|
||||
|
||||
export function NameField({ autoSave = true, onNameUpdate }: OwnProps) {
|
||||
export const NameField = ({ autoSave = true, onNameUpdate }: OwnProps) => {
|
||||
const [currentUser] = useRecoilState(currentUserState);
|
||||
const workspace = currentUser?.workspaceMember?.workspace;
|
||||
|
||||
@ -77,4 +77,4 @@ export function NameField({ autoSave = true, onNameUpdate }: OwnProps) {
|
||||
/>
|
||||
</StyledComboInputContainer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -10,11 +10,11 @@ import {
|
||||
useUploadWorkspaceLogoMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export function WorkspaceLogoUploader() {
|
||||
export const WorkspaceLogoUploader = () => {
|
||||
const [uploadLogo] = useUploadWorkspaceLogoMutation();
|
||||
const [removeLogo] = useRemoveWorkspaceLogoMutation();
|
||||
const [currentUser] = useRecoilState(currentUserState);
|
||||
async function onUpload(file: File) {
|
||||
const onUpload = async (file: File) => {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
@ -24,13 +24,13 @@ export function WorkspaceLogoUploader() {
|
||||
},
|
||||
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
async function onRemove() {
|
||||
const onRemove = async () => {
|
||||
await removeLogo({
|
||||
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ImageInput
|
||||
@ -41,4 +41,4 @@ export function WorkspaceLogoUploader() {
|
||||
onRemove={onRemove}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user