Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to production #1716

Merged
merged 50 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b01caca
worked on checklist completion
OchiengPaul442 Nov 19, 2023
a7946b0
Merge remote-tracking branch 'upstream/staging' into analytics-home-page
OchiengPaul442 Nov 19, 2023
832336d
maintain state of selected nav tab
FaithDaka Nov 21, 2023
4584671
add month to start date on event card
FaithDaka Nov 21, 2023
4e7a85c
separation of split section types
FaithDaka Nov 21, 2023
559d660
change SEO metadata
FaithDaka Nov 21, 2023
4ceddc1
SEO metadata cleaning and loadspinner
FaithDaka Nov 21, 2023
9556ce5
SEO metadata cleaning and removing partner image borders
FaithDaka Nov 21, 2023
d653337
SEO metadata cleaning and styling
FaithDaka Nov 21, 2023
bd1bcc6
add month ro start data
FaithDaka Nov 21, 2023
6474052
styling changes
FaithDaka Nov 21, 2023
acff8d0
add key for country mapper function
FaithDaka Nov 21, 2023
93ff71e
event handling for partner logo
FaithDaka Nov 21, 2023
3dbf0e2
event handling for location_link
FaithDaka Nov 21, 2023
166530e
removed extraction of last four items from the array
OchiengPaul442 Nov 21, 2023
b3b5a90
Merge remote-tracking branch 'upstream/staging' into analytics-home-page
OchiengPaul442 Nov 21, 2023
9f0d6d1
auto save of the user checklist items
OchiengPaul442 Nov 21, 2023
f003bee
include logic for last and this quarter time period data
OchiengPaul442 Nov 21, 2023
388fd04
saves active organisation to preferences api
Codebmk Nov 21, 2023
750bcb2
Merge pull request #1709 from airqo-platform/analytics-home-page
Baalmart Nov 21, 2023
ac5399d
modified logic for set active organisation on login
Codebmk Nov 21, 2023
a545a58
Merge pull request #1714 from airqo-platform/WEB-cleanair-feedback
Baalmart Nov 21, 2023
5783a75
Update next platform staging image tag to stage-750bcb26-1700563894
github-actions[bot] Nov 21, 2023
68dd8c9
Merge remote-tracking branch 'upstream/staging' into analytics-data-e…
OchiengPaul442 Nov 21, 2023
28c7504
patch user preferences
FaithDaka Nov 21, 2023
17e2902
patch user preferences redux
FaithDaka Nov 21, 2023
387eb80
add spinner to selected organisations
Codebmk Nov 21, 2023
50831cb
use patch instead of update for user preferences
FaithDaka Nov 21, 2023
4caf7d1
UX changes
FaithDaka Nov 21, 2023
9dee663
Merge branch 'staging' into hotfix-last-org
Codebmk Nov 21, 2023
3b33cbd
tooltip
FaithDaka Nov 21, 2023
88c14a8
format text within button
Codebmk Nov 21, 2023
794d455
fix text view
Codebmk Nov 21, 2023
5758786
worked on customization of the data to export in pdf and csv
OchiengPaul442 Nov 21, 2023
365f40b
react-dnd
FaithDaka Nov 21, 2023
edeecdf
drag and drop selected locations
FaithDaka Nov 21, 2023
6921e10
Merge pull request #1718 from airqo-platform/hotfix-last-org
Baalmart Nov 21, 2023
056e5e2
Update next platform staging image tag to stage-6921e108-1700572394
github-actions[bot] Nov 21, 2023
c67884d
Merge pull request #1715 from airqo-platform/analytics-data-export
Baalmart Nov 21, 2023
98959bb
Update next platform staging image tag to stage-c67884de-1700573107
github-actions[bot] Nov 21, 2023
bc2eefb
Merge remote-tracking branch 'upstream/staging' into PLAT-customise-l…
OchiengPaul442 Nov 21, 2023
238b832
Merge pull request #1717 from airqo-platform/PLAT-customise-location-…
Baalmart Nov 21, 2023
7b62fd5
Update next platform staging image tag to stage-238b832d-1700574139
github-actions[bot] Nov 21, 2023
8bc55f9
worked on dropdown style issue
OchiengPaul442 Nov 21, 2023
3f20ad5
Merge pull request #1720 from airqo-platform/analytics-home-page
Baalmart Nov 21, 2023
93eea02
Update next platform staging image tag to stage-3f20ad5c-1700575930
github-actions[bot] Nov 21, 2023
d09471f
worked on customization issue
OchiengPaul442 Nov 21, 2023
97c8691
worked on print button not working
OchiengPaul442 Nov 21, 2023
d601c5d
Merge pull request #1721 from airqo-platform/analytics-home-page
Baalmart Nov 21, 2023
eaaf97d
Update next platform staging image tag to stage-d601c5d3-1700587995
github-actions[bot] Nov 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s/platform/values-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ replicaCount: 1
image:
repository: eu.gcr.io/airqo-250220/airqo-stage-next-platform
pullPolicy: Always
tag: stage-7542a4b5-1700216129
tag: stage-d601c5d3-1700587995
imagePullSecrets: []
nameOverride: ''
fullnameOverride: ''
Expand Down
1 change: 1 addition & 0 deletions platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"papaparse": "^5.4.1",
"postcss": "^8.4.16",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-calendar": "^4.0.0",
"react-country-flag": "^3.1.0",
"react-dom": "^18.2.0",
Expand Down
46 changes: 25 additions & 21 deletions platform/src/common/components/Calendar/CustomCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import ChevronDownIcon from '@/icons/Common/chevron_down.svg';
import { useSelector, useDispatch } from 'react-redux';
import { setChartDataRange } from '@/lib/store/services/charts/ChartSlice';
import Calendar from './Calendar';
import { set } from 'date-fns';
import {
differenceInDays,
isSameDay,
startOfMonth,
endOfMonth,
startOfQuarter,
endOfQuarter,
subMonths,
subDays,
} from 'date-fns';

