From 4d14bc1086a1ba05acd01d7466749ff3cffba75f Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 11 Sep 2026 12:58:16 -0400 Subject: enable all and disable all for flatpak --- src/components/FlatpakTab.tsx | 53 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'src/components/FlatpakTab.tsx') diff --git a/src/components/FlatpakTab.tsx b/src/components/FlatpakTab.tsx index 0b20da0..35721f6 100644 --- a/src/components/FlatpakTab.tsx +++ b/src/components/FlatpakTab.tsx @@ -1,4 +1,4 @@ -import { ButtonItem, DialogButton, Field, Focusable, PanelSection, PanelSectionRow, gamepadDialogClasses } from "@decky/ui"; +import { ButtonItem, ConfirmModal, DialogButton, Field, Focusable, PanelSection, PanelSectionRow, gamepadDialogClasses, showModal } from "@decky/ui"; import { useCallback, useMemo, useState } from "react"; import { FaArrowLeft } from "react-icons/fa"; import type { FlatpakApp, LsfgConfig, WorkaroundState } from "../api/lsfgApi"; @@ -15,7 +15,9 @@ interface Props { busyAppId: string; onRefresh: () => Promise; onEnable: (appId: string) => Promise; + onEnableAll: () => Promise; onRemove: (appId: string) => Promise; + onRemoveAll: () => Promise; onConfigChange: (appId: string, config: LsfgConfig) => Promise; onWorkaroundChange: (appId: string, state: WorkaroundState) => Promise; } @@ -30,7 +32,9 @@ export function FlatpakTab({ busyAppId, onRefresh, onEnable, + onEnableAll, onRemove, + onRemoveAll, onConfigChange, onWorkaroundChange, }: Props) { @@ -51,6 +55,33 @@ export function FlatpakTab({ () => apps.filter((app) => !app.enabled).sort((a, b) => a.app_name.localeCompare(b.app_name)), [apps], ); + const enableableApps = useMemo( + () => availableApps.filter((app) => !(app.prepared && !app.owned) && !app.error), + [availableApps], + ); + const confirmEnableAll = () => { + showModal( + void onEnableAll()} + onCancel={() => {}} + />, + ); + }; + const confirmRemoveAll = () => { + showModal( + void onRemoveAll()} + onCancel={() => {}} + />, + ); + }; const itemFor = (app: FlatpakApp) => ({ id: app.app_id, label: app.app_name, @@ -79,6 +110,26 @@ export function FlatpakTab({ onToggle={toggleAvailable} onSelect={setSelectedAppId} /> + {enableableApps.length > 0 && ( + + + Enable all available Flatpaks + + + )} + + + Remove all profiles + + {apps.length === 0 && !loading && ( -- cgit v1.2.3