Sync whiteboard images and add board ownership
CI / server (push) Successful in 33s
CI / frontend (push) Successful in 28s
CI / kiosk (push) Failing after 7m17s
Build and Publish Docker Images / build-and-push (apps/web-client/Dockerfile, pistation-web) (push) Successful in 2m17s
Build and Publish Docker Images / build-and-push (server/Dockerfile, pistation-server) (push) Successful in 2m32s
CI / server (push) Successful in 33s
CI / frontend (push) Successful in 28s
CI / kiosk (push) Failing after 7m17s
Build and Publish Docker Images / build-and-push (apps/web-client/Dockerfile, pistation-web) (push) Successful in 2m17s
Build and Publish Docker Images / build-and-push (server/Dockerfile, pistation-server) (push) Successful in 2m32s
This commit is contained in:
@@ -3,6 +3,7 @@ import type { RoomMode, RoomState } from "./room.js";
|
||||
export interface ModeSetEvent {
|
||||
type: "mode.set";
|
||||
mode: RoomMode;
|
||||
ownerId?: string | null;
|
||||
}
|
||||
|
||||
export interface PresenterSetEvent {
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface RoomState {
|
||||
roomName: string;
|
||||
mode: RoomMode;
|
||||
presenterId: string | null;
|
||||
whiteboardOwnerId?: string | null;
|
||||
annotationsLocked: boolean;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,22 @@ export interface WhiteboardElement {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface WhiteboardFile {
|
||||
id: string;
|
||||
url: string;
|
||||
mimeType: string;
|
||||
}
|
||||
|
||||
export interface WhiteboardPatchEvent {
|
||||
type: "whiteboard.patch";
|
||||
elements: WhiteboardElement[];
|
||||
files?: WhiteboardFile[];
|
||||
}
|
||||
|
||||
export interface WhiteboardSnapshotEvent {
|
||||
type: "whiteboard.snapshot";
|
||||
elements: WhiteboardElement[];
|
||||
files?: WhiteboardFile[];
|
||||
backgroundColor: string;
|
||||
}
|
||||
|
||||
@@ -48,6 +56,22 @@ export function mergeWhiteboardElements(
|
||||
return [...byId.values()];
|
||||
}
|
||||
|
||||
export function mergeWhiteboardFiles(
|
||||
current: WhiteboardFile[],
|
||||
incoming: WhiteboardFile[]
|
||||
): WhiteboardFile[] {
|
||||
const byId = new Map<string, WhiteboardFile>();
|
||||
for (const file of current) {
|
||||
byId.set(file.id, file);
|
||||
}
|
||||
for (const file of incoming) {
|
||||
if (!byId.has(file.id)) {
|
||||
byId.set(file.id, file);
|
||||
}
|
||||
}
|
||||
return [...byId.values()];
|
||||
}
|
||||
|
||||
function isNewerElement(candidate: WhiteboardElement, existing: WhiteboardElement): boolean {
|
||||
if (candidate.version !== existing.version) {
|
||||
return candidate.version > existing.version;
|
||||
|
||||
Reference in New Issue
Block a user