Skip to content

Commit 85e9f4e

Browse files
authored
Merge pull request #272 from lahmacunradio/dev/show-page-metadata-formatting-update
Dev/show page metadata formatting update
2 parents aec1abd + 41f4173 commit 85e9f4e

2 files changed

Lines changed: 48 additions & 29 deletions

File tree

app/pages/shows/_slug/index.vue

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,42 @@
2525
<h1 class="mt-0 font-bold h2">
2626
{{ showObject.name }}
2727
</h1>
28-
<div class="show-infos">
28+
<div v-if="showObject.active" class="show-infos">
2929
<p>
30-
Airing time: {{ dayNames[showObject.day - 1] }} {{
30+
{{ dayNames[showObject.day - 1] }} {{
3131
removeSeconds(showObject.start)
32-
}}–{{ removeSeconds(showObject.end) }},
33-
{{ showFrequency(showObject.frequency, showObject.week) }}, Language: <span
34-
v-sanitize.nothing="getLanguageGraph(showObject.language)"
35-
class="language"
36-
/>
32+
}}–{{ removeSeconds(showObject.end) }}
3733
</p>
38-
<p v-if="showObject && getLatestEpisode">
39-
{{ showObject.active ? 'Show is active.' : 'Show is not active.' }}
40-
Last episode:
41-
<NuxtLink :to="{ path: `/shows/${slug}/${getLatestEpisode.name_slug}` }">
42-
<strong>{{ getLatestEpisode.name }}</strong>
43-
</NuxtLink>,
44-
{{ $moment(getLatestEpisode.play_date).fromNow() }}.
34+
<p>
35+
{{ showFrequency(showObject.frequency, showObject.week, showObject.playlist_name) }}
36+
</p>
37+
<p>
38+
Language: <span v-sanitize.nothing="getLanguageGraph(showObject.language)" class="language"/>
39+
</p>
40+
<p v-if="showObject.archive_mixcloud_base_url">
41+
Elsewhere on web:
42+
<!-- Quick fix: we (mis)use Mixcloud links (originally meant for another upload platform) as arbitrary external link. -->
43+
<!-- Note: link needs to be full path and it will be displayed! -->
44+
<a class="show-external-link" :href="showObject.archive_mixcloud_base_url" target="_blank">
45+
{{ showObject.archive_mixcloud_base_url }}
46+
</a>
47+
</p>
48+
</div>
49+
<!-- Inactive shows: currently hard-coded for more flexibility and readability -->
50+
<div v-else class="show-infos">
51+
<p>
52+
<strong>Show is not active</strong>
53+
</p>
54+
<p>
55+
Language: <span v-sanitize.nothing="getLanguageGraph(showObject.language)" class="language"/>
56+
</p>
57+
<p v-if="showObject.archive_mixcloud_base_url">
58+
Elsewhere on web:
59+
<!-- Quick fix: we (mis)use Mixcloud links (originally meant for another upload platform) as arbitrary external link. -->
60+
<!-- Note: link needs to be full path and it will be displayed! -->
61+
<a class="show-external-link" :href="showObject.archive_mixcloud_base_url" target="_blank">
62+
{{ showObject.archive_mixcloud_base_url }}
63+
</a>
4564
</p>
4665
</div>
4766
<div v-sanitize="[ sanitizeOptions, showObject.description ]" class="description-text" />
@@ -153,17 +172,7 @@ export default {
153172
const day = d.getDate().toLocaleString('en-US', { minimumIntegerDigits: 2 })
154173
return `${year}-${month}-${day}`
155174
},
156-
getLatestEpisode () {
157-
if (this.showObject?.items) {
158-
const itemsSorted = this.showObject.items
159-
.filter(show => show.play_date < this.getToday)
160-
.filter(show => show.archived === true)
161-
.sort((a, b) => b.number - a.number)
162-
.sort((a, b) => new Date(b.play_date) - new Date(a.play_date))
163-
return itemsSorted[0]
164-
}
165-
return null
166-
},
175+
167176
arcsiEpisodesList () {
168177
if (this.showObject?.items) {
169178
const itemsSorted = this.showObject.items
@@ -220,12 +229,18 @@ export default {
220229
</script>
221230
222231
<style lang="scss" scoped>
232+
233+
.show-external-link {
234+
text-decoration: underline;
235+
}
236+
223237
.show-image {
224238
min-width: 300px;
225239
max-width: 360px;
226240
}
227241
.show-infos {
228242
margin-bottom: 1rem;
243+
font-style: italic;
229244
}
230245
.language {
231246
display: inline-block;

app/plugins/mixinCommonMethods.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,20 @@ export function getLanguageGraph (type) {
104104
}
105105
}
106106

107-
export function showFrequency (frequency) {
107+
export function showFrequency (frequency, week, playlist) {
108108
let showText = 'Not defined'
109+
if (playlist === "Ritka csut" || playlist === "Ritka pentek"){
110+
showText = 'New episode occasionally'
111+
return showText
112+
}
109113
if (frequency === 1) {
110-
showText = 'New Episode: Monthly'
114+
showText = 'New episode monthly'
111115
}
112116
if (frequency === 2) {
113-
showText = 'New Episode: Every Second Week'
117+
showText = 'New episode every second week'
114118
}
115119
if (frequency >= 3) {
116-
showText = 'New Episode: Weekly'
120+
showText = 'New episode weekly'
117121
}
118122
return showText
119123
}

0 commit comments

Comments
 (0)