Skip to content

Commit b133b55

Browse files
committed
#672 set height for MediaMap and add conditional rendering
1 parent 12b16a3 commit b133b55

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

frontend/components/media/MediaMap.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import MapLibreGlDirections from "@maplibre/maplibre-gl-directions";
1010
import maplibregl from "maplibre-gl";
1111
import "maplibre-gl/dist/maplibre-gl.css";
1212
13-
const props = defineProps<{ markerColors: string[]; isHidden: boolean }>();
13+
const i18n = useI18n();
14+
const props = defineProps<{ markerColors: string[] }>();
1415
1516
function isWebglSupported() {
1617
if (window.WebGLRenderingContext) {
@@ -30,8 +31,8 @@ function isWebglSupported() {
3031
}
3132
3233
onMounted(() => {
33-
if (!isWebglSupported() && !props.isHidden) {
34-
alert("Your browser does not support MapLibre GL");
34+
if (!isWebglSupported()) {
35+
alert(i18n.t("components.media-map.maplibre-gl-alert"));
3536
} else {
3637
const map = new maplibregl.Map({
3738
container: "map",

frontend/i18n/en-US.json

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
"components.landing-tech-banner.open-source-tagline": "Trust through Transparency",
231231
"components.landing-tech-banner.open-source-text": "We're dedicated to working in the open to build trust with our partner organizations and fellow activists. Building the place for activism the world over takes a lot of effort, so please come join us!",
232232
"components.logo-activist.aria-label": "The activist logo that links to the home page",
233+
"components.media-map.maplibre-gl-alert": "Your browser does not support our mapping service MapLibre GL, so we won't be able to display maps.",
233234
"components.meta-tag-stars.label": "stars",
234235
"components.meta-tag.supporters_lower": "supporters",
235236
"components.modal-command-palette.jump-to": "Jump to",

frontend/pages/events/[id]/about.vue

+21-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</HeaderAppPage>
5959
<div class="pt-3 pb-6 space-y-6 lg:pt-4">
6060
<div
61-
class="pb-6 grid grid-cols-1 grid-rows-2 space-y-6 lg:grid-cols-3 lg:grid-rows-1 lg:pb-0 lg:space-y-0"
61+
class="lg:grid space-y-6 lg:grid-cols-3 lg:grid-rows-1 lg:space-y-0"
6262
:class="{
6363
'lg:space-x-6 lg:mr-6': !textExpanded,
6464
}"
@@ -73,9 +73,12 @@
7373
:event="event"
7474
/>
7575
<MediaMap
76-
v-if="event.inPersonLocation"
76+
v-if="
77+
(event.inPersonLocation && !textExpanded) ||
78+
(event.inPersonLocation && isUnderLargeBP)
79+
"
80+
class="w-full h-[17.5rem]"
7781
:markerColors="event.type === 'learn' ? ['#2176AE'] : ['#BA3D3B']"
78-
:isHidden="textExpanded"
7982
/>
8083
</div>
8184
<CardGetInvolved
@@ -99,6 +102,21 @@ const expandReduceText = () => {
99102
textExpanded.value = !textExpanded.value;
100103
};
101104
105+
const isUnderLargeBP = ref(false);
106+
107+
const checkUnderLargeBP = () => {
108+
isUnderLargeBP.value = window.innerWidth < 1024;
109+
};
110+
111+
const handleResize = () => {
112+
checkUnderLargeBP();
113+
};
114+
115+
onMounted(() => {
116+
window.addEventListener("resize", handleResize);
117+
handleResize(); // initial check
118+
});
119+
102120
const event: Event = {
103121
name: "Brandenburg Gate Climate Demo",
104122
tagline: "There is no Planet B",

0 commit comments

Comments
 (0)