Skip to content

Commit 7dcb534

Browse files
committed
tabs linters
1 parent 211e583 commit 7dcb534

File tree

18 files changed

+106
-26
lines changed

18 files changed

+106
-26
lines changed

src/components/group/GroupForm/GroupForm.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@
122122
@click="openModal('location')"
123123
/>
124124
</label>
125-
<LocationItem v-if="form.location" :location="form.location" :focus="false" />
125+
<LocationItem
126+
v-if="form.location"
127+
:location="form.location"
128+
:focus="false"
129+
show-location-type
130+
/>
126131
<LocationDrawer
127132
:is-opened="stateModal.location"
128133
:locations="form.location ? [form.location] : []"

src/components/group/Modules/Locations/GroupLocationBase.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<FetchLoader :status="status" skeleton only-error>
3-
<MapRecap :locations="locations" expand :editable="isEdit" @expand="opened = true">
3+
<MapRecap ref="map" :locations="locations" expand :editable="isEdit" @expand="opened = true">
44
<template #tooltip="{ location }">
55
<ProjectLocationTooltip
66
:location="location as TranslatedLocation"
@@ -14,12 +14,19 @@
1414
:locations="locations"
1515
@close="opened = false"
1616
/>
17+
<LocationList
18+
v-if="!props.preview"
19+
:editable="isEdit"
20+
:locations="locations"
21+
@focus="onFocus"
22+
/>
1723
</FetchLoader>
1824
</template>
1925

2026
<script setup lang="ts">
2127
import { getGroupLocation } from '@/api/v2/group.service'
2228
import LocationDrawer from '@/components/map/LocationDrawer.vue'
29+
import LocationList from '@/components/map/LocationList.vue'
2330
import MapRecap from '@/components/map/MapRecap.vue'
2431
import ProjectLocationTooltip from '@/components/project/map/ProjectLocationTooltip.vue'
2532
import { TranslatedPeopleGroupModel } from '@/models/invitation.model'
@@ -42,6 +49,9 @@ const opened = ref(false)
4249
const organizationCode = useOrganizationCode()
4350
const groupId = computed(() => props.group.id)
4451
52+
const mapRef = useTemplateRef('map')
53+
const onFocus = (location) => mapRef.value?.map?.flyTo(location, 8)
54+
4555
const { status, data: locations } = getGroupLocation(organizationCode, groupId, {
4656
default: () => [],
4757
})

src/components/group/Modules/Locations/GroupLocationPreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/>
1616
</template>
1717
<template #content>
18-
<GroupLocationBase :group="group" />
18+
<GroupLocationBase :group="group" preview />
1919
</template>
2020
</BaseGroupPreview>
2121
</template>

