Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.3 kB · 79 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import React from "react";import { PinnedRecordViewHydrated } from "streamplace";import { streamNotification } from "../components/stream-notification";import { PinnedCommentNotification } from "../components/stream-notification/pin-notification";import { TeleportNotification } from "../components/stream-notification/teleport-notification";
export const StreamNotifications = { pinnedComment: (params: { pinnedComment: PinnedRecordViewHydrated; onDismiss?: (reason?: "user" | "auto") => void; onUnpin?: () => void; }) => { streamNotification.show({ id: "pinned-comment", render: (isExiting, onDismiss) => { return React.createElement(PinnedCommentNotification, { pinnedComment: params.pinnedComment, onDismiss: () => onDismiss("user"), onUnpin: () => { params.onUnpin?.(); onDismiss("user"); }, }); }, duration: 0, // manually dismissed or auto-dismissed by TTL onDismiss: params.onDismiss, }); },
pinnedCommentDismiss: () => { streamNotification.hide("pinned-comment"); },
teleport: (params: { targetHandle: string; targetDID: string; countdown: number; canCancel: boolean; onDismiss?: (reason?: "user" | "auto") => void; }) => { streamNotification.show({ id: "teleport", render: (isExiting, onDismiss, startTime) => { return React.createElement(TeleportNotification, { targetHandle: params.targetHandle, countdown: params.countdown, canCancel: params.canCancel, startTime: startTime, onDismiss: onDismiss, }); }, duration: 0, // manually dismissed by countdown or user cancel variant: "warning", onDismiss: params.onDismiss, }); },
teleportCancelled: () => { streamNotification.hide("teleport"); },
teleportNow: (targetHandle: string) => { streamNotification.show({ id: "teleport-now", message: `Teleporting to @${targetHandle}...`, duration: 2, variant: "info", }); },
activate: (message: string) => { streamNotification.show({ id: "stream-activate", message: message, duration: 3, variant: "info", }); },};