diff --git a/src/automerge/AutomergeToTLStore.ts b/src/automerge/AutomergeToTLStore.ts index 44e1ec8..d132c0c 100644 --- a/src/automerge/AutomergeToTLStore.ts +++ b/src/automerge/AutomergeToTLStore.ts @@ -119,7 +119,7 @@ export function applyAutomergePatchesToTLStore( // Create new object with correct typeName if it changed if (correctTypeName !== record.typeName) { - record = { ...record, typeName: correctTypeName } + record = { ...record, typeName: correctTypeName } as TLRecord } } diff --git a/src/automerge/CloudflareAdapter.ts b/src/automerge/CloudflareAdapter.ts index 44f65a0..1ae4fd8 100644 --- a/src/automerge/CloudflareAdapter.ts +++ b/src/automerge/CloudflareAdapter.ts @@ -157,6 +157,7 @@ export class CloudflareNetworkAdapter extends NetworkAdapter { private workerUrl: string private websocket: WebSocket | null = null private roomId: string | null = null + private peerId: PeerId | null = null private readyPromise: Promise private readyResolve: (() => void) | null = null private keepAliveInterval: NodeJS.Timeout | null = null @@ -189,6 +190,9 @@ export class CloudflareNetworkAdapter extends NetworkAdapter { return } + // Store peerId + this.peerId = peerId + // Clean up existing connection this.cleanup() @@ -223,16 +227,20 @@ export class CloudflareNetworkAdapter extends NetworkAdapter { // Automerge Repo expects binary sync messages as Uint8Array this.emit('message', { type: 'sync', - data: new Uint8Array(event.data) - }) + data: new Uint8Array(event.data), + senderId: this.peerId || 'unknown' as PeerId, + targetId: this.peerId || 'unknown' as PeerId + } as Message) } else if (event.data instanceof Blob) { // Handle Blob messages (convert to Uint8Array) event.data.arrayBuffer().then((buffer) => { console.log('🔌 CloudflareAdapter: Received Blob message, converted to Uint8Array') this.emit('message', { type: 'sync', - data: new Uint8Array(buffer) - }) + data: new Uint8Array(buffer), + senderId: this.peerId || 'unknown' as PeerId, + targetId: this.peerId || 'unknown' as PeerId + } as Message) }) } else { // Handle text messages (our custom protocol for backward compatibility) diff --git a/src/automerge/useAutomergeSyncRepo.ts b/src/automerge/useAutomergeSyncRepo.ts index 8e9220d..803ad30 100644 --- a/src/automerge/useAutomergeSyncRepo.ts +++ b/src/automerge/useAutomergeSyncRepo.ts @@ -140,10 +140,18 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus // Get the store with status const storeWithStatus = useMemo((): TLStoreWithStatus => { if (!store) { - return { - status: isLoading ? 'loading' : 'not-synced', - connectionStatus: 'offline', - store: undefined + if (isLoading) { + return { + status: 'loading' as const, + connectionStatus: 'offline' as const, + store: undefined + } + } else { + return { + status: 'not-synced' as const, + connectionStatus: 'offline' as const, + store: undefined + } } } @@ -158,7 +166,7 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus const presence = useAutomergePresence({ handle: handle || null, store: store || null, - userMetadata: user || { userId: 'anonymous', name: 'Anonymous', color: '#000000' } + userMetadata: user && 'userId' in user ? user : { userId: user?.id || 'anonymous', name: user?.name || 'Anonymous', color: '#000000' } }) return { diff --git a/src/hooks/useWebSpeechTranscription.ts b/src/hooks/useWebSpeechTranscription.ts index 45783dc..0762f7b 100644 --- a/src/hooks/useWebSpeechTranscription.ts +++ b/src/hooks/useWebSpeechTranscription.ts @@ -83,7 +83,7 @@ export const useWebSpeechTranscription = ({ const speakerChangeThreshold = 0.3 // Threshold for detecting speaker changes // Function to add line breaks after pauses and improve punctuation - const processTranscript = useCallback((text: string, isFinal: boolean = false, confidence?: number) => { + const processTranscript = useCallback((text: string, isFinal: boolean = false, _confidence?: number) => { if (!text.trim()) return text let processedText = text.trim() diff --git a/src/lib/HoloSphereService.ts b/src/lib/HoloSphereService.ts index 27a8dc5..afa2218 100644 --- a/src/lib/HoloSphereService.ts +++ b/src/lib/HoloSphereService.ts @@ -185,14 +185,14 @@ export class HoloSphereService { }) // Handle Promise if subscribe returns one if (subscribeResult instanceof Promise) { - subscribeResult.then((result) => { + subscribeResult.then((result: any) => { unsubscribe = result?.unsubscribe || undefined console.log(`✅ Subscribe called successfully for ${lens}`) }).catch((err) => { console.error(`❌ Error in subscribe promise for ${lens}:`, err) }) } else { - unsubscribe = subscribeResult?.unsubscribe || undefined + unsubscribe = (subscribeResult as any)?.unsubscribe || undefined console.log(`✅ Subscribe called successfully for ${lens}`) } } catch (subError) { diff --git a/src/shapes/FathomTranscriptShapeUtil.tsx b/src/shapes/FathomTranscriptShapeUtil.tsx index d6277b2..9401176 100644 --- a/src/shapes/FathomTranscriptShapeUtil.tsx +++ b/src/shapes/FathomTranscriptShapeUtil.tsx @@ -201,18 +201,6 @@ export class FathomTranscriptShape extends BaseBoxShapeUtil { gap: '12px', } - const buttonStyle: React.CSSProperties = { - padding: '4px 8px', - fontSize: '10px', - border: '1px solid #ccc', - borderRadius: '4px', - backgroundColor: 'white', - cursor: 'pointer', - zIndex: 1000, - position: 'relative', - pointerEvents: 'auto', - } - const transcriptEntryStyle: React.CSSProperties = { marginBottom: '8px', padding: '8px', diff --git a/src/utils/shapeCollisionUtils.ts b/src/utils/shapeCollisionUtils.ts index a093600..4962603 100644 --- a/src/utils/shapeCollisionUtils.ts +++ b/src/utils/shapeCollisionUtils.ts @@ -36,7 +36,7 @@ export function resolveOverlaps(editor: Editor, shapeId: string): void { 'Embed', 'Slide', 'Markdown', 'SharedPiano', 'MycrozineTemplate', 'ChatBox' ] - const shape = editor.getShape(shapeId) + const shape = editor.getShape(shapeId as TLShapeId) if (!shape || !customShapeTypes.includes(shape.type)) return const shapeBounds = getShapeBounds(editor, shape)