Ver código fonte

feat: improve advanced mode adornment

Sv443 1 ano atrás
pai
commit
3339568666

+ 23 - 16
assets/translations/README.md

@@ -6,15 +6,15 @@ To submit or edit a translation, please follow [this guide](../../contributing.m
 ### Translation progress:
 | Locale | Translated keys | Based on |
 | ------ | --------------- | :------: |
-| [`en_US`](./en_US.json) | 152 (default locale) |  |
-| [`de_DE`](./de_DE.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`en_UK`](./en_UK.json) | ✅ `152/152` (100.0%) | `en_US` |
-| [`es_ES`](./es_ES.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`fr_FR`](./fr_FR.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`hi_IN`](./hi_IN.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`ja_JA`](./ja_JA.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`pt_BR`](./pt_BR.json) | 🚫 `125/152` (82.2%) | ─ |
-| [`zh_CN`](./zh_CN.json) | 🚫 `125/152` (82.2%) | ─ |
+| [`en_US`](./en_US.json) | 151 (default locale) |  |
+| [`de_DE`](./de_DE.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`en_UK`](./en_UK.json) | ✅ `151/151` (100.0%) | `en_US` |
+| [`es_ES`](./es_ES.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`fr_FR`](./fr_FR.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`hi_IN`](./hi_IN.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`ja_JA`](./ja_JA.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`pt_BR`](./pt_BR.json) | 🚫 `123/151` (81.5%) | ─ |
+| [`zh_CN`](./zh_CN.json) | 🚫 `123/151` (81.5%) | ─ |
 
 <br>
 
@@ -25,11 +25,12 @@ This means you need to manually check against the base translations for missing
 
 ### Missing keys:
 
-<details><summary><code>de_DE</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>de_DE</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -59,11 +60,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>es_ES</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>es_ES</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -93,11 +95,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>fr_FR</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>fr_FR</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -127,11 +130,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>hi_IN</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>hi_IN</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -161,11 +165,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>ja_JA</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>ja_JA</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -195,11 +200,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>pt_BR</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>pt_BR</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |
@@ -229,11 +235,12 @@ This means you need to manually check against the base translations for missing
 
 <br></details>
 
-<details><summary><code>zh_CN</code> - 27 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>zh_CN</code> - 28 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
 | `trigger_btn_action` | `Trigger` |
+| `advanced_mode_tooltip` | `Advanced mode` |
 | `lyrics_clear_cache_confirm_prompt-1` | `The lyrics cache currently has %1 entry.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_confirm_prompt-n` | `The lyrics cache currently has %1 entries.\nDo you really want to delete them?` |
 | `lyrics_clear_cache_success` | `Lyrics cache was cleared successfully.` |

+ 1 - 2
assets/translations/en_US.json

@@ -49,8 +49,7 @@
     "scroll_to_bottom": "Click to scroll to the bottom",
     "volume_tooltip": "Volume: %1% (Sensitivity: %2%)",
     "middle_click_open_tab": "Middle-click to open in a new tab",
-    "boost_gain_enable_tooltip": "Boost the volume to %1%",
-    "boost_gain_disable_tooltip": "Disable the volume boost",
+    "advanced_mode_tooltip": "Advanced mode",
 
     "open_current_lyrics": "Open the current song's lyrics in a new tab",
     "open_lyrics": "Open this song's lyrics in a new tab",

+ 1 - 1
src/config.ts

@@ -52,11 +52,11 @@ export const migrations: ConfigMigrationsDict = {
   5: (oldData: Record<string, unknown>) => {
     return {
       ...oldData,
+      geniUrlBase: getFeatureDefault("geniUrlBase"),
       lyricsCacheMaxSize: getFeatureDefault("lyricsCacheMaxSize"),
       lyricsCacheTTL: getFeatureDefault("lyricsCacheTTL"),
       clearLyricsCache: undefined,
       advancedMode: getFeatureDefault("advancedMode"),
-      geniUrlBase: getFeatureDefault("geniUrlBase"),
     };
   },
 };

+ 9 - 5
src/features/index.ts

@@ -262,7 +262,7 @@ export const featInfo = {
     normalize: (val: string) => val.trim().replace(/\/+$/, ""),
     advanced: true,
     // TODO: to be reworked or removed in the big menu rework
-    textAdornment: async () => `<span class="advanced-mode-icon">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>`,
+    textAdornment: getAdvancedModeAdornment,
   },
   lyricsCacheMaxSize: {
     type: "slider",
@@ -276,7 +276,7 @@ export const featInfo = {
     change: () => void "TODO",
     advanced: true,
     // TODO: to be reworked or removed in the big menu rework
-    textAdornment: async () => `<span class="advanced-mode-icon">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>`,
+    textAdornment: getAdvancedModeAdornment,
   },
   lyricsCacheTTL: {
     type: "slider",
@@ -290,7 +290,7 @@ export const featInfo = {
     change: () => void "TODO",
     advanced: true,
     // TODO: to be reworked or removed in the big menu rework
-    textAdornment: async () => `<span class="advanced-mode-icon">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>`,
+    textAdornment: getAdvancedModeAdornment,
   },
   clearLyricsCache: {
     type: "button",
@@ -305,7 +305,7 @@ export const featInfo = {
     },
     advanced: true,
     // TODO: to be reworked or removed in the big menu rework
-    textAdornment: async () => `<span class="advanced-mode-icon">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>`,
+    textAdornment: getAdvancedModeAdornment,
   },
 
   //#SECTION general
@@ -342,6 +342,10 @@ export const featInfo = {
     enable: () => void "TODO",
     disable: () => void "TODO",
     // TODO: to be reworked or removed in the big menu rework
-    textAdornment: async () => getFeatures().advancedMode ? `<span class="advanced-mode-icon">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>` : undefined,
+    textAdornment: () => getFeatures().advancedMode ? getAdvancedModeAdornment() : undefined,
   },
 } as const satisfies FeatureInfo;
+
+async function getAdvancedModeAdornment() {
+  return `<span class="advanced-mode-icon" title="${t("advanced_mode_tooltip")}">${await resourceToHTMLString("img-add_circle_small") ?? ""}</span>`;
+}