Skip to content

Commit d19ebf2

Browse files
tabiodunBradenM
authored andcommitted
Live map fixes
Fix google maps Fix issue with tabs (cherry picked from commit 1fa94fab77bf15b69f1c4e7ce68b99305d40806f)
1 parent 5cbb1a7 commit d19ebf2

File tree

5 files changed

+19
-52
lines changed

5 files changed

+19
-52
lines changed

src/components/tabs/LightTab.vue

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,15 @@ export default defineComponent({
1414
selected: { type: Boolean },
1515
disabled: { type: Boolean, default: false },
1616
},
17-
setup(props) {
17+
setup() {
1818
const index = ref(0);
19-
const isActive = ref(false);
19+
const isActive = computed(() => index.value === tabs.selectedIndex);
2020
2121
const tabs = inject('TabsProvider');
2222
23-
watch(
24-
() => tabs.selectedIndex,
25-
() => {
26-
isActive.value = index.value === tabs.selectedIndex;
27-
},
28-
);
29-
30-
watch(
31-
() => props.selected,
32-
() => {
33-
tabs.selectedIndex = index;
34-
},
35-
);
36-
3723
onBeforeMount(() => {
3824
index.value = tabs.count;
3925
tabs.count++;
40-
isActive.value = index.value === tabs.selectedIndex;
4126
});
4227
return { index, isActive };
4328
},

src/components/tabs/Tab.vue

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,15 @@ export default defineComponent({
1414
selected: { type: Boolean },
1515
disabled: { type: Boolean, default: false },
1616
},
17-
setup(props) {
17+
setup() {
1818
const index = ref(0);
19-
const isActive = ref(false);
19+
const isActive = computed(() => index.value === tabs.selectedIndex);
2020
2121
const tabs = inject('TabsProvider');
2222
23-
watch(
24-
() => tabs.selectedIndex,
25-
() => {
26-
isActive.value = index.value === tabs.selectedIndex;
27-
},
28-
);
29-
30-
watch(
31-
() => props.selected,
32-
() => {
33-
tabs.selectedIndex = index;
34-
},
35-
);
36-
3723
onBeforeMount(() => {
3824
index.value = tabs.count;
3925
tabs.count++;
40-
isActive.value = index.value === tabs.selectedIndex;
4126
});
4227
return { index, isActive };
4328
},

src/external/Leaflet.GoogleMutant/lru_map.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export class LRUMap {
160160
}
161161

162162
shift() {
163-
// todo: handle special case when limit == 1
164163
var entry = this.oldest;
165164
if (entry) {
166165
if (this.oldest[NEWER]) {

src/hooks/live/useSiteStatistics.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import axios from 'axios';
22
import moment from 'moment';
3+
import type { Ref } from 'vue';
34
import { getQueryString } from '@/utils/urls';
45
import { i18n } from '@/main';
56
import type { SiteStatistic } from '@/hooks/live/types';
7+
import type Organization from '@/models/Organization';
68

7-
export default function useSiteStatistics(queryFilter: Record<string, any>) {
9+
export default function useSiteStatistics(
10+
queryFilter: Record<string, any>,
11+
organizations: Ref<Organization[]>,
12+
) {
813
const statsInterval = ref<ReturnType<typeof setInterval> | null>(null);
914
const currentSiteStats = ref<SiteStatistic[]>([]);
1015
const currentEngagement = ref(0);
@@ -28,7 +33,6 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
2833
const params = {
2934
start_date: start_date.format('YYYY-MM-DD'),
3035
end_date: end_date.format('YYYY-MM-DD'),
31-
incident: undefined,
3236
};
3337
if (incident) {
3438
params.incident = incident;
@@ -51,9 +55,7 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
5155
statsInterval.value = null;
5256

5357
const { incident } = queryFilter.value;
54-
const params = {
55-
incident: undefined,
56-
};
58+
const params = {};
5759
if (incident) {
5860
params.incident = incident;
5961
}
@@ -80,7 +82,6 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
8082
date: d,
8183
interval,
8284
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
83-
incident: undefined,
8485
};
8586
if (incident) {
8687
params.incident = incident;
@@ -100,7 +101,6 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
100101
const params = {
101102
start_date: start_date.format('YYYY-MM-DD'),
102103
end_date: end_date.format('YYYY-MM-DD'),
103-
incident: undefined,
104104
};
105105
if (incident) {
106106
params.incident = incident;
@@ -198,7 +198,6 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
198198
const params = {
199199
start_date: start_date.format('YYYY-MM-DD'),
200200
end_date: moment().format('YYYY-MM-DD'),
201-
incident: undefined,
202201
};
203202
if (incident) {
204203
params.incident = incident;
@@ -273,8 +272,7 @@ export default function useSiteStatistics(queryFilter: Record<string, any>) {
273272
{
274273
name: 'Total Orgs',
275274
color: mapStatisticsColors[6],
276-
count: 0,
277-
// count: this.organizations.length TODO: Find a better way to do this,
275+
count: organizations.value.length,
278276
style: `border: none`,
279277
title: i18n.global.t('pewPew.total_orgs'),
280278
},

src/pages/unauthenticated/PewPew.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ export default {
520520
const lastEventTimestamp = ref(null);
521521
const markersLength = ref(0);
522522
const mapUtils = ref(null);
523+
const isDarkMode = computed(() => colorMode.value === 'dark');
524+
const isLoggedIn = computed(() => store.getters['auth/isLoggedIn']);
525+
const incidentList = computed(() =>
526+
Incident.query().where('active_phone_number', Boolean).get(),
527+
);
528+
const organizations = ref([]);
523529
524530
const {
525531
currentSiteStats,
@@ -529,7 +535,7 @@ export default {
529535
totalCasesChartData,
530536
mapStatistics,
531537
formatStatValue,
532-
} = useSiteStatistics(queryFilter);
538+
} = useSiteStatistics(queryFilter, organizations);
533539
534540
const styles = computed(() => {
535541
if (colorMode.value === 'dark') {
@@ -557,12 +563,6 @@ export default {
557563
};
558564
});
559565
560-
const isDarkMode = computed(() => colorMode.value === 'dark');
561-
const isLoggedIn = computed(() => store.getters['auth/isLoggedIn']);
562-
const incidentList = computed(() =>
563-
Incident.query().where('active_phone_number', Boolean).get(),
564-
);
565-
const organizations = ref([]);
566566
const siteInfoTimerData = reactive({
567567
timerId: null,
568568
activeInfoTab: 0,

0 commit comments

Comments
 (0)