JIRA-1234 fix(style): 123

This commit is contained in:
bakhirev 2023-11-28 01:19:46 +03:00
parent cd12fcf528
commit 4344c44f9b
13 changed files with 115 additions and 95 deletions

View file

@ -5,9 +5,9 @@ import style from '../styles/index.module.scss';
export function getCustomClassName(type?: string, disabled?: boolean) { export function getCustomClassName(type?: string, disabled?: boolean) {
let customClassName = { let customClassName = {
slim: style.button_slim, slim: style.ui_kit_button_slim,
second: style.button_second, second: style.ui_kit_button_second,
primary: style.button_primary, primary: style.ui_kit_button_primary,
}[type || 'primary'] || ''; }[type || 'primary'] || '';
if (disabled) { if (disabled) {
@ -34,7 +34,7 @@ function UiKitButton({
return ( return (
<button <button
title={title} title={title}
className={`${style.button} ${customClassName || ''} ${className || ''}`} className={`${style.ui_kit_button} ${customClassName || ''} ${className || ''}`}
onClick={() => { onClick={() => {
if (onClick) onClick(); if (onClick) onClick();
}} }}

View file

@ -25,27 +25,27 @@ function UiKitWrapper({
}: IUiKitWrapperProps) { }: IUiKitWrapperProps) {
return ( return (
<div <div
className={`${style.wrapper} ${className || ''}`} className={`${style.ui_kit_wrapper} ${className || ''}`}
title={localization.get(help)} title={localization.get(help)}
> >
{title && ( {title && (
<h6 className={style.title}> <h6 className={style.ui_kit_title}>
{localization.get(title)} {localization.get(title)}
</h6> </h6>
)} )}
{description && ( {description && (
<p className={style.description}> <p className={style.ui_kit_description}>
{localization.get(description)} {localization.get(description)}
</p> </p>
)} )}
{children} {children}
{help && ( {help && (
<p className={style.help}> <p className={style.ui_kit_help}>
{localization.get(example)} {localization.get(example)}
</p> </p>
)} )}
{error && ( {error && (
<p className={style.error}> <p className={style.ui_kit_error}>
{error} {error}
</p> </p>
)} )}

View file

@ -22,15 +22,15 @@
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.wrapper + .wrapper { .ui_kit_wrapper + .ui_kit_wrapper {
vertical-align: top; vertical-align: top;
margin-top: var(--space-l); margin-top: var(--space-l);
} }
.title, .ui_kit_title,
.description, .ui_kit_description,
.help, .ui_kit_help,
.error, .ui_kit_error,
.button { .button {
font-weight: 100; font-weight: 100;
font-size: var(--font-xs); font-size: var(--font-xs);
@ -46,26 +46,27 @@
color: var(--color-grey); color: var(--color-grey);
} }
.title { .ui_kit_title {
font-weight: bold; font-weight: bold;
color: var(--color-black); color: var(--color-black);
} }
.title, .ui_kit_title,
.description { .ui_kit_description {
margin-bottom: 6px; margin-bottom: 6px;
} }
.help, .ui_kit_help,
.error { .ui_kit_error {
margin-top: 6px; margin-top: 6px;
} }
.error { .ui_kit_error {
color: var(--color-12); color: var(--color-12);
} }
.button {
.ui_kit_button {
--button-color-bg: var(--color-button); --button-color-bg: var(--color-button);
--button-color-text: #FFFFFF; --button-color-text: #FFFFFF;
--button-color-border: var(--color-button); --button-color-border: var(--color-button);
@ -82,7 +83,7 @@
} }
} }
.button { .ui_kit_button {
font-weight: bold; font-weight: bold;
font-size: var(--font-xs); font-size: var(--font-xs);
display: inline-block; display: inline-block;
@ -121,7 +122,7 @@
} }
} }
.button + .button { .ui_kit_button + .ui_kit_button {
margin-right: 24px; margin-right: 24px;
} }

View file

@ -2,6 +2,7 @@ import React, { useState } from 'react';
import dataGripStore from 'ts/store/DataGrip'; import dataGripStore from 'ts/store/DataGrip';
import { getDate, getDateByTimestamp } from 'ts/helpers/formatter'; import { getDate, getDateByTimestamp } from 'ts/helpers/formatter';
import RECOMMENDATION_TYPES from 'ts/helpers/Recommendations/contstants';
import RecommendationsWrapper from 'ts/components/Recommendations/wrapper'; import RecommendationsWrapper from 'ts/components/Recommendations/wrapper';
import NothingFound from 'ts/components/NothingFound'; import NothingFound from 'ts/components/NothingFound';
@ -29,7 +30,14 @@ function Changes({ statistic }: IChangesProps) {
const [fullDay, shortDay] = getDateByTimestamp(maxData.timestamp); const [fullDay, shortDay] = getDateByTimestamp(maxData.timestamp);
const recommendations = [ const recommendations = [
[fullDay, ` (${shortDay}) было влито больше всего изменений.`, 'fact'], {
title: fullDay, // TODO: вынести локализацию
description: ` (${shortDay}) было влито больше всего изменений.`,
type: RECOMMENDATION_TYPES.FACT,
arguments: {
description: [shortDay],
},
},
]; ];
return ( return (

View file

@ -9,8 +9,10 @@ import PageWrapper from 'ts/components/Page/wrapper';
import BarChart from 'ts/components/BarChart'; import BarChart from 'ts/components/BarChart';
import DayInfo from 'ts/components/DayInfo'; import DayInfo from 'ts/components/DayInfo';
import Title from 'ts/components/Title'; import Title from 'ts/components/Title';
import RECOMMENDATION_TYPES from 'ts/helpers/Recommendations/contstants';
import localization from 'ts/helpers/Localization'; import localization from 'ts/helpers/Localization';
interface ICommitsProps { interface ICommitsProps {
statistic: any; statistic: any;
} }
@ -31,11 +33,14 @@ function Commits({ statistic }: ICommitsProps) {
const [fullDay, shortDay] = getDateByTimestamp(maxData.timestamp); const [fullDay, shortDay] = getDateByTimestamp(maxData.timestamp);
const recommendations = [ const recommendations = [
[ {
fullDay, title: fullDay,
localization.get('page.common.commits.description', shortDay), description: 'page.common.commits.description',
'fact', type: RECOMMENDATION_TYPES.FACT,
], arguments: {
description: [shortDay],
},
},
]; ];
return ( return (
@ -53,7 +58,6 @@ function Commits({ statistic }: ICommitsProps) {
</PageWrapper> </PageWrapper>
<br/> <br/>
<br/> <br/>
{}
<Title title={localization.get( <Title title={localization.get(
'page.common.commits.title2', 'page.common.commits.title2',
getDate(selected?.timestamp), getDate(selected?.timestamp),

View file

@ -5,7 +5,7 @@ import NothingFound from 'ts/components/NothingFound';
import PageWrapper from 'ts/components/Page/wrapper'; import PageWrapper from 'ts/components/Page/wrapper';
import CandyChart from 'ts/components/CandyChart'; import CandyChart from 'ts/components/CandyChart';
import Title from 'ts/components/Title'; import Title from 'ts/components/Title';
import localization from 'ts/helpers/Localization'; import RECOMMENDATION_TYPES from 'ts/helpers/Recommendations/contstants';
interface IPopularWordsProps { interface IPopularWordsProps {
statistic: any[]; statistic: any[];
@ -23,12 +23,15 @@ function PopularWords({ statistic, mode }: IPopularWordsProps) {
if (!dots?.length) return (<NothingFound />); if (!dots?.length) return (<NothingFound />);
// dots[0].color = COLOR.FIRST;
const recommendations = [ const recommendations = [
[dots[0].title, {
localization.get('page.common.words.description', dots[0].value), title: dots[0].title,
'fact', description: 'page.common.words.description',
], type: RECOMMENDATION_TYPES.FACT,
arguments: {
description: [dots[0].value],
},
},
]; ];
return ( return (

View file

@ -13,7 +13,6 @@ import Pagination from 'ts/components/DataLoader/components/Pagination';
import getFakeLoader from 'ts/components/DataLoader/helpers/formatter'; import getFakeLoader from 'ts/components/DataLoader/helpers/formatter';
import NothingFound from 'ts/components/NothingFound'; import NothingFound from 'ts/components/NothingFound';
import TempoChart from 'ts/components/Tempo'; import TempoChart from 'ts/components/Tempo';
import Title from 'ts/components/Title';
import uiKitStyle from 'ts/components/UiKit/styles/index.module.scss'; import uiKitStyle from 'ts/components/UiKit/styles/index.module.scss';
import style from 'ts/pages/Team/styles/filters.module.scss'; import style from 'ts/pages/Team/styles/filters.module.scss';
@ -59,9 +58,8 @@ const Tempo = observer((): React.ReactElement => {
if (!partOfData?.length) return (<NothingFound />); if (!partOfData?.length) return (<NothingFound />);
return ( return (
<> <>
<Title title="common.filters" />
<PageWrapper> <PageWrapper>
<div className={style.tempo_page_filters}> <div className={style.tempo_filters}>
<UiKitButton <UiKitButton
type="second" type="second"
disabled={week === 1} disabled={week === 1}
@ -71,7 +69,7 @@ const Tempo = observer((): React.ReactElement => {
> >
« «
</UiKitButton> </UiKitButton>
<div className={`${uiKitStyle.ui_kit_common} ${style.date_range}`}> <div className={`${uiKitStyle.ui_kit_common} ${style.tempo_filters_date_range}`}>
{getShortDateRange({ {getShortDateRange({
from: firstWeekDay.timestamp, from: firstWeekDay.timestamp,
to: lastWeekDay.timestamp, to: lastWeekDay.timestamp,

View file

@ -7,12 +7,11 @@ import { IPaginationRequest, IPagination } from 'ts/interfaces/Pagination';
import { getShortDateRange, getShortNumber } from 'ts/helpers/formatter'; import { getShortDateRange, getShortNumber } from 'ts/helpers/formatter';
import dataGripStore from 'ts/store/DataGrip'; import dataGripStore from 'ts/store/DataGrip';
import PageWrapper from 'ts/components/Page/wrapper';
import DataLoader from 'ts/components/DataLoader'; import DataLoader from 'ts/components/DataLoader';
import Pagination from 'ts/components/DataLoader/components/Pagination'; import Pagination from 'ts/components/DataLoader/components/Pagination';
import getFakeLoader from 'ts/components/DataLoader/helpers/formatter'; import getFakeLoader from 'ts/components/DataLoader/helpers/formatter';
import NothingFound from 'ts/components/NothingFound'; import NothingFound from 'ts/components/NothingFound';
import Table from 'ts/components/Table'; import DataView from 'ts/components/DataView';
import Column from 'ts/components/Table/components/Column'; import Column from 'ts/components/Table/components/Column';
import { ColumnTypesEnum } from 'ts/components/Table/interfaces/Column'; import { ColumnTypesEnum } from 'ts/components/Table/interfaces/Column';
import LineChart from 'ts/components/LineChart'; import LineChart from 'ts/components/LineChart';
@ -26,9 +25,11 @@ import ISort from 'ts/interfaces/Sort';
interface IWeekViewProps { interface IWeekViewProps {
name: string; name: string;
response?: IPagination<any>; response?: IPagination<any>;
updateSort?: Function;
mode?: string;
} }
function WeekView({ response, name }: IWeekViewProps) { function WeekView({ response, updateSort, name, mode }: IWeekViewProps) {
if (!response) return null; if (!response) return null;
const typeChart = getOptions({ max: getMax(response, 'authors', name), order: dataGripStore.dataGrip.type.list }); const typeChart = getOptions({ max: getMax(response, 'authors', name), order: dataGripStore.dataGrip.type.list });
@ -39,7 +40,13 @@ function WeekView({ response, name }: IWeekViewProps) {
const taskInDayChart = getOptions({ max: getMax(response, 'taskInDay', name) }); const taskInDayChart = getOptions({ max: getMax(response, 'taskInDay', name) });
return ( return (
<Table rows={response.content}> <DataView
rows={response.content}
sort={response.sort}
updateSort={updateSort}
type={mode === 'print' ? 'cards' : undefined}
columnCount={mode === 'print' ? 3 : undefined}
>
<Column <Column
isFixed isFixed
template={ColumnTypesEnum.STRING} template={ColumnTypesEnum.STRING}
@ -104,7 +111,7 @@ function WeekView({ response, name }: IWeekViewProps) {
)} )}
width={200} width={200}
/> />
</Table> </DataView>
); );
} }
@ -126,17 +133,18 @@ const Week = observer(({
{mode !== 'print' && ( {mode !== 'print' && (
<RecommendationsWrapper recommendations={recommendations} /> <RecommendationsWrapper recommendations={recommendations} />
)} )}
<PageWrapper template="table">
<DataLoader <DataLoader
to="response" to="response"
loader={(pagination?: IPaginationRequest, sort?: ISort[]) => getFakeLoader({ loader={(pagination?: IPaginationRequest, sort?: ISort[]) => getFakeLoader({
content: rows, pagination, sort, content: rows, pagination, sort,
})} })}
> >
<WeekView name={statistic.author} /> <WeekView
name={statistic.author}
mode={mode}
/>
{mode !== 'print' && <Pagination />} {mode !== 'print' && <Pagination />}
</DataLoader> </DataLoader>
</PageWrapper>
</> </>
); );
}); });

View file

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import DataView from 'ts/components/DataView'; import Table from 'ts/components/Table';
import Column from 'ts/components/Table/components/Column'; import Column from 'ts/components/Table/components/Column';
import { ColumnTypesEnum } from 'ts/components/Table/interfaces/Column'; import { ColumnTypesEnum } from 'ts/components/Table/interfaces/Column';
import LineChart from 'ts/components/LineChart'; import LineChart from 'ts/components/LineChart';
@ -40,7 +40,7 @@ function Total() {
]; ];
return ( return (
<DataView rows={rows}> <Table rows={rows}>
<Column <Column
title="page.team.pr.workDays" title="page.team.pr.workDays"
properties="workDays" properties="workDays"
@ -79,7 +79,7 @@ function Total() {
/> />
)} )}
/> />
</DataView> </Table>
); );
} }

View file

@ -67,7 +67,6 @@ const PR = observer(({
<PageBreak/> <PageBreak/>
<Title title="page.team.pr.longDelay"/> <Title title="page.team.pr.longDelay"/>
<PageWrapper template="table">
<DataLoader <DataLoader
to="response" to="response"
loader={(pagination?: IPaginationRequest, sort?: ISort[]) => getFakeLoader({ loader={(pagination?: IPaginationRequest, sort?: ISort[]) => getFakeLoader({
@ -81,7 +80,6 @@ const PR = observer(({
<All mode={mode} /> <All mode={mode} />
{mode !== 'print' && <Pagination/>} {mode !== 'print' && <Pagination/>}
</DataLoader> </DataLoader>
</PageWrapper>
</> </>
); );
}); });

View file

@ -61,7 +61,7 @@ const Tempo = observer((): React.ReactElement => {
<> <>
<Title title="common.filters" /> <Title title="common.filters" />
<PageWrapper> <PageWrapper>
<div className={style.tempo_page_filters}> <div className={style.tempo_filters}>
<UiKitButton <UiKitButton
type="second" type="second"
disabled={week === 1} disabled={week === 1}
@ -71,7 +71,7 @@ const Tempo = observer((): React.ReactElement => {
> >
« «
</UiKitButton> </UiKitButton>
<div className={`${uiKitStyle.ui_kit_common} ${style.date_range}`}> <div className={`${uiKitStyle.ui_kit_common} ${style.tempo_filters_date_range}`}>
{getShortDateRange({ {getShortDateRange({
from: firstWeekDay.timestamp, from: firstWeekDay.timestamp,
to: lastWeekDay.timestamp, to: lastWeekDay.timestamp,
@ -96,7 +96,7 @@ const Tempo = observer((): React.ReactElement => {
« «
</UiKitButton> </UiKitButton>
<UiKitSelect <UiKitSelect
className={style.user} className={style.tempo_filters_user}
value={user} value={user}
options={[ '', ...dataGripStore.dataGrip.author.list]} options={[ '', ...dataGripStore.dataGrip.author.list]}
onChange={(id: number, name: string) => { onChange={(id: number, name: string) => {

View file

@ -15,12 +15,12 @@ const TreeFilters = observer((): React.ReactElement => {
options.unshift({ id: 0, title: localization.get('page.team.tree.filters.all') }); options.unshift({ id: 0, title: localization.get('page.team.tree.filters.all') });
return ( return (
<> <div>
<UiKitSelect <UiKitSelect
title="page.team.tree.filters.author" title="page.team.tree.filters.author"
value={treeStore.authorId} value={treeStore.authorId}
options={options} options={options}
className={style.filter} className={style.tree_filters}
onChange={(authorId: number) => { onChange={(authorId: number) => {
treeStore.updateFilter('authorId', authorId); treeStore.updateFilter('authorId', authorId);
}} }}
@ -29,12 +29,12 @@ const TreeFilters = observer((): React.ReactElement => {
title="page.team.tree.filters.commits" title="page.team.tree.filters.commits"
help="page.team.tree.filters.help" help="page.team.tree.filters.help"
value={treeStore.minCommits} value={treeStore.minCommits}
className={style.filter} className={style.tree_filters}
onChange={(minCommits: number) => { onChange={(minCommits: number) => {
treeStore.updateFilter('minCommits', minCommits); treeStore.updateFilter('minCommits', minCommits);
}} }}
/> />
</> </div>
); );
}); });

View file

@ -1,25 +1,25 @@
@import '../../../../styles/variables'; @import '../../../../styles/variables';
.filter { .tree_filters {
display: inline-block; display: inline-block;
margin: 0 24px 24px 0; margin: 0 24px 24px 0;
vertical-align: top; vertical-align: top;
} }
.tempo_page_filters { .tempo_filters {
margin: 0 0 24px 0; margin: 0 0 24px 0;
}
.date_range { &_date_range {
width: 260px; width: 260px;
max-width: 260px; max-width: 260px;
margin: 0 var(--space-xs); margin: 0 var(--space-xs);
text-align: center; text-align: center;
} }
.user { &_user {
display: inline-block; display: inline-block;
width: 260px; width: 260px;
max-width: 260px; max-width: 260px;
margin: 0 6px; margin: 0 6px;
}
} }