Skip to content

Commit

Permalink
fix [is_time_unit_minute], wrap recipe select with border
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyZJX committed Dec 4, 2023
1 parent 0aa924a commit 6e0b9a4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
4 changes: 4 additions & 0 deletions css/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
color: white !important;
}

.border-recipe-item {
border: 1px dashed #484 !important;
}

.bg-unselected {
background-color: #AAA !important;
color: white !important;
Expand Down
2 changes: 1 addition & 1 deletion src/batch_setting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function BatchSetting() {
}

return <div className="mt-3 d-inline-flex flex-wrap column-gap-3 row-gap-2 align-items-center">
<small>批量预设</small>
<small className="fw-bold">批量预设</small>
{factory_doms}
<HorizontalMultiButtonSelect choice={pro_num} options={proliferate_options}
onChange={change_pro_num} no_gap={true} />
Expand Down
6 changes: 4 additions & 2 deletions src/needs_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ export function NeedsList({ needs_list, set_needs_list }) {
set_needs_list(new_needs_list);
}

const is_min = global_state.ui_settings.is_time_unit_minute;

return <>
<div className="w-fit mt-3 d-flex align-items-center">
<small className="me-3">添加需求</small>
<small className="me-3 fw-bold">添加需求</small>
<div className="input-group input-group-sm w-fit d-inline-flex">
<input type="text" className="form-control" style={{ width: "6em" }} ref={count_ref} defaultValue={60} />
<span className="input-group-text">/min</span>
<span className="input-group-text">/{is_min ? "min" : "sec"}</span>
<ItemSelect text="选择物品" set_item={add_need} />
<button className="btn btn-sm btn-outline-danger" onClick={() => set_needs_list({})}>清空需求</button>
</div>
Expand Down
20 changes: 10 additions & 10 deletions src/result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ export function RecipeSelect({ item, choice, onChange }) {
let game_data = global_state.game_data;
let item_data = global_state.item_data;

let doms = [];
for (let i = 1; i < item_data[item].length; i++) {
let recipe_index = item_data[item][i];
if (item_data[item].length == 2) {
let recipe_index = item_data[item][1];
let recipe = game_data.recipe_data[recipe_index];
if (item_data[item].length == 2) {
// only one recipe
doms.push(<div key={i} className="my-1 px-2 py-1"
onClick={() => onChange(i)}> <Recipe recipe={recipe} /></div>);
} else {
return <div className="my-1 px-2 py-1"><Recipe recipe={recipe} /></div>
} else {
let doms = [];
for (let i = 1; i < item_data[item].length; i++) {
let recipe_index = item_data[item][i];
let recipe = game_data.recipe_data[recipe_index];
let bg_class = (i == choice) ? "selected" : "";
doms.push(<a key={i}
className={`recipe-item px-2 py-1 d-block text-decoration-none text-reset cursor-pointer ${bg_class}`}
onClick={() => onChange(i)}>
<Recipe recipe={recipe} />
</a>);
}
}

return <>{doms}</>;
return <div className="border-recipe-item">{doms}</div>;
}
}

export const pro_num_text = {
Expand Down

0 comments on commit 6e0b9a4

Please sign in to comment.