handleNewComment(content)}
- avatar={user.avatar}
- />
+ {
+
+
handleNewComment(content)}
+ avatar={user?.avatar ?? 'https://avatars.dicebear.com/api/bottts/Default.svg'}
+ />
+
+ {!user &&
+ Connect with ⚡ to comment
+
}
}
diff --git a/src/utils/routing/routes.ts b/src/utils/routing/routes.ts
index b1f6ed9..372a9b2 100644
--- a/src/utils/routing/routes.ts
+++ b/src/utils/routing/routes.ts
@@ -2,32 +2,32 @@ import { toSlug } from "../helperFunctions";
type RouteOptions =
| {
- type: 'post',
+ type: "post",
id: string | number,
postType: string,
title?: string,
username?: string,
}
| {
- type: 'story',
+ type: "story",
id: string | number,
title?: string,
username?: string,
}
| {
- type: 'bounty',
+ type: "bounty",
id: string | number,
title?: string,
username?: string,
}
| {
- type: 'question',
+ type: "question",
id: string | number,
title?: string,
username?: string,
}
| {
- type: 'profile',
+ type: "profile",
id: string | number,
username?: string,
}
@@ -35,27 +35,53 @@ type RouteOptions =
export function createRoute(options: RouteOptions) {
- if (options.type === 'post')
+ if (options.type === "post")
return `/blog/post/${options.postType.toLowerCase()}/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
- if (options.type === 'story')
+ if (options.type === "story")
return `/blog/post/story/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
- if (options.type === 'bounty')
+ if (options.type === "bounty")
return `/blog/post/bounty/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
- if (options.type === 'question')
+ if (options.type === "question")
return `/blog/post/question/${options.id}`
+ (options.title ? `/${toSlug(options.title)}` : "");
- if (options.type === 'profile')
+ if (options.type === "profile")
return `/profile/${options.id}`
+ (options.username ? `/${toSlug(options.username)}` : "");
- return ''
+ return ""
+}
+
+export const PAGES_ROUTES = {
+ apps: {
+ default: "/apps",
+ hottest: "/apps/hottest",
+ byCategoryId: "/apps/category/:id"
+ },
+ blog: {
+ feed: "/blog",
+ postById: "/blog/post/:type/:id/*",
+ createPost: "/blog/create-post"
+ },
+ hackathons: {
+ default: "/hackathons"
+ },
+ donate: {
+ default: "/donate"
+ },
+ profile: {
+ byId: "/profile/:id/*",
+ },
+ auth: {
+ login: "/login",
+ logout: "/logout",
+ }
}
\ No newline at end of file