diff --git a/packages/desktop/src/providers/RealTimeRoomProvider.tsx b/packages/desktop/src/providers/RealTimeRoomProvider.tsx
index 66425bb..867c817 100644
--- a/packages/desktop/src/providers/RealTimeRoomProvider.tsx
+++ b/packages/desktop/src/providers/RealTimeRoomProvider.tsx
@@ -293,26 +293,39 @@ export function RealTimeRoomProvider({ children }: { children: React.ReactChild
* tune into socket room and tell everyone else
*/
const handleSelectLine = useCallback(
- (newLineIdToSelect: string) => {
- setSelectedLineId((prevLineId) => {
- if (newLineIdToSelect === prevLineId) {
- return prevLineId;
- }
+ (newLineIdToSelect: string | undefined) => {
+ if (!newLineIdToSelect) {
+ setSelectedLineId(undefined);
+ } else {
+ setSelectedLineId((prevLineId) => {
+ if (newLineIdToSelect === prevLineId) {
+ return prevLineId;
+ }
- // untune from the last line if it was just a temporary tuned one
- if (roomMap[prevLineId]?.currentUserMember.state === LineMemberState.INBOX) {
- handleUntuneFromLine(prevLineId);
- }
+ // untune from the last line if it was just a temporary tuned one
+ if (roomMap[prevLineId]?.currentUserMember.state === LineMemberState.INBOX) {
+ handleUntuneFromLine(prevLineId);
+ }
- // tune in if not already tuned into this line
- if (!roomMap[newLineIdToSelect].tunedInMemberIds?.includes(user._id.toString())) {
- handleTuneIntoLine(newLineIdToSelect);
- }
+ // tune in if not already tuned into this line
+ if (!roomMap[newLineIdToSelect].tunedInMemberIds?.includes(user._id.toString())) {
+ handleTuneIntoLine(newLineIdToSelect);
+ }
- return newLineIdToSelect;
- });
+ return newLineIdToSelect;
+ });
+ }
+
+ setShowNewChannelForm(false);
},
- [setSelectedLineId, handleUntuneFromLine, roomMap, user, handleTuneIntoLine],
+ [
+ setSelectedLineId,
+ handleUntuneFromLine,
+ roomMap,
+ user,
+ handleTuneIntoLine,
+ setShowNewChannelForm,
+ ],
);
const handleShowNewChannelForm = useCallback(
diff --git a/packages/desktop/src/tree/protected/terminal/line/LineDetails.tsx b/packages/desktop/src/tree/protected/terminal/line/LineDetails.tsx
new file mode 100644
index 0000000..e171785
--- /dev/null
+++ b/packages/desktop/src/tree/protected/terminal/line/LineDetails.tsx
@@ -0,0 +1,287 @@
+import React, { useMemo, useEffect, useState } from 'react';
+import useAuth from '../../../../providers/AuthProvider';
+import useRealTimeRooms from '../../../../providers/RealTimeRoomProvider';
+import useStreams from '../../../../providers/StreamProvider';
+
+import { LineMemberState } from '@nirvana/core/models/line.model';
+import LineIcon from '../../../../components/lineIcon';
+import {
+ FiActivity,
+ FiHeadphones,
+ FiImage,
+ FiMoreVertical,
+ FiSearch,
+ FiSettings,
+ FiSun,
+ FiUsers,
+ FiVideo,
+} from 'react-icons/fi';
+import { Avatar, Tooltip } from 'antd';
+
+export default function LineDetails() {
+ const { user } = useAuth();
+
+ const { selectedLineId, roomsMap, handleUpdateLineMemberState } = useRealTimeRooms();
+
+ const selectedLine = useMemo(() => roomsMap[selectedLineId], [selectedLineId, roomsMap]);
+
+ const isUserToggleTuned = useMemo(
+ () => selectedLine?.currentUserMember?.state === LineMemberState.TUNED,
+ [selectedLine],
+ );
+
+ const { peerMap } = useStreams();
+
+ // seeing if I am in the list of broadcasters
+ // the source of truth from the socket connections telling me if my clicking actually made a round trip
+ const isUserBroadcasting = useMemo(
+ () => selectedLine?.currentBroadcastersUserIds?.includes(user._id.toString()),
+ [user, selectedLine],
+ );
+
+ // showing all tuned in members...they may not hear me since they might be doing something else
+ // but feeling of presentness
+ const tunedProfiles = useMemo(() => {
+ const pictureSources: { name: string; pictureSrc: string }[] = [];
+
+ selectedLine.tunedInMemberIds?.forEach((tunedInMemberUserId) => {
+ // don't want to see my own picture
+ // TODO: don't show myself!?
+ if (tunedInMemberUserId === user._id.toString()) {
+ pictureSources.push();
+
+ pictureSources.push({
+ name: user.givenName,
+ pictureSrc: user.picture,
+ });
+ return;
+ }
+
+ const otherUserObject = selectedLine.otherUserObjects?.find(
+ (userObj) => userObj._id.toString() === tunedInMemberUserId,
+ );
+ if (otherUserObject?.picture)
+ pictureSources.push({
+ name: otherUserObject.givenName,
+ pictureSrc: otherUserObject.picture,
+ });
+ });
+
+ return pictureSources;
+ }, [selectedLine, user]);
+
+ // pics for the line icons
+ const profilePictures = useMemo(() => {
+ const pictureSources: string[] = [];
+
+ // ?don't add in my image as that's useless contextually?
+ // if (userData?.user?.picture) pictureSources.push(userData.user.picture);
+
+ selectedLine.otherUserObjects?.forEach((otherUser) => {
+ if (otherUser.picture) pictureSources.push(otherUser.picture);
+ });
+
+ return pictureSources;
+ }, [selectedLine]);
+
+ return (
+
+ {/* line details */}
+
+ {profilePictures &&
}
+
+
+
+
+ {selectedLine.lineDetails.name || selectedLine.otherUserObjects[0].givenName}
+
+
+
+
+
+
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ ))}
+
+
+
|
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ ))}
+
+
+
+ {/* main canvas */}
+
+ {/* line timeline */}
+
+
load more
+
+
yesterday
+
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ ))}
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ {`${otherUser.givenName}, `}
+
+ ))}
+
+
{`${
+ Math.floor(Math.random() * 10) + 1
+ }:${Math.floor(Math.random() * 100) + 10}pm |`}
+
+
{`${
+ Math.floor(Math.random() * 60) + 1
+ } seconds`}
+
+
+
today
+
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ ))}
+
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+ {`${otherUser.givenName}, `}
+
+ ))}
+
+
{`${
+ Math.floor(Math.random() * 10) + 1
+ }:${Math.floor(Math.random() * 100) + 10}pm |`}
+
+
{`${
+ Math.floor(Math.random() * 60) + 1
+ } seconds`}
+
+
+
+
+ right now
+
+
+ {/* live broadcasters */}
+
+ {selectedLine.otherUserObjects.map((otherUser) => (
+
+
+
+
{otherUser.name}
+
+
+
+ ))}
+
+
+
+ {/* canvas action buttons */}
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/packages/desktop/src/tree/protected/terminal/panels/MainPanel.tsx b/packages/desktop/src/tree/protected/terminal/panels/MainPanel.tsx
index 436fbf1..5c1fee9 100644
--- a/packages/desktop/src/tree/protected/terminal/panels/MainPanel.tsx
+++ b/packages/desktop/src/tree/protected/terminal/panels/MainPanel.tsx
@@ -19,6 +19,7 @@ import { Avatar, Tooltip } from 'antd';
import useStreams from '../../../../providers/StreamProvider';
import Peer from 'simple-peer';
import NewChannelForm from '../compose/NewChannelForm';
+import LineDetails from '../line/LineDetails';
export default function MainPanel() {
const { user } = useAuth();
@@ -45,274 +46,6 @@ export default function MainPanel() {
);
}
-function LineDetails() {
- const { user } = useAuth();
-
- const { selectedLineId, roomsMap, handleUpdateLineMemberState } = useRealTimeRooms();
-
- const selectedLine = useMemo(() => roomsMap[selectedLineId], [selectedLineId, roomsMap]);
-
- const isUserToggleTuned = useMemo(
- () => selectedLine?.currentUserMember?.state === LineMemberState.TUNED,
- [selectedLine],
- );
-
- const { peerMap } = useStreams();
-
- // seeing if I am in the list of broadcasters
- // the source of truth from the socket connections telling me if my clicking actually made a round trip
- const isUserBroadcasting = useMemo(
- () => selectedLine?.currentBroadcastersUserIds?.includes(user._id.toString()),
- [user, selectedLine],
- );
-
- // showing all tuned in members...they may not hear me since they might be doing something else
- // but feeling of presentness
- const tunedProfiles = useMemo(() => {
- const pictureSources: { name: string; pictureSrc: string }[] = [];
-
- selectedLine.tunedInMemberIds?.forEach((tunedInMemberUserId) => {
- // don't want to see my own picture
- // TODO: don't show myself!?
- if (tunedInMemberUserId === user._id.toString()) {
- pictureSources.push();
-
- pictureSources.push({
- name: user.givenName,
- pictureSrc: user.picture,
- });
- return;
- }
-
- const otherUserObject = selectedLine.otherUserObjects?.find(
- (userObj) => userObj._id.toString() === tunedInMemberUserId,
- );
- if (otherUserObject?.picture)
- pictureSources.push({
- name: otherUserObject.givenName,
- pictureSrc: otherUserObject.picture,
- });
- });
-
- return pictureSources;
- }, [selectedLine, user]);
-
- // pics for the line icons
- const profilePictures = useMemo(() => {
- const pictureSources: string[] = [];
-
- // ?don't add in my image as that's useless contextually?
- // if (userData?.user?.picture) pictureSources.push(userData.user.picture);
-
- selectedLine.otherUserObjects?.forEach((otherUser) => {
- if (otherUser.picture) pictureSources.push(otherUser.picture);
- });
-
- return pictureSources;
- }, [selectedLine]);
-
- return (
-
- {/* line details */}
-
- {profilePictures &&
}
-
-
-
-
- {selectedLine.lineDetails.name || selectedLine.otherUserObjects[0].givenName}
-
-
-
-
-
-
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- ))}
-
-
-
|
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- ))}
-
-
-
- {/* main canvas */}
-
- {/* line timeline */}
-
-
load more
-
-
yesterday
-
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- ))}
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- {`${otherUser.givenName}, `}
-
- ))}
-
-
{`${
- Math.floor(Math.random() * 10) + 1
- }:${Math.floor(Math.random() * 100) + 10}pm |`}
-
-
{`${
- Math.floor(Math.random() * 60) + 1
- } seconds`}
-
-
-
today
-
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- ))}
-
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
- {`${otherUser.givenName}, `}
-
- ))}
-
-
{`${
- Math.floor(Math.random() * 10) + 1
- }:${Math.floor(Math.random() * 100) + 10}pm |`}
-
-
{`${
- Math.floor(Math.random() * 60) + 1
- } seconds`}
-
-
-
-
- right now
-
-
- {/* live broadcasters */}
-
- {selectedLine.otherUserObjects.map((otherUser) => (
-
-
-
-
{otherUser.name}
-
-
-
- ))}
-
-
-
- {/* canvas action buttons */}
-
-
-
-
-
-
-
-
-
- );
-}
-
function LineStreams({ broadcasters }: { broadcasters: string[] }) {
const { peerMap } = useStreams();