-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from esamarathon/feat/omnibar-current-track
Add music track to omnibar options
- Loading branch information
Showing
8 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ | |
"UpcomingRun", | ||
"Prize", | ||
"Bid", | ||
"Milestone" | ||
"Milestone", | ||
"MusicTrack" | ||
] | ||
}, | ||
"alerts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/dashboard/omnibar-ticker-control/components/MusicTrack.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<v-card class="pa-2"> | ||
<speed-dial :id="id" /> | ||
<div> | ||
<span class="font-weight-bold">Type:</span> | ||
Current song | ||
</div> | ||
<div> | ||
<span class="font-weight-bold">Length:</span> | ||
{{ seconds }} seconds | ||
</div> | ||
</v-card> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Vue, Component, Prop } from 'vue-property-decorator'; | ||
import SpeedDial from './SpeedDial.vue'; | ||
@Component({ | ||
name: 'UpcomingRun', | ||
components: { | ||
SpeedDial, | ||
}, | ||
}) | ||
export default class extends Vue { | ||
@Prop({ type: String, required: true }) readonly id!: string; | ||
@Prop({ type: Number, default: 25 }) readonly seconds!: number; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<template> | ||
<div | ||
class="Flex" | ||
:style="{ | ||
'font-size': '33px', | ||
'white-space': 'nowrap', | ||
'font-weight': 500, | ||
'text-align': 'center', | ||
'line-height': '100%', | ||
}" | ||
> | ||
<span>🎵 {{ trackInformation }}</span> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { replicantNS } from '@esa-layouts/browser_shared/replicant_store'; | ||
import { wait } from '@esa-layouts/graphics/_misc/helpers'; | ||
import { Vue, Component, Prop } from 'vue-property-decorator'; | ||
import { MusicData } from '@esa-layouts/types/schemas'; | ||
@Component({ | ||
name: 'MusicTrack', | ||
}) | ||
export default class extends Vue { | ||
@replicantNS.State((s) => s.reps.musicData) readonly musicData!: MusicData; | ||
@Prop({ type: Number, default: 25 }) readonly seconds!: number; | ||
get trackInformation(): string | undefined { | ||
const info = [ | ||
this.musicData?.track?.title, | ||
this.musicData?.track?.artist, | ||
].filter(Boolean); | ||
return info.length ? info.join(' - ') : undefined; | ||
} | ||
async created(): Promise<void> { | ||
// Skip display if no track is playing | ||
if (!this.trackInformation) { | ||
this.$emit('end'); | ||
return; | ||
} | ||
await wait(this.seconds * 1000); // Wait the specified length. | ||
this.$emit('end'); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters