remove fluid-dnd drag and drop

This commit is contained in:
Justin Edmund 2025-09-15 21:26:01 -07:00
parent e26b5c2e20
commit ef30e57eba
5 changed files with 278 additions and 231 deletions

View file

@ -60,6 +60,7 @@
"dependencies": { "dependencies": {
"@tanstack/svelte-query": "^5.87.1", "@tanstack/svelte-query": "^5.87.1",
"bits-ui": "^2.9.6", "bits-ui": "^2.9.6",
"fluid-dnd": "^2.6.2",
"modern-normalize": "^3.0.1", "modern-normalize": "^3.0.1",
"zod": "^4.1.5" "zod": "^4.1.5"
} }

View file

@ -14,6 +14,9 @@ importers:
bits-ui: bits-ui:
specifier: ^2.9.6 specifier: ^2.9.6
version: 2.9.6(@internationalized/date@3.9.0)(svelte@5.38.7) version: 2.9.6(@internationalized/date@3.9.0)(svelte@5.38.7)
fluid-dnd:
specifier: ^2.6.2
version: 2.6.2
modern-normalize: modern-normalize:
specifier: ^3.0.1 specifier: ^3.0.1
version: 3.0.1 version: 3.0.1
@ -1338,6 +1341,9 @@ packages:
flatted@3.3.3: flatted@3.3.3:
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==} resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
fluid-dnd@2.6.2:
resolution: {integrity: sha512-NB11wa6QmKkelLi/PrV95nfXM0oA3lrynQD91VrLbhk2BEfH7PLTUMjqlSkavu+fqPlPVCL8HFhYsfv9GVqd7Q==}
fsevents@2.3.2: fsevents@2.3.2:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@ -3332,6 +3338,8 @@ snapshots:
flatted@3.3.3: {} flatted@3.3.3: {}
fluid-dnd@2.6.2: {}
fsevents@2.3.2: fsevents@2.3.2:
optional: true optional: true

View file

