This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): translate stats details page
- Loading branch information
1 parent
2b5c80e
commit 6e82ef2
Showing
18 changed files
with
234 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
front/src/features/statistics/features/details/generic/features/components/next-prev.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { useCallback } from 'react' | ||
import { GroupBy } from '@shared/enum/GroupBy' | ||
import { Button, ButtonType } from '@front/ui/components/form/button' | ||
import { useTranslation } from '@front/domain/i18n' | ||
|
||
interface Props { | ||
group?: GroupBy | ||
previousPeriodNumber: number | ||
setPreviousPeriodNumber: (t: (v: number) => number) => void | ||
} | ||
|
||
export const Prev = ({ group, setPreviousPeriodNumber }: Props) => { | ||
const back = useCallback(() => setPreviousPeriodNumber(v => v + 1), [ | ||
setPreviousPeriodNumber, | ||
]) | ||
|
||
const { t } = useTranslation() | ||
|
||
if (!group) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Button onClick={back} type={ButtonType.Text}> | ||
{t(`stats:details.prev-${group}`)} | ||
</Button> | ||
) | ||
} | ||
|
||
export const Next = ({ | ||
group, | ||
previousPeriodNumber, | ||
setPreviousPeriodNumber, | ||
}: Props) => { | ||
const next = useCallback(() => setPreviousPeriodNumber(v => v - 1), [ | ||
setPreviousPeriodNumber, | ||
]) | ||
|
||
const { t } = useTranslation() | ||
|
||
if (!group || previousPeriodNumber <= 0) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Button onClick={next} type={ButtonType.Text}> | ||
{t(`stats:details.next-${group}`)} | ||
</Button> | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
front/src/features/statistics/features/details/generic/features/components/show-month.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Button, ButtonType } from '@front/ui/components/form/button' | ||
import { pushRoute } from '@front/features/routing' | ||
import { GroupBy } from '@shared/enum/GroupBy' | ||
import { useTranslation } from '@front/domain/i18n' | ||
|
||
interface Props { | ||
group?: GroupBy | ||
detailType: string | ||
} | ||
|
||
export const ShowMonth = ({ group, detailType }: Props) => { | ||
const showMonth = !group || group !== GroupBy.Month | ||
const { t } = useTranslation() | ||
|
||
return showMonth ? ( | ||
<Button | ||
onClick={() => pushRoute(`/app/stats/${detailType}/month`)} | ||
type={ButtonType.Secondary} | ||
> | ||
{t('stats:details.show-month')} | ||
</Button> | ||
) : null | ||
} |
23 changes: 23 additions & 0 deletions
23
front/src/features/statistics/features/details/generic/features/components/show-whole.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Button, ButtonType } from '@front/ui/components/form/button' | ||
import { pushRoute } from '@front/features/routing' | ||
import { GroupBy } from '@shared/enum/GroupBy' | ||
import { useTranslation } from '@front/domain/i18n' | ||
|
||
interface Props { | ||
group?: GroupBy | ||
detailType: string | ||
} | ||
|
||
export const ShowWhole = ({ group, detailType }: Props) => { | ||
const showWhole = !!group | ||
const { t } = useTranslation() | ||
|
||
return showWhole ? ( | ||
<Button | ||
onClick={() => pushRoute(`/app/stats/${detailType}`)} | ||
type={ButtonType.Secondary} | ||
> | ||
{t('stats:details.show-whole')} | ||
</Button> | ||
) : null | ||
} |
23 changes: 23 additions & 0 deletions
23
front/src/features/statistics/features/details/generic/features/components/show-year.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Button, ButtonType } from '@front/ui/components/form/button' | ||
import { pushRoute } from '@front/features/routing' | ||
import { GroupBy } from '@shared/enum/GroupBy' | ||
import { useTranslation } from '@front/domain/i18n' | ||
|
||
interface Props { | ||
group?: GroupBy | ||
detailType: string | ||
} | ||
|
||
export const ShowYear = ({ group, detailType }: Props) => { | ||
const showYear = !group || group !== GroupBy.Year | ||
const { t } = useTranslation() | ||
|
||
return showYear ? ( | ||
<Button | ||
onClick={() => pushRoute(`/app/stats/${detailType}/year`)} | ||
type={ButtonType.Secondary} | ||
> | ||
{t('stats:details.show-year')} | ||
</Button> | ||
) : null | ||
} |
50 changes: 0 additions & 50 deletions
50
front/src/features/statistics/features/details/generic/features/group-chooser.tsx
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
front/src/features/statistics/features/details/generic/features/period-chooser.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...rc/features/statistics/features/details/generic/features/period-chooser/PeriodChooser.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.card { | ||
display: grid; | ||
grid-template-rows: 1fr 1fr; | ||
gap: 16px; | ||
} |
Oops, something went wrong.