const CustomCalendar = ({
initialStartDate,
Expand All @@ -24,27 +33,15 @@ const CustomCalendar = ({
});

const handleValueChange = (newValue) => {
const computeDaysBetweenDates = (startDate, endDate) => {
const oneDay = 24 * 60 * 60 * 1000;
return Math.floor(Math.abs((startDate.getTime() - endDate.getTime()) / oneDay));
};

const isSameDay = (date1, date2) =>
date1.getDate() === date2.getDate() &&
date1.getMonth() === date2.getMonth() &&
date1.getFullYear() === date2.getFullYear();

const handleDateChange = (newValue) => {
const startDate = new Date(newValue.start);
const endDate = new Date(newValue.end);

const today = new Date();

const yesterday = new Date(today);
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
const yesterday = subDays(today, 1);

const computedValue = computeDaysBetweenDates(startDate, endDate);
const computedValue = Math.abs(differenceInDays(startDate, endDate));

let label = `Last ${computedValue} days`;

Expand All @@ -64,19 +61,26 @@ const CustomCalendar = ({
label = 'Last year';
}

// include also for This month and Last month
const thisMonthStart = new Date(today.getFullYear(), today.getMonth(), 1);

const lastMonthStart = new Date(today.getFullYear(), today.getMonth() - 1, 1);

const lastMonthEnd = new Date(today.getFullYear(), today.getMonth(), 0);
const thisMonthStart = startOfMonth(today);
const lastMonthStart = startOfMonth(subMonths(today, 1));
const lastMonthEnd = endOfMonth(subMonths(today, 1));

if (isSameDay(startDate, thisMonthStart) && isSameDay(endDate, today)) {
label = 'This month';
} else if (isSameDay(startDate, lastMonthStart) && isSameDay(endDate, lastMonthEnd)) {
label = 'Last month';
}

const thisQuarterStart = startOfQuarter(today);
const lastQuarterStart = startOfQuarter(subMonths(today, 3));
const lastQuarterEnd = endOfQuarter(subMonths(today, 3));

if (isSameDay(startDate, thisQuarterStart) && isSameDay(endDate, today)) {
label = 'This quarter';
} else if (isSameDay(startDate, lastQuarterStart) && isSameDay(endDate, lastQuarterEnd)) {
label = 'Last quarter';
}

dispatch(setChartDataRange({ startDate, endDate, label }));
setValue(newValue);
};
Expand Down
64 changes: 36 additions & 28 deletions platform/src/common/components/Calendar/components/ShortCuts.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import {
startOfDay,
endOfDay,
Expand All @@ -7,41 +7,49 @@ import {
startOfYear,
endOfMonth,
endOfYear,
startOfQuarter,
endOfQuarter,
subQuarters,
} from 'date-fns';

const ShortCuts = ({ setSelectedRange }) => {
const timePeriods = [
{ label: 'Today', range: () => [startOfDay(new Date()), endOfDay(new Date())] },
{
label: 'Yesterday',
range: () => [startOfDay(subDays(new Date(), 1)), endOfDay(subDays(new Date(), 1))],
},
{
label: 'Last 7 days',
range: () => [startOfDay(subDays(new Date(), 7)), endOfDay(new Date())],
},
{
label: 'Last 30 days',
range: () => [startOfDay(subDays(new Date(), 30)), endOfDay(new Date())],
},
{
label: 'Last 90 days',
range: () => [startOfDay(subDays(new Date(), 90)), endOfDay(new Date())],
},
{ label: 'This month', range: () => [startOfMonth(new Date()), endOfMonth(new Date())] },
{ label: 'This year', range: () => [startOfYear(new Date()), endOfYear(new Date())] },
{
label: 'Last year',
range: () => [startOfYear(subDays(new Date(), 365)), endOfYear(subDays(new Date(), 365))],
},
];
const timePeriods = [
{ label: 'Today', range: () => [startOfDay(new Date()), endOfDay(new Date())] },
{
label: 'Yesterday',
range: () => [startOfDay(subDays(new Date(), 1)), endOfDay(subDays(new Date(), 1))],
},
{ label: 'Last 7 days', range: () => [startOfDay(subDays(new Date(), 7)), endOfDay(new Date())] },
{
label: 'Last 30 days',
range: () => [startOfDay(subDays(new Date(), 30)), endOfDay(new Date())],
},
{
label: 'Last 90 days',
range: () => [startOfDay(subDays(new Date(), 90)), endOfDay(new Date())],
},
{ label: 'This month', range: () => [startOfMonth(new Date()), endOfMonth(new Date())] },
{ label: 'This year', range: () => [startOfYear(new Date()), endOfYear(new Date())] },
{
label: 'Last year',
range: () => [startOfYear(subDays(new Date(), 365)), endOfYear(subDays(new Date(), 365))],
},
{ label: 'This quarter', range: () => [startOfQuarter(new Date()), endOfQuarter(new Date())] },
{
label: 'Last quarter',
range: () => [
startOfQuarter(subQuarters(new Date(), 1)),
endOfQuarter(subQuarters(new Date(), 1)),
],
},
];

const ShortCuts = ({ setSelectedRange }) => {
const handleShortcutClick = (range) => {
setSelectedRange({ start: range()[0], end: range()[1] });
};

return (
<div className='py-6 border-r border-gray-100 w-full md:w-[260px]'>
<div className='py-6 border-r border-gray-100 w-full md:w-[260px] max-h-[350px] overflow-y-auto scr'>
<ul className='text-sm leading-5 font-normal flex flex-wrap md:flex-col lg:flex-col'>
{timePeriods.map((period) => (
<li key={period.label}>
Expand Down
2 changes: 1 addition & 1 deletion platform/src/common/components/Charts/ChartContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const ChartContainer = ({ chartType, chartTitle, menuBtn, height, width, id, dow
<PrintReportModal
title='Share report'
btnText='Send'
ModalType='share'
shareModel={true}
open={openShare}
onClose={() => setOpenShare(false)}
format={shareFormat}
Expand Down
Loading