@@ -3,7 +3,7 @@ import { useAppSelector } from 'flashpoint-launcher-renderer-ext/hooks';
33import { getExtensionFileURL , runCommand , setExtensionEnabled } from 'flashpoint-launcher-renderer-ext/utils' ;
44import { useEffect , useState } from 'react' ;
55import { List , RowComponentProps , useDynamicRowHeight } from 'react-window' ;
6- import { DownloadExtCommand } from '../commands' ;
6+ import { DownloadExtCommand , UninstallExtCommand } from '../commands' ;
77import { loadExtIndexUrl , ManagerExtensionInfo } from '../extensionLoader' ;
88
99export type ExtensionRowProps = {
@@ -14,6 +14,7 @@ export type ExtensionRowProps = {
1414export function ExtensionSubsection ( ) {
1515 const [ availableExtensions , setAvailableExtensions ] = useState < ManagerExtensionInfo [ ] > ( [ ] ) ;
1616 const installedExtensions = useAppSelector ( state => state . main . extensions ) ;
17+ console . log ( installedExtensions ) ;
1718 const disabledExtensions = useAppSelector ( state => state . preferences . disabledExtensions ) ;
1819
1920 useEffect ( ( ) => {
@@ -66,7 +67,7 @@ export function ExtensionSubsection() {
6667}
6768
6869export function ExtensionRow ( { items, disabledExtensions, index, style } : RowComponentProps < ExtensionRowProps > ) {
69- const { id, title, description, installed, newestVersion, iconUrl, getDownloadUrl, } = items [ index ] ;
70+ const { id, title, description, installed, newestVersion, iconUrl, getDownloadUrl } = items [ index ] ;
7071 const [ busy , setBusy ] = useState ( false ) ;
7172 const canInstall = getDownloadUrl !== undefined ;
7273 const enabled = ! disabledExtensions . includes ( id ) ;
@@ -97,7 +98,16 @@ export function ExtensionRow({ items, disabledExtensions, index, style }: RowCom
9798 { ! busy ? (
9899 < >
99100 { installed && (
100- < SimpleButton value = { 'Remove' } />
101+ < SimpleButton value = { 'Remove' } onClick = { ( ) => {
102+ setBusy ( true ) ;
103+ runCommand ( UninstallExtCommand , id )
104+ . catch ( ( error ) => {
105+ const errorString = `Failed to uninstall extension: ${ error } ` ;
106+ alert ( errorString ) ;
107+ log . error ( 'Manager' , errorString ) ;
108+ } )
109+ . finally ( ( ) => setBusy ( false ) ) ;
110+ } } />
101111 ) }
102112 { canInstall && (
103113 < SimpleButton value = { 'Install' } onClick = { ( ) => {
0 commit comments