Skip to content

Commit

Permalink
adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSM100 committed Nov 26, 2024
1 parent a7f04b5 commit 672922b
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions src/entry-points/popup/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
import { fromS } from 'hh-mm-ss'; // TODO it could be lighter. Make a MR or merge it directly and modify.
import { assertDev, getMessage } from '@/helpers';
import { isMobile } from '@/helpers/isMobile';
import { Props } from 'tippy.js';
import type { Props as TippyProps } from 'tippy.js';
// See ./popup.css. Would be cool to do this at build-time
if (BUILD_DEFINITIONS.BROWSER === 'chromium') {
Expand Down Expand Up @@ -498,20 +498,23 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
}
});
// Perhaps using placeholders when passing data to getMessage()
// to allow translator to have more control over this
// Also perhaps including ":" in the translation string because it might also be translated in some languages.
return '\n' + actionName + ': ' + actionString;
}
// `commands` API is currently not supported by Gecko for Android.
const commandsPromise: undefined | ReturnType<typeof browserOrChrome.commands.getAll>
= browserOrChrome.commands?.getAll?.();
let toggleExtensionTooltip: Partial<Props> = {};
let toggleExtensionTooltip: Partial<TippyProps> = {};
if (commandsPromise) {
commandsPromise.then(commands => {
commands.forEach(command => {
if (command.name === 'toggle_enabled') {
toggleExtensionTooltip = {
content: getMessage("toggle") + ': ' + command.shortcut,
content: getMessage("toggleSettingValue") + ': ' + command.shortcut,
theme: 'my-tippy',
placement: 'bottom',
}
Expand Down Expand Up @@ -567,8 +570,8 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
use:tippy={{
content: () => {
let tooltip = getMessage('volume');
const hotkeysString = getActionString(HotkeyAction_INCREASE_VOLUME, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_VOLUME, getMessage("decrease"));
const hotkeysString = getActionString(HotkeyAction_INCREASE_VOLUME, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_VOLUME, getMessage("decreaseSettingValue"));
if (hotkeysString) {
tooltip += '\n' + hotkeysString;
}
Expand Down Expand Up @@ -918,10 +921,10 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
useForInputParams={{
content: () => {
let tooltip = getMessage('volumeThresholdTooltip');
const hotkeysString = getActionString(HotkeyAction_INCREASE_VOLUME_THRESHOLD, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_VOLUME_THRESHOLD, getMessage("decrease")) +
getActionString(HotkeyAction_TOGGLE_VOLUME_THRESHOLD, getMessage("toggle")) +
getActionString(HotkeyAction_SET_VOLUME_THRESHOLD, getMessage("set"));
const hotkeysString = getActionString(HotkeyAction_INCREASE_VOLUME_THRESHOLD, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_VOLUME_THRESHOLD, getMessage("decreaseSettingValue")) +
getActionString(HotkeyAction_TOGGLE_VOLUME_THRESHOLD, getMessage("toggleSettingValue")) +
getActionString(HotkeyAction_SET_VOLUME_THRESHOLD, getMessage("setSettingValue"));

if (hotkeysString) {
tooltip += '\n' + hotkeysString;
Expand Down Expand Up @@ -950,10 +953,10 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
useForInputParams={{
content: () => {
let tooltip = getMessage('soundedSpeedTooltip');
const hotkeysString = getActionString(HotkeyAction_INCREASE_SOUNDED_SPEED, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_SOUNDED_SPEED, getMessage("decrease")) +
getActionString(HotkeyAction_TOGGLE_SOUNDED_SPEED, getMessage("toggle")) +
getActionString(HotkeyAction_SET_SOUNDED_SPEED, getMessage("set"));
const hotkeysString = getActionString(HotkeyAction_INCREASE_SOUNDED_SPEED, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_SOUNDED_SPEED, getMessage("decreaseSettingValue")) +
getActionString(HotkeyAction_TOGGLE_SOUNDED_SPEED, getMessage("toggleSettingValue")) +
getActionString(HotkeyAction_SET_SOUNDED_SPEED, getMessage("setSettingValue"));

if (hotkeysString) {
tooltip += '\n' + hotkeysString;
Expand Down Expand Up @@ -985,10 +988,10 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
: ''
);

const hotkeysString = getActionString(HotkeyAction_INCREASE_SILENCE_SPEED, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_SILENCE_SPEED, getMessage("decrease")) +
getActionString(HotkeyAction_TOGGLE_SILENCE_SPEED, getMessage("toggle")) +
getActionString(HotkeyAction_SET_SILENCE_SPEED, getMessage("set"));
const hotkeysString = getActionString(HotkeyAction_INCREASE_SILENCE_SPEED, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_SILENCE_SPEED, getMessage("decreaseSettingValue")) +
getActionString(HotkeyAction_TOGGLE_SILENCE_SPEED, getMessage("toggleSettingValue")) +
getActionString(HotkeyAction_SET_SILENCE_SPEED, getMessage("setSettingValue"));

if (hotkeysString) {
tooltip += '\n' + hotkeysString;
Expand All @@ -1009,10 +1012,10 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
useForInputParams={{
content: () => {
let tooltip = getMessage('marginBeforeTooltip');
const hotkeysString = getActionString(HotkeyAction_INCREASE_MARGIN_BEFORE, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_MARGIN_BEFORE, getMessage("decrease")) +
getActionString(HotkeyAction_TOGGLE_MARGIN_BEFORE, getMessage('toggle')) +
getActionString(HotkeyAction_SET_MARGIN_BEFORE, getMessage('set'));
const hotkeysString = getActionString(HotkeyAction_INCREASE_MARGIN_BEFORE, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_MARGIN_BEFORE, getMessage("decreaseSettingValue")) +
getActionString(HotkeyAction_TOGGLE_MARGIN_BEFORE, getMessage('toggleSettingValue')) +
getActionString(HotkeyAction_SET_MARGIN_BEFORE, getMessage('setSettingValue'));

if (hotkeysString) {
tooltip += '\n' + hotkeysString;
Expand All @@ -1032,10 +1035,10 @@ along with Jump Cutter Browser Extension. If not, see <https://www.gnu.org/lice
useForInputParams={{
content: () => {
let tooltip = getMessage('marginAfterTooltip');
const hotkeysString = getActionString(HotkeyAction_INCREASE_MARGIN_AFTER, getMessage("increase")) +
getActionString(HotkeyAction_DECREASE_MARGIN_AFTER, getMessage("decrease")) +
getActionString(HotkeyAction_TOGGLE_MARGIN_AFTER, getMessage("toggle")) +
getActionString(HotkeyAction_SET_MARGIN_AFTER, getMessage('set'));
const hotkeysString = getActionString(HotkeyAction_INCREASE_MARGIN_AFTER, getMessage("increaseSettingValue")) +
getActionString(HotkeyAction_DECREASE_MARGIN_AFTER, getMessage("decreaseSettingValue")) +
getActionString(HotkeyAction_TOGGLE_MARGIN_AFTER, getMessage("toggleSettingValue")) +
getActionString(HotkeyAction_SET_MARGIN_AFTER, getMessage('setSettingValue'));

if (hotkeysString) {
tooltip += '\n' + hotkeysString;
Expand Down

0 comments on commit 672922b

Please sign in to comment.