mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 13:44:29 +08:00
impr(commandline): show active tags with a check icon
This commit is contained in:
parent
0f6861d493
commit
c1b71fb9ea
3 changed files with 16 additions and 2 deletions
|
|
@ -296,7 +296,14 @@ async function showCommands(): Promise<void> {
|
|||
}
|
||||
let configIcon = "";
|
||||
const configKey = command.configKey ?? (await getSubgroup()).configKey;
|
||||
if (configKey !== undefined) {
|
||||
if (command.active !== undefined) {
|
||||
if (command.active()) {
|
||||
firstActive = firstActive ?? index;
|
||||
configIcon = `<i class="fas fa-fw fa-check"></i>`;
|
||||
} else {
|
||||
configIcon = `<i class="fas fa-fw"></i>`;
|
||||
}
|
||||
} else if (configKey !== undefined) {
|
||||
const valueIsIncluded =
|
||||
command.configValueMode === "include" &&
|
||||
(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ const subgroup: MonkeyTypes.CommandsSubgroup = {
|
|||
|
||||
const commands: MonkeyTypes.Command[] = [
|
||||
{
|
||||
visible: false,
|
||||
id: "changeTags",
|
||||
display: "Tags...",
|
||||
icon: "fa-tag",
|
||||
|
|
@ -50,6 +49,7 @@ function update(): void {
|
|||
id: "clearTags",
|
||||
display: `Clear tags`,
|
||||
icon: "fa-times",
|
||||
sticky: true,
|
||||
exec: (): void => {
|
||||
const snapshot = DB.getSnapshot();
|
||||
if (!snapshot) return;
|
||||
|
|
@ -71,6 +71,12 @@ function update(): void {
|
|||
id: "toggleTag" + tag._id,
|
||||
display: tag.display,
|
||||
sticky: true,
|
||||
active: () => {
|
||||
return (
|
||||
DB.getSnapshot()?.tags?.find((t) => t._id === tag._id)?.active ??
|
||||
false
|
||||
);
|
||||
},
|
||||
exec: async (): Promise<void> => {
|
||||
TagController.toggle(tag._id);
|
||||
void ModesNotice.update();
|
||||
|
|
|
|||
1
frontend/src/ts/types/types.d.ts
vendored
1
frontend/src/ts/types/types.d.ts
vendored
|
|
@ -313,6 +313,7 @@ declare namespace MonkeyTypes {
|
|||
exec?: (input?: string) => void;
|
||||
hover?: () => void;
|
||||
available?: () => boolean;
|
||||
active?: () => boolean;
|
||||
shouldFocusTestUI?: boolean;
|
||||
customData?: Record<string, string>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue