Skip to content

Commit

Permalink
feat: add active task end time in status bar
Browse files Browse the repository at this point in the history
Resolves #413
  • Loading branch information
ivan-lednev committed Sep 28, 2024
1 parent 97d735c commit 0ba68fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ui/components/status-bar-widget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const statusBarProps = useStatusBarWidget({ tasksForToday });
$: ({ showNow, showNext, progressIndicator } = $settings);
$: ({ showNow, showNext, progressIndicator, timestampFormat } = $settings);
$: ({ current, next } = $statusBarProps);
</script>

Expand All @@ -24,7 +24,9 @@
{:else}
{#if showNow && current}
<span class="status-bar-item-segment"
>Now: {current.text} (-{current.timeLeft})</span
>Now: {current.text} (-{current.timeLeft}, till {current.endTime.format(
timestampFormat,
)})</span
>
{#if progressIndicator === "pie"}
<div
Expand Down
3 changes: 3 additions & 0 deletions src/ui/hooks/use-status-bar-widget.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { sortBy } from "lodash/fp";
import type { Moment } from "moment";
import { derived, type Readable } from "svelte/store";

import { statusBarTextLimit } from "../../constants";
Expand All @@ -17,6 +18,7 @@ interface Widget {
text: string;
timeLeft: string;
percentageComplete: string;
endTime: Moment;
};
next?: {
text: string;
Expand Down Expand Up @@ -68,6 +70,7 @@ export function useStatusBarWidget({ tasksForToday }: UseStatusBarWidgetProps) {
percentageComplete: percentageComplete.toFixed(0),
timeLeft,
text,
endTime: getEndTime(currentItem),
};
}

Expand Down

0 comments on commit 0ba68fb

Please sign in to comment.