Fix channel avatar in select component
This commit is contained in:
parent
42d73f1c57
commit
77f811ced1
|
@ -1,6 +1,7 @@
|
||||||
import { minBy } from 'lodash-es'
|
import { minBy } from 'lodash-es'
|
||||||
import { first, map } from 'rxjs/operators'
|
import { first, map } from 'rxjs/operators'
|
||||||
import { SelectChannelItem } from 'src/types/select-options-item.model'
|
import { SelectChannelItem } from 'src/types/select-options-item.model'
|
||||||
|
import { VideoChannel } from '@shared/models'
|
||||||
import { AuthService } from '../../core/auth'
|
import { AuthService } from '../../core/auth'
|
||||||
|
|
||||||
function listUserChannelsForSelect (authService: AuthService) {
|
function listUserChannelsForSelect (authService: AuthService) {
|
||||||
|
@ -24,7 +25,7 @@ function listUserChannelsForSelect (authService: AuthService) {
|
||||||
id: c.id,
|
id: c.id,
|
||||||
label: c.displayName,
|
label: c.displayName,
|
||||||
support: c.support,
|
support: c.support,
|
||||||
avatarPath: minBy(c.avatars, 'width')?.[0]?.path
|
avatarPath: getAvatarPath(c)
|
||||||
}) as SelectChannelItem)
|
}) as SelectChannelItem)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -33,3 +34,11 @@ function listUserChannelsForSelect (authService: AuthService) {
|
||||||
export {
|
export {
|
||||||
listUserChannelsForSelect
|
listUserChannelsForSelect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getAvatarPath (c: VideoChannel) {
|
||||||
|
if (!c.avatars || c.avatars.length === 0) return undefined
|
||||||
|
|
||||||
|
return minBy(c.avatars, 'width').path
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue