Removed Test Page - Caused Major Issues

This commit is contained in:
Ahmad 2024-03-08 23:08:09 -05:00
parent 1410652f33
commit 6dc56c1497
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
3 changed files with 0 additions and 89 deletions

View file

@ -1,27 +0,0 @@
type Props = {
x: number;
y: number;
};
export function Cursor({ x, y }: Props) {
return (
<svg
style={{
position: 'absolute',
left: 0,
top: 0,
transform: `translateX(${x}px) translateY(${y}px)`,
}}
width='16'
height='16'
viewBox='0 0 16 16'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<path
d='m13.67 6.03-11-4a.5.5 0 0 0-.64.64l4 11a.5.5 0 0 0 .935.015l1.92-4.8 4.8-1.92a.5.5 0 0 0 0-.935h-.015Z'
fill='var(--preview-background-inverse)'
/>
</svg>
);
}

View file

@ -1,22 +0,0 @@
'use client';
import { ReactNode } from 'react';
import { RoomProvider } from '@/liveblocks.config';
import { ClientSideSuspense } from '@liveblocks/react';
import { useAuth } from '@clerk/nextjs';
const Room = ({ children }: { children: ReactNode }) => {
const { orgId } = useAuth();
if (!orgId) return null;
return (
<RoomProvider id={orgId} initialPresence={{ cursor: null }}>
<ClientSideSuspense fallback={<div>Loading</div>}>
{() => children}
</ClientSideSuspense>
</RoomProvider>
);
}
export default Room;

View file

@ -1,40 +0,0 @@
import { useMyPresence, useOthers } from '@/liveblocks.config';
import { Cursor } from './cursor';
const TestPage = () => {
const [myPresence, updateMyPresence] = useMyPresence();
const others = useOthers();
function handlePointerMove(e: any) {
const cursor = { x: Math.floor(e.clientX), y: Math.floor(e.clientY) };
updateMyPresence({ cursor });
}
function handlePointerLeave() {
updateMyPresence({ cursor: null });
}
return (
<div
style={{ width: '100vw', height: '100vh' }}
onPointerMove={handlePointerMove}
onPointerLeave={handlePointerLeave}
>
Cursor: {JSON.stringify(myPresence.cursor)}
{others
.filter((other) => other.presence.cursor !== null)
.map(({ connectionId, presence }) => (
<Cursor
key={connectionId}
// @ts-ignore
x={presence.cursor.x}
// @ts-ignore
y={presence.cursor.y}
/>
))}
</div>
);
};
export default TestPage;