pull/662/head
Zef Hemel 2024-01-24 14:52:07 +01:00
parent 8a89d69c22
commit 308b1232bc
1 changed files with 34 additions and 20 deletions

View File

@ -44,6 +44,9 @@ export function PageNavigator({
if (isFederationPath(pageMeta.name)) { if (isFederationPath(pageMeta.name)) {
orderId = Math.round(orderId / 10); // Just 10x lower the timestamp to push them down, should work orderId = Math.round(orderId / 10); // Just 10x lower the timestamp to push them down, should work
} }
if (mode === "page") {
// Special behavior for regular pages
let description: string | undefined; let description: string | undefined;
let aliases: string[] = []; let aliases: string[] = [];
if (pageMeta.displayName) { if (pageMeta.displayName) {
@ -64,6 +67,17 @@ export function PageNavigator({
description, description,
orderId: orderId, orderId: orderId,
}); });
} else {
// Special behavior for templates
options.push({
...pageMeta,
// Use the displayName or last bit of the path as the name
name: pageMeta.displayName || pageMeta.name.split("/").pop()!,
// And use the full path as the description
description: pageMeta.name,
orderId: orderId,
});
}
} }
let completePrefix = currentPage + "/"; let completePrefix = currentPage + "/";
if (currentPage && currentPage.includes("/")) { if (currentPage && currentPage.includes("/")) {
@ -116,7 +130,7 @@ export function PageNavigator({
newHint={`Create ${mode}`} newHint={`Create ${mode}`}
completePrefix={completePrefix} completePrefix={completePrefix}
onSelect={(opt) => { onSelect={(opt) => {
onNavigate(opt?.name); onNavigate(opt?.ref);
}} }}
/> />
); );