···1212 PlaceStreamSegment,
1313} from "streamplace";
1414import { SystemMessages } from "../lib/system-messages";
1515+import { formatHandleWithAt } from "../utils/format-handle";
1516import { reduceChat } from "./chat";
1617import { LivestreamState } from "./livestream-state";
1718import { findProblems } from "./problems";
···129130 activeTeleport: teleportRecord,
130131 };
131132 } else if (PlaceStreamLivestream.isTeleportArrival(message)) {
133133+ console.log("teleport succeeded");
134134+ // teleport has succeeded, we are now at the target stream
132135 const arrival = message as PlaceStreamLivestream.TeleportArrival;
133133- // when receiving a teleportArrival, we're the target
134134- // the source is teleporting to us
135135- console.log("Received teleport arrival", arrival);
136136- // TODO: show notification or UI for incoming teleport
136136+ const systemMessage = SystemMessages.teleportArrival(
137137+ formatHandleWithAt(arrival.source),
138138+ arrival.viewerCount,
139139+ );
140140+ // set proper times
141141+ systemMessage.indexedAt = arrival.startsAt;
142142+ systemMessage.record.createdAt = arrival.startsAt;
143143+144144+ state = reduceChat(state, [systemMessage], []);
137145 } else if (PlaceStreamLivestream.isTeleportCanceled(message)) {
138146 // teleport was canceled (deleted or denied)
139147 state = {