๐Ÿ“ฆ sleepyfran / duets

๐Ÿ“„ Weather.fs ยท 40 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40module Duets.Cli.Scenes.Phone.Apps.Weather.Root

open Duets.Agents
open Duets.Cli.Components
open Duets.Cli.SceneIndex
open Duets.Cli.Text
open Duets.Entities
open Duets.Simulation

let private weatherIcon weatherCondition =
    match weatherCondition with
    | WeatherCondition.Sunny -> "โ˜€๏ธ"
    | WeatherCondition.Cloudy -> "โ˜๏ธ"
    | WeatherCondition.Rainy -> "๐ŸŒง๏ธ"
    | WeatherCondition.Stormy -> "โ›ˆ๏ธ"
    | WeatherCondition.Snowy -> "โ„๏ธ"

let private weatherDescription weatherCondition =
    match weatherCondition with
    | WeatherCondition.Sunny -> "Sunny"
    | WeatherCondition.Cloudy -> "Cloudy"
    | WeatherCondition.Rainy -> "Rainy"
    | WeatherCondition.Stormy -> "Stormy"
    | WeatherCondition.Snowy -> "Snowy"

let weatherApp () =
    let state = State.get ()
    let currentCity = Queries.World.currentCity state
    let currentWeather = Queries.World.currentWeather state

    let icon = weatherIcon currentWeather
    let description = weatherDescription currentWeather

    Phone.weatherAppTitle |> Styles.header |> showMessage
    Phone.weatherAppContent currentCity.Id icon description |> showMessage

    showContinuationPrompt ()

    Scene.Phone