Skip to content

Commit

Permalink
Add lyrics annotations (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
staniel359 committed Oct 11, 2022
1 parent 25d6c43 commit d88675f
Show file tree
Hide file tree
Showing 19 changed files with 518 additions and 14 deletions.
4 changes: 4 additions & 0 deletions shared/locales/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
"video": "Відэа",
"recommendations": "Рэкамендацыі",
"top": "Папулярнае",
"lyrics": "Тэксты песень",
"data": "Дадзеныя"
},
"profile": {
Expand Down Expand Up @@ -446,6 +447,9 @@
"top": {
"country": "Краіна па змоўчванні"
},
"lyrics": {
"annotations": "Паказваць анатацыі"
},
"data": {
"cache": {
"clear": "Ачысціць кэш",
Expand Down
4 changes: 4 additions & 0 deletions shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
"video": "Video",
"recommendations": "Recommendations",
"top": "Top",
"lyrics": "Lyrics",
"data": "Data"
},
"profile": {
Expand Down Expand Up @@ -446,6 +447,9 @@
"top": {
"country": "Default country"
},
"lyrics": {
"annotations": "Show annotations"
},
"data": {
"cache": {
"clear": "Clear cache",
Expand Down
4 changes: 4 additions & 0 deletions shared/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
"video": "Видео",
"recommendations": "Рекомендации",
"top": "Популярное",
"lyrics": "Тексты песен",
"data": "Данные"
},
"profile": {
Expand Down Expand Up @@ -446,6 +447,9 @@
"top": {
"country": "Страна по умолчанию"
},
"lyrics": {
"annotations": "Показывать аннотации"
},
"data": {
"cache": {
"clear": "Очистить кэш",
Expand Down
4 changes: 2 additions & 2 deletions src/assets/styles/Main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,9 @@ p
@extend .no-margin
margin-left: 0.25em !important

.main-artist-popup
.main-artist-popup,
.main-annotation-popup
@extend .overflow-hidden
min-height: 100px
max-width: unset !important
width: 400px
&.inverted
Expand Down
8 changes: 8 additions & 0 deletions src/components/layout/modals/TheSettingsModal/AppSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import QueueOptions from './AppSettings/QueueOptions.vue'
import VideoOptions from './AppSettings/VideoOptions.vue'
import RecommendationsOptions from './AppSettings/RecommendationsOptions.vue'
import TopOptions from './AppSettings/TopOptions.vue'
import LyricsOptions from './AppSettings/LyricsOptions.vue'
import DataOptions from './AppSettings/DataOptions.vue'
export default {
Expand All @@ -52,6 +53,7 @@ export default {
VideoOptions,
RecommendationsOptions,
TopOptions,
LyricsOptions,
DataOptions
},
data () {
Expand Down Expand Up @@ -133,6 +135,12 @@ export default {
component: 'TopOptions',
isAnonymous: true
},
{
nameCode: 'settings.sections.app.lyrics',
scope: 'lyrics',
component: 'LyricsOptions',
isAnonymous: true
},
{
nameCode:
'settings.sections.app.data',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="main-settings-options-block">
<AnnotationsOption />
</div>
</template>

<script>
import AnnotationsOption from './LyricsOptions/AnnotationsOption.vue'
export default {
name: 'LyricsOptions',
components: {
AnnotationsOption
}
}
</script>

<style lang="sass" scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<div class="option">
<BaseHeader
class="option-header"
tag="h4"
:text="annotationsText"
/>

<BaseToggle
store-key="lyrics.isWithAnnotations"
:is-checked="isLyricsWithAnnotations"
/>
</div>
</template>

<script>
import {
mapState
} from 'vuex'
import BaseHeader from '@/components/BaseHeader.vue'
import BaseToggle from '@/components/toggles/BaseToggle.vue'
export default {
name: 'AnnotationsOption',
components: {
BaseHeader,
BaseToggle
},
computed: {
...mapState(
'lyrics',
{
isLyricsWithAnnotations: 'isWithAnnotations'
}
),
annotationsText () {
return this.$t(
'settings.options.app.lyrics.annotations'
)
}
}
}
</script>

<style lang="sass" scoped></style>
13 changes: 6 additions & 7 deletions src/components/modals/track/BaseTrackLyricsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
:request-track-data="requestTrackData"
>
<template #default="slotProps">
<div class="main-lyrics-container">
<p
class="lyrics"
v-text="slotProps[scope]"
/>
</div>
<ContentSection
:lyrics="slotProps[scope]"
/>
</template>
</BaseTrackModalContainer>
</template>

<script>
import BaseTrackModalContainer
from '@/components/containers/modals/track/BaseTrackModalContainer.vue'
import ContentSection from './BaseTrackLyricsModal/ContentSection.vue'
export default {
name: 'BaseTrackLyricsModal',
components: {
BaseTrackModalContainer
BaseTrackModalContainer,
ContentSection
},
props: {
trackId: Number
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="main-lyrics-container">
<p class="lyrics">
<LyricItem
v-for="(lyricData, index) in lyrics"
:key="index"
:lyric-data="lyricData"
/>
</p>
</div>
</template>

<script>
import LyricItem from './ContentSection/LyricItem.vue'
export default {
name: 'ContentSection',
components: {
LyricItem
},
props: {
lyrics: {
type: Array,
default () {
return []
}
}
}
}
</script>

<style lang="sass" scoped></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<LyricAnnotationItem
v-if="annotationId"
:lyric-data="lyricData"
/>
<span
v-else
v-text="lyricData"
/>
</template>

<script>
import LyricAnnotationItem from './LyricItem/LyricAnnotationItem.vue'
export default {
name: 'LyricItem',
components: {
LyricAnnotationItem
},
props: {
lyricData: {
type: [
String,
Object
],
required: true
}
},
computed: {
annotationId () {
return this.lyricData.annotation_id
}
}
}
</script>

<style lang="sass" scoped></style>
Loading

0 comments on commit d88675f

Please sign in to comment.