-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
open FsSpectre | ||
open System.Threading.Tasks | ||
open FsSpectre | ||
open Spectre.Console | ||
|
||
let focusColor = Color.Lime.ToMarkup() | ||
let breakColor = Color.Aqua.ToMarkup() | ||
|
||
let focusTime = | ||
AnsiConsole.Prompt | ||
<| selectionPrompt { | ||
title "[lime]Focus time[/]" | ||
title $"[{focusColor}]Focus time[/]" | ||
choices [| "25 minutes"; "30 minutes"; "45 minutes"; "1 hour" |] | ||
} | ||
|
||
AnsiConsole.MarkupLine($"You have [lime]{focusTime}[/] of focus time!") | ||
AnsiConsole.MarkupLine($"You have [{focusColor}]{focusTime}[/] of focus time!") | ||
|
||
let breakTime = | ||
AnsiConsole.Prompt | ||
<| selectionPrompt { | ||
title "[aqua]Break time[/]" | ||
title $"[{breakColor}]Break time[/]" | ||
choices [| "5 minutes"; "10 minutes"; "15 minutes"; "20 minutes" |] | ||
} | ||
|
||
AnsiConsole.MarkupLine($"You have [aqua]{breakTime}[/] of break time!") | ||
AnsiConsole.MarkupLine($"You have [{breakColor}]{breakTime}[/] of break time!") | ||
|
||
let progress = AnsiConsole.Progress() | ||
|
||
let result = | ||
progress.StartAsync(fun (ctx) -> | ||
task { | ||
let task1 = ctx.AddTask($"[{focusColor}]Focus[/]") | ||
let task2 = ctx.AddTask($"[{breakColor}]Break[/]") | ||
|
||
while (not ctx.IsFinished) do | ||
do! Task.Delay(250) | ||
task1.Increment(1.5) | ||
task2.Increment(0.5) | ||
|
||
return 0 | ||
}) | ||
|
||
Task.WaitAll(result) | ||
|
||
AnsiConsole.WriteLine("Finished!") |