Improve status bar tooltip

This commit is contained in:
Gordon
2021-03-30 00:53:44 +01:00
parent 5fd611c2ff
commit 2777f16d63

View File

@ -22,17 +22,22 @@ export default class KanbnStatusBarItem {
const text = [
`$(project) ${status.tasks}`
];
const tooltip = [
let tooltip = [];
if (status.tasks > 0) {
tooltip = [
`${status.tasks} task${status.tasks === 1 ? '' : 's'}`
];
if ('startedTasks' in status) {
if ('startedTasks' in status && status.startedTasks! > 0) {
text.push(`$(play) ${status.startedTasks}`);
tooltip.push(`${status.startedTasks} started task${status.startedTasks === 1 ? '' : 's'}`);
}
if ('completedTasks' in status) {
if ('completedTasks' in status && status.completedTasks! > 0) {
text.push(`$(check) ${status.completedTasks}`);
tooltip.push(`${status.completedTasks} completed task${status.completedTasks === 1 ? '' : 's'}`);
}
} else {
tooltip.push('No tasks');
}
this._statusBarItem.text = text.join(' ');
this._statusBarItem.tooltip = tooltip.join('\n');
this._statusBarItem.command = 'kanbn.board';