Skip to content

Commit 07db736

Browse files
committed
feat(components/magazine): enhance magazine display with DOI and permalink
- Updated MagazineList component to include DOI display for magazines, linking to the DOI URL when available. - Refactored magazine incident name to be a clickable permalink for better navigation. - Adjusted data model to standardize timeframe properties and include DOI as a nullable field. - Improved formatting for magazine timeframe display.
1 parent 560ae2c commit 07db736

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

src/components/magazine/MagazineList.vue

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@
4545
Volume {{ latestMagazine.volume }}. Issue
4646
{{ latestMagazine.issue }}.
4747
</div>
48-
<div class="text-xl text-gray-600 mb-1 uppercase">
48+
<router-link
49+
:to="generatePermalink(latestMagazine)"
50+
class="text-xl text-gray-600 mb-1 uppercase hover:text-primary-dark block"
51+
>
4952
{{ latestMagazine.incident_name }}
50-
</div>
53+
</router-link>
5154
<div class="text-base mb-1 uppercase">
5255
{{ latestMagazine.subtitle }}
5356
</div>
@@ -56,6 +59,16 @@
5659
{{ formatDate(latestMagazine.timeframe_start) }} -
5760
{{ formatDate(latestMagazine.timeframe_end) }}
5861
</div>
62+
<div v-if="latestMagazine.doi" class="text-sm text-gray-600 mb-1">
63+
doi:
64+
<a
65+
:href="`https://doi.org/${latestMagazine.doi}`"
66+
target="_blank"
67+
class="text-blue-700 hover:underline"
68+
>
69+
{{ latestMagazine.doi }}
70+
</a>
71+
</div>
5972
<div class="mt-4 flex gap-2">
6073
<a
6174
v-if="latestPrimaryEdition?.file_details?.general_file_url"
@@ -125,15 +138,28 @@
125138
<div class="text-sm mb-1">
126139
Volume {{ magazine.volume }}. Issue {{ magazine.issue }}.
127140
</div>
128-
<div class="text-lg text-gray-600 mb-1 uppercase">
141+
<router-link
142+
:to="generatePermalink(magazine)"
143+
class="text-lg text-gray-600 mb-1 uppercase hover:text-primary-dark block"
144+
>
129145
{{ magazine.incident_name }}
130-
</div>
146+
</router-link>
131147
<div class="text-base mb-1 uppercase">
132148
{{ magazine.subtitle }}
133149
</div>
134150
<div class="text-sm text-gray-600 mb-1 uppercase">
135-
{{ formatDate(magazine.timeframeStart) }} -
136-
{{ formatDate(magazine.timeframeEnd) }}
151+
{{ formatDate(magazine.timeframe_start) }} -
152+
{{ formatDate(magazine.timeframe_end) }}
153+
</div>
154+
<div v-if="magazine.doi" class="text-sm text-gray-600 mb-1">
155+
doi:
156+
<a
157+
:href="`https://doi.org/${magazine.doi}`"
158+
target="_blank"
159+
class="text-blue-700 hover:underline"
160+
>
161+
{{ magazine.doi }}
162+
</a>
137163
</div>
138164
<div class="mt-2 flex gap-2">
139165
<a
@@ -242,8 +268,9 @@ interface Magazine {
242268
volume: number;
243269
issue: number;
244270
publish_at: string;
245-
timeframeStart: string;
246-
timeframeEnd: string;
271+
timeframe_start: string;
272+
timeframe_end: string;
273+
doi: string | null;
247274
editions: MagazineEdition[];
248275
}
249276
@@ -289,6 +316,12 @@ function parsePermalink(permalink: string) {
289316
};
290317
}
291318
319+
// Generate permalink for a magazine
320+
function generatePermalink(magazine: Magazine): string {
321+
const incidentIds = magazine.incident_ids.join('_');
322+
return `/magazine?s=${incidentIds}.${magazine.volume}.${magazine.issue}`;
323+
}
324+
292325
async function fetchMagazines(page = 1): Promise<void> {
293326
loading.value = true;
294327

0 commit comments

Comments
 (0)