fix character card aspect ratio and duplicate key error
- Use proper 16:33 aspect ratio for character cards instead of square - Change object-fit from cover to contain to prevent cropping - Deduplicate search results across pages to prevent duplicate key errors
This commit is contained in:
parent
d107d56f82
commit
7de75ec8d0
2 changed files with 22 additions and 7 deletions
|
|
@ -82,10 +82,24 @@
|
||||||
enabled: open && !collectedIdsQuery.isLoading
|
enabled: open && !collectedIdsQuery.isLoading
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Flatten results
|
// Flatten results and deduplicate by ID
|
||||||
const allResults = $derived(
|
// (API may return duplicates across pages)
|
||||||
searchResults.data?.pages.flatMap((page) => page.results) ?? []
|
const allResults = $derived.by(() => {
|
||||||
)
|
const pages = searchResults.data?.pages ?? []
|
||||||
|
const seen = new Set<string>()
|
||||||
|
const results: SearchResult[] = []
|
||||||
|
|
||||||
|
for (const page of pages) {
|
||||||
|
for (const result of page.results) {
|
||||||
|
if (!seen.has(result.id)) {
|
||||||
|
seen.add(result.id)
|
||||||
|
results.push(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results
|
||||||
|
})
|
||||||
|
|
||||||
// Filter to show only selected if enabled
|
// Filter to show only selected if enabled
|
||||||
const displayedResults = $derived(
|
const displayedResults = $derived(
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,12 @@
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@use '$src/themes/spacing' as *;
|
@use '$src/themes/spacing' as *;
|
||||||
@use '$src/themes/effects' as *;
|
@use '$src/themes/effects' as *;
|
||||||
|
@use '$src/themes/rep' as rep;
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 80px;
|
width: 100%;
|
||||||
height: 80px;
|
@include rep.aspect(rep.$char-cell-w, rep.$char-cell-h);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
@ -85,7 +86,7 @@
|
||||||
.image {
|
.image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.check-overlay {
|
.check-overlay {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue