Couple fixes

This commit is contained in:
wvffle 2022-08-08 14:54:41 +00:00 committed by Georg Krause
parent 0b263dce71
commit 7eca32e006
5 changed files with 17 additions and 12 deletions

View File

@ -86,10 +86,6 @@ const labels = computed(() => ({
addArtistContentFilter: $pgettext('Sidebar/Player/Icon.Tooltip/Verb', 'Hide content from this artist…')
}))
const setCurrentTime = (time: number) => {
currentTime.value = time
}
const switchTab = () => {
store.commit('ui/queueFocused', store.state.ui.queueFocused === 'player' ? 'queue' : 'player')
}
@ -295,7 +291,7 @@ const { width: screenWidth } = useWindowSize()
<template v-if="!isLoadingAudio">
<span
class="start"
@click.stop.prevent="setCurrentTime(0)"
@click.stop.prevent="currentTime = 0"
>
{{ currentTimeFormatted }}
</span>

View File

@ -1,4 +1,5 @@
<script setup lang="ts">
import type { ConfigField } from '~/composables/moderation/useEditConfigs'
import type { Review, ReviewState, ReviewStatePayload } from '~/types'
import type { Change } from 'diff'
@ -93,14 +94,21 @@ const updatedFields = computed(() => {
newRepr: getValueRepr(payload[id]) ?? '',
old: undefined,
oldRepr: '',
diff: [] as Change[]
diff: []
} as {
id: string
config: ConfigField
old?: ReviewStatePayload
new: ReviewStatePayload
oldRepr: string
newRepr: string
diff: Change[]
}
if (state?.[id]) {
const oldState = state[id]
console.log(oldState)
result.old = oldState
result.oldRepr = getValueRepr(typeof oldState === 'string' ? oldState : oldState?.value) ?? ''
result.oldRepr = getValueRepr(('value' in oldState && oldState.value) ?? oldState) ?? ''
// we compute the diffs between the old and new values
result.diff = diffWordsWithSpace(result.oldRepr, result.newRepr)

View File

@ -2,7 +2,7 @@ import type { Album, Artist, Content, Track } from '~/types'
import { gettext } from '~/init/locale'
interface ConfigField {
export interface ConfigField {
id: string
label: string
type: 'content' | 'attachment' | 'tags' | 'text' | 'license'

View File

@ -126,6 +126,7 @@ const store: Module<State, RootState> = {
async resumePlayback ({ commit, state, dispatch }) {
commit('playing', true)
if (state.errored && state.errorCount < state.maxConsecutiveErrors) {
// TODO (wvffle): Cancel whenever we skip track
await new Promise(resolve => setTimeout(resolve, 3000))
if (state.playing) {
return dispatch('queue/next', null, { root: true })
@ -177,8 +178,8 @@ const store: Module<State, RootState> = {
}, 3000)
}
},
updateProgress ({ commit }, t) {
commit('currentTime', t)
updateProgress ({ commit }, time: number) {
commit('currentTime', time)
},
mute ({ commit, state }) {
commit('tempVolume', state.volume)

View File

@ -400,7 +400,7 @@ export interface ReportTarget {
type: EntityObjectType
}
export type ReviewStatePayload = Partial<Artist> | Partial<Album> | Partial<Track>
export type ReviewStatePayload = { value: unknown } | Partial<Artist> | Partial<Album> | Partial<Track>
export interface ReviewState {
[id: string]: ReviewStatePayload
}