fix default lab settings values
parent
cdff9a8f89
commit
dacd3a5a67
|
@ -19,6 +19,7 @@ import { BooleanSetting } from "../session_keys";
|
|||
|
||||
describe("<LoadingPlant/>", () => {
|
||||
it("renders loading text", () => {
|
||||
mockStorj[BooleanSetting.disableAnimations] = true;
|
||||
const wrapper = shallow(<LoadingPlant />);
|
||||
expect(wrapper.find(".loading-plant").length).toEqual(0);
|
||||
expect(wrapper.find(".loading-plant-text").props().y).toEqual(150);
|
||||
|
@ -27,7 +28,7 @@ describe("<LoadingPlant/>", () => {
|
|||
});
|
||||
|
||||
it("renders loading animation", () => {
|
||||
mockStorj[BooleanSetting.plantAnimations] = true;
|
||||
mockStorj[BooleanSetting.disableAnimations] = false;
|
||||
const wrapper = shallow(<LoadingPlant />);
|
||||
expect(wrapper.find(".loading-plant")).toBeTruthy();
|
||||
const circleProps = wrapper.find(".loading-plant-circle").props();
|
||||
|
|
|
@ -11,14 +11,16 @@ export interface LabsFeature {
|
|||
storageKey: BooleanSetting;
|
||||
value: boolean;
|
||||
experimental?: boolean;
|
||||
displayInvert?: boolean;
|
||||
}
|
||||
|
||||
export const fetchLabFeatures = (): LabsFeature[] => ([
|
||||
{
|
||||
name: t("Disable Web App internationalization"),
|
||||
description: t("Set Web App to English."),
|
||||
name: t("Internationalize Web App"),
|
||||
description: t("Turn off to set Web App to English."),
|
||||
storageKey: BooleanSetting.disableI18n,
|
||||
value: false
|
||||
value: false,
|
||||
displayInvert: true
|
||||
},
|
||||
{
|
||||
name: t("Confirm Sequence step deletion"),
|
||||
|
@ -51,9 +53,10 @@ export const fetchLabFeatures = (): LabsFeature[] => ([
|
|||
},
|
||||
{
|
||||
name: t("Display plant animations"),
|
||||
description: trim(t(`Turn on plant animations in the Farm Designer.`)),
|
||||
storageKey: BooleanSetting.plantAnimations,
|
||||
value: true
|
||||
description: trim(t(`Enable plant animations in the Farm Designer.`)),
|
||||
storageKey: BooleanSetting.disableAnimations,
|
||||
value: false,
|
||||
displayInvert: true
|
||||
}
|
||||
].map(fetchRealValue));
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ interface LabsFeaturesListProps {
|
|||
export function LabsFeaturesList(props: LabsFeaturesListProps) {
|
||||
return <div>
|
||||
{fetchLabFeatures().map((p, i) => {
|
||||
const displayValue = p.displayInvert ? !p.value : p.value;
|
||||
return <KeyValShowRow key={i}
|
||||
label={p.name}
|
||||
labelPlaceholder=""
|
||||
value={p.description}
|
||||
toggleValue={p.value ? 1 : 0}
|
||||
toggleValue={displayValue ? 1 : 0}
|
||||
valuePlaceholder=""
|
||||
onClick={() => props.onToggle(p)}
|
||||
disabled={false} />;
|
||||
|
|
|
@ -36,6 +36,7 @@ describe("<GardenPlant/>", () => {
|
|||
}
|
||||
|
||||
it("renders plant", () => {
|
||||
mockStorj[BooleanSetting.disableAnimations] = true;
|
||||
const wrapper = shallow(<GardenPlant {...fakeProps() } />);
|
||||
expect(wrapper.find("image").length).toEqual(1);
|
||||
expect(wrapper.find("image").props().opacity).toEqual(1);
|
||||
|
@ -46,7 +47,7 @@ describe("<GardenPlant/>", () => {
|
|||
});
|
||||
|
||||
it("renders plant animations", () => {
|
||||
mockStorj[BooleanSetting.plantAnimations] = true;
|
||||
mockStorj[BooleanSetting.disableAnimations] = false;
|
||||
const wrapper = shallow(<GardenPlant {...fakeProps() } />);
|
||||
expect(wrapper.find(".soil-cloud").length).toEqual(1);
|
||||
expect(wrapper.find(".animate").length).toEqual(1);
|
||||
|
|
|
@ -37,7 +37,7 @@ export class GardenPlant extends
|
|||
|
||||
const { qx, qy } = getXYFromQuadrant(round(x), round(y), quadrant, gridSize);
|
||||
const alpha = dragging ? 0.4 : 1.0;
|
||||
const animate = Session.getBool(BooleanSetting.plantAnimations);
|
||||
const animate = !Session.getBool(BooleanSetting.disableAnimations);
|
||||
|
||||
return <g id={"plant-" + id}>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
jest.mock("../../../../session", () => {
|
||||
return {
|
||||
Session: {
|
||||
getBool: () => { return true; }
|
||||
getBool: () => { return false; }
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@ export class HoveredPlantLayer extends
|
|||
const hovered = !!this.props.designer.hoveredPlant.icon;
|
||||
const scaledRadius = currentPlant ? radius : radius * 1.2;
|
||||
const alpha = dragging ? 0.4 : 1.0;
|
||||
const animate = Session.getBool(BooleanSetting.plantAnimations);
|
||||
const animate = !Session.getBool(BooleanSetting.disableAnimations);
|
||||
|
||||
return <g id="hovered-plant-layer">
|
||||
{this.props.visible && hovered &&
|
||||
|
|
|
@ -83,7 +83,7 @@ export class SpreadCircle extends
|
|||
const { selected, mapTransformProps } = this.props;
|
||||
const { quadrant, gridSize } = mapTransformProps;
|
||||
const { qx, qy } = getXYFromQuadrant(round(x), round(y), quadrant, gridSize);
|
||||
const animate = Session.getBool(BooleanSetting.plantAnimations);
|
||||
const animate = !Session.getBool(BooleanSetting.disableAnimations);
|
||||
|
||||
return <g id={"spread-" + id}>
|
||||
{!selected &&
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Session } from "./session";
|
|||
import { BooleanSetting } from "./session_keys";
|
||||
|
||||
export function LoadingPlant() {
|
||||
const animations = Session.getBool(BooleanSetting.plantAnimations);
|
||||
const animations = !Session.getBool(BooleanSetting.disableAnimations);
|
||||
return <div className="loading-plant-div-container">
|
||||
<svg width="300px" height="500px">
|
||||
{animations &&
|
||||
|
|
|
@ -17,7 +17,7 @@ export enum BooleanSetting {
|
|||
hideWebcamWidget = "hideWebcamWidget",
|
||||
dynamicMap = "dynamicMap",
|
||||
mapXL = "mapXL",
|
||||
plantAnimations = "plantAnimations",
|
||||
disableAnimations = "disableAnimations",
|
||||
}
|
||||
|
||||
export enum NumericSetting {
|
||||
|
|
Loading…
Reference in New Issue