chore: improved command labels and icons (#3295)

* chore: improved command labels and icons

* chore: fix tests

---------

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Liyas Thomas
2023-08-28 18:15:00 +05:30
committed by GitHub
parent 8499ac7fec
commit 0eacd6763b
5 changed files with 72 additions and 41 deletions

View File

@@ -653,11 +653,12 @@
"chat": "Chat with support", "chat": "Chat with support",
"open_docs": "Read Documentation", "open_docs": "Read Documentation",
"open_keybindings": "Keyboard shortcuts", "open_keybindings": "Keyboard shortcuts",
"open_github": "Open GitHub repository",
"social": "Social", "social": "Social",
"title": "General" "title": "General"
}, },
"miscellaneous": { "miscellaneous": {
"invite": "Invite people to Hoppscotch", "invite": "Invite your friends to Hoppscotch",
"title": "Miscellaneous" "title": "Miscellaneous"
}, },
"request": { "request": {
@@ -679,25 +680,25 @@
"environments": { "environments": {
"new": "Create new environment", "new": "Create new environment",
"new_variable": "Create a new environment variable", "new_variable": "Create a new environment variable",
"edit": "Edit selected environment", "edit": "Edit current environment",
"delete": "Delete selected environment", "delete": "Delete current environment",
"duplicate": "Duplicate selected environment", "duplicate": "Duplicate current environment",
"edit_global": "Edit global environment", "edit_global": "Edit global environment",
"duplicate_global": "Duplicate global environment", "duplicate_global": "Duplicate global environment",
"title": "Environments" "title": "Environments"
}, },
"workspace": { "workspace": {
"new": "Create new team", "new": "Create new team",
"edit": "Edit selected team", "edit": "Edit current team",
"delete": "Delete selected team", "delete": "Delete current team",
"invite": "Invite people to team", "invite": "Invite people to team",
"switch_to_personal": "Switch to personal workspace", "switch_to_personal": "Switch to your personal workspace",
"title": "Teams" "title": "Teams"
}, },
"tab": { "tab": {
"duplicate": "Duplicate tab", "duplicate": "Duplicate current tab",
"close_current": "Close current tab", "close_current": "Close current tab",
"close_others": "Close other tabs", "close_others": "Close all other tabs",
"new_tab": "Open a new tab", "new_tab": "Open a new tab",
"title": "Tabs" "title": "Tabs"
}, },
@@ -710,15 +711,15 @@
"change_language": "Change Language", "change_language": "Change Language",
"settings": { "settings": {
"theme": { "theme": {
"black": "Black Mode", "black": "Black",
"dark": "Dark Mode", "dark": "Dark",
"light": "Light Mode", "light": "Light",
"system": "System Mode" "system": "System preference"
}, },
"font": { "font": {
"size_sm": "Change to Small", "size_sm": "Small",
"size_md": "Change to Medium", "size_md": "Medium",
"size_lg": "Change to Large" "size_lg": "Large"
}, },
"change_interceptor": "Change Interceptor", "change_interceptor": "Change Interceptor",
"change_language": "Change Language" "change_language": "Change Language"

View File

@@ -1,6 +1,7 @@
import { describe, it, expect } from "vitest" import { describe, it, expect } from "vitest"
import { Inspector, InspectionService, InspectorResult } from "../" import { Inspector, InspectionService, InspectorResult } from "../"
import { TestContainer } from "dioc/testing" import { TestContainer } from "dioc/testing"
import { ref } from "vue"
const inspectorResultMock: InspectorResult[] = [ const inspectorResultMock: InspectorResult[] = [
{ {
@@ -21,7 +22,7 @@ const inspectorResultMock: InspectorResult[] = [
const testInspector: Inspector = { const testInspector: Inspector = {
inspectorID: "inspector1", inspectorID: "inspector1",
getInspectorFor: () => inspectorResultMock, getInspections: () => ref(inspectorResultMock),
} }
describe("InspectionService", () => { describe("InspectionService", () => {

View File

@@ -9,9 +9,9 @@ import {
import IconLinkedIn from "~icons/brands/linkedin" import IconLinkedIn from "~icons/brands/linkedin"
import IconTwitter from "~icons/brands/twitter" import IconTwitter from "~icons/brands/twitter"
import IconBook from "~icons/lucide/book" import IconDiscord from "~icons/brands/discord"
import IconDiscord from "~icons/lucide/link"
import IconGitHub from "~icons/lucide/github" import IconGitHub from "~icons/lucide/github"
import IconBook from "~icons/lucide/book"
import IconLifeBuoy from "~icons/lucide/life-buoy" import IconLifeBuoy from "~icons/lucide/life-buoy"
import IconZap from "~icons/lucide/zap" import IconZap from "~icons/lucide/zap"
@@ -61,9 +61,9 @@ export class GeneralSpotlightSearcherService extends StaticSpotlightSearcherServ
invokeAction("flyouts.keybinds.toggle") invokeAction("flyouts.keybinds.toggle")
}, },
}, },
link_github: { open_github: {
text: [this.t("spotlight.general.social"), "GitHub"], text: this.t("spotlight.general.open_github"),
alternates: ["social", "github", "link"], alternates: ["repository", "github", "documentation", "hoppscotch"],
icon: markRaw(IconGitHub), icon: markRaw(IconGitHub),
action: () => this.openURL("https://hoppscotch.io/github"), action: () => this.openURL("https://hoppscotch.io/github"),
}, },

View File

@@ -14,11 +14,11 @@ import IconGlobe from "~icons/lucide/globe"
import IconMonitor from "~icons/lucide/monitor" import IconMonitor from "~icons/lucide/monitor"
import IconMoon from "~icons/lucide/moon" import IconMoon from "~icons/lucide/moon"
import IconSun from "~icons/lucide/sun" import IconSun from "~icons/lucide/sun"
import IconType from "~icons/lucide/type" import IconCircle from "~icons/lucide/circle"
import IconCheckCircle from "~icons/lucide/check-circle"
type Doc = { type Doc = {
text: string | string[] text: string | string[]
excludeFromSearch?: boolean
alternates: string[] alternates: string[]
icon: object | Component icon: object | Component
} }
@@ -35,6 +35,7 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
private t = getI18n() private t = getI18n()
private activeFontSize = useSetting("FONT_SIZE") private activeFontSize = useSetting("FONT_SIZE")
private activeTheme = useSetting("BG_COLOR")
public readonly searcherID = "settings" public readonly searcherID = "settings"
public searcherSectionTitle = this.t("navigation.settings") public searcherSectionTitle = this.t("navigation.settings")
@@ -48,7 +49,11 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
this.t("spotlight.settings.theme.system"), this.t("spotlight.settings.theme.system"),
], ],
alternates: ["theme"], alternates: ["theme"],
icon: markRaw(IconMonitor), icon: computed(() =>
this.activeTheme.value === "system"
? markRaw(IconCheckCircle)
: markRaw(IconMonitor)
),
}, },
theme_light: { theme_light: {
text: [ text: [
@@ -56,7 +61,11 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
this.t("spotlight.settings.theme.light"), this.t("spotlight.settings.theme.light"),
], ],
alternates: ["theme"], alternates: ["theme"],
icon: markRaw(IconSun), icon: computed(() =>
this.activeTheme.value === "light"
? markRaw(IconCheckCircle)
: markRaw(IconSun)
),
}, },
theme_dark: { theme_dark: {
text: [ text: [
@@ -64,7 +73,11 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
this.t("spotlight.settings.theme.dark"), this.t("spotlight.settings.theme.dark"),
], ],
alternates: ["theme"], alternates: ["theme"],
icon: markRaw(IconCloud), icon: computed(() =>
this.activeTheme.value === "dark"
? markRaw(IconCheckCircle)
: markRaw(IconCloud)
),
}, },
theme_black: { theme_black: {
text: [ text: [
@@ -72,7 +85,11 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
this.t("spotlight.settings.theme.black"), this.t("spotlight.settings.theme.black"),
], ],
alternates: ["theme"], alternates: ["theme"],
icon: markRaw(IconMoon), icon: computed(() =>
this.activeTheme.value === "black"
? markRaw(IconCheckCircle)
: markRaw(IconMoon)
),
}, },
font_size_sm: { font_size_sm: {
text: [ text: [
@@ -82,42 +99,51 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer
onClick: () => { onClick: () => {
console.log("clicked") console.log("clicked")
}, },
excludeFromSearch: computed(() => this.activeFontSize.value === "small"),
alternates: [ alternates: [
"font size", "font size",
"change font size", "change font size",
"change font", "change font",
"increase font", "increase font",
], ],
icon: markRaw(IconType), icon: computed(() =>
this.activeFontSize.value === "small"
? markRaw(IconCheckCircle)
: markRaw(IconCircle)
),
}, },
font_size_md: { font_size_md: {
text: [ text: [
this.t("settings.font_size"), this.t("settings.font_size"),
this.t("spotlight.settings.font.size_md"), this.t("spotlight.settings.font.size_md"),
], ],
excludeFromSearch: computed(() => this.activeFontSize.value === "medium"),
alternates: [ alternates: [
"font size", "font size",
"change font size", "change font size",
"change font", "change font",
"increase font", "increase font",
], ],
icon: markRaw(IconType), icon: computed(() =>
this.activeFontSize.value === "medium"
? markRaw(IconCheckCircle)
: markRaw(IconCircle)
),
}, },
font_size_lg: { font_size_lg: {
text: [ text: [
this.t("settings.font_size"), this.t("settings.font_size"),
this.t("spotlight.settings.font.size_lg"), this.t("spotlight.settings.font.size_lg"),
], ],
excludeFromSearch: computed(() => this.activeFontSize.value === "large"),
alternates: [ alternates: [
"font size", "font size",
"change font size", "change font size",
"change font", "change font",
"increase font", "increase font",
], ],
icon: markRaw(IconType), icon: computed(() =>
this.activeFontSize.value === "large"
? markRaw(IconCheckCircle)
: markRaw(IconCircle)
),
}, },
change_lang: { change_lang: {
text: [ text: [

View File

@@ -15,7 +15,10 @@ import {
currentTabID, currentTabID,
getActiveTabs, getActiveTabs,
} from "~/helpers/rest/tab" } from "~/helpers/rest/tab"
import IconWindow from "~icons/lucide/app-window" import IconCopy from "~icons/lucide/copy"
import IconCopyPlus from "~icons/lucide/copy-plus"
import IconXCircle from "~icons/lucide/x-circle"
import IconXSquare from "~icons/lucide/x-square"
import { invokeAction } from "~/helpers/actions" import { invokeAction } from "~/helpers/actions"
type Doc = { type Doc = {
@@ -50,29 +53,29 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService<
duplicate_tab: { duplicate_tab: {
text: this.t("spotlight.tab.duplicate"), text: this.t("spotlight.tab.duplicate"),
alternates: ["tab", "duplicate", "duplicate tab"], alternates: ["tab", "duplicate", "duplicate tab"],
icon: markRaw(IconWindow), icon: markRaw(IconCopy),
excludeFromSearch: computed(() => !this.showAction.value), excludeFromSearch: computed(() => !this.showAction.value),
}, },
close_current_tab: { close_current_tab: {
text: this.t("spotlight.tab.close_current"), text: this.t("spotlight.tab.close_current"),
alternates: ["tab", "close", "close tab"], alternates: ["tab", "close", "close tab"],
icon: markRaw(IconWindow), icon: markRaw(IconXCircle),
excludeFromSearch: computed( excludeFromSearch: computed(
() => !this.showAction.value ?? getActiveTabs().value.length === 1 () => !this.showAction.value || getActiveTabs().value.length === 1
), ),
}, },
close_other_tabs: { close_other_tabs: {
text: this.t("spotlight.tab.close_others"), text: this.t("spotlight.tab.close_others"),
alternates: ["tab", "close", "close all"], alternates: ["tab", "close", "close all"],
icon: markRaw(IconWindow), icon: markRaw(IconXSquare),
excludeFromSearch: computed( excludeFromSearch: computed(
() => !this.showAction.value ?? getActiveTabs().value.length < 2 () => !this.showAction.value || getActiveTabs().value.length < 2
), ),
}, },
open_new_tab: { open_new_tab: {
text: this.t("spotlight.tab.new_tab"), text: this.t("spotlight.tab.new_tab"),
alternates: ["tab", "new", "open tab"], alternates: ["tab", "new", "open tab"],
icon: markRaw(IconWindow), icon: markRaw(IconCopyPlus),
excludeFromSearch: computed(() => !this.showAction.value), excludeFromSearch: computed(() => !this.showAction.value),
}, },
}) })