Skip to content

Commit

Permalink
Merge pull request #128 from DNO-inc/feature#100
Browse files Browse the repository at this point in the history
Fix statuses filter bug and hide statistic
  • Loading branch information
yaroslavUsenko authored Jan 21, 2024
2 parents cdf8641 + a30d5c1 commit b13d638
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 177 deletions.
6 changes: 3 additions & 3 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@
"activitySummary": {
"heading": "Activity summary"
},
"calendarStatistic": {
"heading": "Calendar"
"scopeStatistic": {
"heading": "Tickets processed"
},
"mentionedFaculties": {
"heading": "Mentioned faculties"
},
"systemStatus": {
"heading": "Current system status"
"heading": "Last 30 day"
}
},
"privacyPolicy": {
Expand Down
6 changes: 3 additions & 3 deletions public/locales/ua/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@
"activitySummary": {
"heading": "Підсумок діяльності"
},
"calendarStatistic": {
"heading": "Календар"
"scopeStatistic": {
"heading": "Звернень оброблено"
},
"mentionedFaculties": {
"heading": "Згадані факультети"
},
"systemStatus": {
"heading": "Поточний стан системи"
"heading": "Останні 30 днів"
}
},
"privacyPolicy": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC } from "react";
import { useTranslation } from "react-i18next";

import Box from "@mui/material/Box";
import Checkbox from "@mui/material/Checkbox";
Expand All @@ -13,11 +14,12 @@ interface CustomCheckboxProps {
}

