From 8c5ae8fea5ed3adb2fffe6f212c249eb5e085f83 Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Tue, 31 Dec 2024 19:05:56 +0530 Subject: [PATCH] Issue feat:Fix build issue --- src/components/SearchBox.tsx | 4 +- .../workspace/content/allContents/index.tsx | 3 +- .../content/discover-contents/index.tsx | 49 +++++++------------ .../workspace/content/submitted/index.tsx | 4 +- .../workspace/content/up-review/index.tsx | 4 +- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/components/SearchBox.tsx b/src/components/SearchBox.tsx index 1e3f9cd..4467a99 100644 --- a/src/components/SearchBox.tsx +++ b/src/components/SearchBox.tsx @@ -23,7 +23,7 @@ import { getPrimaryCategory, } from "@/services/ContentService"; import { SortOptions, StatusOptions } from "@/utils/app.constant"; -import router from "next/router"; +import { useRouter } from "next/router"; export interface SearchBarProps { onSearch: (value: string) => void; @@ -52,6 +52,8 @@ const SearchBox: React.FC = ({ allContents = false, discoverContents = false, }) => { + const router = useRouter(); + const theme = useTheme(); const [searchTerm, setSearchTerm] = useState(value); const sort: string = typeof router.query.sort === "string" diff --git a/src/pages/workspace/content/allContents/index.tsx b/src/pages/workspace/content/allContents/index.tsx index 5f7f02d..df822fb 100644 --- a/src/pages/workspace/content/allContents/index.tsx +++ b/src/pages/workspace/content/allContents/index.tsx @@ -26,7 +26,7 @@ import { timeAgo } from "@/utils/Helper"; import Loader from "@/components/Loader"; import NoDataFound from "@/components/NoDataFound"; import { MIME_TYPE } from "@/utils/app.config"; -import router from "next/router"; +import { useRouter } from "next/router"; import PaginationComponent from "@/components/PaginationComponent"; import { LIMIT } from "@/utils/app.constant"; import WorkspaceText from "@/components/WorkspaceText"; @@ -71,6 +71,7 @@ const columns = [ ]; const AllContentsPage = () => { const theme = useTheme(); + const router = useRouter(); const [selectedKey, setSelectedKey] = useState("allContents"); const [page, setPage] = useState(0); diff --git a/src/pages/workspace/content/discover-contents/index.tsx b/src/pages/workspace/content/discover-contents/index.tsx index 1a2f727..eebecc6 100644 --- a/src/pages/workspace/content/discover-contents/index.tsx +++ b/src/pages/workspace/content/discover-contents/index.tsx @@ -1,40 +1,28 @@ +import KaTableComponent from "@/components/KaTableComponent"; +import Loader from "@/components/Loader"; +import PaginationComponent from "@/components/PaginationComponent"; +import WorkspaceText from "@/components/WorkspaceText"; +import { timeAgo } from "@/utils/Helper"; +import { LIMIT } from "@/utils/app.constant"; +import useSharedStore from "@/utils/useSharedState"; +import { + Box, + Typography, + useTheme +} from "@mui/material"; +import { DataType } from "ka-table/enums"; +import "ka-table/style.css"; +import { useRouter } from "next/router"; import React, { useEffect, useMemo, - useState, - useCallback, useRef, + useState } from "react"; import Layout from "../../../../components/Layout"; -import { - Typography, - Box, - Table, - TableHead, - TableBody, - TableRow, - TableCell, - TablePagination, - IconButton, - useTheme, -} from "@mui/material"; -import DeleteIcon from "@mui/icons-material/Delete"; -import UpReviewTinyImage from "@mui/icons-material/LibraryBooks"; import SearchBox from "../../../../components/SearchBox"; -import { deleteContent, getContent } from "../../../../services/ContentService"; -import { timeAgo } from "@/utils/Helper"; -import Loader from "@/components/Loader"; -import NoDataFound from "@/components/NoDataFound"; -import { MIME_TYPE } from "@/utils/app.config"; -import router from "next/router"; -import PaginationComponent from "@/components/PaginationComponent"; -import { LIMIT } from "@/utils/app.constant"; -import WorkspaceText from "@/components/WorkspaceText"; -import { Table as KaTable } from "ka-table"; -import { DataType } from "ka-table/enums"; -import "ka-table/style.css"; -import KaTableComponent from "@/components/KaTableComponent"; -import useSharedStore from "@/utils/useSharedState"; +import { getContent } from "../../../../services/ContentService"; + // const columns = [ // { key: 'name', title: 'Content', dataType: DataType.String, width: "450px" }, // { key: 'lastUpdatedOn', title: 'Last Updated', dataType: DataType.String, width: "300px" }, @@ -74,6 +62,7 @@ const columns = [ ]; const ContentsPage = () => { const theme = useTheme(); + const router = useRouter(); const [selectedKey, setSelectedKey] = useState("discover-contents"); const [page, setPage] = useState(0); diff --git a/src/pages/workspace/content/submitted/index.tsx b/src/pages/workspace/content/submitted/index.tsx index 269ed34..4c03f8f 100644 --- a/src/pages/workspace/content/submitted/index.tsx +++ b/src/pages/workspace/content/submitted/index.tsx @@ -19,7 +19,7 @@ import PaginationComponent from "@/components/PaginationComponent"; import NoDataFound from "@/components/NoDataFound"; import { LIMIT } from "@/utils/app.constant"; import { MIME_TYPE } from "@/utils/app.config"; -import router from "next/router"; +import { useRouter } from "next/router"; import WorkspaceText from "@/components/WorkspaceText"; import { DataType } from "ka-table/enums"; import KaTableComponent from "@/components/KaTableComponent"; @@ -48,6 +48,8 @@ const columns = [ { key: "action", title: "ACTION", dataType: DataType.String, width: "100px" }, ]; const SubmittedForReviewPage = () => { + const router = useRouter(); + const [selectedKey, setSelectedKey] = useState("submitted"); const filterOption: string[] = router.query.filterOptions ? JSON.parse(router.query.filterOptions as string) diff --git a/src/pages/workspace/content/up-review/index.tsx b/src/pages/workspace/content/up-review/index.tsx index 97a58d4..80d3eb9 100644 --- a/src/pages/workspace/content/up-review/index.tsx +++ b/src/pages/workspace/content/up-review/index.tsx @@ -19,7 +19,7 @@ import PaginationComponent from "@/components/PaginationComponent"; import NoDataFound from "@/components/NoDataFound"; import { LIMIT } from "@/utils/app.constant"; import { MIME_TYPE } from "@/utils/app.config"; -import router from "next/router"; +import { useRouter } from "next/router"; import WorkspaceText from "@/components/WorkspaceText"; import { DataType } from 'ka-table/enums'; import KaTableComponent from "@/components/KaTableComponent"; @@ -37,6 +37,8 @@ const columns = [ ] const UpForReviewPage = () => { + const router = useRouter(); + const [selectedKey, setSelectedKey] = useState("up-review"); const filterOption: string[] = router.query.filterOptions ? JSON.parse(router.query.filterOptions as string)