diff --git a/package-lock.json b/package-lock.json index 172e4d9a0..f859dc9b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "apollo-upload-client": "^17.0.0", "autoprefixer": "^10.4.14", "axios": "^1.6.1", - "chart.js": "^4.3.2", + "chart.js": "^4.4.6", "cleave.js": "^1.6.0", "cloudinary": "^1.39.0", "cloudinary-react": "^1.8.1", @@ -85,7 +85,7 @@ "react-tooltip": "^4.5.1", "react-widgets": "^5.8.4", "reactjs-popup": "^2.0.5", - "recharts": "^2.7.2", + "recharts": "^2.13.3", "sheetjs-style": "^0.15.8", "sinon": "^14.0.2", "subscriptions-transport-ws": "^0.11.0", @@ -4043,7 +4043,8 @@ "node_modules/@kurkle/color": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", - "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==", + "license": "MIT" }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.11", @@ -7197,9 +7198,10 @@ } }, "node_modules/chart.js": { - "version": "4.4.4", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.4.tgz", - "integrity": "sha512-emICKGBABnxhMjUjlYRR12PmOXhJ2eJjEHL2/dZlWjxRAZT1D8xplLFq5M0tMQK8ja+wBS/tuVEJB5C6r7VxJA==", + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.6.tgz", + "integrity": "sha512-8Y406zevUPbbIBA/HRk33khEmQPk5+cxeflWE/2rx1NJsjVWMPw/9mSP9rxHP5eqi6LNoPBVMfZHxbwLSgldYA==", + "license": "MIT", "dependencies": { "@kurkle/color": "^0.3.0" }, @@ -19698,6 +19700,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/react-chartjs-2/-/react-chartjs-2-5.2.0.tgz", "integrity": "sha512-98iN5aguJyVSxp5U3CblRLH67J8gkfyGNbiK3c+l1QI/G4irHMPQw44aEPmjVag+YKTyQ260NcF82GTQ3bdscA==", + "license": "MIT", "peerDependencies": { "chart.js": "^4.1.1", "react": "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -20276,14 +20279,15 @@ } }, "node_modules/recharts": { - "version": "2.12.7", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.12.7.tgz", - "integrity": "sha512-hlLJMhPQfv4/3NBSAyq3gzGg4h2v69RJh6KU7b3pXYNNAELs9kEoXOjbkxdXpALqKBoVmVptGfLpxdaVYqjmXQ==", + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.13.3.tgz", + "integrity": "sha512-YDZ9dOfK9t3ycwxgKbrnDlRC4BHdjlY73fet3a0C1+qGMjXVZe6+VXmpOIIhzkje5MMEL8AN4hLIe4AMskBzlA==", + "license": "MIT", "dependencies": { "clsx": "^2.0.0", "eventemitter3": "^4.0.1", "lodash": "^4.17.21", - "react-is": "^16.10.2", + "react-is": "^18.3.1", "react-smooth": "^4.0.0", "recharts-scale": "^0.4.4", "tiny-invariant": "^1.3.1", @@ -20310,11 +20314,6 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, - "node_modules/recharts/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", diff --git a/package.json b/package.json index a053d4731..ca823aa29 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "apollo-upload-client": "^17.0.0", "autoprefixer": "^10.4.14", "axios": "^1.6.1", - "chart.js": "^4.3.2", + "chart.js": "^4.4.6", "cleave.js": "^1.6.0", "cloudinary": "^1.39.0", "cloudinary-react": "^1.8.1", @@ -107,7 +107,7 @@ "react-tooltip": "^4.5.1", "react-widgets": "^5.8.4", "reactjs-popup": "^2.0.5", - "recharts": "^2.7.2", + "recharts": "^2.13.3", "sheetjs-style": "^0.15.8", "sinon": "^14.0.2", "subscriptions-transport-ws": "^0.11.0", diff --git a/src/assets/dash-event-icon.svg b/src/assets/dash-event-icon.svg new file mode 100644 index 000000000..a7d30c74d --- /dev/null +++ b/src/assets/dash-event-icon.svg @@ -0,0 +1,3 @@ + diff --git a/src/assets/multiple-users.svg b/src/assets/multiple-users.svg new file mode 100644 index 000000000..8b94610db --- /dev/null +++ b/src/assets/multiple-users.svg @@ -0,0 +1,3 @@ + diff --git a/src/assets/no-event.png b/src/assets/no-event.png new file mode 100644 index 000000000..5e251d22f Binary files /dev/null and b/src/assets/no-event.png differ diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index 00238a8fc..d77ea4b3b 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -13,7 +13,7 @@ import { useLazyQuery, useMutation } from '@apollo/client'; import { ADD_EVENT, EDIT_EVENT, CANCEL_EVENT } from '../Mutations/event'; import { GET_EVENTS } from '../queries/event.queries'; import moment from 'moment'; -import CalendarSkeleton from '../Skeletons/Calender.skeleton' +import CalendarSkeleton from '../Skeletons/Calender.skeleton'; import { toast } from 'react-toastify'; import EventGuestList from './EventGuestList'; /* istanbul ignore next */ @@ -48,12 +48,12 @@ const Calendar = () => { fetchPolicy: 'network-only', }); } catch (error: any) { - toast.error(error.message) + toast.error(error.message); } }; useEffect(() => { - fetchData() + fetchData(); }, []); const renderEvent = (e: EventContentArg) => ( @@ -91,10 +91,10 @@ const Calendar = () => { authToken: localStorage.getItem('auth_token'), orgToken: localStorage.getItem('orgToken'), invitees: selectedGuests, - } + }, }) .then(() => { - fetchData() + fetchData(); toast.success('Event has been added!'); // {{ edit_1 }} setNewEvent({ title: '', @@ -104,11 +104,10 @@ const Calendar = () => { timeToStart: '', timeToEnd: '', }); - setSelectedGuests([]) + setSelectedGuests([]); setTimeout(() => { setAddEventModel(false); }, 1000); - }) .catch((error) => { toast.error(error.message); // Handle error if needed @@ -124,8 +123,8 @@ const Calendar = () => { }; //edit section - const [editEvent] = useMutation(EDIT_EVENT) - const [editEventModel, setEditEventModel] = useState(false) + const [editEvent] = useMutation(EDIT_EVENT); + const [editEventModel, setEditEventModel] = useState(false); const [editedEvent, setEditedEvent] = useState({ id: '', title: '', @@ -137,9 +136,12 @@ const Calendar = () => { }); const handleEditEventModel = async (e: EventInput) => { - const event = data?.getEvents.find((event: any)=> event.id === e.event?.id) + const event = data?.getEvents.find( + (event: any) => event.id === e.event?.id, + ); if (event) { - if(event.user !== JSON.parse(localStorage.getItem('auth')!).userId) return + if (event.user !== JSON.parse(localStorage.getItem('auth')!).userId) + return; setEditedEvent((prev) => { return { ...prev, @@ -150,16 +152,16 @@ const Calendar = () => { hostName: event.hostName, timeToStart: event.timeToStart, timeToEnd: event.timeToEnd, - } - }) - setSelectedGuests(event.invitees.map((invitee: any) => invitee.email)) + }; + }); + setSelectedGuests(event.invitees.map((invitee: any) => invitee.email)); setEditEventModel(true); } }; const handleEditEvent = async (e: any) => { - e.preventDefault() - const { id, ...rest } = editedEvent + e.preventDefault(); + const { id, ...rest } = editedEvent; editEvent({ variables: { eventId: id, @@ -170,7 +172,7 @@ const Calendar = () => { }, }) .then(() => { - fetchData() + fetchData(); toast.success('Event has been updated!'); setEditedEvent({ id: '', @@ -181,7 +183,7 @@ const Calendar = () => { timeToStart: '', timeToEnd: '', }); - setSelectedGuests([]) + setSelectedGuests([]); setTimeout(() => { setEditEventModel(false); }, 1000); @@ -189,34 +191,34 @@ const Calendar = () => { .catch((error) => { toast.error(error.message); // Handle error if needed }); - } + }; const removeEditModel = (e: any) => { - e.preventDefault() - setSelectedGuests([]) - setEditEventModel(!editEventModel) - } + e.preventDefault(); + setSelectedGuests([]); + setEditEventModel(!editEventModel); + }; // delete section - const [showDeleteModal, setShowDeleteModal] = useState(false) - const [cancelEvent] = useMutation(CANCEL_EVENT) + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [cancelEvent] = useMutation(CANCEL_EVENT); const handleDeleteConfirmation = (e: any) => { - e.preventDefault() - setShowDeleteModal(prev => !prev) - } + e.preventDefault(); + setShowDeleteModal((prev) => !prev); + }; const handleDelete = async (e: any) => { - e.preventDefault() + e.preventDefault(); cancelEvent({ variables: { eventId: editedEvent.id, - authToken: localStorage.getItem('auth_token') + authToken: localStorage.getItem('auth_token'), }, }) .then(() => { - fetchData() - toast.success('Event cancelled successfully') + fetchData(); + toast.success('Event cancelled successfully'); setEditedEvent({ id: '', title: '', @@ -226,23 +228,24 @@ const Calendar = () => { timeToStart: '', timeToEnd: '', }); - setSelectedGuests([]) + setSelectedGuests([]); setTimeout(() => { - setShowDeleteModal(false) + setShowDeleteModal(false); setEditEventModel(false); }, 1000); - } - ) - .catch(err => { - toast.error(err.message) }) - } + .catch((err) => { + toast.error(err.message); + }); + }; return ( <>
Please confirm the cancellation of event {editedEvent.title}.
++ Please confirm the cancellation of event{' '} + {editedEvent.title}. +
+ {allOrganizationData.length.toString().padStart(2, '0') || + '00'} +
++ USERS +
++ Name + | ++ Admin-Email + | ++ Status + | +
---|---|---|
+ {org.name} + | ++ { + // eslint-disable-next-line no-nested-ternary + org.admin + ? // eslint-disable-next-line no-nested-ternary + org.admin.email.length > 20 + ? window.innerWidth > 530 + ? `${org.admin.email.slice(0, 22)}..` + : `${org.admin.email.slice(0, 16)}..` + : org.admin.email + : '-' + } + | +
+ |
+
+
+ {event.timeToStart} + {event.timeToEnd && ` - ${event.timeToEnd}`} +
++ + {format(new Date(event.start), 'dd, MMM yyyy')} + + - + + {format(new Date(event.end), 'dd, MMM yyyy')} + +
++ Oops! No upcoming events scheduled +
+
+
+
+
+ {`${org.monthPercentage.toPrecision(2)}%`} +
+ +{org.organization.name}
+{org.loginsCount}
++ (Recent login location) +
+ )} +- Somethingnewiscoming -
-+ Oops! No upcoming events scheduled +
+