2023-12-07 17:08:22 +08:00
|
|
|
import React from "react";
|
2023-12-11 17:05:35 +08:00
|
|
|
import {TriggerCrateWarnings} from "./warnings";
|
|
|
|
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]))
|
|
|
|
const crate_warnings = TriggerCrateWarnings(crate);
|
|
|
|
// 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) => (
|
|
|
|
<p key={index} className="rule" style={{'color': "red"}}>
|
2023-12-07 17:08:22 +08:00
|
|
|
<img src={`/images${rule.icon}`} /> <i><strong>{rule.name}:</strong> {rule.message}</i>
|
|
|
|
</p>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|