-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui-debug): add Folder component
- Loading branch information
Showing
11 changed files
with
194 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
webapp/src/components/App/Singlestudy/explore/Debug/Data/Folder.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { | ||
Divider, | ||
List, | ||
ListItemButton, | ||
ListItemIcon, | ||
ListItemText, | ||
ListSubheader, | ||
} from "@mui/material"; | ||
import FolderIcon from "@mui/icons-material/Folder"; | ||
import { | ||
getFileIcon, | ||
getFileType, | ||
type TreeFolder, | ||
type DataCompProps, | ||
} from "../utils"; | ||
import ViewWrapper from "../../../../../common/page/ViewWrapper"; | ||
import { Fragment } from "react"; | ||
import EmptyView from "../../../../../common/page/SimpleContent"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
function Folder({ | ||
filename, | ||
filePath, | ||
treeData, | ||
setSelectedFile, | ||
}: DataCompProps) { | ||
const { t } = useTranslation(); | ||
const list = Object.entries(treeData as TreeFolder); | ||
|
||
return ( | ||
<ViewWrapper> | ||
<List subheader={<ListSubheader>{filename}</ListSubheader>} dense> | ||
{list.length > 0 ? ( | ||
list.map(([filename, data], index, arr) => { | ||
const fileType = getFileType(data); | ||
const Icon = getFileIcon(fileType); | ||
const isLast = index === arr.length - 1; | ||
|
||
return ( | ||
<Fragment key={filename}> | ||
<ListItemButton | ||
onClick={() => | ||
setSelectedFile({ | ||
fileType, | ||
filename, | ||
filePath: `${filePath}/${filename}`, | ||
treeData: data, | ||
}) | ||
} | ||
> | ||
<ListItemIcon> | ||
<Icon /> | ||
</ListItemIcon> | ||
<ListItemText primary={filename} /> | ||
</ListItemButton> | ||
{!isLast && <Divider variant="fullWidth" />} | ||
</Fragment> | ||
); | ||
}) | ||
) : ( | ||
<EmptyView title={t("study.debug.folder.empty")} icon={FolderIcon} /> | ||
)} | ||
</List> | ||
</ViewWrapper> | ||
); | ||
} | ||
|
||
export default Folder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 48 additions & 4 deletions
52
webapp/src/components/App/Singlestudy/explore/Debug/Tree/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters