mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
import * as React from "react";
|
|
|
|
import type { Channel } from "@/shared/api/types";
|
|
|
|
const ChannelBrowserDialog = React.lazy(async () => {
|
|
const module = await import("@/features/channels/ui/ChannelBrowserDialog");
|
|
return { default: module.ChannelBrowserDialog };
|
|
});
|
|
|
|
const ChannelManagementSheet = React.lazy(async () => {
|
|
const module = await import("@/features/channels/ui/ChannelManagementSheet");
|
|
return { default: module.ChannelManagementSheet };
|
|
});
|
|
|
|
export type BrowseDialogType = "stream" | "forum" | null;
|
|
|
|
type AppShellOverlaysProps = {
|
|
activeChannel: Channel | null;
|
|
browseDialogType: BrowseDialogType;
|
|
channels: Channel[];
|
|
currentPubkey?: string;
|
|
isChannelManagementOpen: boolean;
|
|
onBrowseChannelJoin: (channelId: string) => Promise<void>;
|
|
onBrowseDialogOpenChange: (open: boolean) => void;
|
|
onChannelManagementOpenChange: (open: boolean) => void;
|
|
onDeleteActiveChannel: () => void;
|
|
onSelectChannel: (channelId: string) => void;
|
|
};
|
|
|
|
export function AppShellOverlays({
|
|
activeChannel,
|
|
browseDialogType,
|
|
channels,
|
|
currentPubkey,
|
|
isChannelManagementOpen,
|
|
onBrowseChannelJoin,
|
|
onBrowseDialogOpenChange,
|
|
onChannelManagementOpenChange,
|
|
onDeleteActiveChannel,
|
|
onSelectChannel,
|
|
}: AppShellOverlaysProps) {
|
|
return (
|
|
<>
|
|
{browseDialogType !== null ? (
|
|
<React.Suspense fallback={null}>
|
|
<ChannelBrowserDialog
|
|
channels={channels}
|
|
channelTypeFilter={browseDialogType}
|
|
onJoinChannel={onBrowseChannelJoin}
|
|
onOpenChange={onBrowseDialogOpenChange}
|
|
onSelectChannel={onSelectChannel}
|
|
open={true}
|
|
/>
|
|
</React.Suspense>
|
|
) : null}
|
|
|
|
{isChannelManagementOpen && activeChannel !== null ? (
|
|
<React.Suspense fallback={null}>
|
|
<ChannelManagementSheet
|
|
channel={activeChannel}
|
|
currentPubkey={currentPubkey}
|
|
onDeleted={onDeleteActiveChannel}
|
|
onOpenChange={onChannelManagementOpenChange}
|
|
open={true}
|
|
/>
|
|
</React.Suspense>
|
|
) : null}
|
|
</>
|
|
);
|
|
}
|