📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
some improvements
Blue Mouse363c1ed373d4
diff --git a/public/locales/en.json b/public/locales/en.jsonindex 82b9f4e32..2f9049407 100644--- a/public/locales/en.json+++ b/public/locales/en.json@@ -21,7 +21,8 @@"generate2FAError": "Error occurred while generating 2FA code","integrationRemovalError": "Error occurred while removing the integration","enterACorrectNumber": "Please enter a correct number",- "numberCantBeNegative": "The number cannot be negative"+ "numberCantBeNegative": "The number cannot be negative",+ "forecastNumberCantBeBigger": "The forecast number cannot be bigger than {{max}} for the selected frequency"},"common": {"features": "Features",diff --git a/src/modals/Forecast.jsx b/src/modals/Forecast.jsxindex 1184c8533..5f927842c 100644--- a/src/modals/Forecast.jsx+++ b/src/modals/Forecast.jsx@@ -5,11 +5,12 @@ import _isNaN from 'lodash/isNaN'import Modal from 'ui/Modal'import Input from 'ui/Input'+import { FORECAST_MAX_MAPPING } from 'redux/constants'const DEFAULT_PERIOD = 3const Forecast = ({- onClose, onSubmit, isOpened, activeTB,+ onClose, onSubmit, isOpened, activeTB, tb,}) => {const { t } = useTranslation('common')const [period, setPeriod] = useState(DEFAULT_PERIOD)@@ -35,6 +36,13 @@ const Forecast = ({return}+ if (processedPeriod > FORECAST_MAX_MAPPING[tb]) {+ setError(t('apiNotifications.forecastNumberCantBeBigger', {+ max: FORECAST_MAX_MAPPING[tb],+ }))+ return+ }+onSubmit(processedPeriod)}@@ -80,6 +88,7 @@ Forecast.propTypes = {isOpened: PropTypes.bool.isRequired,onSubmit: PropTypes.func.isRequired,activeTB: PropTypes.string.isRequired,+ tb: PropTypes.string.isRequired,}export default Forecastdiff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsxindex f6b9c7548..0619b6adc 100644--- a/src/pages/Project/View/ViewProject.jsx+++ b/src/pages/Project/View/ViewProject.jsx@@ -632,7 +632,6 @@ const ViewProject = ({return}- console.log(activePeriod)// return error if periodToForecast is less than 1 or greater than periodif (periodToForecast < 1 || periodToForecast > activePeriod.daysCount) {setDataLoading(false)@@ -1721,6 +1720,7 @@ const ViewProject = ({onClose={() => setIsForecastOpened(false)}onSubmit={onForecastSubmit}activeTB={t(`project.${timeBucket}`)}+ tb={timeBucket}/></Title>)diff --git a/src/redux/constants/index.js b/src/redux/constants/index.jsindex abb158d7b..c61501f83 100644--- a/src/redux/constants/index.js+++ b/src/redux/constants/index.js@@ -13,54 +13,53 @@ const getCustomLabel = (dates, t) => {return t('project.custom')}+export const FORECAST_MAX_MAPPING = {+ hour: 72,+ day: 21,+ week: 21,+ month: 12,+}+export const tbPeriodPairs = (t, tbs, dates) => [{label: t('project.today'),period: 'today',tbs: ['hour'],access: 'free',- daysCount: 1,}, {label: t('project.yesterday'),period: 'yesterday',tbs: ['hour'],access: 'free',- daysCount: 1,}, {label: t('project.last24h'),period: '1d',tbs: ['hour'],access: 'free',- daysCount: 1,}, {label: t('project.lastXDays', { amount: 7 }),period: '7d',tbs: ['hour', 'day'],access: 'free',- daysCount: 7,}, {label: t('project.lastXWeeks', { amount: 4 }),period: '4w',tbs: ['day', 'week'],access: 'free',- daysCount: 28,}, {label: t('project.lastXMonths', { amount: 3 }),period: '3M',tbs: ['week', 'month'],access: 'free',- daysCount: 90,}, {label: t('project.lastXMonths', { amount: 12 }),period: '12M',tbs: ['week', 'month'],access: 'paid',- daysCount: 365,}, {label: t('project.lastXMonths', { amount: 24 }),period: '24M',tbs: ['month'],access: 'paid',- daysCount: 730,}, {label: getCustomLabel(dates, t),dropdownLabel: t('project.custom'),@@ -68,7 +67,6 @@ export const tbPeriodPairs = (t, tbs, dates) => [{period: 'custom',tbs: tbs || ['custom'],access: 'free',- daysCount: dates ? Math.ceil((dates[1] - dates[0]) / (1000 * 60 * 60 * 24)) : 0,}]// the maximum amount of months user can go back when picking a date in flat picker (project view)diff --git a/src/redux/reducers/ui/cache.js b/src/redux/reducers/ui/cache.jsindex 3598980b8..4ee4a80ec 100644--- a/src/redux/reducers/ui/cache.js+++ b/src/redux/reducers/ui/cache.js@@ -2,7 +2,7 @@ import { types } from 'redux/actions/ui/types'import _filter from 'lodash/filter'import _isEmpty from 'lodash/isEmpty'-import { getProjectCacheKey, getProjectForcastCacheKey, LS_VIEW_PREFS_SETTING } from 'redux/constants'+import { getProjectCacheKey, LS_VIEW_PREFS_SETTING } from 'redux/constants'export const getInitialViewPrefs = () => {if (typeof window !== 'undefined' && window.localStorage) {