): Partial & Partial) => {
+ const filtersKeys: (keyof ProjectsFilters)[] = ['categories', 'projectLicense', 'tags', 'projectStatus', 'yearFounded'];
+ if (!params) return {};
+ let res: Record = {};
+ for (const [key, value] of Object.entries(params)) {
+ if (filtersKeys.includes(key as any)) continue;
+ res[key] = value;
+ }
+ console.log(res);
+ return res;
+}
+
export const useUpdateUrlWithFilters = (state?: Partial | null) => {
const location = useLocation()
@@ -38,14 +50,21 @@ export const useUpdateUrlWithFilters = (state?: Partial | null)
useEffect(() => {
+ const allParams = qs.parse(window.location.search.slice(1))
+ console.log(allParams);
+
+ const nonFiltersParams = extractNonFiltersParams(allParams);
+ const filtersParams = removeEmptyFitlers({ ...state } ?? {});
+
+
const queryString = qs.stringify(
- removeEmptyFitlers(state ?? {}),
+ { ...filtersParams, ...nonFiltersParams },
{ skipNulls: true }
)
- navigate(`${location.pathname}?${queryString}`, { replace: true });
+ navigate(`${window.location.pathname}?${queryString}`, { replace: true });
- }, [location.pathname, location.search, navigate, state]);
+ }, [navigate, state]);
}
diff --git a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
index c8be2b5..e52ff53 100644
--- a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
+++ b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { MdLocalFireDepartment } from 'react-icons/md';
import { ModalCard } from 'src/Components/Modals/ModalsContainer/ModalsContainer';
import { useAppDispatch, useAppSelector, useMediaQuery } from 'src/utils/hooks';
-import { openModal, scheduleModal } from 'src/redux/features/modals.slice';
+import { Direction, openModal, scheduleModal } from 'src/redux/features/modals.slice';
import { setProject } from 'src/redux/features/project.slice';
import Button from 'src/Components/Button/Button';
import ProjectCardSkeleton from './ProjectDetailsCard.Skeleton'
@@ -24,10 +24,13 @@ import { CgGitFork } from 'react-icons/cg';
interface Props extends ModalCard {
- projectId: string;
+ params: {
+ projectId: string;
+ }
+
}
-export default function ProjectDetailsCard({ direction, projectId, ...props }: Props) {
+export default function ProjectDetailsCard({ params: { projectId }, ...props }: Props) {
const dispatch = useAppDispatch();
const [screenshotsOpen, setScreenshotsOpen] = useState(-1);
@@ -64,7 +67,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P
if (error)
return
@@ -72,7 +75,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P
if (loading)
- return
;
+ return
;
const project = data?.getProject?.[0];
@@ -113,7 +116,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P
return (
{/* Cover Image */}
@@ -132,7 +135,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P
{/* Title & Basic Info */}
-

+
{project?.title}
diff --git a/src/graphql/index.tsx b/src/graphql/index.tsx
index 1a0a58e..d20710a 100644
--- a/src/graphql/index.tsx
+++ b/src/graphql/index.tsx
@@ -133,6 +133,7 @@ export type QueryCategoryListArgs = {
description: InputMaybe
;
icon: InputMaybe;
id: InputMaybe;
+ isHidden: InputMaybe;
name: InputMaybe;
projectFromData: InputMaybe>>;
projectsCount: InputMaybe;
@@ -318,6 +319,7 @@ export type CategoryList = {
description: Maybe;
icon: Maybe;
id: Maybe;
+ isHidden: Maybe;
name: Maybe;
projectFromData: Maybe>>;
projectsCount: Maybe;
@@ -430,7 +432,7 @@ export type ProjectDetailsQuery = { __typename?: 'Query', getProject: Array<{ __
export const AllCategoriesDocument = gql`
query AllCategories($filter: JSON) {
- categoryList(_filter: $filter) {
+ categoryList(isHidden: false, _filter: $filter) {
projectsCount
id
name
diff --git a/src/utils/Wrapper.tsx b/src/utils/Wrapper.tsx
index fe23740..153fd00 100644
--- a/src/utils/Wrapper.tsx
+++ b/src/utils/Wrapper.tsx
@@ -9,13 +9,13 @@ import { setIsMobileScreen } from 'src/redux/features/ui.slice';
import { isMobileScreen } from './helperFunctions';
import ReactTooltip from 'react-tooltip';
import { ToastContainer } from 'react-toastify';
-
import 'react-toastify/dist/ReactToastify.css';
import 'react-loading-skeleton/dist/skeleton.css'
import THEME from './theme';
import { NotificationsService } from 'src/services';
import ErrorPage from 'src/Components/Errors/ErrorPage/ErrorPage';
import { ErrorBoundary } from 'react-error-boundary';
+
THEME.injectStyles();
let basename = '/';
@@ -41,7 +41,6 @@ export const useWrapperSetup = () => {
useResizeListener(resizeListener)
}
-
export default function Wrapper(props: any) {
return (