diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Content.tsx | 14 | ||||
| -rw-r--r-- | src/components/SmartClipboardButton.tsx | 7 | ||||
| -rw-r--r-- | src/config/configSchema.ts | 4 | ||||
| -rw-r--r-- | src/hooks/useLsfgHooks.ts | 3 | ||||
| -rwxr-xr-x | src/index.tsx | 6 | ||||
| -rw-r--r-- | src/utils/clipboardUtils.ts | 6 |
6 files changed, 2 insertions, 38 deletions
diff --git a/src/components/Content.tsx b/src/components/Content.tsx index 28eefa7..3dc2696 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -39,25 +39,20 @@ export function Content() { const { isInstalling, isUninstalling, handleInstall, handleUninstall } = useInstallationActions(); - // Reload config when installation status changes useEffect(() => { if (isInstalled) { loadLsfgConfig(); } }, [isInstalled, loadLsfgConfig]); - // Generic configuration change handler const handleConfigChange = async (fieldName: keyof ConfigurationData, value: boolean | number | string) => { - // If we have a current profile, update that profile specifically if (currentProfile) { const newConfig = { ...config, [fieldName]: value }; const result = await updateProfileConfig(currentProfile, newConfig); if (result.success) { - // Reload config to reflect the changes from the backend await loadLsfgConfig(); } } else { - // Fallback to the original method for backward compatibility await updateField(fieldName, value); } }; @@ -80,7 +75,6 @@ export function Content() { return ( <PanelSection> - {/* Show installation components at top when not fully installed */} {!isInstalled && ( <> <InstallationButton @@ -100,7 +94,6 @@ export function Content() { </> )} - {/* FPS multiplier controls stay above profile selection when installed */} {isInstalled && ( <> <PanelSectionRow> @@ -126,7 +119,6 @@ export function Content() { </> )} - {/* Profile Management - only show if installed */} {isInstalled && ( <ProfileManagement currentProfile={currentProfile} @@ -137,7 +129,6 @@ export function Content() { /> )} - {/* Configuration Section - only show if installed */} {isInstalled && ( <ConfigurationSection config={config} @@ -145,7 +136,6 @@ export function Content() { /> )} - {/* Clipboard buttons sit beside usage info for quick access */} {isInstalled && ( <> <SmartClipboardButton /> @@ -153,10 +143,8 @@ export function Content() { </> )} - {/* Usage instructions - always visible for user guidance */} <UsageInstructions config={config} /> - {/* Nerd Stuff Button */} <PanelSectionRow> <ButtonItem layout="below" @@ -166,7 +154,6 @@ export function Content() { </ButtonItem> </PanelSectionRow> - {/* Flatpaks Button */} <PanelSectionRow> <ButtonItem layout="below" @@ -176,7 +163,6 @@ export function Content() { </ButtonItem> </PanelSectionRow> - {/* Status and uninstall sit at bottom when installed to match desired layout */} {isInstalled && ( <> <StatusDisplay diff --git a/src/components/SmartClipboardButton.tsx b/src/components/SmartClipboardButton.tsx index 7be3b2f..c90515a 100644 --- a/src/components/SmartClipboardButton.tsx +++ b/src/components/SmartClipboardButton.tsx @@ -9,7 +9,6 @@ export function SmartClipboardButton() { const [isLoading, setIsLoading] = useState(false); const [showSuccess, setShowSuccess] = useState(false); - // Reset success state after 3 seconds useEffect(() => { if (showSuccess) { const timer = setTimeout(() => { @@ -38,10 +37,8 @@ export function SmartClipboardButton() { const { success, verified } = await copyWithVerification(text); if (success) { - // Show success feedback in the button instead of toast setShowSuccess(true); if (!verified) { - // Copy worked but verification failed - still show success console.log('Copy verification failed but copy likely worked'); } } else { @@ -64,9 +61,7 @@ export function SmartClipboardButton() { > <div style={{ display: "flex", alignItems: "center", gap: "8px" }}> {showSuccess ? ( - <FaCheck style={{ - color: "#4CAF50" // Green color for success - }} /> + <FaCheck style={{ color: "#4CAF50" }} /> ) : isLoading ? ( <FaClipboard style={{ animation: "pulse 1s ease-in-out infinite", diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts index d7da4f5..6c6cf19 100644 --- a/src/config/configSchema.ts +++ b/src/config/configSchema.ts @@ -10,7 +10,6 @@ import type { ConfigurationData } from './generatedConfigSchema'; import { getDefaults } from './generatedConfigSchema'; import { updateLsfgConfig } from "../api/lsfgApi"; -// Re-export all auto-generated configuration constants export { ConfigFieldType, ConfigField, @@ -19,7 +18,6 @@ export { getFieldNames, getDefaults, getFieldTypes, - // Field name constants for type-safe access DLL, NO_FP16, MULTIPLIER, FLOW_SCALE, PERFORMANCE_MODE, HDR_MODE, EXPERIMENTAL_PRESENT_MODE, DXVK_FRAME_RATE, ENABLE_WOW64, DISABLE_STEAMDECK_MODE, MANGOHUD_WORKAROUND, DISABLE_VKBASALT, @@ -34,7 +32,6 @@ export class ConfigurationManager { private static instance: ConfigurationManager; private _config: ConfigurationData | null = null; - // Callable methods for backend communication private getConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("get_configuration"); private resetConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("reset_configuration"); @@ -131,5 +128,4 @@ export class ConfigurationManager { } } -// Export singleton instance export const configManager = ConfigurationManager.getInstance(); diff --git a/src/hooks/useLsfgHooks.ts b/src/hooks/useLsfgHooks.ts index e5dea63..adc18ba 100644 --- a/src/hooks/useLsfgHooks.ts +++ b/src/hooks/useLsfgHooks.ts @@ -71,7 +71,6 @@ export function useDllDetection() { } export function useLsfgConfig() { - // Use centralized configuration for initial state const [config, setConfig] = useState<ConfigurationData>(() => ConfigurationManager.getDefaults()); const loadLsfgConfig = useCallback(async () => { @@ -114,7 +113,7 @@ export function useLsfgConfig() { useEffect(() => { loadLsfgConfig(); - }, []); // Empty dependency array to prevent infinite loop + }, []); return { config, diff --git a/src/index.tsx b/src/index.tsx index bbe4cd3..36945ba 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,17 +7,11 @@ export default definePlugin(() => { console.log("decky-lsfg-vk plugin initializing"); return { - // The name shown in various decky menus name: "Decky LSFG-VK", - // The element displayed at the top of your plugin's menu titleView: <div className={staticClasses.Title}>Decky LSFG-VK</div>, - // Always render to retain state when panel is toggled alwaysRender: true, - // The content of your plugin's menu content: <Content />, - // The icon displayed in the plugin list icon: <GiPlasticDuck />, - // The function triggered when your plugin unloads onDismount() { console.log("decky-lsfg-vk unloading"); } diff --git a/src/utils/clipboardUtils.ts b/src/utils/clipboardUtils.ts index 2d480fc..8a04caa 100644 --- a/src/utils/clipboardUtils.ts +++ b/src/utils/clipboardUtils.ts @@ -7,7 +7,6 @@ * This is especially important in gaming mode where clipboard APIs may behave differently */ export async function copyToClipboard(text: string): Promise<boolean> { - // Use the proven input simulation method const tempInput = document.createElement('input'); tempInput.value = text; tempInput.style.position = 'absolute'; @@ -15,18 +14,15 @@ export async function copyToClipboard(text: string): Promise<boolean> { document.body.appendChild(tempInput); try { - // Focus and select the text tempInput.focus(); tempInput.select(); - // Try copying using execCommand first (most reliable in gaming mode) let copySuccess = false; try { if (document.execCommand('copy')) { copySuccess = true; } } catch (e) { - // If execCommand fails, try navigator.clipboard as fallback try { await navigator.clipboard.writeText(text); copySuccess = true; @@ -37,7 +33,6 @@ export async function copyToClipboard(text: string): Promise<boolean> { return copySuccess; } finally { - // Clean up document.body.removeChild(tempInput); } } @@ -50,7 +45,6 @@ export async function verifyCopy(expectedText: string): Promise<boolean> { const readBack = await navigator.clipboard.readText(); return readBack === expectedText; } catch (e) { - // Verification not available, assume success return true; } } |
