Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(site): poof away preview cursor on interaction

Tin08dcaee01a97
diff --git a/apps/site/components/landing/product-showcase.module.css b/apps/site/components/landing/product-showcase.module.css
index 921aa2bea..0f49bf0ae 100644
--- a/apps/site/components/landing/product-showcase.module.css
+++ b/apps/site/components/landing/product-showcase.module.css
@@ -89,6 +89,48 @@
}
.cursor[data-pressed="true"][data-hand="pointing"] .clickPulse { opacity: 0.35; transform: scale(1); }
+.poof {
+ position: absolute;
+ z-index: 40;
+ top: 0;
+ left: 0;
+ pointer-events: none;
+}
+.poofParticle {
+ position: absolute;
+ top: -6px;
+ left: -6px;
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ background: var(--foreground);
+ animation: cursor-poof 200ms cubic-bezier(0.23, 1, 0.32, 1) both;
+}
+.poof::before {
+ content: "";
+ position: absolute;
+ top: -16px;
+ left: -16px;
+ width: 32px;
+ height: 32px;
+ border: 2px solid var(--foreground);
+ border-radius: 50%;
+ animation: cursor-poof-ring 200ms cubic-bezier(0.23, 1, 0.32, 1) both;
+}
+@keyframes cursor-poof {
+ from { opacity: 1; transform: translate(calc(var(--poof-x) * 0.2), calc(var(--poof-y) * 0.2)) scale(0.95); }
+ 35% { opacity: 1; }
+ to { opacity: 0; transform: translate(var(--poof-x), var(--poof-y)) scale(0.2); }
+}
+@keyframes cursor-poof-ring {
+ from { opacity: 0.85; transform: scale(0.95); }
+ 60%, to { opacity: 0; transform: scale(1.8); }
+}
+@keyframes cursor-poof-fade {
+ from { opacity: 0.5; }
+ to { opacity: 0; }
+}
+
@media (hover: hover) and (pointer: fine) {
.sceneButton:hover,
.playButton:hover { background: var(--muted); color: var(--foreground); }
@@ -99,4 +141,6 @@
}
@media (prefers-reduced-motion: reduce) {
.cursor { display: none; transition: none; }
+ .poof::before { display: none; }
+ .poofParticle { animation: cursor-poof-fade 160ms ease both; }
}
diff --git a/apps/site/components/landing/product-showcase.tsx b/apps/site/components/landing/product-showcase.tsx
index 9061522b9..6ae76974d 100644
--- a/apps/site/components/landing/product-showcase.tsx
+++ b/apps/site/components/landing/product-showcase.tsx
@@ -8,7 +8,13 @@ import {
SquareKanban,
} from "lucide-react";
import Image from "next/image";
-import { useCallback, useEffect, useRef, useState } from "react";
+import {
+ type CSSProperties,
+ useCallback,
+ useEffect,
+ useRef,
+ useState,
+} from "react";
import {
AppPreview,
type AppPreviewHandle,
@@ -33,6 +39,17 @@ const tourTargets = [
"project-main",
];
+const poofParticles = [
+ [0, -34],
+ [25, -25],
+ [36, 0],
+ [25, 25],
+ [0, 34],
+ [-25, 25],
+ [-36, 0],
+ [-25, -25],
+] as const;
+
type CursorState = {
x: number;
y: number;
@@ -58,6 +75,7 @@ function waitForTour(ms: number, signal: AbortSignal) {
export function ProductShowcase() {
const root = useRef<HTMLElement>(null);
const screen = useRef<HTMLDivElement>(null);
+ const cursorElement = useRef<HTMLDivElement>(null);
const preview = useRef<AppPreviewHandle>(null);
const movedTask = useRef<string | null>(null);
const interrupted = useRef(false);
@@ -68,6 +86,7 @@ export function ProductShowcase() {
const [reducedMotion, setReducedMotion] = useState(true);
const [pageVisible, setPageVisible] = useState(true);
const [cursorReady, setCursorReady] = useState(false);
+ const [poof, setPoof] = useState<{ x: number; y: number } | null>(null);
const [cursor, setCursor] = useState<CursorState>({
x: 0,
y: 0,
@@ -256,13 +275,30 @@ export function ProductShowcase() {
ref={screen}
id="product-scene"
className={styles.screen}
- onPointerDownCapture={stopTour}
+ onPointerDownCapture={() => {
+ if (playing && cursorReady && !interrupted.current) {
+ const hand = cursorElement.current?.querySelector(
+ `[data-pose="${cursor.hand}"]`,
+ );
+ const bounds = screen.current?.getBoundingClientRect();
+ const rect = hand?.getBoundingClientRect();
+ // Read the rendered position while the cursor may still be in transit.
+ if (bounds && rect) {
+ setPoof({
+ x: rect.left - bounds.left + rect.width / 2,
+ y: rect.top - bounds.top + rect.height / 2,
+ });
+ }
+ }
+ stopTour();
+ }}
onKeyDownCapture={stopTour}
onFocusCapture={stopTour}
>
<AppPreview mode={active} onModeChange={setActive} tourRef={preview} />
{playing && cursorReady && (
<div
+ ref={cursorElement}
className={styles.cursor}
style={{ transform: `translate(${cursor.x}px, ${cursor.y}px)` }}
data-pressed={cursor.pressed}
@@ -286,6 +322,27 @@ export function ProductShowcase() {
))}
</div>
)}
+ {poof && (
+ <div
+ className={styles.poof}
+ style={{ transform: `translate(${poof.x}px, ${poof.y}px)` }}
+ onAnimationEnd={() => setPoof(null)}
+ aria-hidden="true"
+ >
+ {poofParticles.map(([x, y]) => (
+ <span
+ key={`${x},${y}`}
+ className={styles.poofParticle}
+ style={
+ {
+ "--poof-x": `${x}px`,
+ "--poof-y": `${y}px`,
+ } as CSSProperties
+ }
+ />
+ ))}
+ </div>
+ )}
</div>
<fieldset
className={styles.controls}
@@ -315,6 +372,7 @@ export function ProductShowcase() {
aria-label={paused ? landing.showcase.play : landing.showcase.pause}
onClick={() => {
interrupted.current = !paused;
+ setPoof(null);
setCursorReady(false);
setPaused(!paused);
}}