2023-12-07 17:08:22 +08:00
|
|
|
import React from "react";
|
2023-12-12 16:09:29 +08:00
|
|
|
import {LevelUI} from "./warnings";
|
2023-12-11 17:05:35 +08:00
|
|
|
import {useShopStore} from "./shop_store";
|
2023-12-07 17:08:22 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
export function CrateWarnings({crate_index}) {
|
|
|
|
const crate = useShopStore(state => (state.crates[crate_index]))
|
2023-12-12 16:09:29 +08:00
|
|
|
const crate_warnings = crate.warnings;
|
2023-12-11 17:05:35 +08:00
|
|
|
// TODO UI/colors
|
2023-12-07 17:08:22 +08:00
|
|
|
return (
|
|
|
|
<div className="crate-info">
|
2023-12-11 17:05:35 +08:00
|
|
|
{crate_warnings.map((rule, index) => (
|
2023-12-12 16:09:29 +08:00
|
|
|
<p key={index} className="rule" style={{'color': LevelUI(rule.level).color}}>
|
|
|
|
<img src={LevelUI(rule.level).icon} /> <i>{rule.message}</i>
|
2023-12-07 17:08:22 +08:00
|
|
|
</p>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|