Skip to content

Commit

Permalink
Merge branch 'main' into l10n_main
Browse files Browse the repository at this point in the history
  • Loading branch information
maalni authored Jun 6, 2024
2 parents 614e7d2 + 91b14cf commit 6e0a5d6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
3 changes: 3 additions & 0 deletions src/lib/types/keys/CharacterKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const characterKeyList = [
'Chevreuse',
'Chiori',
'Chongyun',
'Clorinde',
'Collei',
'Cyno',
'Dehya',
Expand Down Expand Up @@ -58,8 +59,10 @@ export const characterKeyList = [
'Rosaria', // Rosaria
'SangonomiyaKokomi', // Sangonomiya Kokomi
'Sayu', // Sayu
'Sethos',
'Shenhe', // Shenhe
'ShikanoinHeizou', // Shikanoin Heizou
'Sigewinne',
'Sucrose', // Sucrose
'Tartaglia', // Tartaglia
'Thoma', // Thoma
Expand Down
3 changes: 3 additions & 0 deletions src/lib/types/keys/WeaponKey.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const weaponKeyList = [
'Unknown3Star',
'Absolution',
'AThousandFloatingDreams',
'Akuoumaru',
'AlleyHunter',
Expand All @@ -21,6 +22,7 @@ const weaponKeyList = [
'BloodtaintedGreatsword',
'CalamityQueller',
'CashflowSupervision',
'Cloudforged',
'CinnabarSpindle',
'CompoundBow',
'CoolSteel',
Expand Down Expand Up @@ -127,6 +129,7 @@ const weaponKeyList = [
'SeasonedHuntersBow',
'SerpentSpine',
'SharpshootersOath',
'SilvershowerHeartstrings',
'SilverSword',
'SkyriderGreatsword',
'SkyriderSword',
Expand Down
43 changes: 15 additions & 28 deletions src/routes/characters/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<script lang="ts">
import IconButton from '$lib/components/ui/icon-button/IconButton.svelte';
import { mdiFilterOutline, mdiSort, mdiViewGrid, mdiViewList } from '@mdi/js';
import { mdiFilterOutline, mdiSort } from '@mdi/js';
import CharCard from '$lib/components/ui/card/CharCard.svelte';
import Searchbar from '$lib/components/ui/searchbar/Searchbar.svelte';
import S3Service from '$lib/services/s3';
import {
type CharacterKey,
characterKeyList,
isCharacterKey
} from '$lib/types/keys/CharacterKey';
import DefaultLayout from '$lib/components/layout/DefaultLayout.svelte';
import type { WeaponTypes } from '$lib/types/weapon';
import type { Elements } from '$lib/types/elements';
import { dataIndexStore } from '$lib/store/index_store';
import i18n from '$lib/services/i18n';
import { userProfile } from '$lib/store/user_profile';
import { get } from 'svelte/store';
let view = true;
let charData: {
link: string;
name: CharacterKey;
name: string;
element: Elements;
weapon: WeaponTypes;
img: string;
Expand All @@ -29,34 +24,26 @@
const userCharData = $userProfile.characters;
charData = characterKeyList
.filter((key) => isCharacterKey(key))
.map((key: CharacterKey) => {
const index = $dataIndexStore.character[key];
charData = Object.keys($dataIndexStore.character).map((key) => {
const index = get(dataIndexStore).character[key];
return {
obtained:
userCharData !== undefined ? Object.keys(userCharData).includes(key) : false,
link: '/characters/' + key,
name: index !== undefined ? index.name : key,
element: 'geo',
weapon: 'bow',
img: S3Service.getCharacter(key).icon,
rarity: index !== undefined ? index.rarity : 0
};
});
const toggleViewType = () => {
view = !view;
};
return {
obtained: userCharData !== undefined ? Object.keys(userCharData).includes(key) : false,
link: '/characters/' + key,
name: index.name,
element: 'geo',
weapon: 'bow',
img: S3Service.getCharacter(key).icon,
rarity: index.rarity
};
});
</script>

<DefaultLayout title={$i18n.t('characters.overview.title')}>
<svelte:fragment slot="titlebarActions">
<Searchbar searchGroup="Characters" searchableDataList={charData} />
<IconButton icon={mdiSort}>{$i18n.t('action.sort_by')}</IconButton>
<IconButton icon={mdiFilterOutline}>{$i18n.t('action.filter_by')}</IconButton>
<IconButton icon={view ? mdiViewList : mdiViewGrid} on:click={toggleViewType} />
</svelte:fragment>
<div class="flex flex-wrap gap-4 justify-center">
{#each charData as character}
Expand Down

0 comments on commit 6e0a5d6

Please sign in to comment.