Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit 13a5a7e

Browse files
fix/using react fragment instead of empty brackets
1 parent de4d216 commit 13a5a7e

File tree

16 files changed

+141
-141
lines changed

16 files changed

+141
-141
lines changed

public/packages/app/src/core/components/CodePreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Trace } from "@traceo/types";
22
import { Space } from "@traceo/ui";
3-
import { FC } from "react";
3+
import { FC, Fragment } from "react";
44

55
interface Props {
66
trace: Trace;
77
}
88

99
export const CodePreview: FC<Props> = ({ trace }) => {
1010
return (
11-
<>
11+
<Fragment>
1212
<Space className="code-container rounded-md p-3 mb-5 bg-secondary text-white w-full">
1313
<ol start={trace?.lineNo - 5} className="ml-2 w-full">
1414
{trace.preCode?.map((code, index) => (
@@ -38,6 +38,6 @@ export const CodePreview: FC<Props> = ({ trace }) => {
3838
color: #d67709;
3939
}
4040
`}</style>
41-
</>
41+
</Fragment>
4242
);
4343
};

public/packages/app/src/core/components/ConditionLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LoadingOutlined } from "@ant-design/icons";
22
import { Space } from "@traceo/ui";
3-
import { FC } from "react";
3+
import { FC, Fragment } from "react";
44
import styled from "styled-components";
55

66
interface Props {
@@ -28,7 +28,7 @@ export const ConditionalWrapper: FC<Props> = ({
2828
return <PositionedWrapper>{emptyView}</PositionedWrapper>;
2929
}
3030

31-
return <>{children}</>;
31+
return <Fragment>{children}</Fragment>;
3232
};
3333

3434
const PositionedWrapper = styled.div`

public/packages/app/src/core/components/Confirm/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Alert,
1010
Modal
1111
} from "@traceo/ui";
12-
import { FC, useState } from "react";
12+
import { FC, Fragment, useState } from "react";
1313
import { useUser } from "../../../core/hooks/useUser";
1414

1515
interface CheckCredentialsResponse {
@@ -63,10 +63,10 @@ export const Confirm: FC<Props> = ({
6363
};
6464

6565
return (
66-
<>
66+
<Fragment>
6767
<Space onClick={() => setOpen(true)}>{children}</Space>
6868
<Modal open={isOpen} title={title} onCancel={onCancel}>
69-
<>
69+
<Fragment>
7070
<Space className="w-full" direction="vertical">
7171
<Space className="w-full text-sm">{description}</Space>
7272
{auth && (
@@ -97,8 +97,8 @@ export const Confirm: FC<Props> = ({
9797
Cancel
9898
</Button>
9999
</ButtonContainer>
100-
</>
100+
</Fragment>
101101
</Modal>
102-
</>
102+
</Fragment>
103103
);
104104
};

public/packages/app/src/core/components/Modals/AddMemberModal.tsx

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,42 +65,40 @@ export const AddMemberModal = ({ isOpen, onCancel }) => {
6565
const onChangeUser = (userId: string) => setUserId(userId);
6666

6767
return (
68-
<>
69-
<Modal title="Add member" onCancel={onClose} open={isOpen}>
70-
<Space direction="vertical" className="w-full">
71-
<form id="add-member-form" onSubmit={onFinish}>
72-
<FormItem label="User">
73-
<Select
74-
value={userId}
75-
onChange={(opt) => onChangeUser(opt?.value)}
76-
isLoading={isLoading}
77-
options={usersOptions}
78-
/>
79-
</FormItem>
80-
<FormItem label="Role">
81-
<Select
82-
value={role}
83-
onChange={(opt) => onChangeRole(opt?.value)}
84-
options={roleOptions}
85-
/>
86-
</FormItem>
87-
</form>
68+
<Modal title="Add member" onCancel={onClose} open={isOpen}>
69+
<Space direction="vertical" className="w-full">
70+
<form id="add-member-form" onSubmit={onFinish}>
71+
<FormItem label="User">
72+
<Select
73+
value={userId}
74+
onChange={(opt) => onChangeUser(opt?.value)}
75+
isLoading={isLoading}
76+
options={usersOptions}
77+
/>
78+
</FormItem>
79+
<FormItem label="Role">
80+
<Select
81+
value={role}
82+
onChange={(opt) => onChangeRole(opt?.value)}
83+
options={roleOptions}
84+
/>
85+
</FormItem>
86+
</form>
8887

89-
<ButtonContainer className="float-left">
90-
<Button
91-
disabled={!role || !userId}
92-
loading={loading}
93-
type="submit"
94-
form="add-member-form"
95-
>
96-
OK
97-
</Button>
98-
<Button variant="ghost" onClick={onClose}>
99-
Cancel
100-
</Button>
101-
</ButtonContainer>
102-
</Space>
103-
</Modal>
104-
</>
88+
<ButtonContainer className="float-left">
89+
<Button
90+
disabled={!role || !userId}
91+
loading={loading}
92+
type="submit"
93+
form="add-member-form"
94+
>
95+
OK
96+
</Button>
97+
<Button variant="ghost" onClick={onClose}>
98+
Cancel
99+
</Button>
100+
</ButtonContainer>
101+
</Space>
102+
</Modal>
105103
);
106104
};

public/packages/app/src/core/components/Permissions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useConfig } from "../contexts/ConfigsContextProvider";
22
import { useProject } from "../hooks/useProject";
33
import { MemberRole } from "@traceo/types";
4-
import { FC, ReactNode } from "react";
4+
import { FC, Fragment, ReactNode } from "react";
55

66
interface PermissionsProps {
77
children: ReactNode;
@@ -15,7 +15,7 @@ export const Permissions: FC<PermissionsProps> = ({ statuses, children }) => {
1515
const isDemo = !configs.demoMode && !configs.user.isAdmin;
1616

1717
if (permission && statuses.includes(permission) && !isDemo) {
18-
return <>{children}</>;
18+
return <Fragment>{children}</Fragment>;
1919
}
2020

2121
return null;

public/packages/app/src/core/components/ServerPermissions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useUser } from "../hooks/useUser";
2-
import { FC } from "react";
2+
import { FC, Fragment } from "react";
33

44
const ServerPermissions: FC = ({ children }) => {
55
const user = useUser();
66

77
const isAdmin = user.isAdmin;
88
if (isAdmin) {
9-
return <>{children}</>;
9+
return <Fragment>{children}</Fragment>;
1010
}
1111

1212
return null;

public/packages/app/src/features/admin/components/UserManagement/UserApplications.tsx

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -42,72 +42,70 @@ export const UserApplications = () => {
4242
};
4343

4444
return (
45-
<>
46-
<Card
47-
title="Projects list"
48-
extra={
49-
!isAdmin && (
50-
<Space className="w-full justify-end">
51-
<Button onClick={() => setOpenAddAppDrawer(true)}>Add user to project</Button>
52-
</Space>
53-
)
54-
}
45+
<Card
46+
title="Projects list"
47+
extra={
48+
!isAdmin && (
49+
<Space className="w-full justify-end">
50+
<Button onClick={() => setOpenAddAppDrawer(true)}>Add user to project</Button>
51+
</Space>
52+
)
53+
}
54+
>
55+
<ConditionalWrapper
56+
emptyView={<DataNotFound label="No projects found" />}
57+
isEmpty={isEmpty(projects)}
58+
isLoading={isLoading}
5559
>
56-
<ConditionalWrapper
57-
emptyView={<DataNotFound label="No projects found" />}
58-
isEmpty={isEmpty(projects)}
59-
isLoading={isLoading}
60-
>
61-
<Table collection={projects} striped>
62-
<TableColumn width={15}>
63-
{({ item }) => <Avatar size="sm" src={item?.gravatar} alt={item?.name} />}
64-
</TableColumn>
65-
<TableColumn name="Name" value="name" />
66-
<TableColumn name="Role" className="py-0">
67-
{({ item }) => {
68-
if (user.email === ADMIN_EMAIL) {
69-
return <span>{item.role}</span>;
70-
}
60+
<Table collection={projects} striped>
61+
<TableColumn width={15}>
62+
{({ item }) => <Avatar size="sm" src={item?.gravatar} alt={item?.name} />}
63+
</TableColumn>
64+
<TableColumn name="Name" value="name" />
65+
<TableColumn name="Role" className="py-0">
66+
{({ item }) => {
67+
if (user.email === ADMIN_EMAIL) {
68+
return <span>{item.role}</span>;
69+
}
7170

71+
return (
72+
<div className="max-w-min">
73+
<Select
74+
isDisabled={item.email === ADMIN_EMAIL}
75+
onChange={(opt) => onUpdateRole(item, opt?.value)}
76+
defaultValue={item.role}
77+
options={options}
78+
menuPlacement="auto"
79+
/>
80+
</div>
81+
);
82+
}}
83+
</TableColumn>
84+
<TableColumn width={100} />
85+
<TableColumn width={50}>
86+
{({ item }) => {
87+
if (user.email !== ADMIN_EMAIL) {
7288
return (
73-
<div className="max-w-min">
74-
<Select
75-
isDisabled={item.email === ADMIN_EMAIL}
76-
onChange={(opt) => onUpdateRole(item, opt?.value)}
77-
defaultValue={item.role}
78-
options={options}
79-
menuPlacement="auto"
80-
/>
81-
</div>
89+
<Confirm
90+
description="Are you sure you want to remove this user from project?"
91+
onOk={() => onRemoveFromProject(item)}
92+
>
93+
<Button size="xs" variant="danger">
94+
Remove
95+
</Button>
96+
</Confirm>
8297
);
83-
}}
84-
</TableColumn>
85-
<TableColumn width={100} />
86-
<TableColumn width={50}>
87-
{({ item }) => {
88-
if (user.email !== ADMIN_EMAIL) {
89-
return (
90-
<Confirm
91-
description="Are you sure you want to remove this user from project?"
92-
onOk={() => onRemoveFromProject(item)}
93-
>
94-
<Button size="xs" variant="danger">
95-
Remove
96-
</Button>
97-
</Confirm>
98-
);
99-
}
100-
}}
101-
</TableColumn>
102-
</Table>
103-
</ConditionalWrapper>
98+
}
99+
}}
100+
</TableColumn>
101+
</Table>
102+
</ConditionalWrapper>
104103

105-
<AddToProjectModal
106-
isOpen={isOpenAddAppDrawer}
107-
onCancel={() => setOpenAddAppDrawer(false)}
108-
postExecute={() => refetch()}
109-
/>
110-
</Card>
111-
</>
104+
<AddToProjectModal
105+
isOpen={isOpenAddAppDrawer}
106+
onCancel={() => setOpenAddAppDrawer(false)}
107+
postExecute={() => refetch()}
108+
/>
109+
</Card>
112110
);
113111
};

public/packages/app/src/features/admin/components/UserManagement/UserInformation.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { useSelector } from "react-redux";
2020
import { useNavigate } from "react-router-dom";
2121
import { updateUser } from "../../state/users/actions";
22+
import { Fragment } from "react";
2223

2324
interface UserProps {
2425
email: string;
@@ -101,7 +102,7 @@ export const UserInformation = () => {
101102
};
102103

103104
return (
104-
<>
105+
<Fragment>
105106
{isAdmin && (
106107
<Alert
107108
type="warning"
@@ -121,7 +122,7 @@ export const UserInformation = () => {
121122
onSubmit={onFinish}
122123
>
123124
{({ register, errors }) => (
124-
<>
125+
<Fragment>
125126
<FormItem disabled={isAdmin} label="Name" error={errors.name}>
126127
<Input
127128
{...register("name", {
@@ -147,7 +148,7 @@ export const UserInformation = () => {
147148
})}
148149
/>
149150
</FormItem>
150-
</>
151+
</Fragment>
151152
)}
152153
</Form>
153154
{!isAdmin && (
@@ -159,6 +160,6 @@ export const UserInformation = () => {
159160
)}
160161
</ColumnSection>
161162
</Card>
162-
</>
163+
</Fragment>
163164
);
164165
};
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
import { Alert, Button, Form, FormItem, Input, InputSecret } from "@traceo/ui";
2+
import { Fragment } from "react";
23

34
type FormType = {
45
username: string;
56
password: string;
67
};
78
export const LoginForm = ({ invalid, loading, onFinish }) => {
89
return (
9-
<>
10+
<Fragment>
1011
{invalid && <Alert type="error" title="Bad username or password!" className="mb-9" />}
1112
<Form<FormType> onSubmit={onFinish} id="login-form">
1213
{({ register, errors }) => (
13-
<>
14+
<Fragment>
1415
<FormItem label="Username" error={errors.username}>
1516
<Input {...register("username", { required: true })} />
1617
</FormItem>
1718

1819
<FormItem label="Password" error={errors.password}>
1920
<InputSecret {...register("password", { required: true })} />
2021
</FormItem>
21-
</>
22+
</Fragment>
2223
)}
2324
</Form>
2425
<Button
@@ -29,6 +30,6 @@ export const LoginForm = ({ invalid, loading, onFinish }) => {
2930
>
3031
Login
3132
</Button>
32-
</>
33+
</Fragment>
3334
);
3435
};

0 commit comments

Comments
 (0)