target
This commit is contained in:
parent
089ab00bb8
commit
92f240d486
@ -47,7 +47,7 @@ const feedbackColors = {
|
|||||||
"bad-": "error",
|
"bad-": "error",
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Calculator({ slot, target, preset }) {
|
export function Calculator({ slot, preset }) {
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -71,20 +71,11 @@ export function Calculator({ slot, target, preset }) {
|
|||||||
} = slot;
|
} = slot;
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
if (
|
||||||
slot.id && (
|
slot.id && (
|
||||||
(!isValidSetup) ||
|
(!isValidSetup) || (!carSetup) || (!biasParam) || (!prevCarSetup) || (!prevBiasParam) || (!feedback) || (!track) || (!previousRuns)
|
||||||
(!carSetup) ||
|
|
||||||
(!biasParam) ||
|
|
||||||
(!prevCarSetup) ||
|
|
||||||
(!prevBiasParam) ||
|
|
||||||
(!feedback) ||
|
|
||||||
(!track) ||
|
|
||||||
(!previousRuns)
|
|
||||||
)
|
)
|
||||||
)
|
) {
|
||||||
|
|
||||||
update({
|
update({
|
||||||
isValidSetup: [true, true, true, true, true],
|
isValidSetup: [true, true, true, true, true],
|
||||||
carSetup: [0.5, 0.5, 0.5, 0.5, 0.5],
|
carSetup: [0.5, 0.5, 0.5, 0.5, 0.5],
|
||||||
@ -95,9 +86,8 @@ export function Calculator({ slot, target, preset }) {
|
|||||||
track: "XX",
|
track: "XX",
|
||||||
previousRuns: [],
|
previousRuns: [],
|
||||||
});
|
});
|
||||||
}, [
|
}
|
||||||
update, slot, isValidSetup, carSetup, biasParam, prevCarSetup, prevBiasParam, feedback, track, previousRuns
|
|
||||||
])
|
|
||||||
|
|
||||||
const setCarSetup = (e) => {
|
const setCarSetup = (e) => {
|
||||||
const bias = setupToBias(e);
|
const bias = setupToBias(e);
|
||||||
@ -219,7 +209,7 @@ export function Calculator({ slot, target, preset }) {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container disableGutters maxWidth="xl" key={target}>
|
<Container disableGutters maxWidth="xl" key={slot.slotNaming}>
|
||||||
<Divider variant="fullWidth" />
|
<Divider variant="fullWidth" />
|
||||||
<Dialog
|
<Dialog
|
||||||
open={openClearFeedback}
|
open={openClearFeedback}
|
||||||
@ -397,7 +387,7 @@ export function Calculator({ slot, target, preset }) {
|
|||||||
BiasParams.map(row => {
|
BiasParams.map(row => {
|
||||||
let feedbacks = JSON.parse(JSON.stringify(feedback[row.index]));
|
let feedbacks = JSON.parse(JSON.stringify(feedback[row.index]));
|
||||||
const biasValue = biasParam[row.index];
|
const biasValue = biasParam[row.index];
|
||||||
const k = row.name + ":" + target;
|
const k = row.name + ":" + slot.slotNaming;
|
||||||
let currentFeedback = "";
|
let currentFeedback = "";
|
||||||
for(const fb of feedbacks) {
|
for(const fb of feedbacks) {
|
||||||
if (fb.value === biasValue) {
|
if (fb.value === biasValue) {
|
||||||
@ -674,8 +664,6 @@ export function Calculator({ slot, target, preset }) {
|
|||||||
)
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
// delete localStorage[target];
|
|
||||||
// document.location.reload();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ export function TabManager() {
|
|||||||
<Calculator
|
<Calculator
|
||||||
key={tab}
|
key={tab}
|
||||||
slot={config.slots[tab]}
|
slot={config.slots[tab]}
|
||||||
target={config.slots[tab].slotNaming}
|
|
||||||
preset={PresetSnapshot}
|
preset={PresetSnapshot}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user