Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/_DASHBOARD_MESSAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,23 @@ Separate store for reusable sender definitions:

```json
{
"id": "director_of_football",
"name": "Director of Football",
"name_key": "be.sender.directorOfFootball",
"role": "Director of Football",
"role_key": "be.role.directorOfFootball",
"id": "general_manager",
"name": "General Manager",
"name_key": "be.sender.generalManager",
"role": "General Manager",
"role_key": "be.role.generalManager",
"icon": "director.jpg"
}
```

Used by templates via `"sender": "director_of_football"` and by inline messages via `with_sender()`.
Used by templates via `"sender": "general_manager"` and by inline messages via `with_sender()`.

### Helper: `with_sender()`

Applies sender name, role, and icon from the senders store to any `InboxMessage`:

```rust
crate::messages::with_sender(msg, "director_of_football", vec![("player", &name)])
crate::messages::with_sender(msg, "general_manager", vec![("player", &name)])
```

## Data Format
Expand Down Expand Up @@ -237,10 +237,10 @@ For template-based messages, the Rust `build_message()` resolves translations in
| `season_schedule` | `season/` | board |
| `match_preview` | `match_preview/` | assistant_coach |
| `match_result` | `match_result/` | assistant_coach |
| `transfer_complete` | `transfer/` | director_of_football |
| `transfer_offer` | `transfer/` | director_of_football |
| `contract_terminated` | `transfer/` | director_of_football |
| `contract_expired` | `contract/` | director_of_football |
| `transfer_complete` | `transfer/` | general_manager |
| `transfer_offer` | `transfer/` | general_manager |
| `contract_terminated` | `transfer/` | general_manager |
| `contract_expired` | `contract/` | general_manager |
| `delegated_renewal` | `contract/` | assistant_coach |
| `academy_acquired` | `academy/` | assistant_coach |
| `academy_player_moved` | `academy/` | assistant_coach |
Expand All @@ -256,11 +256,11 @@ For template-based messages, the Rust `build_message()` resolves translations in
| `low_morale` | `player_event/` | player_relations |
| `bench_complaint` | `player_event/` | player_relations |
| `happy_player` | `player_event/` | player_relations |
| `contract_concern` | `player_event/` | director_of_football |
| `contract_concern` | `player_event/` | general_manager |
| `media_story` | `media/` (20 files) | press |
| `podcast` | `podcast/` (10 files) | al_lio |
| `stream` | `stream/` (20 files) | yuste |
| `rival_interest` | `rival_interest/` (10 files) | director_of_football |
| `rival_interest` | `rival_interest/` (10 files) | general_manager |

## Services

Expand Down
7 changes: 4 additions & 3 deletions src-tauri/crates/olm_core/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,13 @@ fn contract_expired_message(
"{} has left {} after their contract expired. The player is now a free agent.",
player_name, team_name
),
"Director of Football".to_string(),
"General Manager".to_string(),
date.to_string(),
)
.with_category(MessageCategory::Contract)
.with_priority(MessagePriority::Urgent),
"director_of_football",
.with_priority(MessagePriority::Urgent)
.with_sender_i18n("be.sender.generalManager", "be.role.generalManager"),
"general_manager",
vec![("player", player_name), ("team", team_name)],
)
}
Expand Down
10 changes: 5 additions & 5 deletions src-tauri/crates/olm_core/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ pub fn transfer_complete_message(player_name: &str, fee: u64, date: &str) -> Inb
)
.with_category(MessageCategory::Transfer)
.with_priority(MessagePriority::Normal)
.with_sender_role("Director of Football")
.with_sender_role("General Manager")
.with_i18n(
"be.msg.transferComplete.subject",
"be.msg.transferComplete.body",
params(&[("player", player_name), ("fee", &fee_display)]),
)
.with_sender_i18n("be.sender.directorOfFootball", "be.role.directorOfFootball")
.with_sender_i18n("be.sender.generalManager", "be.role.generalManager")
}

