don't show buttons on predator fish

This commit is contained in:
insects 2025-02-11 15:55:17 +01:00
parent dbb93543f3
commit 654bcbab1f

View file

@ -76,7 +76,7 @@ pub fn fish_list(data: &ViewData) -> Markup {
html! {
@for fish in data.fish.clone() {
@if !fish.filtered {
(fish_display(&fish, data))
(fish_display(&fish, data, false))
@if !fish.entry.predators.is_empty() {
.predators {
div.predators-header { small { "⇖ Requirements" } }
@ -84,7 +84,7 @@ pub fn fish_list(data: &ViewData) -> Markup {
@if let Some(pred_fish) = data.fish.iter().find(|f| f.entry.id == predator[0]) {
.predators-fish {
.amount { (predator[1]) }
(fish_display(pred_fish, data))
(fish_display(pred_fish, data, true))
}
}
}
@ -95,24 +95,26 @@ pub fn fish_list(data: &ViewData) -> Markup {
}
}
pub fn fish_display(fish: &CombinedFish, data: &ViewData) -> Markup {
pub fn fish_display(fish: &CombinedFish, data: &ViewData, is_predator: bool) -> Markup {
html! {
section.fish.up[fish.is_up].alwaysup[fish.is_always_up].pinned[data.pinned_fish.contains(&(fish.entry.id as i32))] {
.title {
div {
@if !data.caught_fish.contains(&(fish.entry.id as i32)) {
form action=(format!("/{}/catch/{}", data.acc_id, fish.entry.id)) method="post" {
button.catch-button type="submit" { (PreEscaped("✓")) }
@if !is_predator {
div {
@if !data.caught_fish.contains(&(fish.entry.id as i32)) {
form action=(format!("/{}/catch/{}", data.acc_id, fish.entry.id)) method="post" {
button.catch-button type="submit" { (PreEscaped("✓")) }
}
}
}
@if !data.pinned_fish.contains(&(fish.entry.id as i32)) {
form action=(format!("/{}/pin/{}", data.acc_id, fish.entry.id)) method="post" {
button.pin-button type="submit" { (PreEscaped("☆"))}
}
} @else {
form action=(format!("/{}/pin/{}/delete", data.acc_id, fish.entry.id)) method="post" {
button.pin-button type="submit" { (PreEscaped("★"))}
@if !data.pinned_fish.contains(&(fish.entry.id as i32)) {
form action=(format!("/{}/pin/{}", data.acc_id, fish.entry.id)) method="post" {
button.pin-button type="submit" { (PreEscaped("☆"))}
}
} @else {
form action=(format!("/{}/pin/{}/delete", data.acc_id, fish.entry.id)) method="post" {
button.pin-button type="submit" { (PreEscaped("★"))}
}
}
}
}