mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-25 07:17:23 +08:00
fix(commandline): tags not showing active state correctly
This commit is contained in:
parent
e5f8cb3988
commit
363e21b541
1 changed files with 8 additions and 8 deletions
|
|
@ -43,11 +43,11 @@ let subgroupOverride: CommandsSubgroup | null = null;
|
|||
let isAnimating = false;
|
||||
let lastSingleListModeInputValue = "";
|
||||
|
||||
type CommandWithActiveState = Omit<Command, "active"> & { isActive: boolean };
|
||||
type CommandWithIsActive = Command & { isActive: boolean };
|
||||
|
||||
let lastState:
|
||||
| {
|
||||
list: CommandWithActiveState[];
|
||||
list: CommandWithIsActive[];
|
||||
usingSingleList: boolean;
|
||||
}
|
||||
| undefined;
|
||||
|
|
@ -427,8 +427,7 @@ async function showCommands(): Promise<void> {
|
|||
}
|
||||
}
|
||||
}
|
||||
const { active: _active, ...restOfCommand } = command;
|
||||
return { ...restOfCommand, isActive } as CommandWithActiveState;
|
||||
return { ...command, isActive } as CommandWithIsActive;
|
||||
});
|
||||
|
||||
if (
|
||||
|
|
@ -461,7 +460,7 @@ async function showCommands(): Promise<void> {
|
|||
let display = command.display;
|
||||
if (usingSingleList) {
|
||||
display = (command.singleListDisplay ?? "") || command.display;
|
||||
if (command.configValue !== undefined) {
|
||||
if (command.configValue !== undefined || command.active !== undefined) {
|
||||
display = display.replace(
|
||||
`<i class="fas fa-fw fa-chevron-right chevronIcon"></i>`,
|
||||
`<i class="fas fa-fw fa-chevron-right chevronIcon"></i>` +
|
||||
|
|
@ -472,9 +471,10 @@ async function showCommands(): Promise<void> {
|
|||
|
||||
let finalIconHtml = iconHtml;
|
||||
if (
|
||||
!usingSingleList &&
|
||||
command.subgroup === undefined &&
|
||||
command.configValue !== undefined
|
||||
(!usingSingleList &&
|
||||
command.subgroup === undefined &&
|
||||
command.configValue !== undefined) ||
|
||||
(!usingSingleList && command.active !== undefined)
|
||||
) {
|
||||
finalIconHtml = configIconHtml;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue