feat: show a blurred "Add Comment section" for unconnected users.

Fixes #114
This commit is contained in:
MTG2000
2022-08-04 12:13:22 +03:00
parent 6858639161
commit 5ecd6a6a74
3 changed files with 72 additions and 51 deletions

View File

@@ -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",
}
}