From c3f510a2944cf8436c8bccedcb77db9bd6a7f2c3 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Mon, 20 Oct 2025 12:50:03 -0400 Subject: chore: remove unused elements previously commented out, for store release prep --- src/api/lsfgApi.ts | 20 ---- src/components/ClipboardButton.tsx | 22 ----- src/components/ClipboardDisplay.tsx | 139 -------------------------- src/components/Content.tsx | 16 +-- src/components/PluginUpdateChecker.tsx | 176 --------------------------------- src/components/WikiButton.tsx | 22 ----- src/components/index.ts | 11 +++ 7 files changed, 13 insertions(+), 393 deletions(-) delete mode 100644 src/components/ClipboardButton.tsx delete mode 100644 src/components/ClipboardDisplay.tsx delete mode 100644 src/components/PluginUpdateChecker.tsx delete mode 100644 src/components/WikiButton.tsx create mode 100644 src/components/index.ts (limited to 'src') diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts index dda6c23..82f37c8 100644 --- a/src/api/lsfgApi.ts +++ b/src/api/lsfgApi.ts @@ -59,23 +59,6 @@ export interface ConfigSchemaResult { current_profile?: string; } -export interface UpdateCheckResult { - success: boolean; - update_available: boolean; - current_version: string; - latest_version: string; - release_notes: string; - release_date: string; - download_url: string; - error?: string; -} - -export interface UpdateDownloadResult { - success: boolean; - download_path?: string; - error?: string; -} - export interface LaunchOptionResult { launch_option: string; instructions: string; @@ -178,9 +161,6 @@ export const updateLsfgConfigFromObject = async (config: ConfigurationData): Pro }; // Self-updater API functions -export const checkForPluginUpdate = callable<[], UpdateCheckResult>("check_for_plugin_update"); -export const downloadPluginUpdate = callable<[string], UpdateDownloadResult>("download_plugin_update"); - // Profile management API functions export const getProfiles = callable<[], ProfilesResult>("get_profiles"); export const createProfile = callable<[string, string?], ProfileResult>("create_profile"); diff --git a/src/components/ClipboardButton.tsx b/src/components/ClipboardButton.tsx deleted file mode 100644 index cac1863..0000000 --- a/src/components/ClipboardButton.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { PanelSectionRow, ButtonItem } from "@decky/ui"; -import { FaBook } from "react-icons/fa"; - -export function ClipboardButton() { - const handleClipboardClick = () => { - window.open("https://github.com/xXJSONDeruloXx/decky-lossless-scaling-vk/wiki/Clipboard", "_blank"); - }; - - return ( - - -
- -
Plugin Wiki
-
-
-
- ); -} diff --git a/src/components/ClipboardDisplay.tsx b/src/components/ClipboardDisplay.tsx deleted file mode 100644 index 852a50f..0000000 --- a/src/components/ClipboardDisplay.tsx +++ /dev/null @@ -1,139 +0,0 @@ -import { useState, useEffect } from "react"; -import { PanelSectionRow } from "@decky/ui"; -import { FaClipboard, FaEye } from "react-icons/fa"; - -export function ClipboardDisplay() { - const [clipboardContent, setClipboardContent] = useState(""); - const [isReading, setIsReading] = useState(false); - - const readClipboard = async () => { - if (isReading) return; // Prevent concurrent reads - - setIsReading(true); - try { - console.log("ClipboardDisplay: Attempting to read clipboard..."); - - if (!navigator.clipboard) { - console.log("ClipboardDisplay: navigator.clipboard not available"); - setClipboardContent("Clipboard API not available"); - return; - } - - if (!navigator.clipboard.readText) { - console.log("ClipboardDisplay: navigator.clipboard.readText not available"); - setClipboardContent("Clipboard read not supported"); - return; - } - - console.log("ClipboardDisplay: Calling navigator.clipboard.readText()..."); - const content = await navigator.clipboard.readText(); - console.log("ClipboardDisplay: Successfully read clipboard:", content.length, "characters"); - setClipboardContent(content); - } catch (error) { - // This is expected if user hasn't granted clipboard permissions - // or if we're in a context where reading isn't allowed - console.log("ClipboardDisplay: Error reading clipboard:", error); - console.log("ClipboardDisplay: Error name:", (error as Error).name); - console.log("ClipboardDisplay: Error message:", (error as Error).message); - - // More specific error messages based on error type - if (error instanceof DOMException) { - switch (error.name) { - case 'NotAllowedError': - setClipboardContent("Clipboard access denied - check permissions"); - break; - case 'NotFoundError': - setClipboardContent("No clipboard data found"); - break; - case 'SecurityError': - setClipboardContent("Clipboard access blocked by security policy"); - break; - default: - setClipboardContent(`Clipboard error: ${error.name}`); - } - } else { - setClipboardContent("Unable to read clipboard"); - } - } finally { - setIsReading(false); - } - }; - - // Read clipboard on mount and then every 3 seconds - useEffect(() => { - readClipboard(); - - const interval = setInterval(() => { - readClipboard(); - }, 3000); - - return () => clearInterval(interval); - }, []); - - const truncateText = (text: string, maxLength: number = 60) => { - if (text.length <= maxLength) return text; - return text.substring(0, maxLength) + "..."; - }; - - const displayText = truncateText(clipboardContent); - - return ( - -
-
- -
- Current Clipboard -
- {isReading && ( - - )} -
-
- {displayText || "Reading clipboard..."} -
-
- -
- ); -} diff --git a/src/components/Content.tsx b/src/components/Content.tsx index fdb8672..08027d3 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -8,12 +8,8 @@ import { InstallationButton } from "./InstallationButton"; import { ConfigurationSection } from "./ConfigurationSection"; import { ProfileManagement } from "./ProfileManagement"; import { UsageInstructions } from "./UsageInstructions"; -// import { WikiButton } from "./WikiButton"; -// import { ClipboardButton } from "./ClipboardButton"; import { SmartClipboardButton } from "./SmartClipboardButton"; import { FgmodClipboardButton } from "./FgmodClipboardButton"; -// import { ClipboardDisplay } from "./ClipboardDisplay"; -// import { PluginUpdateChecker } from "./PluginUpdateChecker"; import { NerdStuffModal } from "./NerdStuffModal"; import FlatpaksModal from "./FlatpaksModal"; import { ConfigurationData } from "../config/configSchema"; @@ -106,7 +102,6 @@ export function Content() { {/* Clipboard buttons - only show if installed */} {isInstalled && ( <> - {/* */} @@ -131,15 +126,8 @@ export function Content() { /> )} - {/* Usage instructions - always visible for user guidance */} - - - {/* Wiki and clipboard buttons - always available for documentation */} - {/* */} - {/* */} - - {/* Plugin Update Checker */} - {/* */} + {/* Usage instructions - always visible for user guidance */} + {/* Show installation components at bottom when fully installed */} {isInstalled && ( diff --git a/src/components/PluginUpdateChecker.tsx b/src/components/PluginUpdateChecker.tsx deleted file mode 100644 index 9fa2afb..0000000 --- a/src/components/PluginUpdateChecker.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - ButtonItem, - PanelSection, - PanelSectionRow, - Field, - Focusable -} from '@decky/ui'; -import { checkForPluginUpdate, downloadPluginUpdate, UpdateCheckResult, UpdateDownloadResult } from '../api/lsfgApi'; - -interface PluginUpdateCheckerProps { - // Add any props if needed -} - -interface UpdateInfo { - updateAvailable: boolean; - currentVersion: string; - latestVersion: string; - releaseNotes: string; - releaseDate: string; - downloadUrl: string; -} - -export const PluginUpdateChecker: React.FC = () => { - const [checkingUpdate, setCheckingUpdate] = useState(false); - const [downloadingUpdate, setDownloadingUpdate] = useState(false); - const [updateInfo, setUpdateInfo] = useState(null); - const [updateError, setUpdateError] = useState(null); - const [downloadResult, setDownloadResult] = useState(null); - - // Auto-hide error messages after 5 seconds - useEffect(() => { - if (updateError) { - const timer = setTimeout(() => { - setUpdateError(null); - }, 5000); - return () => clearTimeout(timer); - } - return undefined; - }, [updateError]); - - const handleCheckForUpdate = async () => { - setCheckingUpdate(true); - setUpdateError(null); - setUpdateInfo(null); - setDownloadResult(null); // Clear previous download result - - try { - const result: UpdateCheckResult = await checkForPluginUpdate(); - - if (result.success) { - setUpdateInfo({ - updateAvailable: result.update_available, - currentVersion: result.current_version, - latestVersion: result.latest_version, - releaseNotes: result.release_notes, - releaseDate: result.release_date, - downloadUrl: result.download_url - }); - - // Simple console log instead of toast since showToast may not be available - if (result.update_available) { - console.log("Update available!", `Version ${result.latest_version} is now available.`); - } else { - console.log("Up to date!", "You have the latest version installed."); - } - } else { - setUpdateError(result.error || "Failed to check for updates"); - } - } catch (error) { - setUpdateError(`Error checking for updates: ${error}`); - } finally { - setCheckingUpdate(false); - } - }; - - const handleDownloadUpdate = async () => { - if (!updateInfo?.downloadUrl) return; - - setDownloadingUpdate(true); - setUpdateError(null); - setDownloadResult(null); - - try { - const result: UpdateDownloadResult = await downloadPluginUpdate(updateInfo.downloadUrl); - - if (result.success) { - setDownloadResult(result); - console.log("✓ Download complete!", `Plugin downloaded to ${result.download_path}`); - } else { - setUpdateError(result.error || "Failed to download update"); - } - } catch (error) { - setUpdateError(`Error downloading update: ${error}`); - } finally { - setDownloadingUpdate(false); - } - }; - - const getStatusMessage = () => { - if (!updateInfo) return null; - - if (updateInfo.updateAvailable) { - if (downloadResult?.success) { - return "✓ v" + updateInfo.latestVersion + " downloaded - ready to install"; - } else { - return "Update available: v" + updateInfo.latestVersion; - } - } else { - return "Up to date (v" + updateInfo.currentVersion + ")"; - } - }; - - return ( - - - - {checkingUpdate ? 'Checking for updates...' : 'Check for Updates'} - - - - {updateInfo && updateInfo.updateAvailable && !downloadResult?.success && ( - - - {downloadingUpdate ? 'Downloading...' : 'Download Update'} - - - )} - - {downloadResult?.success && ( - <> - - - - File saved to: {downloadResult.download_path} - - - - - - - - 1. Go to Decky Loader settings -
2. Click "Developer" tab -
3. Click "Uninstall" next to "decky-lsfg-vk" -
4. Click "Install from ZIP" -
5. Select the downloaded file -
6. Restart Steam or reload plugins -
-
-
- - )} - - {updateError && ( - - - - {updateError} - - - - )} -
- ); -}; diff --git a/src/components/WikiButton.tsx b/src/components/WikiButton.tsx deleted file mode 100644 index 065fb8e..0000000 --- a/src/components/WikiButton.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { PanelSectionRow, ButtonItem } from "@decky/ui"; -import { FaBook } from "react-icons/fa"; - -export function WikiButton() { - const handleWikiClick = () => { - window.open("https://github.com/PancakeTAS/lsfg-vk/wiki", "_blank"); - }; - - return ( - - -
- -
LSFG-VK Wiki
-
-
-
- ); -} diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..95e7451 --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1,11 @@ +export { Content } from "./Content"; +export { StatusDisplay } from "./StatusDisplay"; +export { InstallationButton } from "./InstallationButton"; +export { ConfigurationSection } from "./ConfigurationSection"; +export { FpsMultiplierControl } from "./FpsMultiplierControl"; +export { UsageInstructions } from "./UsageInstructions"; +export { SmartClipboardButton } from "./SmartClipboardButton"; +export { FgmodClipboardButton } from "./FgmodClipboardButton"; +export { NerdStuffModal } from "./NerdStuffModal"; +export { default as FlatpaksModal } from "./FlatpaksModal"; +export { ProfileManagement } from "./ProfileManagement"; -- cgit v1.2.3