feat: Optimize UI layout and page hierarchy

This commit is contained in:
wonfen 2025-02-07 09:13:30 +08:00
parent a37df46ce7
commit bb0b6c3f77
5 changed files with 126 additions and 126 deletions

View File

@ -115,9 +115,6 @@ export const ConnectionTable = (props: Props) => {
sx={{ sx={{
border: "none", border: "none",
"div:focus": { outline: "none !important" }, "div:focus": { outline: "none !important" },
"& div[aria-rowindex]": {
backgroundColor: `${backgroundColor} !important`,
},
}} }}
columnVisibilityModel={columnVisible} columnVisibilityModel={columnVisible}
onColumnVisibilityModelChange={(e) => setColumnVisible(e)} onColumnVisibilityModelChange={(e) => setColumnVisible(e)}

View File

@ -139,7 +139,15 @@ const ConnectionsPage = () => {
<BasePage <BasePage
full full
title={<span style={{ whiteSpace: "nowrap" }}>{t("Connections")}</span>} title={<span style={{ whiteSpace: "nowrap" }}>{t("Connections")}</span>}
contentStyle={{ height: "100%" }} contentStyle={{
height: "100%",
display: "flex",
flexDirection: "column",
overflow: "auto",
// margin: "0 10px",
// backgroundColor: isDark ? "#282a36" : "#ffffff",
borderRadius: "8px",
}}
header={ header={
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}> <Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<Box sx={{ mx: 1 }}> <Box sx={{ mx: 1 }}>
@ -185,6 +193,10 @@ const ConnectionsPage = () => {
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
userSelect: "text", userSelect: "text",
// backgroundColor: isDark ? "#282a36" : "#ffffff",
position: "sticky",
top: 0,
zIndex: 2,
}} }}
> >
{!isTableLayout && ( {!isTableLayout && (
@ -202,15 +214,6 @@ const ConnectionsPage = () => {
<BaseSearchBox onSearch={(match) => setMatch(() => match)} /> <BaseSearchBox onSearch={(match) => setMatch(() => match)} />
</Box> </Box>
<Box
height="calc(100% - 65px)"
sx={{
userSelect: "text",
margin: "10px",
borderRadius: "8px",
bgcolor: isDark ? "#282a36" : "#ffffff",
}}
>
{filterConn.length === 0 ? ( {filterConn.length === 0 ? (
<BaseEmpty /> <BaseEmpty />
) : isTableLayout ? ( ) : isTableLayout ? (
@ -220,6 +223,11 @@ const ConnectionsPage = () => {
/> />
) : ( ) : (
<Virtuoso <Virtuoso
style={{
flex: 1,
// backgroundColor: isDark ? "#282a36" : "#ffffff",
borderRadius: "8px",
}}
data={filterConn} data={filterConn}
itemContent={(_, item) => ( itemContent={(_, item) => (
<ConnectionItem <ConnectionItem
@ -229,7 +237,6 @@ const ConnectionsPage = () => {
)} )}
/> />
)} )}
</Box>
<ConnectionDetail ref={detailRef} /> <ConnectionDetail ref={detailRef} />
</BasePage> </BasePage>
); );

View File

@ -44,7 +44,12 @@ const LogPage = () => {
<BasePage <BasePage
full full
title={t("Logs")} title={t("Logs")}
contentStyle={{ height: "100%" }} contentStyle={{
height: "100%",
display: "flex",
flexDirection: "column",
overflow: "auto",
}}
header={ header={
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}> <Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<IconButton <IconButton
@ -102,18 +107,13 @@ const LogPage = () => {
/> />
</Box> </Box>
<Box
height="calc(100% - 65px)"
sx={{
margin: "10px",
borderRadius: "8px",
bgcolor: isDark ? "#282a36" : "#ffffff",
}}
>
{filterLogs.length > 0 ? ( {filterLogs.length > 0 ? (
<Virtuoso <Virtuoso
initialTopMostItemIndex={999} initialTopMostItemIndex={999}
data={filterLogs} data={filterLogs}
style={{
flex: 1,
}}
itemContent={(index, item) => ( itemContent={(index, item) => (
<LogItem value={item} searchState={searchState} /> <LogItem value={item} searchState={searchState} />
)} )}
@ -122,7 +122,6 @@ const LogPage = () => {
) : ( ) : (
<BaseEmpty /> <BaseEmpty />
)} )}
</Box>
</BasePage> </BasePage>
); );
}; };

View File

@ -367,20 +367,19 @@ const ProfilePage = () => {
{t("New")} {t("New")}
</Button> </Button>
</Stack> </Stack>
<Box
sx={{
pt: 1,
mb: 0.5,
pl: "10px",
mr: "10px",
height: "calc(100% - 68px)",
overflowY: "auto",
}}
>
<DndContext <DndContext
sensors={sensors} sensors={sensors}
collisionDetection={closestCenter} collisionDetection={closestCenter}
onDragEnd={onDragEnd} onDragEnd={onDragEnd}
>
<Box
sx={{
pl: "10px",
pr: "10px",
height: "calc(100% - 68px)",
overflowY: "auto",
}}
> >
<Box sx={{ mb: 1.5 }}> <Box sx={{ mb: 1.5 }}>
<Grid2 container spacing={{ xs: 1, lg: 1 }}> <Grid2 container spacing={{ xs: 1, lg: 1 }}>
@ -412,7 +411,6 @@ const ProfilePage = () => {
</SortableContext> </SortableContext>
</Grid2> </Grid2>
</Box> </Box>
</DndContext>
<Divider <Divider
variant="middle" variant="middle"
flexItem flexItem
@ -444,6 +442,7 @@ const ProfilePage = () => {
</Grid2> </Grid2>
</Box> </Box>
</Box> </Box>
</DndContext>
<ProfileViewer <ProfileViewer
ref={viewerRef} ref={viewerRef}

View File

@ -39,7 +39,12 @@ const RulesPage = () => {
<BasePage <BasePage
full full
title={t("Rules")} title={t("Rules")}
contentStyle={{ height: "100%" }} contentStyle={{
height: "100%",
display: "flex",
flexDirection: "column",
overflow: "auto",
}}
header={ header={
<Box display="flex" alignItems="center" gap={1}> <Box display="flex" alignItems="center" gap={1}>
<ProviderButton /> <ProviderButton />
@ -59,20 +64,14 @@ const RulesPage = () => {
<BaseSearchBox onSearch={(match) => setMatch(() => match)} /> <BaseSearchBox onSearch={(match) => setMatch(() => match)} />
</Box> </Box>
<Box
height="calc(100% - 65px)"
sx={{
margin: "10px",
borderRadius: "8px",
bgcolor: isDark ? "#282a36" : "#ffffff",
position: "relative",
}}
>
{rules.length > 0 ? ( {rules.length > 0 ? (
<> <>
<Virtuoso <Virtuoso
ref={virtuosoRef} ref={virtuosoRef}
data={rules} data={rules}
style={{
flex: 1,
}}
itemContent={(index, item) => ( itemContent={(index, item) => (
<RuleItem index={index + 1} value={item} /> <RuleItem index={index + 1} value={item} />
)} )}
@ -86,7 +85,6 @@ const RulesPage = () => {
) : ( ) : (
<BaseEmpty /> <BaseEmpty />
)} )}
</Box>
</BasePage> </BasePage>
); );
}; };