mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-12 11:10:29 +00:00
feat: airing schedule leftovers #431
This commit is contained in:
parent
f61874e665
commit
67ce45c437
2 changed files with 11 additions and 2 deletions
|
|
@ -100,7 +100,7 @@
|
|||
<div class='d-flex'>
|
||||
{#each mediaList as media}
|
||||
{@const active = current === media}
|
||||
<div class='pt-10 badge-wrapper' class:pointer={!active} use:click={() => setCurrent(media)}>
|
||||
<div class='pt-10 pb-5 badge-wrapper' class:pointer={!active} use:click={() => setCurrent(media)}>
|
||||
<div class='rounded bg-dark-light mr-10 progress-badge overflow-hidden' class:active style='height: 3px;' style:width={active ? '5rem' : '2.7rem'}>
|
||||
<div class='progress-content h-full' class:bg-white={active} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,20 @@
|
|||
async function fetchAllScheduleEntries (_variables) {
|
||||
const variables = { ..._variables }
|
||||
const results = { data: { Page: { media: [], pageInfo: { hasNextPage: false } } } }
|
||||
const opts = { ...vars, ...SectionsManager.sanitiseObject(variables) }
|
||||
for (let page = 1, hasNextPage = true; hasNextPage && page < 5; ++page) {
|
||||
const res = await anilistClient.search({ page, perPage: 50, ...vars, ...SectionsManager.sanitiseObject(variables) })
|
||||
const res = await anilistClient.search({ ...opts, page, perPage: 50 })
|
||||
hasNextPage = res.data.Page.pageInfo.hasNextPage
|
||||
results.data.Page.media = results.data.Page.media.concat(res.data.Page.media)
|
||||
}
|
||||
|
||||
const seasons = ['WINTER', 'SPRING', 'SUMMER', 'FALL']
|
||||
const season = seasons[(seasons.indexOf(vars.season) + 3) % 4]
|
||||
const year = vars.season === 'WINTER' ? vars.year - 1 : vars.year
|
||||
|
||||
const res = await anilistClient.search({ format: 'TV', ...SectionsManager.sanitiseObject(variables), year, season, status: 'RELEASING', page: 1, perPage: 50 })
|
||||
results.data.Page.media = results.data.Page.media.concat(res.data.Page.media)
|
||||
|
||||
results.data.Page.media.sort((a, b) => a.airingSchedule?.nodes?.[0]?.airingAt - b.airingSchedule?.nodes?.[0]?.airingAt)
|
||||
|
||||
return results
|
||||
|
|
|
|||
Loading…
Reference in a new issue