Skip to content

Commit

Permalink
backend integrations and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsay committed Jun 22, 2023
1 parent de67d44 commit 568d2fd
Show file tree
Hide file tree
Showing 42 changed files with 1,548 additions and 1,657 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function AuthenticatedRoutes({ children, roles }) {
if (authError) {
clearInterval(refreshInterval);
logout();
navigate("/login");
navigate("/");
}
return () => {
clearInterval(refreshInterval);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { ReactComponent as DeleteIcon } from "@/assets/icons/delete-icon-green.s
import { ReactComponent as MessageIcon } from "@/assets/icons/comment-icon.svg";
import { showModal } from "@/redux/Modal/ModalSlice";
import { useNavigate } from "react-router-dom";
import profileImage from "@/assets/images/sample-profile-image.svg";

const MiniProfile = ({ data, type, onClick }) => {
const dispatch = useDispatch();
const navigate = useNavigate();
Expand All @@ -28,7 +30,12 @@ const MiniProfile = ({ data, type, onClick }) => {
return (
<div className={cx(styles.miniProfileContainer, type === "grid" ? styles.gridView : styles.listView)}>
<div className={cx(styles.imageDiv, "flexRow")}>
<img onClick={onClick} className={cx(styles.avatar)} src={data?.image} alt='user-image' />
<img
onClick={onClick}
className={cx(styles.avatar)}
src={data?.profileImage ? data?.profileImage : profileImage}
alt='user-image'
/>
<div className={cx(styles.btnGroup, "flexCol")}>
<MessageIcon onClick={() => navigate(`/dashboard/messages/chats/${data?.id}`)} className={cx(styles.icon)} />
<DeleteIcon onClick={() => handleDelete(data?.id)} className={cx(styles.icon)} />
Expand All @@ -37,13 +44,13 @@ const MiniProfile = ({ data, type, onClick }) => {
<div className={cx(styles.userInfo, "flexRow")}>
<div onClick={onClick} className={cx(styles.leftSection)}>
<div className={cx(styles.groupOne, "flexCol")}>
<h5 className={cx(styles.name)}>{data?.name}</h5>
<p className={cx(styles.designation)}>{data?.designation}</p>
<h5 className={cx(styles.name)}>{`${data?.firstName} ${data?.lastName}`}</h5>
<p className={cx(styles.designation)}>{data?.headline || "Program Assistant, Andela"}</p>
</div>

<div className={cx(styles.positionTags, "flexRow")}>
{data?.positionTags &&
data?.positionTags.map((tag, index) => (
{data?.roles &&
data?.roles.map((tag, index) => (
<span key={index} className={cx(styles.tag)}>
{tag}
</span>
Expand Down
8 changes: 4 additions & 4 deletions frontend/mms-Admin/src/components/Filter/Filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const Filter = ({ selectedFilterItem, dropdownItems, closeSearchInput, closeSele
>
{dropdownItems &&
dropdownItems.map((item, index) => (
<option key={index} value={item.name}>
{item.name}
<option key={index} value={item.value}>
{item.label}
</option>
))}
</select>
Expand All @@ -72,9 +72,9 @@ const Filter = ({ selectedFilterItem, dropdownItems, closeSearchInput, closeSele
<div
key={index}
className={cx(styles.dropdownItem, "flexRow-align-center")}
onClick={() => handleCustomDropdownClick(item.name)}
onClick={() => handleCustomDropdownClick(item.value)}
>
<span className={cx(styles.item)}>{item.name}</span>
<span className={cx(styles.item)}>{item.label}</span>
</div>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,33 @@ import styles from "./ShareReport.module.scss";
import modalImage from "@/assets/images/share-report-modal-image.svg";
import Button from "@/components/Button/Button";
import { hideModal } from "@/redux/Modal/ModalSlice";
import { toast } from "react-toastify";

function ShareReport({ show, size, modalName }) {
const dispatch = useDispatch();
const modalData = useSelector((state) => state.modal.modalData);

const handleClick = () => {
const handleClose = () => {
dispatch(hideModal({ name: "taskDeleteNotification" }));
};

const handleShare = () => {
if (navigator.share) {
navigator
.share({
title: "Report",
text: "Report Details",
url: window.location.href
})
.then(() => {
handleClose();
})
.catch(() => toast.warn("An Error occured. Please try again"));
} else {
toast.warn("Web Share API not supported.");
}
};

return (
<ModalContainer show={show} size={size} modalName={modalName}>
<div className={cx(styles.modalWrapper, "flexCol")}>
Expand All @@ -29,8 +47,8 @@ function ShareReport({ show, size, modalName }) {

<div className={cx(styles.modalFooter)}>
<div className={cx(styles.btnDiv, "flexRow-fully-centered")}>
<Button onClick={handleClick} title='Cancel' type='secondary' />
<Button onClick={handleClick} title='Open Email App' />
<Button onClick={handleClose} title='Cancel' type='secondary' />
<Button onClick={handleShare} title='Open Email App' />
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 568d2fd

Please sign in to comment.