Skip to content

Commit 21ee224

Browse files
committed
feat: client only
1 parent 51dac0a commit 21ee224

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

apps/frontend/src/components/elements/Marquee.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ const handleTouchStart = (e: TouchEvent) => {
160160
161161
isDragging.value = true
162162
const touch = e.touches[0]
163-
dragStartX.value = touch.clientX
163+
dragStartX.value = touch?.clientX || 0
164164
dragStartTranslateX.value = translateX.value
165165
hasDragged = false
166166
167167
// Reset velocity when starting a new drag
168168
velocity.value = 0
169169
170170
// Initialize velocity tracking
171-
lastMouseX = touch.clientX
171+
lastMouseX = touch?.clientX || 0
172172
lastMouseTime = Date.now()
173173
174174
document.addEventListener('touchmove', handleTouchMove, { passive: false })
@@ -180,7 +180,7 @@ const handleTouchMove = (e: TouchEvent) => {
180180
if (!isDragging.value || e.touches.length !== 1) return
181181
182182
const touch = e.touches[0]
183-
const deltaX = touch.clientX - dragStartX.value
183+
const deltaX = (touch?.clientX || 0) - dragStartX.value
184184
translateX.value = dragStartTranslateX.value + deltaX
185185
186186
// Track if user has actually dragged (moved more than 5px)
@@ -195,11 +195,11 @@ const handleTouchMove = (e: TouchEvent) => {
195195
const timeDelta = currentTime - lastMouseTime
196196
197197
if (timeDelta > 0) {
198-
const moveDelta = touch.clientX - lastMouseX
198+
const moveDelta = (touch?.clientX || 0) - lastMouseX
199199
velocity.value = (moveDelta / timeDelta) * 16 // normalize to ~60fps
200200
}
201201
202-
lastMouseX = touch.clientX
202+
lastMouseX = touch?.clientX || 0
203203
lastMouseTime = currentTime
204204
205205
// Normalize position to keep within bounds for seamless looping

apps/frontend/src/components/ui/marketing/Marquee.vue

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,19 @@
11
<template>
22
<div :class="props?.class" class="marquee h-32">
3-
<!-- <NuxtMarquee :autoFill="true" :pauseOnHover="true" :speed="35">
4-
<div
5-
v-for="(item, index) in items"
6-
:key="`item-${index}`"
7-
class="mx-4 inline h-[128px] w-[256px]"
8-
>
9-
<NuxtLink :to="`/browse/${item.identifier}`" tabindex="-1">
10-
<div
11-
class="overflow-hidden rounded-2xl transition-transform hover:scale-95"
12-
>
13-
<div
14-
class="absolute h-[128px] w-[256px] bg-neutral-950/50 opacity-0 transition-all hover:opacity-100"
15-
>
16-
<Icon
17-
name="memory:arrow-up-right-box"
18-
:size="48"
19-
mode="svg"
20-
class="top-6/12 left-6/12 -translate-3/6 absolute"
21-
/>
22-
</div>
23-
<NuxtImg
24-
:src="`https://s3.blueprint.zip/static/${item.identifier}.jpeg`"
25-
:height="128"
26-
:width="256"
27-
:alt="item.name"
28-
class="aspect-[2/1] bg-neutral-800 object-cover"
29-
/>
30-
</div>
31-
</NuxtLink>
32-
</div>
33-
</NuxtMarquee> -->
34-
<ElementsMarquee :direction="'left'" :speed="35" :pause-on-hover="true">
3+
<client-only>
4+
<ElementsMarquee :direction="'left'" :speed="35" :pause-on-hover="true">
355
<div
366
v-for="(item, index) in items"
377
:key="`item-${index}`"
388
class="mx-4 inline h-[128px] w-[256px]"
399
>
4010
<NuxtLink :to="`/browse/${item.identifier}`" tabindex="-1">
41-
<div class="overflow-hidden rounded-2xl transition-transform hover:scale-95">
42-
<div class="absolute h-[128px] w-[256px] bg-neutral-950/50 opacity-0 transition-all hover:opacity-100">
11+
<div
12+
class="overflow-hidden rounded-2xl transition-transform hover:scale-95"
13+
>
14+
<div
15+
class="absolute h-[128px] w-[256px] bg-neutral-950/50 opacity-0 transition-all hover:opacity-100"
16+
>
4317
<Icon
4418
name="memory:arrow-up-right-box"
4519
:size="48"
@@ -58,6 +32,7 @@
5832
</NuxtLink>
5933
</div>
6034
</ElementsMarquee>
35+
</client-only>
6136
</div>
6237
</template>
6338

0 commit comments

Comments
 (0)