Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
feat: MapReportListMarker changeReport
Browse files Browse the repository at this point in the history
  • Loading branch information
yayacat committed Feb 6, 2024
1 parent c0eac87 commit 74d24cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const changeReport = async (report: PartialReport) => {
<template lang="pug">
NavigationBar(:current-view="currentView", :change-view="changeView")
TimeDisplay(:timestamp="rts.value.time")
MapView(:current-view="currentView", :reports="reports", :active-report="activeReport", :stations="stations", :rts="rts", :eew="eew", :current-eew-index="currentEewIndex")
MapView(:current-view="currentView", :reports="reports", :active-report="activeReport", :stations="stations", :rts="rts", :eew="eew", :current-eew-index="currentEewIndex", :change-report="changeReport")
InfoBox(:current-view="currentView", :eew="eew", :current-eew-index="currentEewIndex.value")
ReportBox(:current-view="currentView", :report="activeReport", :handle-hide-report-box="handleHideReportBox")
ReportListBox(:current-view="currentView", :reports="reports", :change-report="changeReport")
Expand Down
3 changes: 2 additions & 1 deletion src/components/component/MapReportListMarker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TaiwanBounds } from "../../scripts/helper/constant";
const props = defineProps<{
map: maplibregl.Map;
reports: PartialReport[];
changeReport(report: PartialReport): void;
}>();
const markers: maplibregl.Marker[] = [];
Expand Down Expand Up @@ -42,5 +43,5 @@ onUnmounted(() => {

<template lang="pug">
template(v-for="(report, i) in reports" :key="report.id")
CrossMarker.report-list-marker(:ref="(el) => reportMarkerTemplate[report.id] = el", :int="report.int", :size="4 + 4 * report.mag", :z-index="props.reports.length - i")
CrossMarker.report-list-marker(:ref="(el) => reportMarkerTemplate[report.id] = el", :int="report.int", :size="4 + 4 * report.mag", :z-index="props.reports.length - i", @click="changeReport(report)")
</template>
3 changes: 2 additions & 1 deletion src/components/view/MapView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ defineProps<{
rts: Ref<Rts>;
eew: Record<string, EewEvent>;
currentEewIndex: Ref<string>;
changeReport(report: PartialReport): void;
}>();
const map = shallowRef<maplibregl.Map | null>(null);
Expand Down Expand Up @@ -250,7 +251,7 @@ onUnmounted(() => {
.home(v-if="!Object.keys(eew).length && currentView == 'home'")
MapHomeViewControl(:map="map")
.report-list(v-if="currentView == 'report-list'")
MapReportListMarker(:map="map", :reports="reports")
MapReportListMarker(:map="map", :reports="reports", :change-report="changeReport")
.active-report(v-if="activeReport && currentView == 'report'")
MapReportMarker(:map="map", :report="activeReport")
.rts(v-if="stations && currentView == 'home'")
Expand Down

0 comments on commit 74d24cc

Please sign in to comment.