Merge pull request #1424 from bluewave-labs/feat/fe/team-empty-view
feat: fe/team empty view, resolves #1400
This commit is contained in:
2 files changed
+18
-81
No files matched your search
@@ -115,7 +115,7 @@ TablePaginationActions.propTypes = {
|
|||||||
* @param {boolean} [props.paginated=false] - Flag to enable pagination.
|
* @param {boolean} [props.paginated=false] - Flag to enable pagination.
|
||||||
* @param {boolean} [props.reversed=false] - Flag to enable reverse order.
|
* @param {boolean} [props.reversed=false] - Flag to enable reverse order.
|
||||||
* @param {number} props.rowsPerPage- Number of rows per page (table).
|
* @param {number} props.rowsPerPage- Number of rows per page (table).
|
||||||
*
|
* @param {string} props.emptyMessage - Message to display when there is no data.
|
||||||
* @example
|
* @example
|
||||||
* const data = {
|
* const data = {
|
||||||
* cols: [
|
* cols: [
|
||||||
@@ -149,7 +149,7 @@ TablePaginationActions.propTypes = {
|
|||||||
* <BasicTable data={data} rows={rows} paginated={true} />
|
* <BasicTable data={data} rows={rows} paginated={true} />
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BasicTable = ({ data, paginated, reversed, table }) => {
|
const BasicTable = ({ data, paginated, reversed, table, emptyMessage = "No data" }) => {
|
||||||
const DEFAULT_ROWS_PER_PAGE = 5;
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -228,6 +228,16 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{displayData.length === 0 && (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell
|
||||||
|
sx={{ textAlign: "center" }}
|
||||||
|
colSpan={data.cols.length}
|
||||||
|
>
|
||||||
|
{emptyMessage}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
@@ -317,6 +327,7 @@ BasicTable.propTypes = {
|
|||||||
reversed: PropTypes.bool,
|
reversed: PropTypes.bool,
|
||||||
rowPerPage: PropTypes.number,
|
rowPerPage: PropTypes.number,
|
||||||
table: PropTypes.string,
|
table: PropTypes.string,
|
||||||
|
emptyMessage: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BasicTable;
|
export default BasicTable;
|
||||||
@@ -64,7 +64,7 @@ const TeamPanel = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchTeam();
|
fetchTeam();
|
||||||
}, [user]);
|
}, [authToken]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let team = members;
|
let team = members;
|
||||||
@@ -81,8 +81,6 @@ const TeamPanel = () => {
|
|||||||
{ id: 1, name: "NAME" },
|
{ id: 1, name: "NAME" },
|
||||||
{ id: 2, name: "EMAIL" },
|
{ id: 2, name: "EMAIL" },
|
||||||
{ id: 3, name: "ROLE" },
|
{ id: 3, name: "ROLE" },
|
||||||
// FEATURE STILL TO BE IMPLEMENTED
|
|
||||||
// { id: 4, name: "ACTION" },
|
|
||||||
],
|
],
|
||||||
rows: team?.map((member, idx) => {
|
rows: team?.map((member, idx) => {
|
||||||
const roles = member.role.map((role) => roleMap[role]).join(",");
|
const roles = member.role.map((role) => roleMap[role]).join(",");
|
||||||
@@ -104,45 +102,19 @@ const TeamPanel = () => {
|
|||||||
},
|
},
|
||||||
{ id: idx + 1, data: member.email },
|
{ id: idx + 1, data: member.email },
|
||||||
{
|
{
|
||||||
// TODO - Add select dropdown
|
|
||||||
id: idx + 2,
|
id: idx + 2,
|
||||||
data: roles,
|
data: roles,
|
||||||
},
|
},
|
||||||
// FEATURE STILL TO BE IMPLEMENTED
|
|
||||||
// {
|
|
||||||
// // TODO - Add delete onClick
|
|
||||||
// id: idx + 3,
|
|
||||||
// data: (
|
|
||||||
// <IconButton
|
|
||||||
// aria-label="remove member"
|
|
||||||
// sx={{
|
|
||||||
// "&:focus": {
|
|
||||||
// outline: "none",
|
|
||||||
// },
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <Remove />
|
|
||||||
// </IconButton>
|
|
||||||
// ),
|
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
setTableData(data);
|
setTableData(data);
|
||||||
}, [members, filter]);
|
}, [filter, members, roleMap, theme]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsDisabled(Object.keys(errors).length !== 0 || toInvite.email === "");
|
setIsDisabled(Object.keys(errors).length !== 0 || toInvite.email === "");
|
||||||
}, [errors, toInvite.email]);
|
}, [errors, toInvite.email]);
|
||||||
|
|
||||||
// RENAME ORGANIZATION
|
|
||||||
// const toggleEdit = () => {
|
|
||||||
// setOrgStates((prev) => ({ ...prev, isEdit: !prev.isEdit }));
|
|
||||||
// };
|
|
||||||
// const handleRename = () => {};
|
|
||||||
|
|
||||||
// INVITE MEMBER
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const handleChange = (event) => {
|
const handleChange = (event) => {
|
||||||
@@ -226,58 +198,11 @@ const TeamPanel = () => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* FEATURE STILL TO BE IMPLEMENTED */}
|
|
||||||
{/* <Stack component="form">
|
|
||||||
<Box sx={{ alignSelf: "flex-start" }}>
|
|
||||||
<Typography component="h1">Organization name</Typography>
|
|
||||||
</Box>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="flex-end"
|
|
||||||
alignItems="center"
|
|
||||||
sx={{ height: "34px" }}
|
|
||||||
>
|
|
||||||
<TextField
|
|
||||||
value={orgStates.name}
|
|
||||||
onChange={(event) =>
|
|
||||||
setOrgStates((prev) => ({
|
|
||||||
...prev,
|
|
||||||
name: event.target.value,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
disabled={!orgStates.isEdit}
|
|
||||||
sx={{
|
|
||||||
color: theme.palette.otherColors.bluishGray,
|
|
||||||
"& .Mui-disabled": {
|
|
||||||
WebkitTextFillColor: "initial !important",
|
|
||||||
},
|
|
||||||
"& .Mui-disabled fieldset": {
|
|
||||||
borderColor: "transparent !important",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
inputProps={{
|
|
||||||
sx: { textAlign: "end", padding: theme.spacing(4) },
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
level={orgStates.isEdit ? "secondary" : "tertiary"}
|
|
||||||
label={orgStates.isEdit ? "Save" : ""}
|
|
||||||
img={!orgStates.isEdit ? <EditSvg /> : ""}
|
|
||||||
onClick={() => toggleEdit()}
|
|
||||||
sx={{
|
|
||||||
minWidth: 0,
|
|
||||||
paddingX: theme.spacing(4),
|
|
||||||
ml: orgStates.isEdit ? theme.spacing(4) : 0,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
<Divider aria-hidden="true" sx={{ marginY: theme.spacing(4) }} /> */}
|
|
||||||
<Stack
|
<Stack
|
||||||
component="form"
|
component="form"
|
||||||
noValidate
|
noValidate
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
gap={SPACING_GAP}
|
gap={SPACING_GAP}
|
||||||
>
|
>
|
||||||
<Typography component="h1">Team members</Typography>
|
<Typography component="h1">Team members</Typography>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -328,6 +253,7 @@ const TeamPanel = () => {
|
|||||||
paginated={false}
|
paginated={false}
|
||||||
reversed={true}
|
reversed={true}
|
||||||
table={"team"}
|
table={"team"}
|
||||||
|
emptyMessage={"There are no team members with this role"}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -341,7 +267,7 @@ const TeamPanel = () => {
|
|||||||
theme={theme}
|
theme={theme}
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
marginBottom={SPACING_GAP}
|
marginBottom={SPACING_GAP}
|
||||||
type="email"
|
type="email"
|
||||||
id="input-team-member"
|
id="input-team-member"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
|
|||||||
Reference in new issue
Block a user