fix: add details to media panel when image is used in author or site
This commit is contained in:
1 parent
63c0aec444
commit
fda2793888
3 files changed
+52
No files matched your search
@@ -20,8 +20,15 @@ export interface UsageEntry {
|
||||
title: string
|
||||
}
|
||||
|
||||
export interface UsageOther {
|
||||
type: 'author' | 'site'
|
||||
id: number
|
||||
title: string
|
||||
}
|
||||
|
||||
export interface UsageSplit {
|
||||
articles: UsageArticle[]
|
||||
others: UsageOther[]
|
||||
entries: UsageEntry[]
|
||||
entryCount: number
|
||||
more: number
|
||||
@@ -74,8 +81,16 @@ export function splitUsage(items: MediaUsageItem[]): UsageSplit {
|
||||
published: item.published === true,
|
||||
}))
|
||||
const entryItems = items.filter((item) => item.type === ENTRY_TYPE)
|
||||
const others = items
|
||||
.filter((item) => item.type === 'author' || item.type === 'site')
|
||||
.map((item) => ({
|
||||
type: item.type as UsageOther['type'],
|
||||
id: item.id,
|
||||
title: item.title ?? '',
|
||||
}))
|
||||
return {
|
||||
articles,
|
||||
others,
|
||||
entries: entryItems.slice(0, ENTRY_ROWS_SHOWN).map(toEntry),
|
||||
entryCount: entryItems.length,
|
||||
more: Math.max(0, entryItems.length - ENTRY_ROWS_SHOWN),
|
||||
|
||||
Reference in new issue
Block a user