summaryrefslogtreecommitdiff
path: root/scripts/.claude/ct-show-swell-direction.yaml
blob: 6021bf0c1e620ebfe4f851c49de1fbf0a5b74c3a (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: "Display swell direction in instrument sheet"
description: "MarineConditions.swellDirDeg is fetched from Open-Meteo and stored but never shown. The Swell cell shows height and period but drops the direction."
agent:
  model: "sonnet"
  working_dir: "/workspace/nav"
  instructions: |
    Context
    -------
    fetchCurrentConditions() populates MarineConditions.swellDirDeg from
    swell_wave_direction (degrees true from Open-Meteo).
        (android-app/app/src/main/kotlin/org/terst/nav/data/model/MarineConditions.kt, line 13)

    The instrument sheet expanded section has a Swell column:
        (android-app/app/src/main/res/layout/layout_instruments_sheet.xml)
        <LinearLayout vertical gravity=center>
            <TextView style="InstrumentLabel" text="Swell" />
            <TextView id="value_swell_ht" style="InstrumentPrimaryValue" />   <!-- e.g. "0.8 m" -->
            <TextView id="value_swell_per" style="InstrumentLabel" />         <!-- e.g. "8 s" -->
        </LinearLayout>

    MainActivity's marineConditions collector sets swellHt and swellPer but ignores swellDirDeg:
        (android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt, marineConditions collector)

    InstrumentHandler.updateConditions() has swellPer but no swellDir parameter.
        (android-app/app/src/main/kotlin/org/terst/nav/ui/InstrumentHandler.kt)

    Goal
    ----
    Show swell direction by updating value_swell_per to contain both direction and period
    (e.g. "045° / 8 s"), avoiding the need for a fourth TextView in an already-tight column.
    Alternatively add a third sub-label TextView — use whichever fits better visually.

    The simplest approach: combine direction and period into value_swell_per as "DIR° / Xs".

    Step 1 — Update updateConditions() in InstrumentHandler
    --------------------------------------------------------
    In android-app/app/src/main/kotlin/org/terst/nav/ui/InstrumentHandler.kt,
    the swellPer parameter already exists. No layout change needed if we combine
    direction + period into that field.

    Step 2 — Update the marineConditions collector in MainActivity
    --------------------------------------------------------------
    In android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt,
    in observeDataSources(), update the swellPer line in updateConditions() to combine
    direction and period:

        swellPer = when {
            c.swellDirDeg != null && c.swellPeriodS != null ->
                "%.0f° / %.0f s".format(Locale.getDefault(), c.swellDirDeg, c.swellPeriodS)
            c.swellPeriodS != null ->
                "%.0f s".format(Locale.getDefault(), c.swellPeriodS)
            c.swellDirDeg != null ->
                "%.0f°".format(Locale.getDefault(), c.swellDirDeg)
            else -> "—"
        }

    Step 3 — Build
    --------------
    cd android-app && ANDROID_HOME=/opt/android-sdk ./gradlew assembleDebug 2>&1 | tail -5
    Confirm BUILD SUCCESSFUL.

    Step 4 — Commit and push
    ------------------------
    git add android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt
    git commit -m "feat(instruments): show swell direction alongside swell period

    swellDirDeg was fetched from Open-Meteo and stored in MarineConditions
    but never displayed. Combines direction and period in the swell sub-label
    as e.g. '045° / 8 s'."
    git push github main && git push local main
timeout: "15m"
tags:
  - "instruments"
  - "swell"
  - "forecast"