diff --git a/src/features/Posts/pages/PostDetailsPage/PostDetailsPage.tsx b/src/features/Posts/pages/PostDetailsPage/PostDetailsPage.tsx
index 2994964..b424b97 100644
--- a/src/features/Posts/pages/PostDetailsPage/PostDetailsPage.tsx
+++ b/src/features/Posts/pages/PostDetailsPage/PostDetailsPage.tsx
@@ -16,16 +16,22 @@ import { RotatingLines } from 'react-loader-spinner'
const CommentsSection = lazy(() => import( /* webpackChunkName: "comments_section" */ "src/features/Posts/Components/Comments"))
-export default function PostDetailsPage() {
- const { type: _type, id } = useParams();
- const type = capitalize(_type);
+interface Props {
+ postType: 'story' | 'bounty' | 'question'
+}
+
+export default function PostDetailsPage(props: Props) {
+ const { slug } = useParams();
+ const type = capitalize(props.postType);
+
+ const id = Number(slug?.includes('--') ? slug.slice(slug.lastIndexOf('--') + 2) : slug)
const postDetailsQuery = usePostDetailsQuery({
variables: {
- id: Number(id!),
+ id,
type: type as any
},
- skip: isNaN(Number(id)),
+ skip: isNaN(id),
})
diff --git a/src/utils/routing/loadable.tsx b/src/utils/routing/loadable.tsx
index d8eabce..26509f0 100644
--- a/src/utils/routing/loadable.tsx
+++ b/src/utils/routing/loadable.tsx
@@ -1,8 +1,10 @@
import { Suspense } from "react";
import LoadingPage from "src/Components/LoadingPage/LoadingPage";
-export const Loadable = (Component: any, Loading = LoadingPage) => (props: any) => (
-
}>
-
-
-);
+export function Loadable
(Component: React.LazyExoticComponent<(props: P) => JSX.Element>, Loading = LoadingPage) {
+ return (props: P) => (
+ }>
+
+
+ )
+}
diff --git a/src/utils/routing/routes.ts b/src/utils/routing/routes.ts
index 21fe2f4..5cc4873 100644
--- a/src/utils/routing/routes.ts
+++ b/src/utils/routing/routes.ts
@@ -50,25 +50,23 @@ type RouteOptions =
export function createRoute(options: RouteOptions) {
-
- if (options.type === "post")
- return `/blog/post/${options.postType.toLowerCase()}/${options.id}`
- + (options.title ? `/${toSlug(options.title)}` : "");
-
- if (options.type === "story")
- return `/blog/post/story/${options.id}`
- + (options.title ? `/${toSlug(options.title)}` : "");
-
-
- if (options.type === "edit-story")
- return `/blog/create-post` + (options.id ? `?id=${options.id}` : '')
-
- if (options.type === "bounty")
+ if ((options.type === "post" && options.postType.toLowerCase() === 'story')
+ || options.type === "story") {
+ const onlyId = !options.title;
+ return "/story/"
+ // + (options.username ? `${toSlug(options.username)}-` : "")
+ + (options.title ? `${toSlug(options.title)}-` : "")
+ + (!onlyId ? "-" : "")
+ + `${options.id}`
+ }
+ if ((options.type === "post" && options.postType.toLowerCase() === 'bounty')
+ || options.type === "bounty")
return `/blog/post/bounty/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
- if (options.type === "question")
+ if ((options.type === "post" && options.postType.toLowerCase() === 'question')
+ || options.type === "question")
return `/blog/post/question/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
@@ -98,9 +96,12 @@ export const PAGES_ROUTES = {
listProject: "/projects/list-project"
},
blog: {
- feed: "/blog",
- postById: "/blog/post/:type/:id/*",
- createPost: "/blog/create-post"
+ feed: "/feed",
+ postById: "/feed/post/:type/:id/*",
+ storyById: "/story/:slug",
+ writeStory: "/story/write",
+ createPost: "/story/create-post",
+ catchStory: '/story'
},
hackathons: {
default: "/hackathons"