From 8196e23ed8cbc68a180f969ca82de08175e8d9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B0=D1=85=D0=B8=D1=80=D0=B5=D0=B2?= Date: Fri, 3 May 2024 00:54:10 +0300 Subject: [PATCH] update --- package.json | 2 +- .../HoursChart/components/Columns.tsx | 2 +- .../HoursChart/components/Header.tsx | 8 +- .../HoursChart/components/Legend.tsx | 20 +-- .../components/HoursChart/index.module.scss | 132 +++++++------- src/ts/components/HoursChart/index.tsx | 10 +- .../HoursChart/styles/legend.module.scss | 2 +- .../Recommendations/styles/index.module.scss | 2 +- src/ts/components/Table/components/Header.tsx | 4 +- .../Table/styles/header.module.scss | 45 +++-- src/ts/helpers/DataGrip/components/author.ts | 3 +- src/ts/helpers/RPC.ts | 26 ++- .../Authorization/components/Success.tsx | 167 ++++++++++-------- src/ts/pages/Person/components/Month.tsx | 1 - src/ts/pages/Person/components/Tasks.tsx | 3 - src/ts/pages/Person/components/Tempo.tsx | 1 - src/ts/pages/Person/components/Week.tsx | 1 - .../Settings/helpers/getEmptySettings.ts | 2 +- src/ts/pages/Team/styles/filters.module.scss | 2 + 19 files changed, 231 insertions(+), 202 deletions(-) diff --git a/package.json b/package.json index f78732b..b00c506 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "build-rename-css": "mv build/static/css/main.*.css build/static/index.css && rm -rf build/static/css", "build-rename-html": "rm build/index.html && mv build/local.html build/index.html", "dev": "set PORT=3006 && react-app-rewired start", - "build": "react-scripts build && npm run build-rename", + "build": "react-scripts build", "build-local": "set REACT_APP_TYPE=local && react-scripts build && npm run build-rename && npm run build-rename-html", "test": "react-scripts test", "eject": "react-scripts eject", diff --git a/src/ts/components/HoursChart/components/Columns.tsx b/src/ts/components/HoursChart/components/Columns.tsx index e9f0ea2..98f333b 100644 --- a/src/ts/components/HoursChart/components/Columns.tsx +++ b/src/ts/components/HoursChart/components/Columns.tsx @@ -22,7 +22,7 @@ function Columns({ week, day, max }: IColumnsProps): React.ReactElement | null { return (
); return (
- + {get2Number(hour - 1)} - + :00
diff --git a/src/ts/components/HoursChart/components/Legend.tsx b/src/ts/components/HoursChart/components/Legend.tsx index c17cf6d..638eeac 100644 --- a/src/ts/components/HoursChart/components/Legend.tsx +++ b/src/ts/components/HoursChart/components/Legend.tsx @@ -6,24 +6,24 @@ import style from '../styles/legend.module.scss'; function Legend(): React.ReactElement | null { const { t } = useTranslation(); return ( -
-
-
-
+
+
+
+
{t('uiKit.hoursChart.work')}
-
-
-
+
+
+
{t('uiKit.hoursChart.weekend')}
-
-
+
+
42
-
+
{t('uiKit.hoursChart.days')}
diff --git a/src/ts/components/HoursChart/index.module.scss b/src/ts/components/HoursChart/index.module.scss index 1a2fe2f..3a8f55e 100644 --- a/src/ts/components/HoursChart/index.module.scss +++ b/src/ts/components/HoursChart/index.module.scss @@ -1,90 +1,94 @@ @import 'src/styles/variables'; -.user { - display: block; - box-sizing: border-box; - vertical-align: top; - margin: 24px 0 0 0; +.hours_chart { + &_user { + display: block; + box-sizing: border-box; + vertical-align: top; + margin: 24px 0 0 0; - --commits-by-hours-size: calc((100vw - 400px) / 25); -} + --commits-by-hours-size: calc((100vw - 400px) / 25); + } -.title { - display: inline-block; - width: 200px; - text-align: left; - white-space: nowrap; -} + &_title { + display: inline-block; + width: 200px; + text-align: left; + white-space: nowrap; + } -.data { - display: inline-block; - width: 100%; - vertical-align: top; -} + &_data { + display: inline-block; + width: 100%; + vertical-align: top; + } -.day { - display: block; - width: 100%; - vertical-align: top; - white-space: nowrap; -} + &_day { + display: block; + width: 100%; + vertical-align: top; + white-space: nowrap; + } -.day_time, -.day_name, -.hour { - font-size: var(--font-xs); - display: inline-block; - width: var(--commits-by-hours-size); - height: var(--commits-by-hours-size); - text-align: center; - line-height: var(--commits-by-hours-size); - vertical-align: top; - box-sizing: border-box; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - -webkit-print-color-adjust: exact; -} + &_day_time, + &_day_name, + &_hour { + font-size: var(--font-xs); + display: inline-block; + width: var(--commits-by-hours-size); + height: var(--commits-by-hours-size); + text-align: center; + line-height: var(--commits-by-hours-size); + vertical-align: top; + box-sizing: border-box; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + -webkit-print-color-adjust: exact; + } -.day_time, -.day_name { - box-sizing: border-box; - border-bottom: 1px solid grey; -} + &_day_time, + &_day_name { + box-sizing: border-box; + border-bottom: 1px solid grey; + } -.day_name { - font-size: var(--font-xs); - border-right: 1px solid grey; -} + &_day_name { + font-size: var(--font-xs); + border-right: 1px solid grey; + } -.hour { - color: white; - border-radius: 6px; - border: 1px solid #FFFFFF; - background-color: var(--color-first); + &_hour { + color: white; + border-radius: 6px; + border: 1px solid #FFFFFF; + background-color: var(--color-first); + } } @media (max-width: 1300px) { - .day_time_mm { + .hours_chart_day_time_mm { display: none; } } @media (max-width: 1000px) { - .user { + .hours_chart_user { --commits-by-hours-size: calc((100vw - 156px) / 25); } } @media (max-width: 900px) { - .day_time, - .day_name, - .hour { - font-size: var(--font-xxs); - } + .hours_chart { + &_day_time, + &_day_name, + &_hour { + font-size: var(--font-xxs); + } - .hour { - border-radius: 0; - border: none; + &_hour { + border-radius: 0; + border: none; + } } } diff --git a/src/ts/components/HoursChart/index.tsx b/src/ts/components/HoursChart/index.tsx index 8267906..e9cc3d5 100644 --- a/src/ts/components/HoursChart/index.tsx +++ b/src/ts/components/HoursChart/index.tsx @@ -21,9 +21,9 @@ function HoursChart({ return (
-
+
{getDayName(day, 'short')}
-
-
+
+
+
{items} diff --git a/src/ts/components/HoursChart/styles/legend.module.scss b/src/ts/components/HoursChart/styles/legend.module.scss index e849660..8d2957c 100644 --- a/src/ts/components/HoursChart/styles/legend.module.scss +++ b/src/ts/components/HoursChart/styles/legend.module.scss @@ -1,6 +1,6 @@ @import 'src/styles/variables'; -.legend { +.hours_chart_legend { display: block; box-sizing: border-box; vertical-align: top; diff --git a/src/ts/components/Recommendations/styles/index.module.scss b/src/ts/components/Recommendations/styles/index.module.scss index e422b34..1933351 100644 --- a/src/ts/components/Recommendations/styles/index.module.scss +++ b/src/ts/components/Recommendations/styles/index.module.scss @@ -3,7 +3,7 @@ .recommendations_container { position: relative; display: block; - margin: 0; + margin: 0 auto 12px 0; padding: 0; text-align: left; diff --git a/src/ts/components/Table/components/Header.tsx b/src/ts/components/Table/components/Header.tsx index b9ac829..3edbed6 100644 --- a/src/ts/components/Table/components/Header.tsx +++ b/src/ts/components/Table/components/Header.tsx @@ -42,10 +42,10 @@ function Header({ {formattedTitle} {column.title && column.sortDirection === -1 && ( -
+
)} {column.title && column.sortDirection === 1 && ( -
+
)}
); diff --git a/src/ts/components/Table/styles/header.module.scss b/src/ts/components/Table/styles/header.module.scss index 63ac4bf..0c87d0a 100644 --- a/src/ts/components/Table/styles/header.module.scss +++ b/src/ts/components/Table/styles/header.module.scss @@ -1,28 +1,23 @@ @import 'src/styles/variables'; -.title { - font-size: var(--font-l); - font-weight: 100; - margin: 24px 0; - color: var(--color-black); -} - -.sort_up, -.sort_down { - display: inline-block; - height: 0; - width: 0; - margin: 0 0 -5px 8px; - - cursor: pointer; - transform: rotateZ(-45deg); - - border: 6px solid var(--color-grey); - border-left-color: white; - border-bottom-color: white; -} - -.sort_down { - margin: 0 0 3px 8px; - transform: rotateZ(135deg); +.table { + &_sort_up, + &_sort_down { + display: inline-block; + height: 0; + width: 0; + margin: 0 0 -5px 8px; + + cursor: pointer; + transform: rotateZ(-45deg); + + border: 6px solid var(--color-grey); + border-left-color: white; + border-bottom-color: white; + } + + &_sort_down { + margin: 0 0 3px 8px; + transform: rotateZ(135deg); + } } diff --git a/src/ts/helpers/DataGrip/components/author.ts b/src/ts/helpers/DataGrip/components/author.ts index c803324..0acb249 100644 --- a/src/ts/helpers/DataGrip/components/author.ts +++ b/src/ts/helpers/DataGrip/components/author.ts @@ -163,8 +163,7 @@ export default class DataGripByAuthor { const moneyLosses = lazyDays > 0 ? Math.ceil(lazyDays * middleSalaryInDay) : 0; - const salaryInMonth = settingsStore.getMiddleSalaryInMonth(dot.author); - const moneyAll = Math.ceil((allDaysInProject / 30) * salaryInMonth); + const moneyAll = Math.ceil((allDaysInProject / 30) * middleSalaryInMonth); const tasksEntries = Object.entries(dot.tasks).filter(t => t[0]); const tasks = tasksEntries.map(t => t[0]); diff --git a/src/ts/helpers/RPC.ts b/src/ts/helpers/RPC.ts index 9f3c3e8..8b52fa4 100644 --- a/src/ts/helpers/RPC.ts +++ b/src/ts/helpers/RPC.ts @@ -16,7 +16,7 @@ function getParametersFromURL(): IHashMap { }; } -function loadJsDump(url: string, callback: Function) { +function loadJsLocal(url: string, callback: Function) { const script = document.createElement('script'); script.src = url; script.async = true; // @ts-ignore @@ -27,6 +27,30 @@ function loadJsDump(url: string, callback: Function) { document.body.appendChild(script); } +function loadJsLGlobal(url: string, callback: Function) { + fetch(url) + .then((response) => response.text()) + .then((text) => { + if (!text) return callback(); + if (text[0] === 'r') { + eval(text); + return callback(); + } else { + // @ts-ignore + window.report = text.split('\n'); + } + callback(); + }); +} + +function loadJsDump(url: string, callback: Function) { + if (url?.[0] === '.') { + loadJsLocal(url, callback); + } else { + loadJsLGlobal(url, callback); + } +} + function loadCssFile(url: string) { const node = document.createElement('link'); node.setAttribute('rel', 'stylesheet'); diff --git a/src/ts/pages/Authorization/components/Success.tsx b/src/ts/pages/Authorization/components/Success.tsx index fee8818..6c03c93 100644 --- a/src/ts/pages/Authorization/components/Success.tsx +++ b/src/ts/pages/Authorization/components/Success.tsx @@ -15,93 +15,104 @@ import Welcome from '../../Welcome/index'; import Settings from '../../Settings/index'; import DebugPage from '../../Debug/index'; +interface IViewWithChartsProps { + showSplashScreen: boolean; +} + +function ViewWithCharts({ showSplashScreen }: IViewWithChartsProps) { + return ( + <> + + + + + + )} + /> + + + + )} + /> + + + + )} + /> + + + + )} + /> + + + + )} + /> + + + + )} + /> + + {showSplashScreen && } + + ); +} + +function ViewWithText() { + return ( + + + )} + /> + + ); +} + const Success = observer((): React.ReactElement => { const [showSplashScreen, setShowSplashScreen] = useState(true); + const showChart = dataGripStore.showApplication; useEffect(() => { // @ts-ignore dataGripStore.setCommits(window?.report || []); }, []); - const dropArea = ( - { - setShowSplashScreen(false); - if (type === 'dump') dataGripStore.setCommits(data); - setTimeout(() => { - setShowSplashScreen(true); - }); - }} - /> - ); - - return dataGripStore.showApplication ? ( - <> - - {dropArea} - - - - - )} - /> - - - - )} - /> - - - - )} - /> - - - - )} - /> - - - - )} - /> - - - - )} - /> - - {showSplashScreen && } - - ) : ( + return ( <> - {dropArea} - - - )} - /> - + {showChart && } + {!showChart && } + { + setShowSplashScreen(false); + if (type === 'dump') dataGripStore.setCommits(data); + setTimeout(() => { + setShowSplashScreen(true); + }); + }} + /> ); }); diff --git a/src/ts/pages/Person/components/Month.tsx b/src/ts/pages/Person/components/Month.tsx index 0567f7e..d7c5ae9 100644 --- a/src/ts/pages/Person/components/Month.tsx +++ b/src/ts/pages/Person/components/Month.tsx @@ -14,7 +14,6 @@ const Month = observer(({ user }: IPersonCommonProps): React.ReactElement => { return ( <> -
-
-
-
-
-