Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
refactor(thumb): add reason title
Browse files Browse the repository at this point in the history
  • Loading branch information
ttshivers committed Sep 28, 2020
1 parent 4e45eb7 commit e9aadef
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
35 changes: 25 additions & 10 deletions src/components/PlexThumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,30 +78,39 @@
>
<v-col
cols="12"
style="max-width: 100%;"
class="text-subtitle-2 text-truncate"
>
<div
class="text-subtitle-2 text-truncate"
>
{{ getTitle(content, fullTitle) }}
</div>
{{ getTitle(content, fullTitle) }}
</v-col>

<v-col
cols="12"
class="text-caption text-truncate text--secondary"
>
<div class="text-caption text-truncate text--secondary">
{{ getSecondaryTitle(content, fullTitle) }}
</div>
{{ getSecondaryTitle(content, fullTitle) }}
</v-col>

<v-col
v-if="content.reason"
cols="12"
class="text-caption text-truncate text--secondary"
>
{{ getReasonTitle(content) }}
</v-col>
</v-row>
</template>

<div>{{ getTitle(content, fullTitle) }}</div>

<div class="text-caption text--secondary">
{{ getSecondaryTitle(content, fullTitle) }}
</div>

<div
v-if="content.reason"
class="text-caption text--secondary"
>
{{ getSecondaryTitle(content, fullTitle) }}
{{ getReasonTitle(content) }}
</div>
</v-tooltip>
</v-card>
Expand Down Expand Up @@ -295,6 +304,12 @@ export default {
}
},
beforeDestroy() {
if (this.$el.vanillaTilt) {
this.$el.vanillaTilt.destroy();
}
},
methods: {
getImageUrl(width) {
return this.GET_MEDIA_IMAGE_URL({
Expand Down
4 changes: 3 additions & 1 deletion src/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export default {
]),
getItemSecondaryTitle(item) {
return item.reasonTitle || this.getSecondaryTitle(item);
return item.reason
? this.getReasonTitle(item)
: this.getSecondaryTitle(item);
},
getItemThumb({ type, thumb, grandparentThumb }) {
Expand Down
8 changes: 8 additions & 0 deletions src/utils/contenttitleutils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const reasonWord = {
section: 'in',
actor: 'with',
director: 'by',
};

export default {
getTitle: (metadata, fullTitle) => {
switch (metadata.type) {
Expand Down Expand Up @@ -63,4 +69,6 @@ export default {
}
}
},

getReasonTitle: ({ reason, reasonTitle }) => `${reasonWord[reason]} ${reasonTitle}`,
};

0 comments on commit e9aadef

Please sign in to comment.