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,
createTLStore,
TLStoreSnapshot,
RecordsDiff,
} from "@tldraw/tldraw"
import { createTLSchema, defaultBindingSchemas, defaultShapeSchemas } from "@tldraw/tlschema"
import { useEffect, useState } from "react"

View File

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

View File

@ -69,8 +69,27 @@ export const StandardizedToolWrapper: React.FC<StandardizedToolWrapperProps> = (
useEffect(() => {
if (editor && shapeId && isSelected) {
try {
// Use sendToFront to bring the shape to the top of the z-order
editor.sendToFront([shapeId])
// Bring the shape to the front by updating its index
// 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) {
// Silently fail if shape doesn't exist or operation fails
// This prevents console spam if shape is deleted during selection

View File

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

View File

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

View File

@ -235,8 +235,30 @@ export function Board() {
if (selectionChanged && selectedShapeIds.length > 0) {
try {
// Bring all selected shapes to the front
editor.sendToFront(selectedShapeIds)
// Bring all selected shapes to the front by updating their index
// 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]
} catch (error) {
// Silently fail if shapes don't exist or operation fails
@ -253,7 +275,7 @@ export function Board() {
return () => {
if (typeof unsubscribe === 'function') {
unsubscribe()
;(unsubscribe as () => void)()
}
}
}, [editor])

View File

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

View File

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

View File

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

View File

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

View File

@ -53,12 +53,26 @@ export const components: TLComponents = {
<DefaultKeyboardShortcutsDialog {...props}>
{/* Custom Tools */}
{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 */}
{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) */}

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