pub fn incoming_transfer_offer_message(
Expand All @@ -340,12 +340,12 @@ pub fn incoming_transfer_offer_message(
"{} have submitted an offer of {} for {}. Review the bid in the Transfers tab to accept or reject it.",
buying_team_name, fee_display, player_name
),
"Director of Football".to_string(),
"General Manager".to_string(),
date.to_string(),
)
.with_category(MessageCategory::Transfer)
.with_priority(MessagePriority::High)
.with_sender_role("Director of Football")
.with_sender_role("General Manager")
.with_action(action(
"view_transfers",
"Review Offer",
Expand All @@ -367,6 +367,6 @@ pub fn incoming_transfer_offer_message(
("player", player_name),
]),
)
.with_sender_i18n("be.sender.directorOfFootball", "be.role.directorOfFootball")
.with_sender_i18n("be.sender.generalManager", "be.role.generalManager")
}

7 changes: 4 additions & 3 deletions src-tauri/crates/olm_core/src/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2718,12 +2718,13 @@ pub fn release_player_contract(game: &mut Game, player_id: &str) -> Result<i64,
"You terminated {}'s contract. The player is now a free agent. Termination cost: €{}.",
player_name, penalty
),
"Director of Football".to_string(),
"General Manager".to_string(),
today,
)
.with_category(crate::domain::message::MessageCategory::Contract)
.with_priority(crate::domain::message::MessagePriority::High),
"director_of_football",
.with_priority(crate::domain::message::MessagePriority::High)
.with_sender_i18n("be.sender.generalManager", "be.role.generalManager"),
"general_manager",
vec![("player", &player_name)],
);
game.messages.push(message);
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/crates/olm_core/tests/messages_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ fn transfer_message_millions() {
"Should format millions: {}",
msg.body
);
assert_eq!(msg.sender_role, "Director of Football");
assert_eq!(msg.sender_role, "General Manager");
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/crates/olm_core/tests/random_events_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ fn rival_interest_msg(player_id: &str) -> InboxMessage {
id: "rival_interest_2025-06-15".to_string(),
subject: "Transfer Rumour".to_string(),
body: "A rival is interested".to_string(),
sender: "Director of Football".to_string(),
sender_role: "Director of Football".to_string(),
sender: "General Manager".to_string(),
sender_role: "General Manager".to_string(),
date: "2025-06-15".to_string(),
read: false,
category: MessageCategory::Transfer,
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@
"financialDirector": "Finanzdirektor",
"commercialDirector": "Kaufmännischer Leiter",
"communityManager": "Community-Manager",
"directorOfFootball": "Sportdirektor",
"generalManager": "General Manager",
"intlLiaison": "Internationaler Verbindungsbeauftragter",
"player": "Spieler",
"pressOfficer": "Pressesprecher",
Expand All @@ -2535,7 +2535,7 @@
"financialDirector": "Finanzdirektor",
"commercialDirector": "Kaufmännischer Leiter",
"communityManager": "Community-Manager",
"directorOfFootball": "Sportdirektor",
"generalManager": "General Manager",
"intlLiaison": "Internationaler Verbindungsbeauftragter",
"player": "Spieler",
"scout": "Scout",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@
"financialDirector": "Financial Director",
"commercialDirector": "Commercial Director",
"communityManager": "Community Manager",
"directorOfFootball": "Esports Director",
"generalManager": "General Manager",
"intlLiaison": "International Liaison",
"player": "Player",
"pressOfficer": "Press Officer",
Expand All @@ -2690,7 +2690,7 @@
"financialDirector": "Financial Director",
"commercialDirector": "Commercial Director",
"communityManager": "Community Manager",
"directorOfFootball": "Esports Director",
"generalManager": "General Manager",
"intlLiaison": "International Liaison",
"player": "Player",
"scout": "Scout",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@
"financialDirector": "Director Financiero",
"commercialDirector": "Director Comercial",
"communityManager": "Responsable de Comunidad",
"directorOfFootball": "Director Deportivo",
"generalManager": "Gerente General",
"intlLiaison": "Enlace Internacional",
"player": "Jugador",
"pressOfficer": "Jefe de Prensa",
Expand All @@ -2680,7 +2680,7 @@
"financialDirector": "Director Financiero",
"commercialDirector": "Director Comercial",
"communityManager": "Responsable de Comunidad",
"directorOfFootball": "Director Deportivo",
"generalManager": "Gerente General",
"intlLiaison": "Enlace Internacional",
"player": "Jugador",
"scout": "Ojeador",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@
"financialDirector": "Directeur Financier",
"commercialDirector": "Directeur Commercial",
"communityManager": "Responsable Communauté",
"directorOfFootball": "Directeur Sportif",
"generalManager": "Directeur Général",
"intlLiaison": "Chargé des Relations Internationales",
"player": "Joueur",
"pressOfficer": "Attaché de Presse",
Expand All @@ -2535,7 +2535,7 @@
"financialDirector": "Directeur Financier",
"commercialDirector": "Directeur Commercial",
"communityManager": "Responsable Communauté",
"directorOfFootball": "Directeur Sportif",
"generalManager": "Directeur Général",
"intlLiaison": "Chargé des Relations Internationales",
"player": "Joueur",
"scout": "Recruteur",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@
"financialDirector": "Direttore finanziario",
"commercialDirector": "Direttore commerciale",
"communityManager": "Responsabile comunità",
"directorOfFootball": "Direttore sportivo",
"generalManager": "Direttore Generale",
"intlLiaison": "Responsabile relazioni internazionali",
"player": "Giocatore",
"pressOfficer": "Addetto stampa",
Expand All @@ -2370,7 +2370,7 @@
"financialDirector": "Direttore finanziario",
"commercialDirector": "Direttore commerciale",
"communityManager": "Responsabile comunità",
"directorOfFootball": "Direttore sportivo",
"generalManager": "Direttore Generale",
"intlLiaison": "Responsabile relazioni internazionali",
"player": "Giocatore",
"scout": "Osservatore",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@
"financialDirector": "Diretor Financeiro",
"commercialDirector": "Diretor Comercial",
"communityManager": "Gerente Comunitário",
"directorOfFootball": "Diretor de Equipe",
"generalManager": "Gerente Geral",
"intlLiaison": "Relações Internacionais",
"player": "Jogador",
"pressOfficer": "Assessor de Imprensa",
Expand All @@ -2535,7 +2535,7 @@
"financialDirector": "Diretor Financeiro",
"commercialDirector": "Diretor Comercial",
"communityManager": "Gerente Comunitário",
"directorOfFootball": "Diretor de Equipe",
"generalManager": "Gerente Geral",
"intlLiaison": "Relações Internacionais",
"player": "Jogador",
"scout": "Olheiro",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2513,7 +2513,7 @@
"financialDirector": "Diretor Financeiro",
"commercialDirector": "Diretor Comercial",
"communityManager": "Gestor da Comunidade",
"directorOfFootball": "Diretor Desportivo",
"generalManager": "Gerente Geral",
"intlLiaison": "Responsável pelas Relações Internacionais",
"player": "Jogador",
"pressOfficer": "Assessor de Imprensa",
Expand All @@ -2534,7 +2534,7 @@
"financialDirector": "Diretor Financeiro",
"commercialDirector": "Diretor Comercial",
"communityManager": "Gestor da Comunidade",
"directorOfFootball": "Diretor Desportivo",
"generalManager": "Gerente Geral",
"intlLiaison": "Responsável pelas Relações Internacionais",
"player": "Jogador",
"scout": "Olheiro",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@
"financialDirector": "Finans Direktörü",
"commercialDirector": "Ticari Direktör",
"communityManager": "Topluluk Yöneticisi",
"directorOfFootball": "Espor Direktörü",
"generalManager": "Genel Müdür",
"intlLiaison": "Uluslararası İlişkiler",
"player": "Oyuncu",
"pressOfficer": "Basın Sorumlusu",
Expand All @@ -2535,7 +2535,7 @@
"financialDirector": "Finans Direktörü",
"commercialDirector": "Ticari Direktör",
"communityManager": "Topluluk Yöneticisi",
"directorOfFootball": "Espor Direktörü",
"generalManager": "Genel Müdür",
"intlLiaison": "Uluslararası İlişkiler",
"player": "Oyuncu",
"scout": "Gözlemci",
Expand Down