From b8008182fc65dd772ca486293554d091c43ca974 Mon Sep 17 00:00:00 2001 From: sylenien Date: Mon, 5 Dec 2022 15:38:55 +0100 Subject: [PATCH] change(ui): split large file into chunks --- .../Session_/Multiview/EmptyTile.tsx | 16 +++++++ .../Session_/Multiview/Multiview.tsx | 45 +++++++------------ .../Session_/Multiview/SessionTileFooter.tsx | 36 +++++++++++++++ 3 files changed, 67 insertions(+), 30 deletions(-) create mode 100644 frontend/app/components/Session_/Multiview/EmptyTile.tsx create mode 100644 frontend/app/components/Session_/Multiview/SessionTileFooter.tsx diff --git a/frontend/app/components/Session_/Multiview/EmptyTile.tsx b/frontend/app/components/Session_/Multiview/EmptyTile.tsx new file mode 100644 index 000000000..e92657603 --- /dev/null +++ b/frontend/app/components/Session_/Multiview/EmptyTile.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import { InactiveTab } from 'App/components/Session_/Player/Controls/AssistSessionsTabs'; + +function EmptyTile({ onClick }: { onClick: () => void }) { + return ( +
+ + Add Session +
+ ); +} + +export default EmptyTile; diff --git a/frontend/app/components/Session_/Multiview/Multiview.tsx b/frontend/app/components/Session_/Multiview/Multiview.tsx index 82ee3be35..d4f4a94d5 100644 --- a/frontend/app/components/Session_/Multiview/Multiview.tsx +++ b/frontend/app/components/Session_/Multiview/Multiview.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { useStore } from 'App/mstore'; -import { BackLink, Icon } from 'UI'; +import { BackLink } from 'UI'; import { observer } from 'mobx-react-lite'; import { connect } from 'react-redux'; import { fetchSessions, customSetSessions } from 'Duck/liveSearch'; @@ -9,7 +9,8 @@ import { liveSession, assist, withSiteId, multiview } from 'App/routes'; import AssistSessionsModal from 'App/components/Session_/Player/Controls/AssistSessionsModal'; import { useModal } from 'App/components/Modal'; import LivePlayer from 'App/components/Session/LivePlayer'; -import { InactiveTab } from 'App/components/Session_/Player/Controls/AssistSessionsTabs'; +import EmptyTile from './EmptyTile' +import SessionTileFooter from './SessionTileFooter' function Multiview({ total, @@ -57,7 +58,7 @@ function Multiview({ history.push(withSiteId(liveSession(sessionId), siteId)); }; - const openList = () => { + const returnToList = () => { history.push(withSiteId(assist(), siteId)); }; @@ -82,7 +83,7 @@ function Multiview({
{/* @ts-ignore */} - +
{`Watching ${assistMultiviewStore.sessions.length} of ${total} Live Sessions`}
@@ -90,7 +91,7 @@ function Multiview({ {assistMultiviewStore.sortedSessions.map((session: Record) => (
openLiveSession(e, session.sessionId)} className="w-full h-full"> {session.agentToken ? ( @@ -103,34 +104,18 @@ function Multiview({
Loading session
)}
-
-
{session.userDisplayName}
-
-
replaceSession(e, session.sessionId)} - > - Replace Session -
-
deleteSession(e, session.sessionId)} - > - -
-
-
+
))} {placeholder.map((_, i) => ( -
- - Add Session -
+ + + ))} diff --git a/frontend/app/components/Session_/Multiview/SessionTileFooter.tsx b/frontend/app/components/Session_/Multiview/SessionTileFooter.tsx new file mode 100644 index 000000000..be3205421 --- /dev/null +++ b/frontend/app/components/Session_/Multiview/SessionTileFooter.tsx @@ -0,0 +1,36 @@ +import React from 'react' +import { Icon } from 'UI' + +function SessionTileFooter({ + userDisplayName, + sessionId, + replaceSession, + deleteSession, +}: { + userDisplayName: string; + sessionId: string; + replaceSession: (e: any, id: string) => void; + deleteSession: (e: any, id: string) => void; +}) { + return ( +
+
{userDisplayName}
+
+
replaceSession(e, sessionId)} + > + Replace Session +
+
deleteSession(e, sessionId)} + > + +
+
+
+ ); +} + +export default SessionTileFooter;