diff --git a/nginx.conf b/nginx.conf index b390bff..1537b32 100644 --- a/nginx.conf +++ b/nginx.conf @@ -71,6 +71,12 @@ http { add_header Cache-Control "no-store, no-cache, must-revalidate"; } + # Force re-cache of old service-worker + location = /service-worker.js { + root /usr/share/nginx/html; # adjust if your build folder is elsewhere + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + # Redirect old /index.html requests to new file location = /index.html { return 301 /indexV2.html; diff --git a/package-lock.json b/package-lock.json index 34a1da0..dda1c90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#libracart", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", @@ -10911,7 +10911,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#8308e3c2a3bbc296d152b2df83246de3d0df4321", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#d0ac088df3822c10c0497f49173d1679b4e107b0", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/package.json b/package.json index 89efa4d..ee0e9b7 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#libracart", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", diff --git a/public/service-worker.js b/public/service-worker.js new file mode 100644 index 0000000..6b6a19c --- /dev/null +++ b/public/service-worker.js @@ -0,0 +1,24 @@ +// public/service-worker.js +self.addEventListener('install', () => self.skipWaiting()); + +self.addEventListener('activate', async () => { + // Unregister old CRA SW + const regs = await self.registration.scope ? [self.registration] : await self.clients.getRegistrations(); + for (const reg of regs) { + if (reg && reg.scriptURL.endsWith('service-worker.js')) { + await reg.unregister(); + } + } + + // Clear all caches + if ('caches' in self) { + const keys = await caches.keys(); + for (const key of keys) { + await caches.delete(key); + } + } + + // Reload all clients + const clients = await self.clients.matchAll({ type: 'window' }); + clients.forEach(client => client.navigate(client.url)); +}); diff --git a/src/app/UserWrapper.tsx b/src/app/UserWrapper.tsx index 722705e..cb4cdf8 100644 --- a/src/app/UserWrapper.tsx +++ b/src/app/UserWrapper.tsx @@ -82,7 +82,20 @@ export default function UserWrapper(props: Props) { firmware: new Map() }) }).catch(() => { - setGlobal(globalDefault) + userAPI.getUser(user_id).then(user => { + setGlobal({ + user: user ? user : User.create(), + team: globalDefault.team, + as: "", + showErrors: false, + userTeamPermissions: [], + backgroundTasksComplete: false, + firmware: new Map() + }) + }).catch(() => { + setGlobal(globalDefault) + }) + }) .finally(() => { setLoading(false) diff --git a/src/assets/marketplaceImages/Libra_Cart_temp.jpg b/src/assets/marketplaceImages/Libra_Cart_temp.jpg new file mode 100644 index 0000000..a6ff0cc Binary files /dev/null and b/src/assets/marketplaceImages/Libra_Cart_temp.jpg differ diff --git a/src/bin/BinActions.tsx b/src/bin/BinActions.tsx index 5f4d93a..a425ea6 100644 --- a/src/bin/BinActions.tsx +++ b/src/bin/BinActions.tsx @@ -24,7 +24,7 @@ import RemoveSelfFromObject from "user/RemoveSelfFromObject"; import ShareObject from "user/ShareObject"; import { isOffline } from "utils/environment"; import ObjectTeams from "teams/ObjectTeams"; -// import BinDuplication from "./BinDuplication"; +import BinDuplication from "./BinDuplication"; import BinsIcon from "products/Bindapt/BinsIcon"; import HelpIcon from "@mui/icons-material/Help"; import BinSensors from "./BinSensors"; @@ -269,14 +269,14 @@ export default function BinActions(props: Props) { closeDialogCallback={() => setOpenState({ ...openState, users: false })} refreshCallback={refreshCallback} /> - {/* { setOpenState({ ...openState, duplication: false }); }} bin={bin} refreshCallback={refreshCallback} - /> */} + /> - {user.hasFeature("admin") && ( + {user.hasFeature("installer") && ( )} - {/* - - */} void; + refreshCallback: () => void; +} + +export default function BinDuplication(props: Props) { + const { open, bin, closeDialog, refreshCallback } = props; + const [binDupName, setBinDupName] = useState("(copy of) " + bin.name()); + const binAPI = useBinAPI(); + const { openSnack } = useSnackbar(); + + useEffect(() => { + setBinDupName("(copy of) " + bin.name()); + }, [bin]); + + const duplicate = () => { + let settings = bin.settings; + settings.name = binDupName; + binAPI + .addBin(settings) + .then(resp => { + openSnack("Successfully duplicated bin"); + }) + .catch(err => { + openSnack("Failed to duplicate bin"); + }); + refreshCallback(); + closeDialog(); + }; + + return ( + + Create Duplicate Bin + + + This will create a new bin with the same settings as {bin.name()}. + + setBinDupName(e.target.value)} + /> + + + + + + + ); +} diff --git a/src/bin/BinSVGV2.tsx b/src/bin/BinSVGV2.tsx index 2c7a888..c3c1a40 100644 --- a/src/bin/BinSVGV2.tsx +++ b/src/bin/BinSVGV2.tsx @@ -476,11 +476,11 @@ export default function BinSVGV2(props: Props) { return cableGrainPath; }; - const nodeClass = (nodeTemp: number) => { - if (hottestNodeTemp && hottestNodeTemp.toFixed(2) === nodeTemp.toFixed(2)) { + const nodeClass = (nodeTemp: number, underTop: boolean) => { + if (hottestNodeTemp && hottestNodeTemp.toFixed(2) === nodeTemp.toFixed(2) && underTop) { return classes.hotNode; } - if (coldestNodeTemp && coldestNodeTemp.toFixed(2) === nodeTemp.toFixed(2)) { + if (coldestNodeTemp && coldestNodeTemp.toFixed(2) === nodeTemp.toFixed(2) && underTop) { return classes.coldNode; } return classes.cableNode; @@ -507,12 +507,12 @@ export default function BinSVGV2(props: Props) { //if the cables have the same number of nodes if (b.temperatures.length === a.temperatures.length) { //sort by temp only last and any type that has humidity first - if ( - a.settings.subtype === quack.GrainCableSubtype.GRAIN_CABLE_SUBTYPE_OPI_TEMP && - b.settings.subtype !== quack.GrainCableSubtype.GRAIN_CABLE_SUBTYPE_OPI_TEMP - ) { + if ((avg(a.humidities) === 0 || a.humidities.length === 0) && (avg(b.humidities) !== 0 || b.humidities.length > 0)) { return 1; - } else { + } else if ((avg(b.humidities) === 0 || b.humidities.length === 0) && (avg(a.humidities) !== 0 || a.humidities.length > 0)) { + return -1; + } + else { return a.key() > b.key() ? 1 : -1; } } @@ -759,7 +759,7 @@ export default function BinSVGV2(props: Props) { return ( {e.nodeNumber === topNode && !e.excluded && topNodeHat(cablePos, e.y)} - + ) } diff --git a/src/bin/BinSettings.tsx b/src/bin/BinSettings.tsx index 2c97be1..c65bd31 100644 --- a/src/bin/BinSettings.tsx +++ b/src/bin/BinSettings.tsx @@ -374,7 +374,6 @@ export default function BinSettings(props: Props) { let options: Option[] = [] libracartAPI.listDestinations(0,0,undefined, as) .then(resp=>{ - console.log(resp) //set the options for the search select resp.data.destinations.forEach(d => { let newOp: Option = { @@ -743,7 +742,7 @@ export default function BinSettings(props: Props) { case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_HYBRID_LIDAR: return "Hybrid (lidar)" case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_LIBRACART: - return "Auto (LibraCart)" + return "Auto (Libra Cart)" default: return "Manual" } @@ -907,7 +906,7 @@ export default function BinSettings(props: Props) { } - label={"Auto (LibraCart)"} + label={"Auto (Libra Cart)"} /> } @@ -953,7 +952,7 @@ export default function BinSettings(props: Props) { {inventoryControl === pond.BinInventoryControl.BIN_INVENTORY_CONTROL_LIBRACART && { let newForm = form; @@ -965,7 +964,7 @@ export default function BinSettings(props: Props) { options={lcDestinationOptions} /> - The linked bins inventory will be adjusted When the LibraCart Destination data is synced every 6 hours + The linked bins inventory will be adjusted When the Libra Cart Destination data is synced every 6 hours } diff --git a/src/bin/BinVisualizerV2.tsx b/src/bin/BinVisualizerV2.tsx index 0db4690..8cd41e0 100644 --- a/src/bin/BinVisualizerV2.tsx +++ b/src/bin/BinVisualizerV2.tsx @@ -250,6 +250,7 @@ export default function BinVisualizer(props: Props) { const [cfmHighOpen, setCFMHighOpen] = useState(false); const [{ user }] = useGlobalState(); const [newPreset, setNewPreset] = useState(pond.BinMode.BIN_MODE_NONE); + const [newBinMode, setNewBinMode] = useState(pond.BinMode.BIN_MODE_NONE); const [selectedCable, setSelectedCable] = useState(); const [openNodeDialog, setOpenNodeDialog] = useState(false); const [cableDevice, setCableDevice] = useState(); @@ -345,6 +346,7 @@ export default function BinVisualizer(props: Props) { setGrainOption(ToGrainOption(bin.settings.inventory.grainType)); setBushPerTonne(bin.settings.inventory.bushelsPerTonne.toFixed(2)); setGrainSubtype(bin.subtype()); + setNewBinMode(bin.settings.mode); } if (bin.settings) { let t = bin.settings.outdoorTemp; @@ -384,8 +386,11 @@ export default function BinVisualizer(props: Props) { //also reverse it so that the node 1 (end of the cable) is in the first position let filteredNodes = cable.filteredNodes(true) temps.push(...filteredNodes.temps) - humids.push(...filteredNodes.humids) - emcs.push(...filteredNodes.moistures) + //only push to the humidity values if the cable reads humidities + if(cable.subType() !== quack.GrainCableSubtype.GRAIN_CABLE_SUBTYPE_OPI_TEMP){ + humids.push(...filteredNodes.humids) + emcs.push(...filteredNodes.moistures) + } // let tempClone = cloneDeep(cable.temperatures).reverse(); // let humClone = cloneDeep(cable.humidities).reverse(); // let emcClone = cloneDeep(cable.grainMoistures).reverse(); @@ -409,14 +414,15 @@ export default function BinVisualizer(props: Props) { //if the lowest temp for this cable is less than the temp in the low node conditions or the low node conditions are not set //use this cables lowest node and trend data in the condition - if (!lowNodeConditions || Math.min(...temps) < lowNodeConditions.tempC) { + if (!lowNodeConditions || Math.min(...filteredNodes.temps) < lowNodeConditions.tempC) { //determine which node is the coldest so that the data displayed is for the same node let lowTempIndex = - temps.indexOf(Math.min(...temps)) === -1 ? 0 : temps.indexOf(Math.min(...temps)); + filteredNodes.temps.indexOf(Math.min(...filteredNodes.temps)) === -1 ? 0 : filteredNodes.temps.indexOf(Math.min(...filteredNodes.temps)); + console.log(lowTempIndex) lowNodeConditions = { - tempC: temps[lowTempIndex], - humidity: humids[lowTempIndex], - emc: emcs[lowTempIndex], + tempC: filteredNodes.temps[lowTempIndex], + humidity: filteredNodes.humids[lowTempIndex], + emc: filteredNodes.moistures[lowTempIndex], tempCTrend: cableTrendData.coldNodeTrend?.tempTrend ?? 0, humidityTrend: cableTrendData.coldNodeTrend?.humidityTrend ?? 0, emcTrend: cableTrendData.coldNodeTrend?.emcTrend ?? 0 @@ -424,13 +430,13 @@ export default function BinVisualizer(props: Props) { } //do the same for the high node - if (!highNodeConditions || cable.maxTemp() > highNodeConditions.tempC) { + if (!highNodeConditions || Math.max(...filteredNodes.temps) > highNodeConditions.tempC) { let highTempIndex = - temps.indexOf(Math.max(...temps)) === -1 ? 0 : temps.indexOf(Math.max(...temps)); + filteredNodes.temps.indexOf(Math.max(...filteredNodes.temps)) === -1 ? 0 : filteredNodes.temps.indexOf(Math.max(...filteredNodes.temps)); highNodeConditions = { - tempC: temps[highTempIndex], - humidity: humids[highTempIndex], - emc: emcs[highTempIndex], + tempC: filteredNodes.temps[highTempIndex], + humidity: filteredNodes.humids[highTempIndex], + emc: filteredNodes.moistures[highTempIndex], tempCTrend: cableTrendData.hotNodeTrend?.tempTrend ?? 0, humidityTrend: cableTrendData.hotNodeTrend?.humidityTrend ?? 0, emcTrend: cableTrendData.hotNodeTrend?.emcTrend ?? 0 @@ -1967,6 +1973,7 @@ export default function BinVisualizer(props: Props) { const setModeStorage = () => { setNewPreset(pond.BinMode.BIN_MODE_STORAGE); + setNewBinMode(pond.BinMode.BIN_MODE_STORAGE); }; const setModeCooldown = () => { @@ -1974,6 +1981,7 @@ export default function BinVisualizer(props: Props) { return; } setNewPreset(pond.BinMode.BIN_MODE_COOLDOWN); + setNewBinMode(pond.BinMode.BIN_MODE_COOLDOWN); }; const setModeDrying = () => { @@ -1982,13 +1990,16 @@ export default function BinVisualizer(props: Props) { bin.settings.inventory?.initialMoisture < bin.settings.inventory?.targetMoisture ) { setNewPreset(pond.BinMode.BIN_MODE_HYDRATING); + setNewBinMode(pond.BinMode.BIN_MODE_HYDRATING); } else { setNewPreset(pond.BinMode.BIN_MODE_DRYING); + setNewBinMode(pond.BinMode.BIN_MODE_DRYING); } }; const closeMoistureDialog = () => { setNewPreset(0); + setNewBinMode(bin.settings.mode); setShowInputMoisture(false); }; @@ -2049,6 +2060,7 @@ export default function BinVisualizer(props: Props) { diff --git a/src/models/Bin.ts b/src/models/Bin.ts index 603a9ce..b84af8c 100644 --- a/src/models/Bin.ts +++ b/src/models/Bin.ts @@ -96,7 +96,7 @@ export class Bin { } public empty(): boolean { - return this.settings.inventory?.empty || (this.settings.inventory !== undefined && this.settings.inventory !== null && this.settings.inventory.grainBushels < 5); + return this.settings.inventory?.empty || (this.settings.inventory !== undefined && this.settings.inventory !== null && this.bushels() < 5); } public objectType(): pond.ObjectType { diff --git a/src/models/Component.ts b/src/models/Component.ts index 9b96599..473d85d 100644 --- a/src/models/Component.ts +++ b/src/models/Component.ts @@ -114,7 +114,7 @@ export class Component { return 0; } - public addressDescription = (deviceProduct?: pond.DeviceProduct) => { + public addressDescription(deviceProduct?: pond.DeviceProduct): string { if ( this.settings.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY || (this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 && diff --git a/src/models/GrainCable.ts b/src/models/GrainCable.ts index 52d6b6b..70dc257 100644 --- a/src/models/GrainCable.ts +++ b/src/models/GrainCable.ts @@ -273,7 +273,7 @@ export class GrainCable { let filtered: number[] = [] values.forEach((val, index) => { //if the node is not excluded AND is either under the top node OR top node is not set - if(!this.excludedNodes.includes(index) && (index <= this.topNode || this.topNode === 0)){ + if(!this.excludedNodes.includes(index) && (index < this.topNode || this.topNode === 0)){ filtered.push(val) } }) diff --git a/src/navigation/SideNavigator.tsx b/src/navigation/SideNavigator.tsx index 7bfa1e5..f3e95a4 100644 --- a/src/navigation/SideNavigator.tsx +++ b/src/navigation/SideNavigator.tsx @@ -70,19 +70,26 @@ const useStyles = makeStyles((theme: Theme) => ({ }) }, sideMenuOnClosed: { - transition: theme.transitions.create(["width", "z-index", "opacity"], { + transition: theme.transitions.create(["width"], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen }), - overflowX: "hidden", - width: theme.spacing(7), - zIndex: theme.zIndex.drawer, - opacity: 0, + // overflowX: "hidden", + width: theme.spacing(0), + // zIndex: theme.zIndex.drawer, + // opacity: 0, [theme.breakpoints.up("md")]: { - width: theme.spacing(9), + width: theme.spacing(9.25), opacity: 1 } }, + sideMenuOnClosedMobile: { + transition: theme.transitions.create(["width"], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen + }), + width: theme.spacing(0), + }, list: { paddingTop: 0 }, @@ -504,7 +511,7 @@ export default function SideNavigator(props: Props) { classes={{ paper: classNames( classes.sideMenu, - open ? classes.sideMenuOpened : classes.sideMenuOnClosed + open ? classes.sideMenuOpened : (isMobile ? classes.sideMenuOnClosedMobile : classes.sideMenuOnClosed) ) }} anchor="left" diff --git a/src/pages/Bins.tsx b/src/pages/Bins.tsx index 477aa05..a0e1397 100644 --- a/src/pages/Bins.tsx +++ b/src/pages/Bins.tsx @@ -345,6 +345,7 @@ export default function Bins(props: Props) { let b = resp.data.bins.map(b => Bin.any(b)); b.forEach(bin => { if (bin.empty()) { + console.log(bin.name()) empty.push(bin); } else if (bin.storage() === pond.BinStorage.BIN_STORAGE_FERTILIZER) { fert.push(bin); @@ -1214,37 +1215,6 @@ export default function Bins(props: Props) { } ]} /> - {/* - { - setCardValDisplay("low"); - }}> - Low - - { - setCardValDisplay("average"); - }}> - Average - - { - setCardValDisplay("high"); - }}> - High - - */} @@ -1270,41 +1240,6 @@ export default function Bins(props: Props) { } ]} /> - {/* - { - setBinView("grid"); - sessionStorage.setItem("binsView", "grid"); - }}> - - */} - {/* hidden at dustins request so that grid view and list are the only two */} - {/* { - setBinView("scroll"); - sessionStorage.setItem("binsView", "scroll"); - }}> - - */} - {/* { - setBinView("list"); - sessionStorage.setItem("binsView", "list"); - }}> - - - */} { diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index 7721ec1..673f097 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -472,7 +472,7 @@ export default function Devices() { ] if (hasPlenums) { columns.push({ - title: "Plenum", + title: "Temp/Humidity", // sortKey: "hi", // disableSort: true, render: (device: Device) => { diff --git a/src/pages/Users.tsx b/src/pages/Users.tsx index 45dd476..c7e155c 100644 --- a/src/pages/Users.tsx +++ b/src/pages/Users.tsx @@ -129,7 +129,7 @@ export default function Users() { "marketplace", "installer", "cnhi", - "libracart" + "libra-cart" ].sort(); const [rows, setRows] = useState([]) diff --git a/src/pbHelpers/Power.tsx b/src/pbHelpers/Power.tsx index 67bb45b..b98a842 100644 --- a/src/pbHelpers/Power.tsx +++ b/src/pbHelpers/Power.tsx @@ -71,16 +71,19 @@ export function describePower(power?: pond.DevicePower | null): PowerDescriber { } } else { let thresholds = notChargingThresholds; - let suffix = "not charging"; - if (power.inputVoltage >= 4) { - thresholds = chargingThresholds; - if (power.chargePercent === 100) { - suffix = "charged"; - } else { - suffix = "charging"; - } - } - result.description = power.chargePercent.toString() + "%, " + suffix; + // we would not actually know if it is charging here since it is just looking at the voltage now and not comparing to previous voltage + // let suffix = "not charging"; + // if (power.inputVoltage >= 4) { + // thresholds = chargingThresholds; + // if (power.chargePercent === 100) { + // suffix = "charged"; + // } else { + // suffix = "charging"; + // } + // } + // result.description = power.chargePercent.toString() + "%, " + suffix; + // TODO: there is a plan in place to add a boolean value to power in the backend to have it check and set the boolean, we can then use that to know if it is charging or not + result.description = power.chargePercent.toString() + "%" for (let i = 0; i < thresholds.length; i++) { if (power.chargePercent >= thresholds[i].threshold) { result.icon = thresholds[i].icon; diff --git a/src/user/UserSettings.tsx b/src/user/UserSettings.tsx index ec86924..17575e5 100644 --- a/src/user/UserSettings.tsx +++ b/src/user/UserSettings.tsx @@ -10,7 +10,7 @@ import { Textsms as TextIcon, Contrast, } from "@mui/icons-material"; -import { AppBar, Box, Button, Checkbox, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Grid2, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, MenuItem, Radio, RadioGroup, TextField, Theme, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography } from "@mui/material"; +import { AppBar, Box, Button, Checkbox, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Grid2, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, MenuItem, Radio, RadioGroup, Slider, TextField, Theme, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography } from "@mui/material"; import ResponsiveDialog from "common/ResponsiveDialog"; import UserAvatar from "./UserAvatar"; import { useGlobalState, useSnackbar, useUserAPI } from "providers"; @@ -31,6 +31,7 @@ import UnitsIcon from "@mui/icons-material/Category"; import { setThemeType } from "theme"; import { IsAdaptiveAgriculture } from "services/whiteLabel"; import { setDistanceUnit, setGrainUnit, setPressureUnit, setTemperatureUnit } from "utils"; +import FieldsIcon from "products/AgIcons/FieldsIcon"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -82,7 +83,9 @@ export default function UserSettings(props: Props) { const [avatarExpanded, setAvatarExpanded] = useState(false); const [notificationsExpanded, setNotificationsExpanded] = useState(false); const [unitsExpanded, setUnitsExpanded] = useState(false); + const [mapsExpanded, setMapsExpanded] = useState(false); const [avatarUrl, setAvatarUrl] = useState(""); + const [sliderVal, setSliderVal] = useState(globalState.user.settings.mapZoom); // const [themeValue, setThemeValue] = useState<"light" | "dark" | "system">(themeMode.mode) useEffect(() => { @@ -151,6 +154,30 @@ export default function UserSettings(props: Props) { setUser(updatedUser); }; + const changeDefaultZoom = (value: number) => { + setSliderVal(value); + let updatedUser = User.clone(user); + updatedUser.settings.mapZoom = value; + setUser(updatedUser) + }; + + const mapSettings = () => { + return ( + + Map Zoom Level + { + changeDefaultZoom(val as number); + }} + /> + + ); + }; + const generalSettings = () => { const { name, email, phoneNumber, timezone } = user.settings; @@ -631,15 +658,15 @@ export default function UserSettings(props: Props) { - {/* + - setMapsExpanded(!mapsExpanded)}> + setMapsExpanded(!mapsExpanded)}> {mapsExpanded ? : } - + @@ -648,7 +675,7 @@ export default function UserSettings(props: Props) { - */} + ); }; diff --git a/src/userFeatures/UserFeatures.tsx b/src/userFeatures/UserFeatures.tsx index c61cebc..fa797a1 100644 --- a/src/userFeatures/UserFeatures.tsx +++ b/src/userFeatures/UserFeatures.tsx @@ -17,6 +17,7 @@ import FeatureCard from "./FeatureCard"; //import { ImgIcon } from "common/ImgIcon"; //images to import for the image in the card for the feature make sure to have a 2:1 aspect ratio to keep the cards symmetrical import FeatureImageTest from "assets/marketplaceImages/VisualFarmMPImage.png"; +import LibraCartImage from "assets/marketplaceImages/Libra_Cart_temp.jpg"; // export interface FAQ { // question: string; @@ -66,7 +67,7 @@ const agFeatureList: ProductDetails[] = [ featureName: "libra-cart", featureLogo: , featureCost: 0, - cardImage: FeatureImageTest, + cardImage: LibraCartImage, featureTitle: "Libra Cart", longDescription: "Integrate with Libra Cart to bring your data into our platform" }