Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/side-panel/CustomTabPanel.tsx

This file was deleted.

20 changes: 12 additions & 8 deletions src/side-panel/SidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

// react
import { type SyntheticEvent, useEffect, useRef, useState } from "react";
import { Activity, type SyntheticEvent, useEffect, useRef, useState } from "react";
import {
AppBar,
Box,
Expand All @@ -20,12 +20,16 @@ import { lightGreen } from "@mui/material/colors";
import { RecordPanel } from "@/side-panel/record-panel/RecordPanel.tsx";
import { SessionPanel } from "@/side-panel/session-panel/SessionPanel.tsx";
import { SidePanelState } from "@/side-panel/config.ts";
// tab-panel
import { a11yProps } from "@/side-panel/utils.ts";
import { CustomTabPanel } from "@/side-panel/CustomTabPanel.tsx";
// local
import type { SessionSummary } from "@/common/models/session-summary.ts";

const a11yProps = (index: number) => {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
};

const SidePanel = ({ tabId, testId }: { tabId: number; testId?: string }) => {
const [panelState, setPanelState] = useState<SidePanelState>(SidePanelState.STOPPED);
const [sessionSummaries, setSessionSummaries] = useState<SessionSummary[]>([]);
Expand Down Expand Up @@ -93,7 +97,7 @@ const SidePanel = ({ tabId, testId }: { tabId: number; testId?: string }) => {
}}
/>
<Toolbar />
<CustomTabPanel value={tabValue} index={0}>
<Activity mode={tabValue === 0 ? "visible" : "hidden"}>
<RecordPanel
tabId={tabId}
panelState={panelState}
Expand All @@ -103,8 +107,8 @@ const SidePanel = ({ tabId, testId }: { tabId: number; testId?: string }) => {
headerHeight={headerHeight}
testId={testId}
/>
</CustomTabPanel>
<CustomTabPanel value={tabValue} index={1}>
</Activity>
<Activity mode={tabValue === 1 ? "visible" : "hidden"}>
<SessionPanel
tabId={tabId}
panelState={panelState}
Expand All @@ -114,7 +118,7 @@ const SidePanel = ({ tabId, testId }: { tabId: number; testId?: string }) => {
headerHeight={headerHeight}
testId={testId}
/>
</CustomTabPanel>
</Activity>
</Box>
</ThemeProvider>
</>
Expand Down
34 changes: 27 additions & 7 deletions src/side-panel/record-panel/RecordPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// react
import React, { useEffect, useRef, useState } from "react";
import { Box } from "@mui/material";
import { grey } from "@mui/material/colors";
// side-panel
import { SessionCardList } from "@/side-panel/session-card/SessionCardList.tsx";
import { RecordButton } from "@/side-panel/record-panel/RecordButton.tsx";
Expand Down Expand Up @@ -121,16 +122,35 @@ const RecordPanel = ({
/>
</Box>
</Box>
<SessionCardList
tabId={tabId}
sessionSummaries={sessionSummaries}
setSessionSummaries={setSessionSummaries}
imported={false}
<Box
sx={{
marginTop: `${buttonHeight + 8}px`,
height: `calc(100vh - ${headerHeight + buttonHeight + 8}px)`,
overflowY: "auto",
// scrollbar
"&::-webkit-scrollbar": {
width: "12px", // 8 + 2(left) + 2(right)
},
"&::-webkit-scrollbar-thumb": {
backgroundColor: grey[700],
borderRadius: "4px",
borderLeft: "2px solid transparent",
borderRight: "2px solid transparent",
backgroundClip: "padding-box",
},
"&::-webkit-scrollbar-thumb:hover": {
backgroundColor: grey[600],
},
}}
testId={testId}
/>
>
<SessionCardList
tabId={tabId}
sessionSummaries={sessionSummaries}
setSessionSummaries={setSessionSummaries}
imported={false}
testId={testId}
/>
</Box>
</>
);
};
Expand Down
34 changes: 27 additions & 7 deletions src/side-panel/session-panel/SessionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// react
import React, { useEffect, useRef, useState } from "react";
import { Box } from "@mui/material";
import { grey } from "@mui/material/colors";
// side-panel
import { SessionCardList } from "@/side-panel/session-card/SessionCardList.tsx";
import { LoadButton } from "@/side-panel/session-panel/LoadButton.tsx";
Expand Down Expand Up @@ -81,16 +82,35 @@ const SessionPanel = ({
/>
</Box>
</Box>
<SessionCardList
tabId={tabId}
sessionSummaries={sessionSummaries}
setSessionSummaries={setSessionSummaries}
imported={true}
<Box
sx={{
marginTop: `${buttonHeight + 8}px`,
height: `calc(100vh - ${headerHeight + buttonHeight + 8}px)`,
overflowY: "auto",
// scrollbar
"&::-webkit-scrollbar": {
width: "12px", // 8 + 2(left) + 2(right)
},
"&::-webkit-scrollbar-thumb": {
backgroundColor: grey[700],
borderRadius: "4px",
borderLeft: "2px solid transparent",
borderRight: "2px solid transparent",
backgroundClip: "padding-box",
},
"&::-webkit-scrollbar-thumb:hover": {
backgroundColor: grey[600],
},
}}
testId={testId}
/>
>
<SessionCardList
tabId={tabId}
sessionSummaries={sessionSummaries}
setSessionSummaries={setSessionSummaries}
imported={true}
testId={testId}
/>
</Box>
</>
);
};
Expand Down
9 changes: 1 addition & 8 deletions src/side-panel/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
// react
import { type EffectCallback, useEffect } from "react";

const a11yProps = (index: number) => {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
};

const formatRFC3339Date = (d: Date) => {
if (isNaN(d.valueOf())) return "";

Expand Down Expand Up @@ -53,4 +46,4 @@ const useEffectOnce = (effect: EffectCallback) => {
useEffect(effect, []); // eslint-disable-line react-hooks/exhaustive-deps
};

export { a11yProps, formatRFC3339, timestamp, useEffectOnce };
export { formatRFC3339, timestamp, useEffectOnce };