Skip to content

Commit f319688

Browse files
committed
rework: Make bugs column as hook
1 parent e4e07c2 commit f319688

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/pages/MyBugs/columns.ts renamed to src/pages/MyBugs/columns.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Column } from "@appquality/appquality-design-system/dist/stories/table/_types";
2-
import { TFunction } from "react-i18next";
2+
import { useTranslation } from "react-i18next";
3+
import { useAppDispatch } from "src/store";
34
import { updateMybugsSortingOptions } from "../../redux/myBugs/actionCreator";
45

5-
export const MyBugsColumns = (
6-
dispatch: AppDispatch,
7-
t: TFunction<"translation">
8-
): Column[] => {
6+
export const useBugColumns = (): Column[] => {
7+
const { t } = useTranslation();
8+
const dispatch = useAppDispatch();
99
return [
1010
{
1111
title: "Id",

src/pages/MyBugs/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import { coloredStatus } from "../../redux/myBugs/utils";
1414
import { useAppDispatch } from "../../redux/provider";
1515
import MyBugsFilters from "./MyBugsFilters";
1616
import MyBugsTable from "./MyBugsTable";
17-
import { MyBugsColumns } from "./columns";
17+
import { useBugColumns } from "./columns";
1818
import { useQueryStringFilters } from "./useQueryStringFilters";
1919

2020
export default function MyBugs() {
2121
const { t } = useTranslation();
2222
const dispatch = useAppDispatch();
23+
const columns = useBugColumns();
2324
useQueryStringFilters();
2425
const { selectedCampaign, selectedSeverity, selectedStatus } = useSelector(
2526
(state: GeneralState) => ({
@@ -29,7 +30,6 @@ export default function MyBugs() {
2930
}),
3031
shallowEqual
3132
);
32-
3333
const { limit, start, order, orderBy } = useSelector(
3434
(state: GeneralState) => ({
3535
limit: state.myBugs.bugsList.limit,
@@ -96,7 +96,6 @@ export default function MyBugs() {
9696
};
9797
});
9898

99-
const columns = MyBugsColumns(dispatch, t);
10099
return (
101100
<PageTemplate title={t("Uploaded Bugs")} route={"my-bugs"} shouldBeLoggedIn>
102101
<BSGrid>

0 commit comments

Comments
 (0)