update cloudflare errors

This commit is contained in:
Jeff Emmett 2025-11-11 22:38:24 -08:00
parent ffef04df50
commit 2528ad4726
12 changed files with 87 additions and 27 deletions

View File

@ -3,6 +3,7 @@ import {
TLStoreWithStatus, TLStoreWithStatus,
createTLStore, createTLStore,
TLStoreSnapshot, TLStoreSnapshot,
RecordsDiff,
} from "@tldraw/tldraw" } from "@tldraw/tldraw"
import { createTLSchema, defaultBindingSchemas, defaultShapeSchemas } from "@tldraw/tlschema" import { createTLSchema, defaultBindingSchemas, defaultShapeSchemas } from "@tldraw/tlschema"
import { useEffect, useState } from "react" import { useEffect, useState } from "react"

View File

@ -33,6 +33,8 @@ interface FathomMeeting {
email: string email: string
team?: string team?: string
} }
call_id?: string | number
id?: string | number
} }
interface FathomMeetingsPanelProps { interface FathomMeetingsPanelProps {

View File

@ -69,8 +69,27 @@ export const StandardizedToolWrapper: React.FC<StandardizedToolWrapperProps> = (
useEffect(() => { useEffect(() => {
if (editor && shapeId && isSelected) { if (editor && shapeId && isSelected) {
try { try {
// Use sendToFront to bring the shape to the top of the z-order // Bring the shape to the front by updating its index
editor.sendToFront([shapeId]) // Note: sendToFront doesn't exist in this version of tldraw
const allShapes = editor.getCurrentPageShapes()
let highestIndex = 'a0'
for (const s of allShapes) {
if (s.index && typeof s.index === 'string' && s.index > highestIndex) {
highestIndex = s.index
}
}
const shape = editor.getShape(shapeId)
if (shape) {
const match = highestIndex.match(/^([a-z])(\d+)$/)
if (match) {
const letter = match[1]
const num = parseInt(match[2], 10)
const newIndex = num < 100 ? `${letter}${num + 1}` : `${String.fromCharCode(letter.charCodeAt(0) + 1)}1`
if (/^[a-z]\d+$/.test(newIndex)) {
editor.updateShape({ id: shapeId, type: shape.type, index: newIndex as any })
}
}
}
} catch (error) { } catch (error) {
// Silently fail if shape doesn't exist or operation fails // Silently fail if shape doesn't exist or operation fails
// This prevents console spam if shape is deleted during selection // This prevents console spam if shape is deleted during selection

View File

@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { Editor } from 'tldraw' import { Editor, TLShapeId } from 'tldraw'
/** /**
* Hook to manage shapes pinned to the viewport. * Hook to manage shapes pinned to the viewport.
@ -23,7 +23,7 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
return return
} }
const shape = editor.getShape(shapeId) const shape = editor.getShape(shapeId as TLShapeId)
if (!shape) return if (!shape) return
// If just became pinned (transition from false to true), capture the current screen position // If just became pinned (transition from false to true), capture the current screen position
@ -63,12 +63,10 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
} }
} }
// Bring the shape to the front using editor's sendToFront method // Bring the shape to the front by manually setting index
// This is safer than manually setting index values // Note: sendToFront doesn't exist in this version of tldraw, so we use manual index setting
try { try {
editor.sendToFront([shapeId]) // Try to set a safe index value
} catch (frontError) {
// Fallback: try to set a safe index value
// Use conservative values that are known to work (a1, a2, b1, etc.) // Use conservative values that are known to work (a1, a2, b1, etc.)
let newIndex: string = 'a2' // Safe default let newIndex: string = 'a2' // Safe default
@ -100,7 +98,7 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
// Validate before using // Validate before using
if (/^[a-z]\d+$/.test(newIndex)) { if (/^[a-z]\d+$/.test(newIndex)) {
editor.updateShape({ editor.updateShape({
id: shapeId, id: shapeId as TLShapeId,
type: shape.type, type: shape.type,
index: newIndex as any, index: newIndex as any,
}) })
@ -121,7 +119,7 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
// Animate back to original coordinates and size with a calm drift // Animate back to original coordinates and size with a calm drift
if (originalCoordinatesRef.current && originalSizeRef.current && originalZoomRef.current !== null) { if (originalCoordinatesRef.current && originalSizeRef.current && originalZoomRef.current !== null) {
const currentShape = editor.getShape(shapeId) const currentShape = editor.getShape(shapeId as TLShapeId)
if (currentShape) { if (currentShape) {
const startX = currentShape.x const startX = currentShape.x
const startY = currentShape.y const startY = currentShape.y
@ -173,7 +171,7 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
try { try {
editor.updateShape({ editor.updateShape({
id: shapeId, id: shapeId as TLShapeId,
type: currentShape.type, type: currentShape.type,
x: currentX, x: currentX,
y: currentY, y: currentY,
@ -266,7 +264,7 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
return return
} }
const currentShape = editor.getShape(shapeId) const currentShape = editor.getShape(shapeId as TLShapeId)
if (!currentShape) { if (!currentShape) {
animationFrameRef.current = requestAnimationFrame(updatePinnedPosition) animationFrameRef.current = requestAnimationFrame(updatePinnedPosition)
return return
@ -381,11 +379,11 @@ export function usePinnedToView(editor: Editor | null, shapeId: string | undefin
// Only respond to changes that affect this specific shape // Only respond to changes that affect this specific shape
const changedShapes = event?.changedShapes || event?.shapes || [] const changedShapes = event?.changedShapes || event?.shapes || []
const shapeChanged = changedShapes.some((s: any) => s?.id === shapeId) const shapeChanged = changedShapes.some((s: any) => s?.id === (shapeId as TLShapeId))
if (!shapeChanged) return if (!shapeChanged) return
const currentShape = editor.getShape(shapeId) const currentShape = editor.getShape(shapeId as TLShapeId)
if (!currentShape) return if (!currentShape) return
// Update the pinned screen position to the shape's current screen position // Update the pinned screen position to the shape's current screen position

View File

@ -1,5 +1,5 @@
// Blockchain integration exports // Blockchain integration exports
// Note: These modules may not exist yet - commented out to prevent build errors
export * from './ethereum'; // export * from './ethereum';
export * from './walletIntegration'; // export * from './walletIntegration';

View File

@ -235,8 +235,30 @@ export function Board() {
if (selectionChanged && selectedShapeIds.length > 0) { if (selectionChanged && selectedShapeIds.length > 0) {
try { try {
// Bring all selected shapes to the front // Bring all selected shapes to the front by updating their index
editor.sendToFront(selectedShapeIds) // Note: sendToFront doesn't exist in this version of tldraw
const allShapes = editor.getCurrentPageShapes()
let highestIndex = 'a0'
for (const s of allShapes) {
if (s.index && typeof s.index === 'string' && s.index > highestIndex) {
highestIndex = s.index
}
}
// Update each selected shape's index
for (const id of selectedShapeIds) {
const shape = editor.getShape(id)
if (shape) {
const match = highestIndex.match(/^([a-z])(\d+)$/)
if (match) {
const letter = match[1]
const num = parseInt(match[2], 10)
const newIndex = num < 100 ? `${letter}${num + 1}` : `${String.fromCharCode(letter.charCodeAt(0) + 1)}1`
if (/^[a-z]\d+$/.test(newIndex)) {
editor.updateShape({ id, type: shape.type, index: newIndex as any })
}
}
}
}
lastSelectedIds = [...selectedShapeIds] lastSelectedIds = [...selectedShapeIds]
} catch (error) { } catch (error) {
// Silently fail if shapes don't exist or operation fails // Silently fail if shapes don't exist or operation fails
@ -253,7 +275,7 @@ export function Board() {
return () => { return () => {
if (typeof unsubscribe === 'function') { if (typeof unsubscribe === 'function') {
unsubscribe() ;(unsubscribe as () => void)()
} }
} }
}, [editor]) }, [editor])

View File

@ -95,6 +95,8 @@ export class ChatBoxShape extends BaseBoxShapeUtil<IChatBoxShape> {
w={shape.props.w} w={shape.props.w}
h={shape.props.h - 40} // Subtract header height h={shape.props.h - 40} // Subtract header height
userName="" userName=""
pinnedToView={shape.props.pinnedToView}
tags={shape.props.tags}
/> />
</StandardizedToolWrapper> </StandardizedToolWrapper>
</HTMLContainer> </HTMLContainer>

View File

@ -1,5 +1,6 @@
import React, { useState } from 'react' import React, { useState } from 'react'
import { BaseBoxShapeUtil, TLBaseShape, createShapeId, IndexKey, TLParentId, HTMLContainer } from '@tldraw/tldraw' import { BaseBoxShapeUtil, TLBaseShape, createShapeId, IndexKey, TLParentId, HTMLContainer } from '@tldraw/tldraw'
import type { JSX } from 'react'
import { StandardizedToolWrapper } from '../components/StandardizedToolWrapper' import { StandardizedToolWrapper } from '../components/StandardizedToolWrapper'
import { usePinnedToView } from '../hooks/usePinnedToView' import { usePinnedToView } from '../hooks/usePinnedToView'

View File

@ -210,7 +210,7 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
let isNewRoom: boolean = false; let isNewRoom: boolean = false;
if (!response.ok) { if (!response.ok) {
const error = await response.json() const error = await response.json() as any
console.error('🔧 Daily.co API error:', error); console.error('🔧 Daily.co API error:', error);
// Check if the room already exists // Check if the room already exists
@ -228,7 +228,7 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
}); });
if (getRoomResponse.ok) { if (getRoomResponse.ok) {
const roomData = await getRoomResponse.json(); const roomData = await getRoomResponse.json() as any;
url = roomData.url; url = roomData.url;
console.log('🔧 Retrieved existing room URL:', url); console.log('🔧 Retrieved existing room URL:', url);
} else { } else {

View File

@ -1,5 +1,6 @@
import { StateNode } from "tldraw" import { StateNode } from "tldraw"
import { ObsNoteShape } from "@/shapes/ObsNoteShapeUtil" import { ObsNoteShape } from "@/shapes/ObsNoteShapeUtil"
import { findNonOverlappingPosition } from "@/utils/shapeCollisionUtils"
export class ObsNoteTool extends StateNode { export class ObsNoteTool extends StateNode {
static override id = "obs_note" static override id = "obs_note"

View File

@ -53,12 +53,26 @@ export const components: TLComponents = {
<DefaultKeyboardShortcutsDialog {...props}> <DefaultKeyboardShortcutsDialog {...props}>
{/* Custom Tools */} {/* Custom Tools */}
{customTools.map(tool => ( {customTools.map(tool => (
<TldrawUiMenuItem key={tool.id} {...tool} /> <TldrawUiMenuItem
key={tool.id}
id={tool.id}
label={tool.label}
icon={typeof tool.icon === 'string' ? tool.icon : undefined}
kbd={tool.kbd}
onSelect={tool.onSelect}
/>
))} ))}
{/* Custom Actions */} {/* Custom Actions */}
{customActions.map(action => ( {customActions.map(action => (
<TldrawUiMenuItem key={action.id} {...action} /> <TldrawUiMenuItem
key={action.id}
id={action.id}
label={action.label}
icon={typeof action.icon === 'string' ? action.icon : undefined}
kbd={action.kbd}
onSelect={action.onSelect}
/>
))} ))}
{/* Default content (includes standard TLDraw shortcuts) */} {/* Default content (includes standard TLDraw shortcuts) */}

View File

@ -550,7 +550,7 @@ const router = AutoRouter<IRequest, [env: Environment, ctx: ExecutionContext]>({
// Support both Authorization: Bearer and X-Api-Key headers for backward compatibility // Support both Authorization: Bearer and X-Api-Key headers for backward compatibility
let apiKey = req.headers.get('X-Api-Key') let apiKey = req.headers.get('X-Api-Key')
if (!apiKey) { if (!apiKey) {
apiKey = req.headers.get('Authorization')?.split('Bearer ')[1] apiKey = req.headers.get('Authorization')?.split('Bearer ')[1] || null
} }
console.log('API key present:', !!apiKey) console.log('API key present:', !!apiKey)
@ -648,7 +648,7 @@ const router = AutoRouter<IRequest, [env: Environment, ctx: ExecutionContext]>({
// Support both Authorization: Bearer and X-Api-Key headers // Support both Authorization: Bearer and X-Api-Key headers
let apiKey = req.headers.get('X-Api-Key') let apiKey = req.headers.get('X-Api-Key')
if (!apiKey) { if (!apiKey) {
apiKey = req.headers.get('Authorization')?.split('Bearer ')[1] apiKey = req.headers.get('Authorization')?.split('Bearer ')[1] || null
} }
const { meetingId } = req.params const { meetingId } = req.params