mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
fix: sorting
This commit is contained in:
parent
d20f0de099
commit
b0fb2a8717
3 changed files with 19 additions and 16 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<script context='module'>
|
||||
const badgeKeys = ['title', 'search', 'genre', 'tag', 'season', 'year', 'format', 'status', 'sort', 'hideSubs', 'hideMyAnime', 'hideStatus']
|
||||
const badgeDisplayNames = { title: BookUser, search: Type, genre: Drama, tag: Hash, season: CalendarRange, year: Leaf, format: Tv, status: MonitorPlay, sort: ArrowDownWideNarrow, hideMyAnime: SlidersHorizontal, hideSubs: Mic }
|
||||
const sortOptions = { START_DATE_DESC: 'Release Date', SCORE_DESC: 'Score', POPULARITY_DESC: 'Popularity', TRENDING_DESC: 'Trending', UPDATED_AT_DESC: 'Updated Date', UPDATED_TIME_DESC: 'Last Updated', STARTED_ON_DESC: 'Started On', FINISHED_ON_DESC: 'Finished On', PROGRESS_DESC: 'Your Progress', USER_SCORE_DESC: 'Your Score' }
|
||||
const sortOptions = { TITLE_ROMAJI: 'Title', START_DATE_DESC: 'Release Date', SCORE_DESC: 'Score', POPULARITY_DESC: 'Popularity', UPDATED_AT_DESC: 'Date Updated', UPDATED_TIME_DESC: 'Last Updated', STARTED_ON_DESC: 'Start Date', FINISHED_ON_DESC: 'Completed Date', PROGRESS_DESC: 'Your Progress', USER_SCORE_DESC: 'Your Score' }
|
||||
|
||||
export function searchCleanup (search, badge) {
|
||||
return Object.fromEntries(Object.entries(search).map((entry) => {
|
||||
|
|
@ -479,24 +479,27 @@
|
|||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light' required bind:value={search.sort} on:change={clearTags} disabled={search.disableSearch}>
|
||||
<option value selected>Name</option>
|
||||
<option value='SCORE_DESC'>Score</option>
|
||||
<option value selected>Trending</option>
|
||||
<option value='POPULARITY_DESC'>Popularity</option>
|
||||
<option value='TRENDING_DESC'>Trending</option>
|
||||
<option value='TITLE_ROMAJI'>Title</option>
|
||||
<option value='SCORE_DESC'>Score</option>
|
||||
<option value='START_DATE_DESC'>Release Date</option>
|
||||
<option value='UPDATED_AT_DESC'>Recently Updated</option>
|
||||
<option value='UPDATED_AT_DESC'>Updated Date</option>
|
||||
{#if search.userList && search.title && !search.missedList}
|
||||
<option value='UPDATED_TIME_DESC'>Last Updated</option>
|
||||
{#if !search.planningList}
|
||||
<option value='STARTED_ON_DESC'>Started On</option>
|
||||
{#if search.completedList}
|
||||
<option value='FINISHED_ON_DESC'>Completed Date</option>
|
||||
{/if}
|
||||
{#if !search.planningList}
|
||||
<option value='STARTED_ON_DESC'>Start Date</option>
|
||||
{/if}
|
||||
<option value='UPDATED_TIME_DESC'>Last Updated</option>
|
||||
{#if !search.completedList && !search.planningList}
|
||||
<option value='PROGRESS_DESC'>Your Progress</option>
|
||||
{/if}
|
||||
{#if search.completedList || search.droppedList}
|
||||
<option value='USER_SCORE_DESC'>Your Score</option>
|
||||
{/if}
|
||||
{#if search.completedList}
|
||||
<option value='FINISHED_ON_DESC'>Finished On</option>
|
||||
<option value='USER_SCORE_DESC'>Your Score</option>
|
||||
{:else if !search.planningList}
|
||||
<option value='PROGRESS_DESC'>Your Progress</option>
|
||||
{/if}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@ class AnilistClient {
|
|||
variables: {
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
sort: 'TRENDING_DESC',
|
||||
status_in: '[CURRENT,PLANNING,COMPLETED,DROPPED,PAUSED,REPEATING]',
|
||||
...variables
|
||||
}
|
||||
|
|
@ -569,7 +570,6 @@ class AnilistClient {
|
|||
|
||||
async search (variables = {}) {
|
||||
debug(`Searching ${JSON.stringify(variables)}`)
|
||||
variables.sort ||= 'SEARCH_MATCH'
|
||||
const query = /* js */`
|
||||
query($page: Int, $perPage: Int, $sort: [MediaSort], $search: String, $onList: Boolean, $status: MediaStatus, $status_not: MediaStatus, $season: MediaSeason, $year: Int, $genre: [String], $tag: [String], $format: MediaFormat, $id_not: [Int], $idMal_not: [Int], $idMal: [Int]) {
|
||||
Page(page: $page, perPage: $perPage) {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ function createSections () {
|
|||
hide: !Helper.isAuthorized()
|
||||
},
|
||||
{
|
||||
title: 'Dropped List', variables : { sort: 'UPDATED_TIME_DESC', userList: true, disableHide: true },
|
||||
title: 'Dropped List', variables : { sort: 'UPDATED_TIME_DESC', droppedList: true, userList: true, disableHide: true },
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = Helper.userLists(variables).then(res => {
|
||||
const mediaList = Helper.isAniAuth()
|
||||
|
|
|
|||
Loading…
Reference in a new issue