mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 00:22:08 +00:00
fix: studios property
This commit is contained in:
parent
9a8deb0786
commit
9ef524da6e
4 changed files with 27 additions and 7 deletions
5
common/modules/al.d.ts
vendored
5
common/modules/al.d.ts
vendored
|
|
@ -67,6 +67,11 @@ export type Media = {
|
||||||
day: number
|
day: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
studios?: {
|
||||||
|
nodes: {
|
||||||
|
name: string
|
||||||
|
}[]
|
||||||
|
}
|
||||||
airingSchedule?: {
|
airingSchedule?: {
|
||||||
nodes?: {
|
nodes?: {
|
||||||
episode: number
|
episode: number
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,11 @@ countryOfOrigin,
|
||||||
isAdult,
|
isAdult,
|
||||||
bannerImage,
|
bannerImage,
|
||||||
synonyms,
|
synonyms,
|
||||||
|
studios(sort: NAME, isMain: true) {
|
||||||
|
nodes {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
},
|
||||||
stats {
|
stats {
|
||||||
scoreDistribution {
|
scoreDistribution {
|
||||||
score,
|
score,
|
||||||
|
|
@ -609,6 +614,11 @@ class AnilistClient {
|
||||||
Media(id: $id, type: ANIME) {
|
Media(id: $id, type: ANIME) {
|
||||||
id,
|
id,
|
||||||
idMal,
|
idMal,
|
||||||
|
studios(sort: NAME, isMain: true) {
|
||||||
|
nodes {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
},
|
||||||
recommendations {
|
recommendations {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
export let media = null
|
export let media = null
|
||||||
|
export let alt = null
|
||||||
|
|
||||||
const detailsMap = [
|
const detailsMap = [
|
||||||
{ property: 'season', label: 'Season', icon: 'spa', custom: 'property' },
|
{ property: 'season', label: 'Season', icon: 'spa', custom: 'property' },
|
||||||
{ property: 'status', label: 'Status', icon: 'live_tv' },
|
{ property: 'status', label: 'Status', icon: 'live_tv' },
|
||||||
{ property: 'nodes', label: 'Studio', icon: 'business' },
|
{ property: 'studios', label: 'Studio', icon: 'business', custom: 'property' },
|
||||||
{ property: 'source', label: 'Source', icon: 'source' },
|
{ property: 'source', label: 'Source', icon: 'source' },
|
||||||
{ property: 'countryOfOrigin', label: 'Country', icon: 'public', custom: 'property' },
|
{ property: 'countryOfOrigin', label: 'Country', icon: 'public', custom: 'property' },
|
||||||
{ property: 'isAdult', label: 'Adult', icon: '18_up_rating' },
|
{ property: 'isAdult', label: 'Adult', icon: '18_up_rating' },
|
||||||
|
|
@ -12,7 +13,7 @@
|
||||||
{ property: 'romaji', label: 'Romaji', icon: 'translate' },
|
{ property: 'romaji', label: 'Romaji', icon: 'translate' },
|
||||||
{ property: 'native', label: 'Native', icon: '語', custom: 'icon' }
|
{ property: 'native', label: 'Native', icon: '語', custom: 'icon' }
|
||||||
]
|
]
|
||||||
function getCustomProperty (detail, media) {
|
async function getCustomProperty (detail, media) {
|
||||||
if (detail.property === 'averageScore') {
|
if (detail.property === 'averageScore') {
|
||||||
return media.averageScore + '%'
|
return media.averageScore + '%'
|
||||||
} else if (detail.property === 'season') {
|
} else if (detail.property === 'season') {
|
||||||
|
|
@ -24,6 +25,8 @@
|
||||||
US: 'United States'
|
US: 'United States'
|
||||||
}
|
}
|
||||||
return countryMap[media.countryOfOrigin] || 'Unknown'
|
return countryMap[media.countryOfOrigin] || 'Unknown'
|
||||||
|
} else if (detail.property === 'studios') { // has to be manually fetched as studios returned by user lists are broken.
|
||||||
|
return ((await alt)?.data?.Media || media)?.studios?.nodes?.map(node => node.name).filter(name => name).join(', ') || 'Unknown'
|
||||||
} else {
|
} else {
|
||||||
return media[detail.property]
|
return media[detail.property]
|
||||||
}
|
}
|
||||||
|
|
@ -51,9 +54,11 @@
|
||||||
<div class='d-flex flex-column justify-content-center text-nowrap'>
|
<div class='d-flex flex-column justify-content-center text-nowrap'>
|
||||||
<div class='font-weight-bold select-all'>
|
<div class='font-weight-bold select-all'>
|
||||||
{#if detail.custom === 'property'}
|
{#if detail.custom === 'property'}
|
||||||
{getCustomProperty(detail, media)}
|
{#await getCustomProperty(detail, media)}
|
||||||
{:else if property.constructor === Array}
|
Fetching...
|
||||||
{property === 'nodes' ? property[0] && property[0].name : property.join(', ').replace(/_/g, ' ').toLowerCase()}
|
{:then res }
|
||||||
|
{res}
|
||||||
|
{/await}
|
||||||
{:else}
|
{:else}
|
||||||
{property.toString().replace(/_/g, ' ').toLowerCase()}
|
{property.toString().replace(/_/g, ' ').toLowerCase()}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
let modal
|
let modal
|
||||||
let container = null
|
let container = null
|
||||||
let mediaList = []
|
let mediaList = []
|
||||||
$: media = $view
|
$: media = anilistClient.mediaCache[$view?.id] || $view
|
||||||
$: mediaRecommendation = media && anilistClient.recommendations({ id: media.id })
|
$: mediaRecommendation = media && anilistClient.recommendations({ id: media.id })
|
||||||
$: media && (modal?.focus(), overlay = 'viewanime', saveMedia(), (container && container.dispatchEvent(new Event('scrolltop'))))
|
$: media && (modal?.focus(), overlay = 'viewanime', saveMedia(), (container && container.dispatchEvent(new Event('scrolltop'))))
|
||||||
function checkClose ({ keyCode }) {
|
function checkClose ({ keyCode }) {
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Details {media} />
|
<Details {media} alt={mediaRecommendation} />
|
||||||
<div class='m-0 px-20 pb-0 pt-10 d-flex flex-row text-nowrap overflow-x-scroll text-capitalize align-items-start'>
|
<div class='m-0 px-20 pb-0 pt-10 d-flex flex-row text-nowrap overflow-x-scroll text-capitalize align-items-start'>
|
||||||
{#each media.tags as tag}
|
{#each media.tags as tag}
|
||||||
<div class='bg-dark px-20 py-10 mr-10 rounded text-nowrap'>
|
<div class='bg-dark px-20 py-10 mr-10 rounded text-nowrap'>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue