Add comissions location to achievement page

pull/1/head
Made Baruna 2022-07-28 13:17:03 +07:00
parent 63b0430d5d
commit f706a41a5b
15 changed files with 39 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -63,7 +63,12 @@
})); }));
let versionFilter = []; let versionFilter = [];
const types = [{ label: $t('achievement.commissions'), value: 'commissions' }]; const types = [
{ label: $t('achievement.commissions'), value: 'commissions' },
{ label: $t('fishing.mondstadt'), value: 'mondstadt' },
{ label: $t('fishing.liyue'), value: 'liyue' },
{ label: $t('fishing.inazuma'), value: 'inazuma' },
];
let typeFilter = []; let typeFilter = [];
function parseCategories() { function parseCategories() {
@ -176,7 +181,15 @@
const filterVersion = versionFilter.length > 0; const filterVersion = versionFilter.length > 0;
const filteredVersion = versionFilter.map((e) => e.value); const filteredVersion = versionFilter.map((e) => e.value);
const filterComission = typeFilter.map((e) => e.value).includes('commissions'); let filterComission = [];
for (const e of typeFilter) {
if (e.value === 'commissions') {
filterComission = ['mondstadt', 'liyue', 'inazuma'];
break;
}
filterComission.push(e.value);
}
const filterName = nameFilter !== ''; const filterName = nameFilter !== '';
const query = nameFilter.toLowerCase(); const query = nameFilter.toLowerCase();
@ -190,12 +203,12 @@
.filter((e) => { .filter((e) => {
if (Array.isArray(e)) { if (Array.isArray(e)) {
if (filterVersion && !filteredVersion.includes(e[0].ver)) return false; if (filterVersion && !filteredVersion.includes(e[0].ver)) return false;
if (filterComission && !e[0].commissions) return false; if (filterComission.length > 0 && !filterComission.includes(e[0].commissions)) return false;
if (filterName && !e[0].name.toLowerCase().includes(query)) return false; if (filterName && !e[0].name.toLowerCase().includes(query)) return false;
return true; return true;
} else { } else {
if (filterVersion && !filteredVersion.includes(e.ver)) return false; if (filterVersion && !filteredVersion.includes(e.ver)) return false;
if (filterComission && !e.commissions) return false; if (filterComission.length > 0 && !filterComission.includes(e.commissions)) return false;
if (filterName && !e.name.toLowerCase().includes(query)) return false; if (filterName && !e.name.toLowerCase().includes(query)) return false;
return true; return true;
} }
@ -428,10 +441,13 @@
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none"> <span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{it.ver} {it.ver}
</span> </span>
{#if it.commissions} {#if it.commissions !== undefined}
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none"> <span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{$t('achievement.commissions')} {$t('achievement.commissions')}
</span> </span>
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{$t(`fishing.${it.commissions}`)}
</span>
{/if} {/if}
</p> </p>
<p class="text-gray-400">{it.desc}</p> <p class="text-gray-400">{it.desc}</p>
@ -459,10 +475,13 @@
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none"> <span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{el.ver} {el.ver}
</span> </span>
{#if el.commissions} {#if el.commissions !== undefined}
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none"> <span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{$t('achievement.commissions')} {$t('achievement.commissions')}
</span> </span>
<span class="ml-1 rounded-xl bg-background px-2 text-gray-400 text-sm font-normal select-none">
{$t(`fishing.${el.commissions}`)}
</span>
{/if} {/if}
</p> </p>
<p class="text-gray-400">{el.desc}</p> <p class="text-gray-400">{el.desc}</p>

View File

@ -7,7 +7,7 @@ const IMAGE_CACHE = `cacheimg${IMAGE_CACHE_VER}`;
const IMAGE_URL = `${self.location.origin}/images/`; const IMAGE_URL = `${self.location.origin}/images/`;
const changelog = ['Update timeline', 'Adjust character detail page']; const changelog = ['Add commissions location to achievement tracker', 'Adjust character detail page'];
const channel = new BroadcastChannel('paimonmoe-sw'); const channel = new BroadcastChannel('paimonmoe-sw');