diff --git a/build/assets/games/quize/balloon_0.png b/build/assets/games/quize/balloon_0.png new file mode 100644 index 0000000..82fa012 Binary files /dev/null and b/build/assets/games/quize/balloon_0.png differ diff --git a/build/assets/games/quize/balloon_1.png b/build/assets/games/quize/balloon_1.png new file mode 100644 index 0000000..1e5499c Binary files /dev/null and b/build/assets/games/quize/balloon_1.png differ diff --git a/build/assets/games/quize/balloon_2.png b/build/assets/games/quize/balloon_2.png new file mode 100644 index 0000000..ec19908 Binary files /dev/null and b/build/assets/games/quize/balloon_2.png differ diff --git a/build/assets/games/quize/balloon_3.png b/build/assets/games/quize/balloon_3.png new file mode 100644 index 0000000..23a3f4e Binary files /dev/null and b/build/assets/games/quize/balloon_3.png differ diff --git a/build/assets/games/quize/balloon_4.png b/build/assets/games/quize/balloon_4.png new file mode 100644 index 0000000..d4be67d Binary files /dev/null and b/build/assets/games/quize/balloon_4.png differ diff --git a/build/assets/games/quize/balloon_5.png b/build/assets/games/quize/balloon_5.png new file mode 100644 index 0000000..ccfd741 Binary files /dev/null and b/build/assets/games/quize/balloon_5.png differ diff --git a/build/assets/games/quize/border.png b/build/assets/games/quize/border.png new file mode 100644 index 0000000..ea1fb42 Binary files /dev/null and b/build/assets/games/quize/border.png differ diff --git a/build/assets/games/quize/cloud.png b/build/assets/games/quize/cloud.png new file mode 100644 index 0000000..4a36c68 Binary files /dev/null and b/build/assets/games/quize/cloud.png differ diff --git a/build/assets/games/quize/cloud_bg.png b/build/assets/games/quize/cloud_bg.png new file mode 100644 index 0000000..7dfcaac Binary files /dev/null and b/build/assets/games/quize/cloud_bg.png differ diff --git a/build/assets/games/quize/cloud_big.png b/build/assets/games/quize/cloud_big.png new file mode 100644 index 0000000..9a36896 Binary files /dev/null and b/build/assets/games/quize/cloud_big.png differ diff --git a/build/assets/games/quize/Фон.png b/build/assets/games/quize/Фон.png new file mode 100644 index 0000000..2992568 Binary files /dev/null and b/build/assets/games/quize/Фон.png differ diff --git a/build/assets/games/quize/кнопка.png b/build/assets/games/quize/кнопка.png new file mode 100644 index 0000000..1e55259 Binary files /dev/null and b/build/assets/games/quize/кнопка.png differ diff --git a/build/assets/games/quize/окно.png b/build/assets/games/quize/окно.png new file mode 100644 index 0000000..d124693 Binary files /dev/null and b/build/assets/games/quize/окно.png differ diff --git a/build/assets/games/quize/фон вместе.jpg b/build/assets/games/quize/фон вместе.jpg new file mode 100644 index 0000000..c3c0b48 Binary files /dev/null and b/build/assets/games/quize/фон вместе.jpg differ diff --git a/build/assets/games/quize/фон все вместе.png b/build/assets/games/quize/фон все вместе.png new file mode 100644 index 0000000..368d25f Binary files /dev/null and b/build/assets/games/quize/фон все вместе.png differ diff --git a/build/assets/games/races/bg.png b/build/assets/games/races/bg.png new file mode 100644 index 0000000..151084e Binary files /dev/null and b/build/assets/games/races/bg.png differ diff --git a/build/assets/games/races/car.png b/build/assets/games/races/car.png new file mode 100644 index 0000000..2b43c26 Binary files /dev/null and b/build/assets/games/races/car.png differ diff --git a/build/assets/games/races/car2.png b/build/assets/games/races/car2.png new file mode 100644 index 0000000..aff6dc9 Binary files /dev/null and b/build/assets/games/races/car2.png differ diff --git a/build/assets/games/races/greenBottom.png b/build/assets/games/races/greenBottom.png new file mode 100644 index 0000000..7dc0847 Binary files /dev/null and b/build/assets/games/races/greenBottom.png differ diff --git a/build/assets/games/races/greenTop.png b/build/assets/games/races/greenTop.png new file mode 100644 index 0000000..aefacb8 Binary files /dev/null and b/build/assets/games/races/greenTop.png differ diff --git a/build/assets/games/races/road.png b/build/assets/games/races/road.png new file mode 100644 index 0000000..021deba Binary files /dev/null and b/build/assets/games/races/road.png differ diff --git a/build/assets/games/swimmingPool/bg.png b/build/assets/games/swimmingPool/bg.png new file mode 100644 index 0000000..857314e Binary files /dev/null and b/build/assets/games/swimmingPool/bg.png differ diff --git a/build/assets/games/swimmingPool/block.png b/build/assets/games/swimmingPool/block.png new file mode 100644 index 0000000..338039c Binary files /dev/null and b/build/assets/games/swimmingPool/block.png differ diff --git a/build/assets/games/swimmingPool/block2.png b/build/assets/games/swimmingPool/block2.png new file mode 100644 index 0000000..bb2a68a Binary files /dev/null and b/build/assets/games/swimmingPool/block2.png differ diff --git a/build/assets/games/swimmingPool/man.png b/build/assets/games/swimmingPool/man.png new file mode 100644 index 0000000..1c9020f Binary files /dev/null and b/build/assets/games/swimmingPool/man.png differ diff --git a/build/assets/games/swimmingPool/track_titl3e.png b/build/assets/games/swimmingPool/track_titl3e.png new file mode 100644 index 0000000..8c3f101 Binary files /dev/null and b/build/assets/games/swimmingPool/track_titl3e.png differ diff --git a/build/assets/games/swimmingPool/track_title.png b/build/assets/games/swimmingPool/track_title.png new file mode 100644 index 0000000..2010577 Binary files /dev/null and b/build/assets/games/swimmingPool/track_title.png differ diff --git a/build/assets/games/swimmingPool/track_title3.png b/build/assets/games/swimmingPool/track_title3.png new file mode 100644 index 0000000..aa5e6c7 Binary files /dev/null and b/build/assets/games/swimmingPool/track_title3.png differ diff --git a/build/assets/games/swimmingPool/water.png b/build/assets/games/swimmingPool/water.png new file mode 100644 index 0000000..e21d61f Binary files /dev/null and b/build/assets/games/swimmingPool/water.png differ diff --git a/build/assets/games/swimmingPool/белая клетка со стрелкой.png b/build/assets/games/swimmingPool/белая клетка со стрелкой.png new file mode 100644 index 0000000..57459ac Binary files /dev/null and b/build/assets/games/swimmingPool/белая клетка со стрелкой.png differ diff --git a/build/assets/games/swimmingPool/клеточки все вместе.png b/build/assets/games/swimmingPool/клеточки все вместе.png new file mode 100644 index 0000000..ca0bdf3 Binary files /dev/null and b/build/assets/games/swimmingPool/клеточки все вместе.png differ diff --git a/build/assets/games/swimmingPool/стрелочка.png b/build/assets/games/swimmingPool/стрелочка.png new file mode 100644 index 0000000..444d82f Binary files /dev/null and b/build/assets/games/swimmingPool/стрелочка.png differ diff --git a/build/assets/games/swimmingPool/черная клетка.png b/build/assets/games/swimmingPool/черная клетка.png new file mode 100644 index 0000000..78d326f Binary files /dev/null and b/build/assets/games/swimmingPool/черная клетка.png differ diff --git a/public/assets/games/quize/balloon_0.png b/public/assets/games/quize/balloon_0.png new file mode 100644 index 0000000..82fa012 Binary files /dev/null and b/public/assets/games/quize/balloon_0.png differ diff --git a/public/assets/games/quize/balloon_1.png b/public/assets/games/quize/balloon_1.png new file mode 100644 index 0000000..1e5499c Binary files /dev/null and b/public/assets/games/quize/balloon_1.png differ diff --git a/public/assets/games/quize/balloon_2.png b/public/assets/games/quize/balloon_2.png new file mode 100644 index 0000000..ec19908 Binary files /dev/null and b/public/assets/games/quize/balloon_2.png differ diff --git a/public/assets/games/quize/balloon_3.png b/public/assets/games/quize/balloon_3.png new file mode 100644 index 0000000..23a3f4e Binary files /dev/null and b/public/assets/games/quize/balloon_3.png differ diff --git a/public/assets/games/quize/balloon_4.png b/public/assets/games/quize/balloon_4.png new file mode 100644 index 0000000..d4be67d Binary files /dev/null and b/public/assets/games/quize/balloon_4.png differ diff --git a/public/assets/games/quize/balloon_5.png b/public/assets/games/quize/balloon_5.png new file mode 100644 index 0000000..ccfd741 Binary files /dev/null and b/public/assets/games/quize/balloon_5.png differ diff --git a/public/assets/games/quize/border.png b/public/assets/games/quize/border.png new file mode 100644 index 0000000..ea1fb42 Binary files /dev/null and b/public/assets/games/quize/border.png differ diff --git a/public/assets/games/quize/cloud.png b/public/assets/games/quize/cloud.png new file mode 100644 index 0000000..4a36c68 Binary files /dev/null and b/public/assets/games/quize/cloud.png differ diff --git a/public/assets/games/quize/cloud_bg.png b/public/assets/games/quize/cloud_bg.png new file mode 100644 index 0000000..7dfcaac Binary files /dev/null and b/public/assets/games/quize/cloud_bg.png differ diff --git a/public/assets/games/quize/cloud_big.png b/public/assets/games/quize/cloud_big.png new file mode 100644 index 0000000..9a36896 Binary files /dev/null and b/public/assets/games/quize/cloud_big.png differ diff --git a/public/assets/games/quize/Фон.png b/public/assets/games/quize/Фон.png new file mode 100644 index 0000000..2992568 Binary files /dev/null and b/public/assets/games/quize/Фон.png differ diff --git a/public/assets/games/quize/кнопка.png b/public/assets/games/quize/кнопка.png new file mode 100644 index 0000000..1e55259 Binary files /dev/null and b/public/assets/games/quize/кнопка.png differ diff --git a/public/assets/games/quize/окно.png b/public/assets/games/quize/окно.png new file mode 100644 index 0000000..d124693 Binary files /dev/null and b/public/assets/games/quize/окно.png differ diff --git a/public/assets/games/quize/фон вместе.jpg b/public/assets/games/quize/фон вместе.jpg new file mode 100644 index 0000000..c3c0b48 Binary files /dev/null and b/public/assets/games/quize/фон вместе.jpg differ diff --git a/public/assets/games/quize/фон все вместе.png b/public/assets/games/quize/фон все вместе.png new file mode 100644 index 0000000..368d25f Binary files /dev/null and b/public/assets/games/quize/фон все вместе.png differ diff --git a/public/assets/games/races/bg.png b/public/assets/games/races/bg.png new file mode 100644 index 0000000..151084e Binary files /dev/null and b/public/assets/games/races/bg.png differ diff --git a/public/assets/games/races/car.png b/public/assets/games/races/car.png new file mode 100644 index 0000000..2b43c26 Binary files /dev/null and b/public/assets/games/races/car.png differ diff --git a/public/assets/games/races/car2.png b/public/assets/games/races/car2.png new file mode 100644 index 0000000..aff6dc9 Binary files /dev/null and b/public/assets/games/races/car2.png differ diff --git a/public/assets/games/races/greenBottom.png b/public/assets/games/races/greenBottom.png new file mode 100644 index 0000000..7dc0847 Binary files /dev/null and b/public/assets/games/races/greenBottom.png differ diff --git a/public/assets/games/races/greenTop.png b/public/assets/games/races/greenTop.png new file mode 100644 index 0000000..aefacb8 Binary files /dev/null and b/public/assets/games/races/greenTop.png differ diff --git a/public/assets/games/races/road.png b/public/assets/games/races/road.png new file mode 100644 index 0000000..021deba Binary files /dev/null and b/public/assets/games/races/road.png differ diff --git a/public/assets/games/swimmingPool/bg.png b/public/assets/games/swimmingPool/bg.png new file mode 100644 index 0000000..857314e Binary files /dev/null and b/public/assets/games/swimmingPool/bg.png differ diff --git a/public/assets/games/swimmingPool/block.png b/public/assets/games/swimmingPool/block.png new file mode 100644 index 0000000..338039c Binary files /dev/null and b/public/assets/games/swimmingPool/block.png differ diff --git a/public/assets/games/swimmingPool/block2.png b/public/assets/games/swimmingPool/block2.png new file mode 100644 index 0000000..bb2a68a Binary files /dev/null and b/public/assets/games/swimmingPool/block2.png differ diff --git a/public/assets/games/swimmingPool/man.png b/public/assets/games/swimmingPool/man.png new file mode 100644 index 0000000..1c9020f Binary files /dev/null and b/public/assets/games/swimmingPool/man.png differ diff --git a/public/assets/games/swimmingPool/track_titl3e.png b/public/assets/games/swimmingPool/track_titl3e.png new file mode 100644 index 0000000..8c3f101 Binary files /dev/null and b/public/assets/games/swimmingPool/track_titl3e.png differ diff --git a/public/assets/games/swimmingPool/track_title.png b/public/assets/games/swimmingPool/track_title.png new file mode 100644 index 0000000..2010577 Binary files /dev/null and b/public/assets/games/swimmingPool/track_title.png differ diff --git a/public/assets/games/swimmingPool/track_title3.png b/public/assets/games/swimmingPool/track_title3.png new file mode 100644 index 0000000..aa5e6c7 Binary files /dev/null and b/public/assets/games/swimmingPool/track_title3.png differ diff --git a/public/assets/games/swimmingPool/water.png b/public/assets/games/swimmingPool/water.png new file mode 100644 index 0000000..e21d61f Binary files /dev/null and b/public/assets/games/swimmingPool/water.png differ diff --git a/public/assets/games/swimmingPool/белая клетка со стрелкой.png b/public/assets/games/swimmingPool/белая клетка со стрелкой.png new file mode 100644 index 0000000..57459ac Binary files /dev/null and b/public/assets/games/swimmingPool/белая клетка со стрелкой.png differ diff --git a/public/assets/games/swimmingPool/клеточки все вместе.png b/public/assets/games/swimmingPool/клеточки все вместе.png new file mode 100644 index 0000000..ca0bdf3 Binary files /dev/null and b/public/assets/games/swimmingPool/клеточки все вместе.png differ diff --git a/public/assets/games/swimmingPool/стрелочка.png b/public/assets/games/swimmingPool/стрелочка.png new file mode 100644 index 0000000..444d82f Binary files /dev/null and b/public/assets/games/swimmingPool/стрелочка.png differ diff --git a/public/assets/games/swimmingPool/черная клетка.png b/public/assets/games/swimmingPool/черная клетка.png new file mode 100644 index 0000000..78d326f Binary files /dev/null and b/public/assets/games/swimmingPool/черная клетка.png differ diff --git a/src/ts/components/BarChart/index.module.scss b/src/ts/components/BarChart/index.module.scss index 616c838..7a693f1 100644 --- a/src/ts/components/BarChart/index.module.scss +++ b/src/ts/components/BarChart/index.module.scss @@ -23,7 +23,7 @@ -webkit-print-color-adjust: exact; &:hover { - background-color: #ED675F; + background-color: var(--color-second); } } diff --git a/src/ts/components/DataView/index.module.scss b/src/ts/components/DataView/index.module.scss index 45634e7..7c84c74 100644 --- a/src/ts/components/DataView/index.module.scss +++ b/src/ts/components/DataView/index.module.scss @@ -17,19 +17,6 @@ margin-left: var(--space-l); 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 { diff --git a/src/ts/components/DataView/index.tsx b/src/ts/components/DataView/index.tsx index 8b6e9be..783776b 100644 --- a/src/ts/components/DataView/index.tsx +++ b/src/ts/components/DataView/index.tsx @@ -6,9 +6,9 @@ import ISort from 'ts/interfaces/Sort'; import Table from 'ts/components/Table'; import Cards from 'ts/components/Cards'; import viewSettings from 'ts/store/ViewSettings'; -import globalScroll from 'ts/helpers/globalScroll'; import { downloadExcel } from 'ts/helpers/File'; import isMobile from 'ts/helpers/isMobile'; +import fullScreen from 'ts/store/FullScreen'; import style from './index.module.scss'; import PageWrapper from '../Page/wrapper'; @@ -41,7 +41,6 @@ function DataView({ const urlParams = useParams(); const defaultType = viewSettings.getItem(urlParams, isMobile ? 'cards' : 'table'); const [localType, setType] = useState(type || defaultType); - const [fullSize, setFullSize] = useState(false); if (!rows || !rows.length) return null; @@ -55,8 +54,6 @@ function DataView({ cards: 'Отобразить таблицой', }[localType]; - const fullSizeClass = fullSize ? style.data_view_full_screen : ''; - return ( <>
@@ -72,18 +69,14 @@ function DataView({ }} /> )} - {false && !isMobile && ( + {!isMobile && ( { - if (fullSize) { - globalScroll.off(); - } else { - globalScroll.on(); - } - setFullSize(!fullSize); + fullScreen.toggle(); }} /> )} @@ -103,10 +96,7 @@ function DataView({
{localType === 'table' && ( - + localization.get(column.title || '')); + return columns.map((column: IColumn) => t(column.title || '')); } function getFormatter(columns: IColumn[]) { @@ -58,8 +57,10 @@ function getFormatter(columns: IColumn[]) { const type = typeof value; if (type === 'object') { + if (!column.formatter && column.template) return ''; + return Object.entries(value) - .map((row: any) => row.join(': ')) + .map((row: any) => `${t(row[0]) || ''}: ${row[1] || ''}`) .join(', '); } @@ -78,7 +79,6 @@ export function downloadCsv( name?: string, ) { const columns = getColumnsFromChildren(children); - console.dir(columns); const formatter = getFormatter(columns); const csvFile = [ getTitles(columns).join(';'), diff --git a/src/ts/pages/PageWrapper/index.tsx b/src/ts/pages/PageWrapper/index.tsx index b71836c..7fca7e9 100644 --- a/src/ts/pages/PageWrapper/index.tsx +++ b/src/ts/pages/PageWrapper/index.tsx @@ -1,6 +1,8 @@ import React, { ReactNode } from 'react'; +import { observer } from 'mobx-react-lite'; import Recommendations from 'ts/components/Recommendations/components/ModalDescription'; +import fullScreen from 'ts/store/FullScreen'; import isMobile from 'ts/helpers/isMobile'; 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 ( + <> +
+ {children} +
+ + + ); + } + return (
@@ -45,7 +58,7 @@ function DesktopView({ children }: IPageWrapper) {
); -} +}); function PageWrapper({ children }: IPageWrapper) { return isMobile diff --git a/src/ts/pages/PageWrapper/styles/index.module.scss b/src/ts/pages/PageWrapper/styles/index.module.scss index 3e2e68f..65b14e5 100644 --- a/src/ts/pages/PageWrapper/styles/index.module.scss +++ b/src/ts/pages/PageWrapper/styles/index.module.scss @@ -32,9 +32,20 @@ break-inside: auto; } - &_main_mobile { - width: calc(100vw - 240px); - padding: 24px 24px 82px; + &_main { + &_mobile { + 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; + } } } diff --git a/src/ts/pages/Person/index.tsx b/src/ts/pages/Person/index.tsx index 533b2ac..84a2fb5 100644 --- a/src/ts/pages/Person/index.tsx +++ b/src/ts/pages/Person/index.tsx @@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'; import Title from 'ts/components/Title'; import dataGripStore from 'ts/store/DataGrip'; +import fullScreen from 'ts/store/FullScreen'; import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider'; import printStore from 'ts/pages/PageWrapper/store/Print'; @@ -29,7 +30,10 @@ interface IPersonProps { function getViewByIdByUser(user: any, filters: any) { 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 ; if (page === 'money') return ; if (page === 'week') return ( diff --git a/src/ts/pages/Team/components/Author.tsx b/src/ts/pages/Team/components/Author.tsx index f5c28dd..6027502 100644 --- a/src/ts/pages/Team/components/Author.tsx +++ b/src/ts/pages/Team/components/Author.tsx @@ -65,16 +65,17 @@ function AuthorView({ response, updateSort, rowsForExcel, mode }: IAuthorViewPro isFixed template={ColumnTypesEnum.STRING} properties="author" + title="page.team.pr.author" width={200} /> { - let value = works; - if (row.isDismissed) value = dismissed; - if (row.isStaff) value = staff; - return ; + formatter={(row: any) => { + if (row.isDismissed) return dismissed; + if (row.isStaff) return staff; + return works; }} + template={(value: string) => } width={100} /> - + {mode !== 'fullscreen' && ( + + )} <DataLoader to="response" diff --git a/src/ts/pages/Team/components/Hours.tsx b/src/ts/pages/Team/components/Hours.tsx index 1771a9a..0d025db 100644 --- a/src/ts/pages/Team/components/Hours.tsx +++ b/src/ts/pages/Team/components/Hours.tsx @@ -18,10 +18,12 @@ const Hours = observer(({ return ( <> - <Recommendations - mode={mode} - recommendations={recommendations} - /> + {mode !== 'fullscreen' && ( + <Recommendations + mode={mode} + recommendations={recommendations} + /> + )} <Title title="page.team.hours.title"/> <PageWrapper template="table"> <HoursChart statistic={statistic} /> diff --git a/src/ts/pages/Team/components/Month.tsx b/src/ts/pages/Team/components/Month.tsx index 89efe68..eb08ce8 100644 --- a/src/ts/pages/Team/components/Month.tsx +++ b/src/ts/pages/Team/components/Month.tsx @@ -20,10 +20,12 @@ const Month = observer(({ return ( <> - <Recommendations - mode={mode} - recommendations={recommendations} - /> + {mode !== 'fullscreen' && ( + <Recommendations + mode={mode} + recommendations={recommendations} + /> + )} <Title title="page.team.month.title"/> <PageWrapper template="table"> <YearChart diff --git a/src/ts/pages/Team/components/Scope.tsx b/src/ts/pages/Team/components/Scope.tsx index 23837bc..0144dfb 100644 --- a/src/ts/pages/Team/components/Scope.tsx +++ b/src/ts/pages/Team/components/Scope.tsx @@ -123,10 +123,12 @@ const Scope = observer(({ return ( <> - <Recommendations - mode={mode} - recommendations={recommendations} - /> + {mode !== 'fullscreen' && ( + <Recommendations + mode={mode} + recommendations={recommendations} + /> + )} <Title title="page.team.scope.title"/> <DataLoader to="response" diff --git a/src/ts/pages/Team/components/Type.tsx b/src/ts/pages/Team/components/Type.tsx index 34e9672..01ecfc7 100644 --- a/src/ts/pages/Team/components/Type.tsx +++ b/src/ts/pages/Team/components/Type.tsx @@ -127,10 +127,12 @@ const Type = observer(({ return ( <> - <Recommendations - mode={mode} - recommendations={recommendations} - /> + {mode !== 'fullscreen' && ( + <Recommendations + mode={mode} + recommendations={recommendations} + /> + )} <Title title="page.team.type.title"/> <DataLoader to="response" diff --git a/src/ts/pages/Team/components/Week.tsx b/src/ts/pages/Team/components/Week.tsx index 5b0e189..a89db16 100644 --- a/src/ts/pages/Team/components/Week.tsx +++ b/src/ts/pages/Team/components/Week.tsx @@ -163,10 +163,12 @@ const Week = observer(({ return ( <> - <Recommendations - mode={mode} - recommendations={recommendations} - /> + {mode !== 'fullscreen' && ( + <Recommendations + mode={mode} + recommendations={recommendations} + /> + )} {mode === 'print' ? ( <Title title="page.team.week.title"/> ) : ( diff --git a/src/ts/pages/Team/index.tsx b/src/ts/pages/Team/index.tsx index fa8b6d7..87bc19f 100644 --- a/src/ts/pages/Team/index.tsx +++ b/src/ts/pages/Team/index.tsx @@ -1,8 +1,10 @@ import React from 'react'; import { useParams } from 'react-router-dom'; +import { observer } from 'mobx-react-lite'; import SectionSlider from 'ts/pages/PageWrapper/components/SectionSlider'; import printStore from 'ts/pages/PageWrapper/store/Print'; +import fullScreen from 'ts/store/FullScreen'; import Author from './components/Author'; import Commits from './components/Commits'; @@ -23,8 +25,15 @@ import Pr from './components/PR'; import Print from './components/Print'; import Release from './components/Release'; -function getViewById(page?: string) { - const mode = printStore.processing ? 'print' : undefined; +interface ViewProps { + 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 === 'scope') return <Scope mode={mode}/>; if (page === 'author') return <Author mode={mode}/>; @@ -45,11 +54,11 @@ function getViewById(page?: string) { if (page === 'print') return <Print/>; if (page === 'tasks') return <Tasks/>; return <Total/>; -} +}); export default function Team() { const { type } = useParams<any>(); if (type && type !== 'team') return null; - return <SectionSlider getViewById={getViewById} />; + return <SectionSlider getViewById={(page: string) => <View page={page} />} />; } diff --git a/src/ts/store/FullScreen.tsx b/src/ts/store/FullScreen.tsx new file mode 100644 index 0000000..d4a29a4 --- /dev/null +++ b/src/ts/store/FullScreen.tsx @@ -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;