mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-19 22:34:33 +01:00
feat: show a blurred "Add Comment section" for unconnected users.
Fixes #114
This commit is contained in:
@@ -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",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user