This commit is contained in:
bakhirev 2024-07-19 00:10:58 +03:00
parent ba04aaefae
commit 00c41b9fe4
81 changed files with 140 additions and 75 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -23,7 +23,7 @@
-webkit-print-color-adjust: exact; -webkit-print-color-adjust: exact;
&:hover { &:hover {
background-color: #ED675F; background-color: var(--color-second);
} }
} }

View file

@ -17,19 +17,6 @@
margin-left: var(--space-l); margin-left: var(--space-l);
cursor: pointer; cursor: pointer;
} }
&_full_screen {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
padding: var(--space-xxl);
margin: 0;
border-radius: 0;
}
} }
@media print { @media print {

View file

@ -6,9 +6,9 @@ import ISort from 'ts/interfaces/Sort';
import Table from 'ts/components/Table'; import Table from 'ts/components/Table';
import Cards from 'ts/components/Cards'; import Cards from 'ts/components/Cards';
import viewSettings from 'ts/store/ViewSettings'; import viewSettings from 'ts/store/ViewSettings';
import globalScroll from 'ts/helpers/globalScroll';
import { downloadExcel } from 'ts/helpers/File'; import { downloadExcel } from 'ts/helpers/File';
import isMobile from 'ts/helpers/isMobile'; import isMobile from 'ts/helpers/isMobile';
import fullScreen from 'ts/store/FullScreen';
import style from './index.module.scss'; import style from './index.module.scss';
import PageWrapper from '../Page/wrapper'; import PageWrapper from '../Page/wrapper';
@ -41,7 +41,6 @@ function DataView({
const urlParams = useParams<any>(); const urlParams = useParams<any>();
const defaultType = viewSettings.getItem(urlParams, isMobile ? 'cards' : 'table'); const defaultType = viewSettings.getItem(urlParams, isMobile ? 'cards' : 'table');
const [localType, setType] = useState<string>(type || defaultType); const [localType, setType] = useState<string>(type || defaultType);
const [fullSize, setFullSize] = useState<boolean>(false);
if (!rows || !rows.length) return null; if (!rows || !rows.length) return null;
@ -55,8 +54,6 @@ function DataView({
cards: 'Отобразить таблицой', cards: 'Отобразить таблицой',
}[localType]; }[localType];
const fullSizeClass = fullSize ? style.data_view_full_screen : '';
return ( return (
<> <>
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
@ -72,18 +69,14 @@ function DataView({
}} }}
/> />
)} )}
{false && !isMobile && ( {!isMobile && (
<img <img
title={'Развернуть'} src={fullScreen.isOpen
src="./assets/icons/OpenFullscreen.svg" ? './assets/icons/CloseFullscreen.svg'
: './assets/icons/OpenFullscreen.svg'}
className={style.data_view_icon} className={style.data_view_icon}
onClick={() => { onClick={() => {
if (fullSize) { fullScreen.toggle();
globalScroll.off();
} else {
globalScroll.on();
}
setFullSize(!fullSize);
}} }}
/> />
)} )}
@ -103,10 +96,7 @@ function DataView({
</div> </div>
{localType === 'table' && ( {localType === 'table' && (
<PageWrapper <PageWrapper template="table">
template="table"
className={fullSizeClass}
>
<Table <Table
rows={rows} rows={rows}
sort={sort} sort={sort}

View file

@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import { utils, writeFile } from 'xlsx'; import { utils, writeFile } from 'xlsx';
import localization from 'ts/helpers/Localization'; import { t } from 'ts/helpers/Localization';
import { ColumnTypesEnum, IColumn } from '../components/Table/interfaces/Column'; import { ColumnTypesEnum, IColumn } from '../components/Table/interfaces/Column';
import { getDate, getDateForExcel } from './formatter'; import { getDate, getDateForExcel } from './formatter';
// import localization from './Localization';
export function downloadFile(file: Blob, fileName: string) { export function downloadFile(file: Blob, fileName: string) {
const link = document.createElement('a'); const link = document.createElement('a');
@ -34,7 +33,7 @@ function getColumnsFromChildren(children: React.ReactNode) {
} }
function getTitles(columns: IColumn[]) { function getTitles(columns: IColumn[]) {
return columns.map((column: IColumn) => localization.get(column.title || '')); return columns.map((column: IColumn) => t(column.title || ''));
} }
function getFormatter(columns: IColumn[]) { function getFormatter(columns: IColumn[]) {
@ -58,8 +57,10 @@ function getFormatter(columns: IColumn[]) {
const type = typeof value; const type = typeof value;
if (type === 'object') { if (type === 'object') {
if (!column.formatter && column.template) return '';
return Object.entries(value) return Object.entries(value)
.map((row: any) => row.join(': ')) .map((row: any) => `${t(row[0]) || ''}: ${row[1] || ''}`)
.join(', '); .join(', ');
} }
@ -78,7 +79,6 @@ export function downloadCsv(
name?: string, name?: string,
) { ) {
const columns = getColumnsFromChildren(children); const columns = getColumnsFromChildren(children);
console.dir(columns);
const formatter = getFormatter(columns); const formatter = getFormatter(columns);
const csvFile = [ const csvFile = [
getTitles(columns).join(';'), getTitles(columns).join(';'),

View file

@ -1,6 +1,8 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { observer } from 'mobx-react-lite';
import Recommendations from 'ts/components/Recommendations/components/ModalDescription'; import Recommendations from 'ts/components/Recommendations/components/ModalDescription';
import fullScreen from 'ts/store/FullScreen';
import isMobile from 'ts/helpers/isMobile'; import isMobile from 'ts/helpers/isMobile';
import SideBar from './components/sidebar'; import SideBar from './components/sidebar';
@ -33,7 +35,18 @@ function MobileView({
); );
} }
function DesktopView({ children }: IPageWrapper) { const DesktopView = observer(({ children }: IPageWrapper): React.ReactElement => {
if (fullScreen.isOpen) {
return (
<>
<div className={style.page_wrapper_main_fullscreen}>
{children}
</div>
<Recommendations/>
</>
);
}
return ( return (
<div className={style.page_wrapper}> <div className={style.page_wrapper}>
<SideBar/> <SideBar/>
@ -45,7 +58,7 @@ function DesktopView({ children }: IPageWrapper) {
<Recommendations/> <Recommendations/>
</div> </div>
); );
} });
function PageWrapper({ children }: IPageWrapper) { function PageWrapper({ children }: IPageWrapper) {
return isMobile return isMobile

View file

@ -32,9 +32,20 @@
break-inside: auto; break-inside: auto;
} }
&_main_mobile { &_main {
width: calc(100vw - 240px); &_mobile {
padding: 24px 24px 82px; width: calc(100vw - 240px);
padding: 24px 24px 82px;
}
&_fullscreen {
display: block;
padding: 24px;
width: calc(100vw - 18px);
min-height: 100vh;
box-sizing: border-box;
background-color: #F5F7F9;
}
} }
} }

View file

@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
import Title from 'ts/components/Title'; import Title from 'ts/components/Title';
import dataGripStore from 'ts/store/DataGrip'; import dataGripStore from 'ts/store/DataGrip';
import fullScreen from 'ts/store/FullScreen';
import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider'; import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider';
import printStore from 'ts/pages/PageWrapper/store/Print'; import printStore from 'ts/pages/PageWrapper/store/Print';
@ -29,7 +30,10 @@ interface IPersonProps {
function getViewByIdByUser(user: any, filters: any) { function getViewByIdByUser(user: any, filters: any) {
return function getViewById(page?: string) { return function getViewById(page?: string) {
const mode = printStore.processing ? 'print' : undefined; let mode = undefined;
if (fullScreen.isOpen) mode = 'fullscreen';
if (printStore.processing) mode = 'print';
if (page === 'total') return <Total user={user}/>; if (page === 'total') return <Total user={user}/>;
if (page === 'money') return <Money user={user}/>; if (page === 'money') return <Money user={user}/>;
if (page === 'week') return ( if (page === 'week') return (

View file

@ -65,16 +65,17 @@ function AuthorView({ response, updateSort, rowsForExcel, mode }: IAuthorViewPro
isFixed isFixed
template={ColumnTypesEnum.STRING} template={ColumnTypesEnum.STRING}
properties="author" properties="author"
title="page.team.pr.author"
width={200} width={200}
/> />
<Column <Column
title="page.team.author.status" title="page.team.author.status"
template={(row: any) => { formatter={(row: any) => {
let value = works; if (row.isDismissed) return dismissed;
if (row.isDismissed) value = dismissed; if (row.isStaff) return staff;
if (row.isStaff) value = staff; return works;
return <UiKitTags value={value} />;
}} }}
template={(value: string) => <UiKitTags value={value} />}
width={100} width={100}
/> />
<Column <Column
@ -208,10 +209,12 @@ const Author = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
<Title title="page.team.author.title"/> <Title title="page.team.author.title"/>
<DataLoader <DataLoader
to="response" to="response"

View file

@ -18,10 +18,12 @@ const Hours = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
<Title title="page.team.hours.title"/> <Title title="page.team.hours.title"/>
<PageWrapper template="table"> <PageWrapper template="table">
<HoursChart statistic={statistic} /> <HoursChart statistic={statistic} />

View file

@ -20,10 +20,12 @@ const Month = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
<Title title="page.team.month.title"/> <Title title="page.team.month.title"/>
<PageWrapper template="table"> <PageWrapper template="table">
<YearChart <YearChart

View file

@ -123,10 +123,12 @@ const Scope = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
<Title title="page.team.scope.title"/> <Title title="page.team.scope.title"/>
<DataLoader <DataLoader
to="response" to="response"

View file

@ -127,10 +127,12 @@ const Type = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
<Title title="page.team.type.title"/> <Title title="page.team.type.title"/>
<DataLoader <DataLoader
to="response" to="response"

View file

@ -163,10 +163,12 @@ const Week = observer(({
return ( return (
<> <>
<Recommendations {mode !== 'fullscreen' && (
mode={mode} <Recommendations
recommendations={recommendations} mode={mode}
/> recommendations={recommendations}
/>
)}
{mode === 'print' ? ( {mode === 'print' ? (
<Title title="page.team.week.title"/> <Title title="page.team.week.title"/>
) : ( ) : (

View file

@ -1,8 +1,10 @@
import React from 'react'; import React from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { observer } from 'mobx-react-lite';
import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider'; import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider';
import printStore from 'ts/pages/PageWrapper/store/Print'; import printStore from 'ts/pages/PageWrapper/store/Print';
import fullScreen from 'ts/store/FullScreen';
import Author from './components/Author'; import Author from './components/Author';
import Commits from './components/Commits'; import Commits from './components/Commits';
@ -23,8 +25,15 @@ import Pr from './components/PR';
import Print from './components/Print'; import Print from './components/Print';
import Release from './components/Release'; import Release from './components/Release';
function getViewById(page?: string) { interface ViewProps {
const mode = printStore.processing ? 'print' : undefined; page?: string;
}
const View = observer(({ page }: ViewProps): React.ReactElement => {
let mode = undefined;
if (fullScreen.isOpen) mode = 'fullscreen';
if (printStore.processing) mode = 'print';
if (page === 'total') return <Total/>; if (page === 'total') return <Total/>;
if (page === 'scope') return <Scope mode={mode}/>; if (page === 'scope') return <Scope mode={mode}/>;
if (page === 'author') return <Author mode={mode}/>; if (page === 'author') return <Author mode={mode}/>;
@ -45,11 +54,11 @@ function getViewById(page?: string) {
if (page === 'print') return <Print/>; if (page === 'print') return <Print/>;
if (page === 'tasks') return <Tasks/>; if (page === 'tasks') return <Tasks/>;
return <Total/>; return <Total/>;
} });
export default function Team() { export default function Team() {
const { type } = useParams<any>(); const { type } = useParams<any>();
if (type && type !== 'team') return null; if (type && type !== 'team') return null;
return <SectionSlider getViewById={getViewById} />; return <SectionSlider getViewById={(page: string) => <View page={page} />} />;
} }

View file

@ -0,0 +1,38 @@
import { observable, action, makeObservable } from 'mobx';
class FullScreenStore {
mode: string = '';
isOpen: boolean = false;
constructor() {
makeObservable(this, {
isOpen: observable,
on: action,
off: action,
toggle: action,
});
}
on(mode?: string) {
this.isOpen = true;
this.mode = mode || '';
}
off() {
this.isOpen = false;
this.mode = '';
}
toggle(mode?: string) {
if (this.isOpen) {
this.off();
} else {
this.on(mode);
}
}
}
const fullScreen = new FullScreenStore();
export default fullScreen;