A free, open source, and extensible speech-to-text application that works completely offline.
fix: tooltip overflow (#269)
Piyush Gupta951283ca8ad4
diff --git a/src/components/settings/HandyShortcut.tsx b/src/components/settings/HandyShortcut.tsxindex b89b87fb..660914cf 100644--- a/src/components/settings/HandyShortcut.tsx+++ b/src/components/settings/HandyShortcut.tsx@@ -273,6 +273,7 @@ export const HandyShortcut: React.FC<HandyShortcutProps> = ({description="Set the keyboard shortcut to start and stop speech-to-text recording"descriptionMode={descriptionMode}grouped={grouped}+ tooltipPosition="bottom">{(() => {const primaryBinding = Object.values(bindings)[0];diff --git a/src/components/settings/PasteMethod.tsx b/src/components/settings/PasteMethod.tsxindex 21c4c0c2..70b1b717 100644--- a/src/components/settings/PasteMethod.tsx+++ b/src/components/settings/PasteMethod.tsx@@ -14,30 +14,30 @@ const pasteMethodOptions = [{ value: "direct", label: "Direct" },];-export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(({- descriptionMode = "tooltip",- grouped = false,-}) => {- const { getSetting, updateSetting, isUpdating } = useSettings();+export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(+ ({ descriptionMode = "tooltip", grouped = false }) => {+ const { getSetting, updateSetting, isUpdating } = useSettings();- const selectedMethod = (getSetting("paste_method") ||- "ctrl_v") as PasteMethod;+ const selectedMethod = (getSetting("paste_method") ||+ "ctrl_v") as PasteMethod;- return (- <SettingContainer- title="Paste Method"- description="Clipboard (Ctrl+V) simulates Ctrl/Cmd+V keystrokes to paste from your clipboard. Direct tries to use system input methods if possible, otherwise inputs keystrokes one by one into the text field."- descriptionMode={descriptionMode}- grouped={grouped}- >- <Dropdown- options={pasteMethodOptions}- selectedValue={selectedMethod}- onSelect={(value) =>- updateSetting("paste_method", value as PasteMethod)- }- disabled={isUpdating("paste_method")}- />- </SettingContainer>- );-});+ return (+ <SettingContainer+ title="Paste Method"+ description="Clipboard (Ctrl+V) simulates Ctrl/Cmd+V keystrokes to paste from your clipboard. Direct tries to use system input methods if possible, otherwise inputs keystrokes one by one into the text field."+ descriptionMode={descriptionMode}+ grouped={grouped}+ tooltipPosition="bottom"+ >+ <Dropdown+ options={pasteMethodOptions}+ selectedValue={selectedMethod}+ onSelect={(value) =>+ updateSetting("paste_method", value as PasteMethod)+ }+ disabled={isUpdating("paste_method")}+ />+ </SettingContainer>+ );+ },+);diff --git a/src/components/settings/StartHidden.tsx b/src/components/settings/StartHidden.tsxindex 186b425d..87321b7a 100644--- a/src/components/settings/StartHidden.tsx+++ b/src/components/settings/StartHidden.tsx@@ -24,6 +24,7 @@ export const StartHidden: React.FC<StartHiddenProps> = React.memo(({description="Launch to system tray without opening the window."descriptionMode={descriptionMode}grouped={grouped}+ tooltipPosition="bottom"/>);});diff --git a/src/components/ui/SettingContainer.tsx b/src/components/ui/SettingContainer.tsxindex 1a064c71..32099267 100644--- a/src/components/ui/SettingContainer.tsx+++ b/src/components/ui/SettingContainer.tsx@@ -8,6 +8,7 @@ interface SettingContainerProps {grouped?: boolean;layout?: "horizontal" | "stacked";disabled?: boolean;+ tooltipPosition?: "top" | "bottom";}export const SettingContainer: React.FC<SettingContainerProps> = ({@@ -18,6 +19,7 @@ export const SettingContainer: React.FC<SettingContainerProps> = ({grouped = false,layout = "horizontal",disabled = false,+ tooltipPosition = "top",}) => {const [showTooltip, setShowTooltip] = useState(false);const tooltipRef = useRef<HTMLDivElement>(null);@@ -162,11 +164,11 @@ export const SettingContainer: React.FC<SettingContainerProps> = ({/></svg>{showTooltip && (- <div className="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-background border border-mid-gray/80 rounded-lg shadow-lg z-50 max-w-xs min-w-[200px] whitespace-normal animate-in fade-in-0 zoom-in-95 duration-200">+ <div className={`absolute ${tooltipPosition === "top" ? "bottom-full" : "top-[150%]"} left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-background border border-mid-gray/80 rounded-lg shadow-lg z-50 max-w-xs min-w-[200px] whitespace-normal animate-in fade-in-0 zoom-in-95 duration-200`}><p className="text-sm text-center leading-relaxed">{description}</p>- <div className="absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[6px] border-r-[6px] border-t-[6px] border-l-transparent border-r-transparent border-t-mid-gray/80"></div>+ <div className={`absolute ${tooltipPosition === "top" ? "top-full" : "bottom-full rotate-180"} left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-[6px] border-r-[6px] border-t-[6px] border-l-transparent border-r-transparent border-t-mid-gray/80`}></div></div>)}</div>diff --git a/src/components/ui/ToggleSwitch.tsx b/src/components/ui/ToggleSwitch.tsxindex b40c6d13..4be04610 100644--- a/src/components/ui/ToggleSwitch.tsx+++ b/src/components/ui/ToggleSwitch.tsx@@ -10,6 +10,7 @@ interface ToggleSwitchProps {description: string;descriptionMode?: "inline" | "tooltip";grouped?: boolean;+ tooltipPosition?: "top" | "bottom";}export const ToggleSwitch: React.FC<ToggleSwitchProps> = ({@@ -21,6 +22,7 @@ export const ToggleSwitch: React.FC<ToggleSwitchProps> = ({description,descriptionMode = "tooltip",grouped = false,+ tooltipPosition = "top",}) => {return (<SettingContainer@@ -29,6 +31,7 @@ export const ToggleSwitch: React.FC<ToggleSwitchProps> = ({descriptionMode={descriptionMode}grouped={grouped}disabled={disabled}+ tooltipPosition={tooltipPosition}><labelclassName={`inline-flex items-center ${disabled || isUpdating ? "cursor-not-allowed" : "cursor-pointer"}`}