feat(housekeeping): finish accessible command deck
This commit is contained in:
1 parent
85ad0452d3
commit
a113e48880
55 files changed
+17064
-509
No files matched your search
@@ -58,7 +58,13 @@ function matches(tokens: readonly string[], ...values: readonly string[]) {
|
||||
return tokens.every((token) => haystack.includes(token));
|
||||
}
|
||||
|
||||
function commandTitle(commandId: string): string {
|
||||
function commandTitle(
|
||||
commandId: string,
|
||||
translate: (key: string) => string,
|
||||
): string {
|
||||
const key = `pages.housekeeping.commands.${commandId}`;
|
||||
const translated = translate(key);
|
||||
if (translated !== key) return translated;
|
||||
return commandId
|
||||
.split(".")
|
||||
.slice(1)
|
||||
@@ -120,7 +126,7 @@ export function searchNavigationAndCommands({
|
||||
(candidate) => candidate.id === command.owner,
|
||||
);
|
||||
if (!domain || !satisfiesCapability(context, domain.capability)) continue;
|
||||
const title = commandTitle(command.id);
|
||||
const title = commandTitle(command.id, translate);
|
||||
if (!matches(tokens, command.id, command.owner, title)) continue;
|
||||
commandsFound.push({
|
||||
id: `command:${command.id}`,
|
||||
|
||||
Reference in new issue
Block a user