feat: no update w/ autohide option & add option to swap netstat icon … (#591)
* feat: no update w/ autohide option & add option to swap netstat icon for up/down links * Update src/scss/style/bar/bar.scss * Update src/components/bar/shared/Module.tsx * Update src/components/bar/settings/config.tsx * Update src/options.ts * Apply suggestions from code review * move visibilty to updatesIcon func --------- Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -10,6 +10,7 @@ const {
|
||||
updateCommand,
|
||||
label,
|
||||
padZero,
|
||||
autoHide,
|
||||
pollingInterval,
|
||||
icon,
|
||||
leftClick,
|
||||
@@ -21,6 +22,7 @@ const {
|
||||
|
||||
const pendingUpdates: Variable<string> = Variable('0');
|
||||
const postInputUpdater = Variable(true);
|
||||
const isVis = Variable(!autoHide.get());
|
||||
|
||||
const processUpdateCount = (updateCount: string): string => {
|
||||
if (!padZero.get()) return updateCount;
|
||||
@@ -40,6 +42,7 @@ updatesPoller.initialize('updates');
|
||||
const updatesIcon = Variable.derive(
|
||||
[bind(icon.pending), bind(icon.updated), bind(pendingUpdates)],
|
||||
(pendingIcon, updatedIcon, pUpdates) => {
|
||||
isVis.set(!autoHide.get() || (autoHide.get() && parseFloat(pUpdates) > 0));
|
||||
return parseFloat(pUpdates) === 0 ? updatedIcon : pendingIcon;
|
||||
},
|
||||
);
|
||||
@@ -49,6 +52,7 @@ export const Updates = (): BarBoxChild => {
|
||||
textIcon: updatesIcon(),
|
||||
tooltipText: bind(pendingUpdates).as((v) => `${v} updates available`),
|
||||
boxClass: 'updates',
|
||||
isVis: isVis,
|
||||
label: bind(pendingUpdates),
|
||||
showLabelBinding: bind(label),
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user