update
This commit is contained in:
parent
43be624ac2
commit
17b6a16ec7
@ -13,7 +13,7 @@ impl Filter {
|
||||
id: Uuid::new_v4(),
|
||||
enabled: true,
|
||||
name: "".to_string(),
|
||||
lines: HashMap::new(),
|
||||
rule: Default::default(),
|
||||
remain: FilterRemain::Leaf(Default::default()),
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ impl Filter {
|
||||
id: Uuid::new_v4(),
|
||||
enabled: true,
|
||||
name: "".to_string(),
|
||||
lines: HashMap::new(),
|
||||
rule: Default::default(),
|
||||
remain: FilterRemain::Group(Default::default()),
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ pub struct Filter {
|
||||
pub id: uuid::Uuid,
|
||||
pub enabled: bool,
|
||||
pub name: String,
|
||||
pub lines: HashMap<String, Line>,
|
||||
pub rule: FilterRule,
|
||||
pub remain: FilterRemain,
|
||||
}
|
||||
|
||||
@ -75,29 +75,29 @@ pub struct Color {
|
||||
pub type Level = RangedNumber<1, 100>;
|
||||
|
||||
#[cfg_attr(feature = "store", derive(reactive_stores::Store))]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub enum Line {
|
||||
Class(Vec<ItemClass>),
|
||||
BaseType(Vec<ItemBaseType>),
|
||||
AreaLevel(Op, Level),
|
||||
DropLevel(Op, Level),
|
||||
ItemLevel(Op, Level),
|
||||
Rarity(Op, ItemRarity),
|
||||
Sockets(Op, u32),
|
||||
Quality(Op, u32),
|
||||
StackSize(Op, u32),
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||
pub struct FilterRule {
|
||||
pub class: Option<Vec<ItemClass>>,
|
||||
pub base_type: Option<Vec<ItemBaseType>>,
|
||||
pub area_level: Option<(Op, Level)>,
|
||||
pub drop_level: Option<(Op, Level)>,
|
||||
pub item_level: Option<(Op, Level)>,
|
||||
pub rarity: Option<(Op, ItemRarity)>,
|
||||
pub sockets: Option<(Op, u32)>,
|
||||
pub quality: Option<(Op, u32)>,
|
||||
pub stack_size: Option<(Op, u32)>,
|
||||
|
||||
// waystones
|
||||
WaystoneTier(Op, RangedNumber<1, 16>),
|
||||
pub waystone_tier: Option<(Op, RangedNumber<1, 16>)>,
|
||||
|
||||
// effects
|
||||
SetFontSize(RangedNumber<1, 45>),
|
||||
SetTextColor(Color),
|
||||
SetBorderColor(Color),
|
||||
SetBackgroundColor(Color),
|
||||
PlayAlertSound(RangedNumber<1, 16>, RangedNumber<0, 300>),
|
||||
PlayEffect(GameColor),
|
||||
MinimapIcon(RangedNumber<0, 2>, GameColor, MinimapIconShape),
|
||||
pub set_font_size: Option<RangedNumber<1, 45>>,
|
||||
pub set_text_color: Option<Color>,
|
||||
pub set_border_color: Option<Color>,
|
||||
pub set_background_color: Option<Color>,
|
||||
pub play_alert_sound: Option<(RangedNumber<1, 16>, RangedNumber<0, 300>)>,
|
||||
pub play_effect: Option<GameColor>,
|
||||
pub minimap_icon: Option<(RangedNumber<0, 2>, GameColor, MinimapIconShape)>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
||||
@ -103,11 +103,11 @@ fn group(
|
||||
<For
|
||||
each=move || group.filters()
|
||||
key=|row| row.read().id.to_string()
|
||||
children=move |filter| {
|
||||
let id = filter.clone().id().get();
|
||||
children=move |child| {
|
||||
let id = child.clone().id().get();
|
||||
view! {
|
||||
<Filter
|
||||
filter
|
||||
filter=child
|
||||
selected
|
||||
on_action=move |action| {
|
||||
let i = group
|
||||
@ -126,8 +126,9 @@ fn group(
|
||||
group.filters().write().swap(i, i + 1);
|
||||
}
|
||||
}
|
||||
a @ Action::Select(_) => {
|
||||
on_action.run((a,));
|
||||
Action::Select(mut v) => {
|
||||
v.push(filter);
|
||||
on_action.run((Action::Select(v),));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,61 @@
|
||||
use leptos::prelude::*;
|
||||
use reactive_stores::Field;
|
||||
use src_common::models::loot_filter::Filter;
|
||||
use reactive_stores::{Field, OptionStoreExt};
|
||||
use src_common::models::loot_filter::{
|
||||
Filter, FilterLeafStoreFields, FilterRemain, FilterRemainStoreFields, FilterRule,
|
||||
FilterRuleStoreFields, FilterStoreFields,
|
||||
};
|
||||
|
||||
#[component]
|
||||
pub fn FilterDetail(#[prop(into)] filter: Vec<Field<Filter>>) -> impl IntoView {
|
||||
let (first, rest) = filter.split_first().unwrap();
|
||||
view! {
|
||||
<article class="prose">
|
||||
<h3>Filter details:</h3>
|
||||
</article>
|
||||
{match first.remain().get_untracked() {
|
||||
FilterRemain::Leaf(_) => {
|
||||
let leaf = first.remain().leaf_0().unwrap();
|
||||
Some(
|
||||
view! {
|
||||
<div class="flex gap-2 items-center">
|
||||
<label class="label">Hide</label>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="toggle"
|
||||
prop:checked=move || leaf.show().get()
|
||||
on:change:target=move |ev| {
|
||||
leaf.show().set(event_target_checked(&ev));
|
||||
}
|
||||
/>
|
||||
<label class="label">Show</label>
|
||||
</div>
|
||||
},
|
||||
)
|
||||
}
|
||||
FilterRemain::Group(_) => None,
|
||||
}}
|
||||
<RuleDetail rule=first.rule() />
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn RuleDetail(#[prop(into)] rule: Field<FilterRule>) -> impl IntoView {
|
||||
let class = view! {
|
||||
<tr class="flex items-center gap-2">
|
||||
<td>
|
||||
<input type="checkbox" class="checkbox" />
|
||||
</td>
|
||||
<td>
|
||||
<label class="label">Class</label>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label">Class</label>
|
||||
</td>
|
||||
</tr>
|
||||
};
|
||||
view! {
|
||||
<table class="table">
|
||||
<tbody>{class}</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user