@ -2,6 +2,8 @@
<script lang="ts"> <script lang="ts">
import type { GridCharacter } from '$lib/types/api/party' import type { GridCharacter } from '$lib/types/api/party'
import { getContext } from 'svelte'
import type { PartyContext } from '$lib/services/party.service'
interface Props { interface Props {
characters?: GridCharacter[] characters?: GridCharacter[]
@ -9,22 +11,26 @@
partyElement?: number | null | undefined partyElement?: number | null | undefined
} }
let { let { characters = [], mainWeaponElement = undefined, partyElement = undefined }: Props = $props()
characters = [],
mainWeaponElement = undefined,
partyElement = undefined
}: Props = $props()
import CharacterUnit from '$lib/components/units/CharacterUnit.svelte' import CharacterUnit from '$lib/components/units/CharacterUnit.svelte'
let grid = $derived(Array.from({ length: 5 }, (_, i) => characters.find((c) => c.position === i))) const ctx = getContext<PartyContext>('party')
</script> </script>
<div class="wrapper"> <div class="wrapper">
<ul class="characters" aria-label="Character Grid"> <ul
{#each grid as c, i} class="characters"
<li aria-label={`Character slot ${i}`}> aria-label="Character Grid"
<CharacterUnit item={c} position={i} {mainWeaponElement} {partyElement} /> >
{#each Array(5) as _, i}
{@const character = characters.find((c) => c.position === i)}
<li
aria-label={`Character slot ${i}`}
class:main-character={i === 0}
class:Empty={!character}
>
<CharacterUnit item={character} position={i} {mainWeaponElement} {partyElement} />
</li> </li>
{/each} {/each}
</ul> </ul>
@ -40,7 +46,9 @@
grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-columns: repeat(5, minmax(0, 1fr));
gap: $unit-3x; gap: $unit-3x;
& > li { list-style: none; } & > li {
list-style: none;
}
} }
.unit { .unit {
@ -51,7 +59,13 @@
gap: $unit; gap: $unit;
} }
.image { width: 100%; height: auto; border: 1px solid $grey-75; border-radius: 8px; display: block; } .image {
width: 100%;
height: auto;
border: 1px solid $grey-75;
border-radius: 8px;
display: block;
}
.name { .name {
font-size: $font-small; font-size: $font-small;

View file

@ -2,6 +2,8 @@
<script lang="ts"> <script lang="ts">
import type { GridSummon } from '$lib/types/api/party' import type { GridSummon } from '$lib/types/api/party'
import { getContext } from 'svelte'
import type { PartyContext } from '$lib/services/party.service'
interface Props { interface Props {
summons?: GridSummon[] summons?: GridSummon[]
@ -12,9 +14,10 @@
import SummonUnit from '$lib/components/units/SummonUnit.svelte' import SummonUnit from '$lib/components/units/SummonUnit.svelte'
import ExtraSummons from '$lib/components/extra/ExtraSummonsGrid.svelte' import ExtraSummons from '$lib/components/extra/ExtraSummonsGrid.svelte'
const ctx = getContext<PartyContext>('party')
let main = $derived(summons.find((s) => s.main || s.position === -1)) let main = $derived(summons.find((s) => s.main || s.position === -1))
let friend = $derived(summons.find((s) => s.friend || s.position === 6)) let friend = $derived(summons.find((s) => s.friend || s.position === 6))
let grid = $derived(Array.from({ length: 4 }, (_, i) => summons.find((s) => s.position === i)))
</script> </script>
<div class="wrapper"> <div class="wrapper">
@ -27,9 +30,13 @@
<section> <section>
<div class="label">Summons</div> <div class="label">Summons</div>
<ul class="summons"> <ul class="summons">
{#each grid as s, i} {#each Array(4) as _, i}
<li aria-label={`Summon slot ${i}`}> {@const summon = summons.find((s) => s.position === i)}
<SummonUnit item={s} position={i} /> <li
aria-label={`Summon slot ${i}`}
class:Empty={!summon}
>
<SummonUnit item={summon} position={i} />
</li> </li>
{/each} {/each}
</ul> </ul>
@ -40,7 +47,7 @@
<SummonUnit item={friend} position={6} /> <SummonUnit item={friend} position={6} />
</div> </div>
</div> </div>
<ExtraSummons summons={summons} offset={4} /> <ExtraSummons {summons} offset={4} />
</div> </div>
<style lang="scss"> <style lang="scss">
@ -110,7 +117,13 @@
gap: $unit; gap: $unit;
} }
.image { width: 100%; height: auto; border: 1px solid $grey-75; border-radius: 8px; display: block; } .image {
width: 100%;
height: auto;
border: 1px solid $grey-75;
border-radius: 8px;
display: block;
}
.name { .name {
font-size: $font-small; font-size: $font-small;

View file

@ -2,6 +2,8 @@
<script lang="ts"> <script lang="ts">
import type { GridWeapon } from '$lib/types/api/party' import type { GridWeapon } from '$lib/types/api/party'
import { getContext } from 'svelte'
import type { PartyContext } from '$lib/services/party.service'
interface Props { interface Props {
weapons?: GridWeapon[] weapons?: GridWeapon[]
@ -21,8 +23,9 @@
import ExtraWeapons from '$lib/components/extra/ExtraWeaponsGrid.svelte' import ExtraWeapons from '$lib/components/extra/ExtraWeaponsGrid.svelte'
import Guidebooks from '$lib/components/extra/GuidebooksGrid.svelte' import Guidebooks from '$lib/components/extra/GuidebooksGrid.svelte'
const ctx = getContext<PartyContext>('party')
let mainhand = $derived(weapons.find((w) => (w as any).mainhand || w.position === -1)) let mainhand = $derived(weapons.find((w) => (w as any).mainhand || w.position === -1))
let grid = $derived(Array.from({ length: 9 }, (_, i) => weapons.find((w) => w.position === i)))
</script> </script>
<div class="wrapper"> <div class="wrapper">
@ -32,15 +35,20 @@
</div> </div>
<ul class="weapons" aria-label="Weapon Grid"> <ul class="weapons" aria-label="Weapon Grid">
{#each grid as w, i} {#each Array(9) as _, i}
<li class:Empty={!w} aria-label={`Weapon slot ${i}`}> {@const weapon = weapons.find((w) => w.position === i)}
<WeaponUnit item={w} {i} position={i} /> <li
aria-label={weapon ? `Weapon ${i}` : `Empty slot ${i}`}
data-index={i}
class={weapon ? '' : 'Empty'}
>
<WeaponUnit item={weapon} position={i} />
</li> </li>
{/each} {/each}
</ul> </ul>
</div> </div>
{#if raidExtra} {#if raidExtra}
<ExtraWeapons weapons={weapons} offset={9} /> <ExtraWeapons {weapons} offset={9} />
{/if} {/if}
{#if showGuidebooks} {#if showGuidebooks}
<Guidebooks {guidebooks} /> <Guidebooks {guidebooks} />
@ -85,10 +93,7 @@
3, 3,
minmax(0, 1fr) minmax(0, 1fr)
); /* create 3 columns, each taking up 1 fraction */ ); /* create 3 columns, each taking up 1 fraction */
grid-template-rows: repeat( grid-template-rows: repeat(3, 1fr); /* create 3 rows, each taking up 1 fraction */
3,
1fr
); /* create 3 rows, each taking up 1 fraction */
gap: $unit-3x; gap: $unit-3x;
@include breakpoint(tablet) { @include breakpoint(tablet) {
@ -114,7 +119,13 @@
gap: $unit; gap: $unit;
} }
.image { width: 100%; height: auto; border: 1px solid $grey-75; border-radius: 8px; display: block; } .image {
width: 100%;
height: auto;
border: 1px solid $grey-75;
border-radius: 8px;
display: block;
}
.name { .name {
font-size: $font-small; font-size: $font-small;