add translate
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export interface Route {
|
||||
type: 'home' | 'user' | 'post' | 'atbrowser' | 'service' | 'collection' | 'record'
|
||||
type: 'home' | 'user' | 'post' | 'postpage' | 'atbrowser' | 'service' | 'collection' | 'record'
|
||||
handle?: string
|
||||
rkey?: string
|
||||
service?: string
|
||||
@@ -45,7 +45,13 @@ export function parseRoute(): Route {
|
||||
return { type: 'user', handle: userMatch[1] }
|
||||
}
|
||||
|
||||
// Post page: /@handle/rkey (for config.collection)
|
||||
// Post form page: /@handle/at/post
|
||||
const postPageMatch = path.match(/^\/@([^/]+)\/at\/post\/?$/)
|
||||
if (postPageMatch) {
|
||||
return { type: 'postpage', handle: postPageMatch[1] }
|
||||
}
|
||||
|
||||
// Post detail page: /@handle/rkey (for config.collection)
|
||||
const postMatch = path.match(/^\/@([^/]+)\/([^/]+)$/)
|
||||
if (postMatch) {
|
||||
return { type: 'post', handle: postMatch[1], rkey: postMatch[2] }
|
||||
@@ -61,6 +67,8 @@ export function navigate(route: Route): void {
|
||||
|
||||
if (route.type === 'user' && route.handle) {
|
||||
path = `/@${route.handle}`
|
||||
} else if (route.type === 'postpage' && route.handle) {
|
||||
path = `/@${route.handle}/at/post`
|
||||
} else if (route.type === 'post' && route.handle && route.rkey) {
|
||||
path = `/@${route.handle}/${route.rkey}`
|
||||
} else if (route.type === 'atbrowser' && route.handle) {
|
||||
|
||||
Reference in New Issue
Block a user