truncate long names in database cells
This commit is contained in:
parent
4da92fbb31
commit
8646a494f4
3 changed files with 91 additions and 1 deletions
|
|
@ -20,7 +20,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="name-cell">
|
<div class="name-cell">
|
||||||
<span class="name">{displayName}</span>
|
<span class="name" title={displayName}>{displayName}</span>
|
||||||
<CharacterTags {character} />
|
<CharacterTags {character} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -33,9 +33,13 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: $unit-half;
|
gap: $unit-half;
|
||||||
padding: $unit-half 0;
|
padding: $unit-half 0;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
font-weight: $medium;
|
font-weight: $medium;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
43
src/lib/components/database/cells/SummonNameCell.svelte
Normal file
43
src/lib/components/database/cells/SummonNameCell.svelte
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<svelte:options runes={true} />
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import type { Cell } from 'wx-svelte-grid'
|
||||||
|
import type { Summon } from '$lib/types/api/entities'
|
||||||
|
|
||||||
|
const { row }: Cell = $props()
|
||||||
|
|
||||||
|
// Cast row to Summon type for type safety
|
||||||
|
const summon = row as Summon
|
||||||
|
|
||||||
|
// Get display name
|
||||||
|
const displayName = $derived.by(() => {
|
||||||
|
const nameObj = summon.name
|
||||||
|
if (!nameObj) return '—'
|
||||||
|
if (typeof nameObj === 'string') return nameObj
|
||||||
|
return nameObj.en || nameObj.ja || '—'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="name-cell">
|
||||||
|
<span class="name" title={displayName}>{displayName}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use '$src/themes/spacing' as *;
|
||||||
|
@use '$src/themes/typography' as *;
|
||||||
|
|
||||||
|
.name-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $unit-half;
|
||||||
|
padding: $unit-half 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: $medium;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
43
src/lib/components/database/cells/WeaponNameCell.svelte
Normal file
43
src/lib/components/database/cells/WeaponNameCell.svelte
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<svelte:options runes={true} />
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import type { Cell } from 'wx-svelte-grid'
|
||||||
|
import type { Weapon } from '$lib/types/api/entities'
|
||||||
|
|
||||||
|
const { row }: Cell = $props()
|
||||||
|
|
||||||
|
// Cast row to Weapon type for type safety
|
||||||
|
const weapon = row as Weapon
|
||||||
|
|
||||||
|
// Get display name
|
||||||
|
const displayName = $derived.by(() => {
|
||||||
|
const nameObj = weapon.name
|
||||||
|
if (!nameObj) return '—'
|
||||||
|
if (typeof nameObj === 'string') return nameObj
|
||||||
|
return nameObj.en || nameObj.ja || '—'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="name-cell">
|
||||||
|
<span class="name" title={displayName}>{displayName}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use '$src/themes/spacing' as *;
|
||||||
|
@use '$src/themes/typography' as *;
|
||||||
|
|
||||||
|
.name-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $unit-half;
|
||||||
|
padding: $unit-half 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: $medium;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in a new issue