mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 15:55:26 +02:00
added EmptyStateScreen.tsx to ReportsRoute.tsx
This commit is contained in:
parent
9c1ea3707b
commit
2840645b94
@ -168,6 +168,10 @@
|
|||||||
},
|
},
|
||||||
"ReportsRoute": {
|
"ReportsRoute": {
|
||||||
"title": "Reports",
|
"title": "Reports",
|
||||||
|
"emptyState": {
|
||||||
|
"title": "Welcome to your Reports!",
|
||||||
|
"description": "Here you will find your email reports. Currently, you don't have any reports. Wait until you receive an email"
|
||||||
|
},
|
||||||
"pageActions": {
|
"pageActions": {
|
||||||
"sort": {
|
"sort": {
|
||||||
"List": "List reports by their date",
|
"List": "List reports by their date",
|
||||||
|
28
src/route-widgets/ReportsRoute/EmptyStateScreen.tsx
Normal file
28
src/route-widgets/ReportsRoute/EmptyStateScreen.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import {ReactElement} from "react"
|
||||||
|
import {useTranslation} from "react-i18next"
|
||||||
|
|
||||||
|
import {Grid, Typography} from "@mui/material"
|
||||||
|
import {mdiTextBoxMultiple} from "@mdi/js/commonjs/mdi"
|
||||||
|
import Icon from "@mdi/react"
|
||||||
|
|
||||||
|
export default function EmptyStateScreen(): ReactElement {
|
||||||
|
const {t} = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid container spacing={4} direction="column" alignItems="center">
|
||||||
|
<Grid item>
|
||||||
|
<Typography variant="h6" component="h2">
|
||||||
|
{t("routes.ReportsRoute.emptyState.title")}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<Icon path={mdiTextBoxMultiple} size={2.5} />,
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<Typography variant="body1">
|
||||||
|
{t("routes.ReportsRoute.emptyState.description")}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
}
|
@ -14,6 +14,7 @@ import {getReports} from "~/apis"
|
|||||||
import {WithEncryptionRequired} from "~/hocs"
|
import {WithEncryptionRequired} from "~/hocs"
|
||||||
import {DecryptReport} from "~/components"
|
import {DecryptReport} from "~/components"
|
||||||
import {createEnumMapFromTranslation} from "~/utils"
|
import {createEnumMapFromTranslation} from "~/utils"
|
||||||
|
import EmptyStateScreen from "~/route-widgets/ReportsRoute/EmptyStateScreen"
|
||||||
import QueryResult from "~/components/QueryResult"
|
import QueryResult from "~/components/QueryResult"
|
||||||
import ReportInformationItem from "~/route-widgets/ReportsRoute/ReportInformationItem"
|
import ReportInformationItem from "~/route-widgets/ReportsRoute/ReportInformationItem"
|
||||||
import SimplePage from "~/components/SimplePage"
|
import SimplePage from "~/components/SimplePage"
|
||||||
@ -43,6 +44,7 @@ function ReportsRoute(): ReactElement {
|
|||||||
<SimplePage
|
<SimplePage
|
||||||
title="Reports"
|
title="Reports"
|
||||||
pageOptionsActions={
|
pageOptionsActions={
|
||||||
|
(query.data?.items?.length || 0) > 0 && (
|
||||||
<TextField
|
<TextField
|
||||||
value={sortingView}
|
value={sortingView}
|
||||||
onChange={event => setSortingView(event.target.value as SortingView)}
|
onChange={event => setSortingView(event.target.value as SortingView)}
|
||||||
@ -63,6 +65,7 @@ function ReportsRoute(): ReactElement {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</TextField>
|
</TextField>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<QueryResult<PaginationResult<Report>> query={query}>
|
<QueryResult<PaginationResult<Report>> query={query}>
|
||||||
@ -72,6 +75,10 @@ function ReportsRoute(): ReactElement {
|
|||||||
{reports => (
|
{reports => (
|
||||||
<>
|
<>
|
||||||
{(() => {
|
{(() => {
|
||||||
|
if (result.items.length === 0) {
|
||||||
|
return <EmptyStateScreen />
|
||||||
|
}
|
||||||
|
|
||||||
switch (sortingView) {
|
switch (sortingView) {
|
||||||
case SortingView.List:
|
case SortingView.List:
|
||||||
return sortArray(
|
return sortArray(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user