Skip to content

Commit e612f83

Browse files
authored
Merge pull request #1897 from airqo-platform/staging
move to production
2 parents d0e073b + 5b88899 commit e612f83

File tree

22 files changed

+859
-250
lines changed

22 files changed

+859
-250
lines changed

k8s/netmanager/values-prod.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
replicaCount: 2
22
image:
33
repository: eu.gcr.io/airqo-250220/airqo-platform-frontend
4-
tag: prod-ab2ae2ef-1709930981
4+
tag: prod-d0e073b4-1709981759
55
pullPolicy: Always
66
imagePullSecrets: []
77
nameOverride: ''

k8s/netmanager/values-stage.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
replicaCount: 2
22
image:
33
repository: eu.gcr.io/airqo-250220/airqo-stage-platform-frontend
4-
tag: stage-1943dfae-1709894381
4+
tag: stage-c37ecd9f-1710234424
55
pullPolicy: Always
66
imagePullSecrets: []
77
nameOverride: ''

k8s/platform/values-stage.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ replicaCount: 1
22
image:
33
repository: eu.gcr.io/airqo-250220/airqo-stage-next-platform
44
pullPolicy: Always
5-
tag: stage-7ac69339-1709894334
5+
tag: stage-1d591b59-1710234659
66
imagePullSecrets: []
77
nameOverride: ''
88
fullnameOverride: ''

netmanager/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Netmanager application
22

3-
This application is used for monitoring, device registration, location registration. Can be accessed here: https://staging-platform.airqo.net/ and https://platform.airqo.net/
3+
This application is used for monitoring , device registration, location registration. Can be accessed here: https://staging-platform.airqo.net/ and https://platform.airqo.net/
44

55
## Local Setup
66

platform/public/icons/arrow_left.svg

+5
Loading
3.35 KB
Loading