src/components/map/BaseMap.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const centerMap = () => {
122122
}
123123
124124
// this is called by other components
125-
const flyTo = (coordinates, zoom) => {
125+
const flyTo = (coordinates, zoom = undefined) => {
126126
const map = toRaw(mapInstance.value)
127127
map?.flyTo([coordinates.lat, coordinates.lng], zoom)
128128
}

src/components/map/LocationItem.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="location-list-item">
33
<div class="location-title">
4-
<LocationType :location="location" />
4+
<LocationType v-if="showLocationType" :location-type="location.type" />
55
<h4>{{ title }}</h4>
66
<p>{{ description }}</p>
77
</div>
@@ -26,17 +26,20 @@
2626

2727
<script setup lang="ts">
2828
import LocationType from '@/components/map/LocationType.vue'
29+
import { cropIfTooLong } from '@/functs/string'
2930
import { TranslatedLocation } from '@/models/location.model'
3031
3132
const props = withDefaults(
3233
defineProps<{
3334
location: TranslatedLocation
3435
editable?: boolean
3536
focus?: boolean
37+
showLocationType?: boolean
3638
}>(),
3739
{
3840
editable: false,
3941
focus: true,
42+
showLocationType: false,
4043
}
4144
)
4245
@@ -47,8 +50,10 @@ defineEmits<{
4750
}>()
4851
4952
// need to safe guard with translated title (if we are in edit/create mode)
50-
const title = computed(() => props.location.$t?.title ?? props.location.title)
51-
const description = computed(() => props.location.$t?.description ?? props.location.description)
53+
const title = computed(() => cropIfTooLong(props.location.$t?.title ?? props.location.title, 40))
54+
const description = computed(() =>
55+
cropIfTooLong(props.location.$t?.description ?? props.location.description, 80)
56+
)
5257
</script>
5358

5459
<style scoped lang="scss">

src/components/map/LocationList.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
:key="locationType"
66
class="location-list-wrapper"
77
>
8-
<h3 class="list-title">{{ $t(`location.${locationType}`) }}</h3>
8+
<h3 class="list-title">
9+
<LocationType :location-type="locationType" />
10+
</h3>
911
<ul class="location-list">
1012
<li v-for="location in locationsList" :key="location.id" class="location">
1113
<LocationItem
@@ -26,6 +28,7 @@
2628

2729
<script setup lang="ts">
2830
import LocationItem from '@/components/map/LocationItem.vue'
31+
import LocationType from '@/components/map/LocationType.vue'
2932
import { TranslatedLocation } from '@/models/location.model'
3033
import { groupBy } from 'es-toolkit'
3134

src/components/map/LocationTooltip.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="location-tooltip" :class="location.type">
33
<div class="location-tooltip-header">
4-
<LocationType :location="location" />
4+
<LocationType :location-type="location.type" />
55
<LpiButton
66
btn-icon="Close"
77
class="location-tooltip-icon"

src/components/map/LocationType.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="location-header" :class="[location.type]" :title="typeLabel">
3-
<IconImage :name="pointerIcon" :class="['location-icon', location.type]" />
2+
<div class="location-header" :class="[locationType]" :title="typeLabel">
3+
<IconImage :name="pointerIcon" :class="['location-icon', locationType]" />
44
<h2 v-if="label" class="location-title">
55
{{ typeLabel }}
66
</h2>
@@ -9,16 +9,16 @@
99

1010
<script setup lang="ts">
1111
import { IconMapLocationType } from '@/functs/maps'
12-
import { AnyLocation } from '@/models/location.model'
12+
import { LocationType } from '@/models/types'
1313
14-
const props = withDefaults(defineProps<{ location: AnyLocation; label?: boolean }>(), {
14+
const props = withDefaults(defineProps<{ locationType: LocationType; label?: boolean }>(), {
1515
label: true,
1616
})
1717
1818
const { t } = useNuxtI18n()
1919
2020
const typeLabel = computed(() => {
21-
switch (props.location.type) {
21+
switch (props.locationType) {
2222
case 'impact':
2323
return t('location.impact')
2424
case 'team':
@@ -28,7 +28,7 @@ const typeLabel = computed(() => {
2828
}
2929
})
3030
31-
const pointerIcon = computed(() => IconMapLocationType(props.location.type))
31+
const pointerIcon = computed(() => IconMapLocationType(props.locationType))
3232
</script>
3333

3434
<style lang="scss" scoped>

src/components/map/MapPointer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div ref="marker" class="map-pointer" :data-location-type="location.type">
44
<slot name="marker">
55
<div :class="['badge', location.type]">
6-
<LocationType :location="location" />
6+
<LocationType :location-type="location.type" />
77
<div v-if="editable" class="actions">
88
<ContextActionButton
99
action-icon="Pen"

src/i18n/locales/ca.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,11 @@
10061006
"help": "Editor"
10071007
}
10081008
},
1009-
"view": "Visualitza el grup"
1009+
"view": "Visualitza el grup",
1010+
"conferences": "Conferèncias",
1011+
"publications": "Publicacions",
1012+
"similars": "Grups similars",
1013+
"locations": "Ubicacions"
10101014
},
10111015
"header": {
10121016
"private": "Privat: només visible per als membres de l' equip",

0 commit comments

Comments
 (0)