Skip to content

Commit 436e81b

Browse files
committed
feat: add notification badge if plugin has updates
Makes it more consistent with the rest of the app, which already has badges on available updates. It also makes it more obvious now that the "Update" button is only shown conditionally, calling attention to the updatable entries.
1 parent cee70da commit 436e81b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ import { FC } from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { FaEyeSlash, FaLock } from 'react-icons/fa';
44

5+
import { StorePluginVersion } from '../../../../store';
6+
import NotificationBadge from '../../../NotificationBadge';
7+
58
interface PluginListLabelProps {
69
frozen: boolean;
710
hidden: boolean;
811
name: string;
912
version?: string;
13+
update: StorePluginVersion | undefined;
1014
}
1115

12-
const PluginListLabel: FC<PluginListLabelProps> = ({ name, frozen, hidden, version }) => {
16+
const PluginListLabel: FC<PluginListLabelProps> = ({ name, frozen, hidden, version, update }) => {
1317
const { t } = useTranslation();
1418
return (
1519
<div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
16-
<div>
20+
<div
21+
style={{
22+
// needed for NotificationBadge
23+
position: 'relative',
24+
}}
25+
>
1726
{name}
1827
{version && (
1928
<>
@@ -28,6 +37,7 @@ const PluginListLabel: FC<PluginListLabelProps> = ({ name, frozen, hidden, versi
2837
</span>
2938
</>
3039
)}
40+
<NotificationBadge show={!!update} style={{ top: '-5px', right: '-10px' }} />
3141
</div>
3242
{hidden && (
3343
<div

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,18 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) {
173173
const frozen = frozenPlugins.includes(name);
174174
const hidden = hiddenPlugins.includes(name);
175175

176+
const update = updates?.get(name);
177+
176178
return {
177-
label: <PluginListLabel name={name} frozen={frozen} hidden={hidden} version={version} />,
179+
label: <PluginListLabel name={name} frozen={frozen} hidden={hidden} version={version} update={update} />,
178180
position: pluginOrder.indexOf(name),
179181
data: {
180182
name,
181183
frozen,
182184
hidden,
183185
isDeveloper,
184186
version,
185-
update: updates?.get(name),
187+
update,
186188
onFreeze: () => frozenPluginsService.update([...frozenPlugins, name]),
187189
onUnfreeze: () => frozenPluginsService.update(frozenPlugins.filter((pluginName) => name !== pluginName)),
188190
onHide: () => hiddenPluginsService.update([...hiddenPlugins, name]),

0 commit comments

Comments
 (0)