const CustomCheckbox: FC<CustomCheckboxProps> = ({ status }) => {
const { t } = useTranslation();
const { palette }: IPalette = useTheme();

return (
<FormControlLabel
label={status.name}
label={t(`statusesFilter.${status.name}`)}
control={
<Box sx={{ position: "relative" }}>
<Checkbox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChangeEvent } from "react";
import { useTranslation } from "react-i18next";
import { useSearchParams } from "react-router-dom";

import useTheme from "@mui/material/styles/useTheme";
Expand All @@ -19,7 +18,6 @@ export interface IStatus {
export const useGetStatusesFullInfo = (
isAllStatuses: boolean
): [IStatus[], boolean[]] => {
const { t } = useTranslation();
const { palette }: IPalette = useTheme();

const [searchParams] = useSearchParams();
Expand All @@ -32,7 +30,7 @@ export const useGetStatusesFullInfo = (
checked: boolean
): IStatus => ({
id,
name: t(`statusesFilter.${name}`),
name: name,
color: palette.semantic[color],
checked,
onChange: handleChange(id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import GridViewIcon from "@mui/icons-material/GridView";
import GridViewSharpIcon from "@mui/icons-material/GridViewSharp";
import ExpandLess from "@mui/icons-material/ExpandLess";
import ExpandMore from "@mui/icons-material/ExpandMore";
import InsertChartIcon from "@mui/icons-material/InsertChart";
import InsertChartOutlinedIcon from "@mui/icons-material/InsertChartOutlined";
// import InsertChartIcon from "@mui/icons-material/InsertChart";
// import InsertChartOutlinedIcon from "@mui/icons-material/InsertChartOutlined";

import { NavbarListItem } from "./components/NavbarListItem";

Expand Down Expand Up @@ -115,15 +115,15 @@ const GeneralActions: FC<GeneralActionsProps> = ({
activeIcon={<GridViewSharpIcon />}
disableIcon={<GridViewIcon />}
/>
<NavbarListItem
{/* <NavbarListItem
title={"statistic"}
endpoint={endpoints.STATISTIC}
disabled={!isAuth}
selectedKey={selectedKey}
handleListItemClick={handleListItemClick}
activeIcon={<InsertChartIcon />}
disableIcon={<InsertChartOutlinedIcon />}
/>
/> */}
</>
)}
<NavbarListItem
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Queue/Queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface IScope {
queues: IQueue[];
}

const scopeNames = ["Reports", "Q/A", "Suggestions"];
const scopeNames = ["Reports", "Q/A", "Suggestion"];

const Queue: FC = () => {
const { t, i18n } = useTranslation();
Expand Down
10 changes: 6 additions & 4 deletions src/pages/Statistic/Statistic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Typography from "@mui/material/Typography";

import { StatusesStatistic } from "./components/StatusesStatistic";
import { ActivitySummary } from "./components/ActivitySummary";
import { CalendarStatistic } from "./components/CalendarStatistic";
import { ScopesStatistic } from "./components/ScopesStatistic";
import { FacultiesStatistic } from "./components/FacultiesStatistic";

import {
Expand Down Expand Up @@ -44,16 +44,17 @@ const Statistic: FC = () => {
sx={{
display: "grid",
gap: "20px",
gridTemplateAreas: `"statuses calendar faculties faculties"
"statuses activities activities none"`,
gridTemplateAreas: `"statuses activities faculties"
"statuses scopes faculties"
"statuses none none"`,
pt: "100px !important",
}}
>
{generalStatistic && (
<StatusesStatistic statusesStatistic={generalStatistic.statuses} />
)}
{generalStatistic && (
<CalendarStatistic calendarStatistic={generalStatistic.scopes} />
<ScopesStatistic calendarStatistic={generalStatistic.scopes} />
)}
{facultiesStatistic && (
<FacultiesStatistic
Expand All @@ -63,6 +64,7 @@ const Statistic: FC = () => {
{summaryActivity && (
<ActivitySummary summaryActivity={summaryActivity} />
)}
<div style={{ gridArea: "none" }}></div>
</Box>
</Grid>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ActivitySummary: FC<ActivitySummaryProps> = ({ summaryActivity }) => {
return (
<StatisticCard
title={"activitySummary"}
width={420}
width={320}
styles={{ gridArea: "activities" }}
>
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,31 @@ interface ActivityTileProps {
color: string;
}

const ActivityTile: FC<ActivityTileProps> = ({
icon,
stat,
title,
percent,
color,
}) => {
const ActivityTile: FC<ActivityTileProps> = ({ icon, stat, title }) => {
return (
<Box>
<img src={icon} alt={title} style={{ marginBottom: 12 }} />
<div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
flexGrow: 1,
}}
>
<img
src={icon}
alt={title}
style={{ marginBottom: 12, width: 26, height: 26 }}
/>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: 5,
}}
>
<div style={{ fontSize: 16 }}>{stat}</div>
<div style={{ fontSize: 12 }}>{title}</div>
<div style={{ fontSize: 10, color: color }}>{percent}</div>
</div>
</Box>
);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/Statistic/components/CalendarStatistic/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,63 +1,39 @@
import { FC } from "react";

import Box from "@mui/material/Box";
import useTheme from "@mui/material/styles/useTheme";
import { Button, Divider, Typography } from "@mui/material";

import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
import FlagOutlinedIcon from "@mui/icons-material/FlagOutlined";
import HandshakeOutlinedIcon from "@mui/icons-material/HandshakeOutlined";

import IPalette from "theme/IPalette.interface";
import { IScope } from "../../CalendarStatistic";
import { StatisticCard } from "components/StatisticCard";

import { scopes } from "constants/scopes";
import { ScopeTile } from "./components/ScopeTile";

interface IScope {
date: string;
scope: string;
tickets_count: number;
}

interface ScopesStatisticProps {
calendarStatistic: IScope[];
}

const ScopesStatistic: FC<ScopesStatisticProps> = ({ calendarStatistic }) => {
const { palette }: IPalette = useTheme();

const icons = {
[scopes.QA]: <HelpOutlineIcon fontSize="small" />,
[scopes.REPORTS]: <FlagOutlinedIcon fontSize="small" />,
[scopes.SUGGESTION]: <HandshakeOutlinedIcon fontSize="small" />,
};

return (
<Box
sx={{
display: "flex",
flexDirection: "column",
gap: "25px",
fontSize: 14,
fontWeight: 500,
}}
<StatisticCard
title={"scopeStatistic"}
width={320}
styles={{ gridArea: "scopes" }}
>
<Divider sx={{ ml: "-14px", width: "110%" }} />
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<Typography variant="h2" sx={{ fontWeight: 500 }}>
Tickets processed
</Typography>
<Button
color="inherit"
sx={{
fontSize: 14,
color: palette.whiteAlpha.default,
textTransform: "initial",
}}
>
View all
</Button>
</Box>
<Box sx={{ display: "flex", flexDirection: "column", gap: "14px" }}>
{calendarStatistic.map(scopeStat => {
const { scope, tickets_count } = scopeStat;
Expand All @@ -72,7 +48,7 @@ const ScopesStatistic: FC<ScopesStatisticProps> = ({ calendarStatistic }) => {
);
})}
</Box>
</Box>
</StatisticCard>
);
};

Expand Down
Loading

0 comments on commit b13d638

Please sign in to comment.