From 321e7585b88248439ec39e2690e4df2da08282d4 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 15 Dec 2025 19:51:38 -0800 Subject: [PATCH] extract CharacterTags component, use in unit and search --- .../database/cells/CharacterNameCell.svelte | 53 +------------ .../components/sidebar/SearchContent.svelte | 4 + src/lib/components/tags/CharacterTags.svelte | 77 +++++++++++++++++++ src/lib/components/units/CharacterUnit.svelte | 4 + .../characters/[granblueId]/+page.svelte | 4 +- 5 files changed, 89 insertions(+), 53 deletions(-) create mode 100644 src/lib/components/tags/CharacterTags.svelte diff --git a/src/lib/components/database/cells/CharacterNameCell.svelte b/src/lib/components/database/cells/CharacterNameCell.svelte index dd02a137..c621f20f 100644 --- a/src/lib/components/database/cells/CharacterNameCell.svelte +++ b/src/lib/components/database/cells/CharacterNameCell.svelte @@ -3,9 +3,7 @@
{displayName} - {#if hasSeason || hasDistinctSeries} -
- {#if hasSeason} - - {/if} - {#if hasDistinctSeries} - - {/if} -
- {/if} +
diff --git a/src/lib/components/sidebar/SearchContent.svelte b/src/lib/components/sidebar/SearchContent.svelte index 6fc4d60c..98436298 100644 --- a/src/lib/components/sidebar/SearchContent.svelte +++ b/src/lib/components/sidebar/SearchContent.svelte @@ -7,6 +7,7 @@ import { collectionQueries } from '$lib/api/queries/collection.queries' import Button from '../ui/Button.svelte' import Icon from '../Icon.svelte' + import CharacterTags from '$lib/components/tags/CharacterTags.svelte' import { IsInViewport } from 'runed' import { getCharacterImage, getWeaponImage, getSummonImage } from '$lib/features/database/detail/image' import type { AddItemResult, SearchMode } from '$lib/types/api/search' @@ -447,6 +448,9 @@ loading="lazy" /> {getItemName(item)} + {#if type === 'character'} + + {/if} {#if item.collectionId} {:else if owned} diff --git a/src/lib/components/tags/CharacterTags.svelte b/src/lib/components/tags/CharacterTags.svelte new file mode 100644 index 00000000..c3d3590c --- /dev/null +++ b/src/lib/components/tags/CharacterTags.svelte @@ -0,0 +1,77 @@ + + + + +{#if hasTags} +
+ {#if hasSeason} + + {/if} + {#if hasDistinctSeries} + + {/if} +
+{/if} + + diff --git a/src/lib/components/units/CharacterUnit.svelte b/src/lib/components/units/CharacterUnit.svelte index 2567ad8f..b5d4633b 100644 --- a/src/lib/components/units/CharacterUnit.svelte +++ b/src/lib/components/units/CharacterUnit.svelte @@ -6,6 +6,7 @@ import UnitMenuContainer from '$lib/components/ui/menu/UnitMenuContainer.svelte' import MenuItems from '$lib/components/ui/menu/MenuItems.svelte' import UncapIndicator from '$lib/components/uncap/UncapIndicator.svelte' + import CharacterTags from '$lib/components/tags/CharacterTags.svelte' import { getCharacterImageWithPose } from '$lib/utils/images' import { openDetailsSidebar } from '$lib/features/details/openDetailsSidebar.svelte' import { sidebar } from '$lib/stores/sidebar.svelte' @@ -326,6 +327,9 @@ {/if} + {#if item?.character} + + {/if}