fix: deterministically sort footer badges
This commit is contained in:
@@ -72,8 +72,8 @@
|
|||||||
.sk-label Offline
|
.sk-label Offline
|
||||||
.sk-app-bar-item(ng-click='ctrl.refreshData()', ng-if='!ctrl.offline')
|
.sk-app-bar-item(ng-click='ctrl.refreshData()', ng-if='!ctrl.offline')
|
||||||
.sk-label Refresh
|
.sk-label Refresh
|
||||||
.sk-app-bar-item.border(ng-if='ctrl.dockShortcuts.length > 0')
|
.sk-app-bar-item.border(ng-if='ctrl.state.dockShortcuts.length > 0')
|
||||||
.sk-app-bar-item.dock-shortcut(ng-repeat='shortcut in ctrl.dockShortcuts')
|
.sk-app-bar-item.dock-shortcut(ng-repeat='shortcut in ctrl.state.dockShortcuts')
|
||||||
.sk-app-bar-item-column(
|
.sk-app-bar-item-column(
|
||||||
ng-class="{'underline': shortcut.component.active}",
|
ng-class="{'underline': shortcut.component.active}",
|
||||||
ng-click='ctrl.selectShortcut(shortcut)'
|
ng-click='ctrl.selectShortcut(shortcut)'
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ type DockShortcut = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FooterViewCtrl extends PureViewCtrl {
|
class FooterViewCtrl extends PureViewCtrl<{}, {
|
||||||
|
outOfSync: boolean;
|
||||||
|
hasPasscode: boolean;
|
||||||
|
dataUpgradeAvailable: boolean;
|
||||||
|
dockShortcuts: DockShortcut[];
|
||||||
|
}> {
|
||||||
|
|
||||||
private $rootScope: ng.IRootScopeService
|
private $rootScope: ng.IRootScopeService
|
||||||
private rooms: SNComponent[] = []
|
private rooms: SNComponent[] = []
|
||||||
@@ -96,7 +101,10 @@ class FooterViewCtrl extends PureViewCtrl {
|
|||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
hasPasscode: false
|
outOfSync: false,
|
||||||
|
dataUpgradeAvailable: false,
|
||||||
|
hasPasscode: false,
|
||||||
|
dockShortcuts: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,19 +387,19 @@ class FooterViewCtrl extends PureViewCtrl {
|
|||||||
icon: icon
|
icon: icon
|
||||||
} as DockShortcut);
|
} as DockShortcut);
|
||||||
}
|
}
|
||||||
this.dockShortcuts = shortcuts.sort((a, b) => {
|
this.setState({
|
||||||
/** Circles first, then images */
|
dockShortcuts: shortcuts.sort((a, b) => {
|
||||||
const aType = a.icon.type;
|
/** Circles first, then images */
|
||||||
const bType = b.icon.type;
|
const aType = a.icon.type;
|
||||||
if (aType === bType) {
|
const bType = b.icon.type;
|
||||||
return 0;
|
if (aType === 'circle' && bType === 'svg') {
|
||||||
} else if (aType === 'circle' && bType === 'svg') {
|
return -1;
|
||||||
return -1;
|
} else if (bType === 'circle' && aType === 'svg') {
|
||||||
} else if (bType === 'circle' && aType === 'svg') {
|
return 1;
|
||||||
return 1;
|
} else {
|
||||||
} else {
|
return a.name.localeCompare(b.name);
|
||||||
return 0;
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user