mirror of
https://github.com/pawelorzech/MacTorn.git
synced 2026-03-31 12:15:48 +00:00
2.5 KiB
2.5 KiB
Cooldown Quick Action Buttons — Design Spec
Overview
When a cooldown (drug, medical, booster) reaches 0 ("Ready"), the cooldown cell transforms into a clickable button that opens the corresponding Items subsection on Torn's website. For the booster cooldown, the user can configure in Settings whether the link targets boosters or alcohol.
UI Changes
Cooldown Cells (LiveCooldownItem / CooldownItem)
When remaining == 0 and an actionURL is provided:
- Background:
Color.green.opacity(0.12)fill - Border:
Color.green.opacity(0.25),cornerRadius(6) - Action label: Below "Ready" text, a subtle hint in
.caption2font atopacity(0.7):- Drug: "Use Drug →"
- Medical: "Use Medical →"
- Booster: "Use Booster →" or "Use Alcohol →" (depending on setting)
- Behavior: Entire cell is a
Buttonthat callsBrowserManager.shared.open(url)
When cooldown > 0 or no actionURL: no visual or behavioral change from current implementation.
Target URLs
| Cooldown | URL |
|---|---|
| Drug | https://www.torn.com/item.php#drugs-items |
| Medical | https://www.torn.com/item.php#medical-items |
| Booster (boosters) | https://www.torn.com/item.php#boosters-items |
| Booster (alcohol) | https://www.torn.com/item.php#alcohol-items |
Settings
New option in SettingsView: "Booster cooldown link"
Pickerwith two choices: "Boosters" (default), "Alcohol"- Stored in
@AppStorage("boosterCooldownTarget")asString— value"boosters"or"alcohol" - Placed after the existing Reduce Transparency toggle in the settings layout
Data Flow
LiveCooldownItemandCooldownItemgain a new optional parameter:actionURL: URL?cooldownsSectioninStatusViewconstructs the URLs:- Drug and Medical: static URLs
- Booster: reads
@AppStorage("boosterCooldownTarget")to determine which URL to use
- URL opening is delegated to
BrowserManager.shared.open()(respects preferred browser setting)
Scope — What Does NOT Change
- Cooldown notifications in
AppState— unchanged AppStatelogic — no modifications (feature is view-layer only)- Quick Links section — unchanged
- Cooldown behavior when timer > 0 — unchanged
CooldownItemfallback (nofetchTime) renders action button using same logic based onseconds == 0
Visual Reference
Style C from brainstorming: entire cooldown cell becomes a clickable button with green background, border, and subtle action text when ready.