fixing widget update
This commit is contained in:
parent
e973ca5b0e
commit
aff2cd6ea0
@ -136,9 +136,10 @@ const Prototype = () => {
|
||||
dispatch(
|
||||
addElementToWidget(
|
||||
possibleWidgets[0].id,
|
||||
possibleWidgets[0].elements[0],
|
||||
possibleWidgets[0].elements,
|
||||
),
|
||||
);
|
||||
console.log('widgets', widgets);
|
||||
break;
|
||||
case 'none':
|
||||
console.log('proposed widgets could not be placed');
|
||||
|
@ -71,7 +71,12 @@ export const missileToOwnshipDetectedMessageHigh = () => {
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
// Blinking icon?
|
||||
// Blinking icon? Is it possible in Tailwind without defining blink animation?
|
||||
{
|
||||
display: 'block',
|
||||
margin: 'auto',
|
||||
width: '50%',
|
||||
},
|
||||
),
|
||||
WARNING_LOGO,
|
||||
'warning',
|
||||
|
@ -71,7 +71,12 @@ const missileToOwnshipDetectedMessageMedium = () => {
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
// Blinking icon?
|
||||
// Blinking icon? Is it possible in Tailwind without defining blink animation?
|
||||
{
|
||||
display: 'block',
|
||||
margin: 'auto',
|
||||
width: '50%',
|
||||
},
|
||||
),
|
||||
WARNING_LOGO,
|
||||
'warning',
|
||||
|
@ -30,8 +30,8 @@ const selector = ({ message, stressLevel }: SelectorProps = {}) => {
|
||||
// Call the LPD function that corresponds to the stress level from the message
|
||||
if (message && stressLevel) {
|
||||
// Transform range of stress levels from 0-1 to 0-2 only returning integers
|
||||
stressLevel = Math.floor(stressLevel * 3);
|
||||
return stressLevelLPDFunctions[0](message);
|
||||
stressLevel = Math.floor(stressLevel * 2);
|
||||
return stressLevelLPDFunctions[stressLevel](message);
|
||||
} else {
|
||||
// If no message is provided, return the initial LPD
|
||||
return initialLPD;
|
||||
|
@ -44,17 +44,19 @@ export const minimapSlice = createSlice({
|
||||
},
|
||||
|
||||
addElementToWidget: {
|
||||
prepare(widgetId: string, element: Element) {
|
||||
return { payload: { widgetId, element } };
|
||||
prepare(widgetId: string, elements: Element[]) {
|
||||
return { payload: { widgetId, elements } };
|
||||
},
|
||||
|
||||
reducer(
|
||||
state,
|
||||
action: PayloadAction<{ widgetId: string; element: Element }>,
|
||||
action: PayloadAction<{ widgetId: string; elements: Element[] }>,
|
||||
) {
|
||||
state.widgets[action.payload.widgetId].elements.push(
|
||||
action.payload.element,
|
||||
);
|
||||
console.log('adding elements to widget', action.payload.elements);
|
||||
state.widgets[action.payload.widgetId].elements = action.payload.elements;
|
||||
// state.widgets[action.payload.widgetId].elements.push(
|
||||
// ...action.payload.elements,
|
||||
// );
|
||||
},
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user