Skip to content

Commit cee70da

Browse files
committed
feat: button to open sidebar as main action
The action is expected to be more common than the current "Reinstall" button (which seems to be there because it turns into "Update" when an update is available for the plugin). Instead: - Remove "Open" action from context menu and add it as an icon button - Move "Reinstall" option to context menu (regardless of available updates) so plugin can always be reinstalled - Keep "Update" button in main interactables, but only show it when an update is available
1 parent 775588b commit cee70da

File tree

1 file changed

+37
-36
lines changed
  • frontend/src/components/settings/pages/plugin_list

1 file changed

+37
-36
lines changed

frontend/src/components/settings/pages/plugin_list/index.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import {
1111
ReorderableList,
1212
showContextMenu,
1313
} from '@decky/ui';
14-
import { useEffect, useMemo } from 'react';
14+
import { CSSProperties, useEffect, useMemo } from 'react';
1515
import { useTranslation } from 'react-i18next';
16-
import { FaDownload, FaEllipsisH, FaRecycle } from 'react-icons/fa';
16+
import { FaDownload, FaEllipsisH } from 'react-icons/fa';
17+
import { TbLayoutSidebarRightExpandFilled } from 'react-icons/tb';
1718

1819
import { InstallType } from '../../../../plugin';
1920
import {
@@ -49,6 +50,17 @@ type PluginTableData = PluginData & {
4950

5051
const reloadPluginBackend = DeckyBackend.callable<[pluginName: string], void>('loader/reload_plugin');
5152

53+
const squareButtonStyle: CSSProperties = {
54+
height: '40px',
55+
width: '40px',
56+
minWidth: '40px',
57+
padding: '0',
58+
display: 'flex',
59+
flexDirection: 'column',
60+
justifyContent: 'center',
61+
alignItems: 'center',
62+
};
63+
5264
function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> }) {
5365
const { t } = useTranslation();
5466

@@ -63,7 +75,6 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> }
6375
const showCtxMenu = (e: MouseEvent | GamepadEvent) => {
6476
showContextMenu(
6577
<Menu label={t('PluginListIndex.plugin_actions')}>
66-
<MenuItem onSelected={onOpen}>{t('PluginListIndex.open')}</MenuItem>
6778
<MenuItem
6879
onSelected={async () => {
6980
try {
@@ -75,6 +86,7 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> }
7586
>
7687
{t('PluginListIndex.reload')}
7788
</MenuItem>
89+
<MenuItem onSelected={() => reinstallPlugin(name, version)}>{t('PluginListIndex.reinstall')}</MenuItem>
7890
<MenuItem
7991
onSelected={() =>
8092
DeckyPluginLoader.uninstallPlugin(
@@ -103,46 +115,34 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> }
103115
};
104116

105117
return (
106-
<>
118+
<div style={{ display: 'flex', gap: '10px' }}>
107119
{update ? (
108120
<DialogButton
109-
style={{ height: '40px', minWidth: '60px', marginRight: '10px' }}
121+
style={{
122+
flex: '1 1',
123+
minWidth: 'unset',
124+
height: '40px',
125+
display: 'flex',
126+
gap: '1rem',
127+
justifyContent: 'center',
128+
alignItems: 'center',
129+
}}
110130
onClick={() => requestPluginInstall(name, update, InstallType.UPDATE)}
111131
onOKButton={() => requestPluginInstall(name, update, InstallType.UPDATE)}
112132
>
113-
<div style={{ display: 'flex', minWidth: '180px', justifyContent: 'space-between', alignItems: 'center' }}>
114-
{t('PluginListIndex.update_to', { name: update.name })}
115-
<FaDownload style={{ paddingLeft: '1rem' }} />
116-
</div>
133+
{t('PluginListIndex.update_to', { name: update.name })} <FaDownload />
117134
</DialogButton>
118-
) : (
119-
<DialogButton
120-
style={{ height: '40px', minWidth: '60px', marginRight: '10px' }}
121-
onClick={() => reinstallPlugin(name, version)}
122-
onOKButton={() => reinstallPlugin(name, version)}
123-
>
124-
<div style={{ display: 'flex', minWidth: '180px', justifyContent: 'space-between', alignItems: 'center' }}>
125-
{t('PluginListIndex.reinstall')}
126-
<FaRecycle style={{ paddingLeft: '1rem' }} />
127-
</div>
128-
</DialogButton>
129-
)}
130-
<DialogButton
131-
style={{
132-
height: '40px',
133-
width: '40px',
134-
padding: '10px 12px',
135-
minWidth: '40px',
136-
display: 'flex',
137-
flexDirection: 'column',
138-
justifyContent: 'center',
139-
}}
140-
onClick={showCtxMenu}
141-
onOKButton={showCtxMenu}
142-
>
135+
) : null}
136+
<DialogButton style={squareButtonStyle} onClick={onOpen} onOKButton={onOpen}>
137+
<TbLayoutSidebarRightExpandFilled
138+
// make size more consistent with the rest of icons in app
139+
size={'1.5rem'}
140+
/>
141+
</DialogButton>
142+
<DialogButton style={squareButtonStyle} onClick={showCtxMenu} onOKButton={showCtxMenu}>
143143
<FaEllipsisH />
144144
</DialogButton>
145-
</>
145+
</div>
146146
);
147147
}
148148

@@ -232,10 +232,11 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) {
232232
width: 'auto',
233233
display: 'flex',
234234
alignItems: 'center',
235+
gap: '1rem',
235236
}}
236237
>
237238
{t('PluginListIndex.update_all', { count: updates.size })}
238-
<FaDownload style={{ paddingLeft: '1rem' }} />
239+
<FaDownload />
239240
</DialogButton>
240241
)}
241242
<DialogControlsSection style={{ marginTop: 0 }}>

0 commit comments

Comments
 (0)