platform/src/common/components/Button/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ const Button = ({
1111
color,
1212
bgColor,
1313
Icon,
14+
paddingStyles = 'px-4 py-3',
1415
}) => {
15-
let buttonClass = `flex justify-center items-center px-4 py-3 rounded sm:gap-1 ${className}`;
16+
let buttonClass = `flex justify-center items-center ${paddingStyles} rounded sm:gap-1 ${className}`;
1617
let textColor = '';
1718
let backgroundColor = '';
1819
let border = '';
@@ -28,6 +29,8 @@ const Button = ({
2829
} else if (variant === 'disabled') {
2930
backgroundColor = 'bg-secondary-neutral-light-100';
3031
textColor = 'text-secondary-neutral-light-600';
32+
} else if (variant === 'primaryText') {
33+
textColor = 'text-blue-600';
3134
}
3235

3336
if (bgColor) {

platform/src/common/components/Calendar/Calendar.jsx

+94-45
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import {
33
format,
44
startOfMonth,
@@ -17,25 +17,45 @@ import Footer from './components/Footer';
1717
import ShortCuts from './components/ShortCuts';
1818
import CalendarHeader from './components/CalendarHeader';
1919

20-
const Calendar = ({ initialMonth1, initialMonth2, handleValueChange, closeDatePicker }) => {
20+
const Calendar = ({
21+
initialMonth1,
22+
initialMonth2,
23+
handleValueChange,
24+
closeDatePicker,
25+
showAsSingle = false,
26+
useRange = true,
27+
}) => {
2128
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
2229
const [selectedDays1, setSelectedDays1] = useState([]);
2330
const [selectedDays2, setSelectedDays2] = useState([]);
2431
const [month1, setMonth1] = useState(initialMonth1);
2532
const [month2, setMonth2] = useState(initialMonth2);
2633
const [selectedRange, setSelectedRange] = useState({ start: null, end: null });
2734

35+
useEffect(() => {
36+
if (!useRange && showAsSingle) {
37+
setSelectedRange({ start: new Date(), end: null });
38+
setSelectedDays1((prev) => [...prev, new Date()]);
39+
}
40+
}, [useRange, showAsSingle]);
41+
2842
const handleDayClick = (day, setSelectedDays) => {
29-
setSelectedDays((prev) => [...prev, day]);
30-
if (!selectedRange.start) {
43+
if (!useRange) {
44+
const newDay = new Date(month2.getFullYear(), month2.getMonth(), day.getDate());
45+
setSelectedDays((prev) => [...prev, newDay]);
46+
setSelectedRange({ start: newDay, end: null });
47+
} else if (!selectedRange.start) {
48+
setSelectedDays((prev) => [...prev, day]);
3149
setSelectedRange({ start: day, end: null });
3250
} else if (!selectedRange.end) {
51+
setSelectedDays((prev) => [...prev, day]);
3352
if (isBefore(day, selectedRange.start)) {
3453
setSelectedRange({ start: day, end: selectedRange.start });
3554
} else {
3655
setSelectedRange({ start: selectedRange.start, end: day });
3756
}
3857
} else {
58+
setSelectedDays([day]);
3959
setSelectedRange({ start: day, end: null });
4060
}
4161
};
@@ -75,13 +95,16 @@ const Calendar = ({ initialMonth1, initialMonth2, handleValueChange, closeDatePi
7595
(selectedRange.end && isSameDay(day, selectedRange.end)) || isEndOfWeek
7696
? 'rounded-r-full'
7797
: ''
78-
}`}>
98+
}`}
99+
>
79100
<button
80101
onClick={() => handleDayClick(day, setSelectedDays)}
81102
className={`
82103
w-10 h-10 text-sm flex justify-center items-center
83104
${
84-
selectedDays.includes(day) || isStartOrEndDay
105+
selectedDays.includes(day) ||
106+
isStartOrEndDay ||
107+
(showAsSingle && !useRange && isSameDay(day, selectedRange.start))
85108
? 'bg-blue-600 dark:bg-blue-500 rounded-full text-red-50 hover:text-red-50'
86109
: ''
87110
}
@@ -94,7 +117,8 @@ const Calendar = ({ initialMonth1, initialMonth2, handleValueChange, closeDatePi
94117
}
95118
hover:border-blue-600 hover:text-blue-600 hover:rounded-full hover:border dark:hover:border-gray-500 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600
96119
disabled:text-gray-300 disabled:pointer-events-none md:w-14 lg:w-16
97-
`}>
120+
`}
121+
>
98122
{format(day, 'd')}
99123
</button>
100124
</div>
@@ -103,54 +127,46 @@ const Calendar = ({ initialMonth1, initialMonth2, handleValueChange, closeDatePi
103127
};
104128

105129
return (
106-
<div className='flex flex-col items-center justify-center w-auto bg-none md:flex-row mb-10'>
107-
<div className='z-50 flex flex-col border border-gray-100 bg-white shadow-lg rounded-xl max-w-full min-w-[260px] md:min-w-[660px] lg:min-w-[800px]'>
130+
<div
131+
className={
132+
!showAsSingle && useRange
133+
? 'flex flex-col items-center justify-center w-full bg-none md:flex-row mb-10 z-[900]'
134+
: ''
135+
}
136+
>
137+
<div
138+
className={`z-[900] border border-gray-100 bg-white shadow-lg rounded-xl ${
139+
!showAsSingle && useRange
140+
? 'max-w-full min-w-[260px] md:min-w-[660px] lg:min-w-[800px]'
141+
: 'max-w-[328px] w-full min-w-40'
142+
}`}
143+
>
108144
<div className='flex flex-col'>
109145
<div className='divide-x flex flex-col md:flex-row lg:flex-row'>
110146
{/* shortcut section */}
111-
<ShortCuts setSelectedRange={setSelectedRange} />
147+
{!showAsSingle && useRange && <ShortCuts setSelectedRange={setSelectedRange} />}
112148

113149
{/* calendar section one */}
114150
<div className='flex flex-col px-6 pt-5 pb-6'>
115151
<CalendarHeader
116-
month={format(month1, 'MMMM yyyy')}
117-
onNext={() => {
118-
const nextMonth = addMonths(month1, 1);
119-
if (!isSameMonth(nextMonth, month2)) {
120-
setMonth1(nextMonth);
121-
}
122-
}}
123-
onPrev={() => {
124-
const prevMonth = subMonths(month1, 1);
125-
if (!isSameMonth(prevMonth, month2)) {
126-
setMonth1(prevMonth);
127-
}
128-
}}
129-
/>
130-
<div className='grid grid-cols-7 text-xs text-center text-gray-900 space-y-[1px]'>
131-
{daysOfWeek.map((day) => (
132-
<span
133-
key={day}
134-
className='flex text-gray-600 items-center justify-center w-10 h-10 font-semibold rounded-lg'>
135-
{day}
136-
</span>
137-
))}
138-
{renderDays(month1, selectedDays1, setSelectedDays1)}
139-
</div>
140-
</div>
141-
{/* calendar section two */}
142-
<div className='flex flex-col px-6 pt-5 pb-6'>
143-
<CalendarHeader
144-
month={format(month2, 'MMMM yyyy')}
152+
month={format(useRange ? month1 : month2, 'MMMM yyyy')}
145153
onNext={() => {
146-
const nextMonth = addMonths(month2, 1);
147-
if (!isSameMonth(nextMonth, month1)) {
154+
const nextMonth = addMonths(useRange ? month1 : month2, 1);
155+
if (useRange) {
156+
if (!isSameMonth(nextMonth, month2)) {
157+
setMonth1(nextMonth);
158+
}
159+
} else {
148160
setMonth2(nextMonth);
149161
}
150162
}}
151163
onPrev={() => {
152-
const prevMonth = subMonths(month2, 1);
153-
if (!isSameMonth(prevMonth, month1)) {
164+
const prevMonth = subMonths(useRange ? month1 : month2, 1);
165+
if (useRange) {
166+
if (!isSameMonth(prevMonth, month2)) {
167+
setMonth1(prevMonth);
168+
}
169+
} else {
154170
setMonth2(prevMonth);
155171
}
156172
}}
@@ -159,16 +175,49 @@ const Calendar = ({ initialMonth1, initialMonth2, handleValueChange, closeDatePi
159175
{daysOfWeek.map((day) => (
160176
<span
161177
key={day}
162-
className='flex text-gray-600 items-center justify-center w-10 h-10 font-semibold rounded-lg'>
178+
className='flex text-gray-600 items-center justify-center w-10 h-10 font-semibold rounded-lg'
179+
>
163180
{day}
164181
</span>
165182
))}
166-
{renderDays(month2, selectedDays2, setSelectedDays2)}
183+
{renderDays(month1, selectedDays1, setSelectedDays1, selectedRange)}
167184
</div>
168185
</div>
186+
{/* calendar section two */}
187+
{useRange && (
188+
<div className='flex flex-col px-6 pt-5 pb-6'>
189+
<CalendarHeader
190+
month={format(month2, 'MMMM yyyy')}
191+
onNext={() => {
192+
const nextMonth = addMonths(month2, 1);
193+
if (!isSameMonth(nextMonth, month1)) {
194+
setMonth2(nextMonth);
195+
}
196+
}}
197+
onPrev={() => {
198+
const prevMonth = subMonths(month2, 1);
199+
if (!isSameMonth(prevMonth, month1)) {
200+
setMonth2(prevMonth);
201+
}
202+
}}
203+
/>
204+
<div className='grid grid-cols-7 text-xs text-center text-gray-900 space-y-[1px]'>
205+
{daysOfWeek.map((day) => (
206+
<span
207+
key={day}
208+
className='flex text-gray-600 items-center justify-center w-10 h-10 font-semibold rounded-lg'
209+
>
210+
{day}
211+
</span>
212+
))}
213+
{renderDays(month2, selectedDays2, setSelectedDays2)}
214+
</div>
215+
</div>
216+
)}
169217
</div>
170218
{/* footer section */}
171219
<Footer
220+
useRange={useRange}
172221
selectedRange={selectedRange}
173222
setSelectedRange={setSelectedRange}
174223
handleValueChange={handleValueChange}

platform/src/common/components/Calendar/CustomCalendar.jsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const CustomCalendar = ({
110110
useEffect(() => {
111111
if (openDatePicker) {
112112
document.addEventListener('click', handleClickOutside);
113+
localStorage.setItem('collapsed', true);
113114
} else {
114115
document.removeEventListener('click', handleClickOutside);
115116
}
@@ -124,17 +125,23 @@ const CustomCalendar = ({
124125
<button
125126
onClick={handleClick}
126127
type='button'
127-
className='relative border border-grey-750 rounded flex items-center justify-between gap-2 px-4 py-3'>
128+
className='relative border border-grey-750 rounded flex items-center justify-between gap-2 px-4 py-3'
129+
>
128130
{Icon ? <Icon /> : <CalendarIcon />}
129131
<span className='hidden sm:inline-block text-sm font-medium'>
130132
{chartData.chartDataRange.label}
131133
</span>
132134
{dropdown && <ChevronDownIcon />}
133135
</button>
134-
<div className={`absolute top-[50px] ${className} ${openDatePicker ? 'block' : 'hidden'}`}>
136+
<div
137+
className={`absolute top-[50px] z-[900] ${className} ${
138+
openDatePicker ? 'block' : 'hidden'
139+
}`}
140+
>
135141
<DatePickerHiddenInput />
136142
</div>
137143
</div>
138144
);
139145
};
146+
140147
export default CustomCalendar;

platform/src/common/components/Calendar/components/CalendarHeader.jsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ const CalendarHeader = ({ month, onNext, onPrev }) => {
44
return (
55
<div className='flex items-center justify-between'>
66
<button
7-
className='flex items-center justify-center p-2 hover:bg-gray-50 border border-gray-300 rounded-md'
8-
onClick={onPrev}>
7+
className='flex items-center justify-center p-2 w-10 h-10 hover:bg-gray-50 border border-gray-300 rounded-xl'
8+
onClick={onPrev}
9+
>
910
<svg className='w-6 h-6 text-gray-500 stroke-current' fill='none'>
1011
<path
1112
d='M13.25 8.75L9.75 12l3.5 3.25'
@@ -17,8 +18,9 @@ const CalendarHeader = ({ month, onNext, onPrev }) => {
1718
</button>
1819
<div className='text-sm text-gray-700 font-semibold'>{month}</div>
1920
<button
20-
className='flex items-center justify-center p-2 hover:bg-gray-50 border border-gray-300 rounded-md'
21-
onClick={onNext}>
21+
className='flex items-center justify-center p-2 hover:bg-gray-50 border border-gray-300 rounded-xl w-10 h-10'
22+
onClick={onNext}
23+
>
2224
<svg className='w-6 h-6 text-gray-500 stroke-current' fill='none'>
2325
<path
2426
d='M10.75 8.75l3.5 3.25-3.5 3.25'

0 commit comments

Comments
 (0)