Skip to content
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For detailed explanation on how things work, check out [Nuxt.js docs](https://nu

## Dev env
#### Node
Node version `=14.18.2`
Node version `=14.21.3`

Node Version Manager (.nvmrc) has 14.18.2 as recommended, run `nvm install` and `nvm use` in `app` folder

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valóban, itt el lett felejtve frissíteni a readme-t az .nvmrc aktuális állapotáról, köszi! viszont akkor ebben a sorban is frissíteni kellene

#### Yarn
Expand Down
56 changes: 28 additions & 28 deletions app/components/AutoCompleteSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<li
v-for="(suggestion, i) in suggestions"
:key="suggestionAttribute ? suggestion.id : suggestion + i"
:ref="i === itemCounter ? `focusItem` : null"
:ref="i === showCounter ? `focusShow` : null"
class="suggestion"
:class="{ 'is-active': i === itemCounter }"
:class="{ 'is-active': i === showCounter }"
@click="onClick(suggestion)"
>
{{ suggestionAttribute ? suggestion[suggestionAttribute] : suggestion }}
Expand All @@ -34,7 +34,7 @@ export default {
event: 'change'
},
props: {
defaultItems: {
defaultShows: {
required: true,
type: Array
},
Expand All @@ -55,7 +55,7 @@ export default {
data () {
return {
value: '',
itemCounter: -1,
showCounter: -1,
isOpen: false,
suggestions: []
}
Expand All @@ -68,73 +68,73 @@ export default {
this.suggestions = []
},
updated () {
if (this.$refs.focusItem) {
if (this.$refs.focusItem.length) {
this.$refs.focusItem[0].scrollIntoView({ behavior: 'smooth', block: 'end' })
if (this.$refs.focusShow) {
if (this.$refs.focusShow.length) {
this.$refs.focusShow[0].scrollIntoView({ behavior: 'smooth', block: 'end' })
}
}
},
methods: {
withAttribute (item) {
withAttribute (show) {
return (
this.searchFields.some(field => (
item[field].toLowerCase().includes(this.value.toLowerCase()))
show[field].toLowerCase().includes(this.value.toLowerCase()))
)
)
},
withoutAttribute (item) {
return item.toLowerCase().includes(this.value.toLowerCase())
withoutAttribute (show) {
return show.toLowerCase().includes(this.value.toLowerCase())
},
getSuggestions () {
this.suggestions = this.defaultItems.filter(item => (
this.suggestions = this.defaultShows.filter(show => (
this.suggestionAttribute
? this.withAttribute(item)
: this.withoutAttribute(item)
? this.withAttribute(show)
: this.withoutAttribute(show)
))
},
emitResult (result) {
this.isOpen = false
this.$emit('update', result)
},
onClick (item) {
this.value = this.suggestionAttribute ? item[this.suggestionAttribute] : item
this.emitResult([item])
onClick (show) {
this.value = this.suggestionAttribute ? show[this.suggestionAttribute] : show
this.emitResult([show])
},
onEnter () {
if (this.itemCounter >= 0) {
if (this.showCounter >= 0) {
this.value =
this.suggestionAttribute
? this.suggestions[this.itemCounter][this.suggestionAttribute]
? this.suggestions[this.showCounter][this.suggestionAttribute]
: this.suggestions
}
this.emitResult(this.itemCounter >= 0
? [this.suggestions[this.itemCounter]]
this.emitResult(this.showCounter >= 0
? [this.suggestions[this.showCounter]]
: this.suggestions)
},
onChange () {
this.getSuggestions()
this.isOpen = Boolean(this.value) && this.suggestions.length > 0
this.itemCounter = -1
this.showCounter = -1
},
listChange () {
this.getSuggestions()
this.isOpen = Boolean(this.value) && this.suggestions.length > 0
this.itemCounter = -1
this.showCounter = -1

if (this.itemCounter >= 0) {
if (this.showCounter >= 0) {
this.value =
this.suggestionAttribute
? this.suggestions[this.itemCounter][this.suggestionAttribute]
? this.suggestions[this.showCounter][this.suggestionAttribute]
: this.suggestions
}
this.emitResult(this.itemCounter >= 0
? [this.suggestions[this.itemCounter]]
this.emitResult(this.showCounter >= 0
? [this.suggestions[this.showCounter]]
: this.suggestions)
},
handleClickOutside (event) {
if (!this.$el.contains(event.target)) {
this.isOpen = false
this.itemCounter = -1
this.showCounter = -1
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/components/BottomArcsiPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { mediaServerURL } from '~/constants'

export default {
validate ({ params, store }) {
// Check if arcsiShows exists
return store.state.arcsiShows.length
// Check if arcsiShowsForTiles exists
return store.state.arcsiShowsForTiles.length
},
data () {
return {
Expand Down
31 changes: 23 additions & 8 deletions app/components/HeaderBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ export default {

const minutes = today.getMinutes()

// refresh arcsiShows every 10 minutes
// refresh arcsiShowsForTiles every 10 minutes
if (minutes % 10 === 0) {
this.refreshAllShows()
this.refreshArcsiShowsForTiles()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about tiles: Is it only going to change when we add new shows or also whenever a new episode is published?

Anyway I think schedule 10 min is okay but hopefully we can be more relaxed about shows tiles after this split, what do you think?

}

// refresh arcsiShowsForSchedule every 10 minutes
if (minutes % 10 === 0) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a két if (minutes % 10 === 0) ugyanaz, össze lehet vonni és egy blokkon belül menjen a két call?

this.refreshArcsiShowsForSchedule()
}

// refresh rareShows every 3 minutes
Expand All @@ -68,14 +73,24 @@ export default {
this.refreshCustomSchedule()
}
},
async refreshAllShows () {
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items', config)
async refreshArcsiShowsForTiles () {
await this.$axios.get(`${arcsiShowsBaseURL}/all_tiles`, config)
.then((res) => {
this.$store.commit('refreshArcsiShowsForTiles', res.data)
})
.catch((e) => {
this.$sentry.captureException(e)
this.error({ statusCode: 404, message: 'Arcsi Shows Tiles endpoint not found' })
})
},
async refreshArcsiShowsForSchedule () {
await this.$axios.get(`${arcsiShowsBaseURL}/all_schedule`, config)
.then((res) => {
this.$store.commit('refreshAllShowsList', res.data)
this.$store.commit('refreshArcsiShowsForSchedule', res.data)
})
.catch((e) => {
this.$sentry.captureException(e)
this.error({ statusCode: 404, message: 'All shows endpoint not found' })
this.error({ statusCode: 404, message: 'Arcsi Shows Schedule endpoint not found' })
})
},
async refreshRareShows () {
Expand All @@ -85,7 +100,7 @@ export default {
})
.catch((e) => {
this.$sentry.captureException(e)
this.error({ statusCode: 404, message: 'Rare Shows not found' })
this.error({ statusCode: 404, message: 'CMS Rare Shows not found' })
})
},
async refreshCustomSchedule () {
Expand All @@ -95,7 +110,7 @@ export default {
})
.catch((e) => {
this.$sentry.captureException(e)
this.error({ statusCode: 404, message: 'Custom schedule not found' })
this.error({ statusCode: 404, message: 'CMS Custom schedule not found' })
})
}

Expand Down
Loading