Skip to content

Commit

Permalink
removing grayscale icons used and updating count
Browse files Browse the repository at this point in the history
  • Loading branch information
monicakochofar committed Oct 4, 2023
1 parent a5aabaa commit 824b361
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions app_vue/src/components/sensorMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ onDeactivated(() => {
<style lang="scss" scoped>
// leaflet css override for mobile views
:deep img.low-opacity {
// class from sensorMapMaker
opacity: 0.6;
// class from sensorMapMaker that handles filtered out bins opacity
opacity: 0.2;
}
:deep .leaflet-pane .leaflet-layer {
// handles map opacity level
Expand Down
10 changes: 5 additions & 5 deletions app_vue/src/components/sensorSideBarFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const routeStore = useRouteStore();
// sensor store
const sensorStore = useSensorStore();
const { sensors, getAllGroupOptions, getAllAssetTags, getAllBinTypes, getAllBinVolumes, getAllMaterialTypes } = storeToRefs(sensorStore);
const { getAllGroupOptions, getAllAssetTags, getAllBinTypes, getAllBinVolumes, getAllMaterialTypes, getRoutableSensors } = storeToRefs(sensorStore);
// component reactive variables
const state = reactive({
Expand All @@ -27,7 +27,7 @@ const state = reactive({
binType: [],
binVolume: [],
materialType: [],
totalSensors: 0,
totalSensorsShown: 0,
showFillLabel: false,
isCollapsed: false,
filtersUsedMap: {
Expand All @@ -41,8 +41,8 @@ const state = reactive({
});
// watching for store state updates and updating component variables
watch(sensors, () => {
state.totalSensors = sensorStore.getTotalSensors;
watch(getRoutableSensors, () => {
state.totalSensorsShown = sensorStore.getRoutableSensors.length || 0;
});
watch(getAllGroupOptions, () => {
Expand Down Expand Up @@ -266,7 +266,7 @@ function getFilterCount() {
</section>

<div class="mb-6">
<span class="font-weight-bold">Result: {{ state.totalSensors }} bin{{ state.totalSensors > 1 ? 's' : '' }}</span>
<span class="font-weight-bold">Result: {{ state.totalSensorsShown }} bin{{ state.totalSensorsShown > 1 ? 's' : '' }}</span>
displayed on map
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion app_vue/src/components/sensorSideBarRoutes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ watch(getHasMappedStartEnd, () => {
async function findRouteClicked() {
state.isLoadingGoogApi = true;
routeStore.setSelectedRouteList(sensorStore.sensors); // store current displayed sensors into route list
routeStore.setSelectedRouteList(sensorStore.getRoutableSensors); // store current displayed sensors into route list
if (sensorStore.getTotalSensors === 1) {
await routeStore.googUpdateRouteStats();
Expand Down
5 changes: 5 additions & 0 deletions app_vue/src/stores/sensors_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export const useSensorStore = defineStore('sensors', {
getSensors({ sensors }) {
return sensors;
},
getRoutableSensors({ sensors }) {
return sensors.filter((sensor) => {
return !sensor.isFilteredOut;
});
},
getTotalSensors({ sensors }) {
return Object.keys(sensors).length;
},
Expand Down
16 changes: 6 additions & 10 deletions app_vue/src/utils/mapMarkerHelper.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
const ICON_NAMES = {
GREYSCALE_FULL_BIN: 'greyscale-full-bin',
FULL_BIN: 'full-bin',
GREYSCALE_HALF_FULL_BIN: 'greyscale-half-full-bin',
HALF_FULL_BIN: 'half-full-bin',
GREYSCALE_EMPTY_BIN: 'greyscale-empty-bin',
EMPTY_BIN: 'empty-bin',
ERROR_BIN: 'error-bin'
// GREYSCALE_EMPTY_BIN: 'greyscale-empty-bin',
// GREYSCALE_HALF_FULL_BIN: 'greyscale-half-full-bin',
// GREYSCALE_FULL_BIN: 'greyscale-full-bin'
};

// const IS_FILTERED_OUT = 'isFilteredOut';

export const getBinIconName = (sensor) => {
const isErrorState = sensor.error;
const isFilteredOut = sensor.isFilteredOut;
// const isFilteredOut = sensor[IS_FILTERED_OUT];
const isFullState = sensor.fill_level && sensor.fill_level >= 75;
const isHalfFullState = sensor.fill_level && sensor.fill_level >= 50 && sensor.fill_level < 75;
const isEmptyState = sensor.fill_level && sensor.fill_level < 50;

if (isErrorState) {
return ICON_NAMES.ERROR_BIN;
} else if (isFilteredOut && isFullState) {
return ICON_NAMES.GREYSCALE_FULL_BIN;
} else if (isFilteredOut && isHalfFullState) {
return ICON_NAMES.GREYSCALE_HALF_FULL_BIN;
} else if (isFilteredOut && isEmptyState) {
return ICON_NAMES.GREYSCALE_EMPTY_BIN;
} else if (isFullState) {
return ICON_NAMES.FULL_BIN;
} else if (isHalfFullState) {
Expand Down

0 comments on commit 824b361

Please sign in to comment.