Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

♻️(frontend) remove redundant formatLongPressLabel helper

Cyril2cdf19de777b
diff --git a/src/frontend/src/features/shortcuts/formatLabels.ts b/src/frontend/src/features/shortcuts/formatLabels.ts
index 98123e32..d3a59f94 100644
--- a/src/frontend/src/features/shortcuts/formatLabels.ts
+++ b/src/frontend/src/features/shortcuts/formatLabels.ts
@@ -14,7 +14,7 @@ export const formatShortcutLabel = (shortcut?: Shortcut) => {
return parts.join('+')
}
-// SR-friendly label for a shortcut (reads “Control plus D”).
+// SR-friendly label for a shortcut (reads "Control plus D").
export const formatShortcutLabelForSR = (
shortcut: Shortcut | undefined,
{
@@ -57,12 +57,3 @@ export const getKeyLabelFromCode = (code?: string) => {
if (code.startsWith('Arrow')) return code.slice(5) // Up, Down, Left, Right
return code
}
-
-// Long-press label (visual or SR), e.g. “Hold V”.
-export const formatLongPressLabel = (
- codeLabel: string,
- holdTemplate: string
-) => {
- if (!codeLabel) return holdTemplate.replace('{{key}}', '?')
- return holdTemplate.replace('{{key}}', codeLabel)
-}
diff --git a/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts b/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts
index 1c747da0..4f1fcaa5 100644
--- a/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts
+++ b/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts
@@ -4,7 +4,6 @@ import { Shortcut } from '../types'
import {
formatShortcutLabel,
formatShortcutLabelForSR,
- formatLongPressLabel,
getKeyLabelFromCode,
} from '../formatLabels'
@@ -15,10 +14,7 @@ export const useShortcutFormatting = () => {
(shortcut?: Shortcut, code?: string, kind?: string) => {
if (code && kind === 'longPress') {
const label = getKeyLabelFromCode(code)
- return formatLongPressLabel(
- label,
- t('shortcutsPanel.visual.hold', { key: '{{key}}' })
- )
+ return t('shortcutsPanel.visual.hold', { key: label || '?' })
}
return formatShortcutLabel(shortcut)
},
@@ -29,10 +25,7 @@ export const useShortcutFormatting = () => {
(shortcut?: Shortcut, code?: string, kind?: string) => {
if (code && kind === 'longPress') {
const label = getKeyLabelFromCode(code)
- return formatLongPressLabel(
- label,
- t('shortcutsPanel.sr.hold', { key: '{{key}}' })
- )
+ return t('shortcutsPanel.sr.hold', { key: label || '?' })
}
return formatShortcutLabelForSR(shortcut, {
controlLabel: t('shortcutsPanel.sr.control'),