Skip to content

Commit

Permalink
chore(ui): remove some unused code (#3157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-rasmussen authored Dec 12, 2024
1 parent 16e47c3 commit 444c04d
Showing 1 changed file with 1 addition and 137 deletions.
138 changes: 1 addition & 137 deletions weave-js/src/components/PagePanelComponents/Home/Browse3.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import {ApolloProvider} from '@apollo/client';
import {Home} from '@mui/icons-material';
import {
AppBar,
Box,
Breadcrumbs,
Drawer,
IconButton,
Link as MaterialLink,
Toolbar,
Typography,
} from '@mui/material';
import {Box, Drawer} from '@mui/material';
import {
GridColumnVisibilityModel,
GridFilterModel,
Expand All @@ -21,9 +11,7 @@ import {LicenseInfo} from '@mui/x-license';
import {makeGorillaApolloClient} from '@wandb/weave/apollo';
import {EVALUATE_OP_NAME_POST_PYDANTIC} from '@wandb/weave/components/PagePanelComponents/Home/Browse3/pages/common/heuristics';
import {opVersionKeyToRefUri} from '@wandb/weave/components/PagePanelComponents/Home/Browse3/pages/wfReactInterface/utilities';
import _ from 'lodash';
import React, {
ComponentProps,
FC,
useCallback,
useEffect,
Expand All @@ -33,7 +21,6 @@ import React, {
} from 'react';
import useMousetrap from 'react-hook-mousetrap';
import {
Link as RouterLink,
Redirect,
Route,
Switch,
Expand Down Expand Up @@ -199,7 +186,6 @@ export const Browse3: FC<{
`/${URL_BROWSE3}`,
]}>
<Browse3Mounted
hideHeader={props.hideHeader}
headerOffset={props.headerOffset}
navigateAwayFromProject={props.navigateAwayFromProject}
/>
Expand All @@ -211,7 +197,6 @@ export const Browse3: FC<{
};

const Browse3Mounted: FC<{
hideHeader?: boolean;
headerOffset?: number;
navigateAwayFromProject?: () => void;
}> = props => {
Expand All @@ -225,37 +210,6 @@ const Browse3Mounted: FC<{
overflow: 'auto',
flexDirection: 'column',
}}>
{!props.hideHeader && (
<AppBar
sx={{
zIndex: theme => theme.zIndex.drawer + 1,
height: '60px',
flex: '0 0 auto',
position: 'static',
}}>
<Toolbar
sx={{
backgroundColor: '#1976d2',
minHeight: '30px',
}}>
<IconButton
component={RouterLink}
to={`/`}
sx={{
color: theme =>
theme.palette.getContrastText(theme.palette.primary.main),
'&:hover': {
color: theme =>
theme.palette.getContrastText(theme.palette.primary.dark),
},
marginRight: theme => theme.spacing(2),
}}>
<Home />
</IconButton>
<Browse3Breadcrumbs />
</Toolbar>
</AppBar>
)}
<Switch>
<Route path={baseRouter.projectUrl(':entity', ':project')} exact>
<ProjectRedirect />
Expand Down Expand Up @@ -1050,20 +1004,6 @@ const ComparePageBinding = () => {
return <ComparePage entity={params.entity} project={params.project} />;
};

const AppBarLink = (props: ComponentProps<typeof RouterLink>) => (
<MaterialLink
sx={{
color: theme => theme.palette.getContrastText(theme.palette.primary.main),
'&:hover': {
color: theme =>
theme.palette.getContrastText(theme.palette.primary.dark),
},
}}
{...props}
component={RouterLink}
/>
);

const PlaygroundPageBinding = () => {
const params = useParamsDecoded<Browse3TabItemParams>();
return (
Expand All @@ -1074,79 +1014,3 @@ const PlaygroundPageBinding = () => {
/>
);
};

const Browse3Breadcrumbs: FC = props => {
const params = useParamsDecoded<Browse3Params>();
const query = useURLSearchParamsDict();
const filePathParts = query.path?.split('/') ?? [];
const refFields = query.extra?.split('/') ?? [];

return (
<Breadcrumbs>
{params.entity && (
<AppBarLink to={`/${URL_BROWSE3}/${params.entity}`}>
{params.entity}
</AppBarLink>
)}
{params.project && (
<AppBarLink to={`/${URL_BROWSE3}/${params.entity}/${params.project}`}>
{params.project}
</AppBarLink>
)}
{params.tab && (
<AppBarLink
to={`/${URL_BROWSE3}/${params.entity}/${params.project}/${params.tab}`}>
{params.tab}
</AppBarLink>
)}
{params.itemName && (
<AppBarLink
to={`/${URL_BROWSE3}/${params.entity}/${params.project}/${params.tab}/${params.itemName}`}>
{params.itemName}
</AppBarLink>
)}
{params.version && (
<AppBarLink
to={`/${URL_BROWSE3}/${params.entity}/${params.project}/${params.tab}/${params.itemName}/versions/${params.version}`}>
{params.version}
</AppBarLink>
)}
{filePathParts.map((part, idx) => (
<AppBarLink
key={idx}
to={`/${URL_BROWSE3}/${params.entity}/${params.project}/${
params.tab
}/${params.itemName}/versions/${
params.version
}?path=${encodeURIComponent(
filePathParts.slice(0, idx + 1).join('/')
)}`}>
{part}
</AppBarLink>
))}
{_.range(0, refFields.length, 2).map(idx => (
<React.Fragment key={idx}>
<Typography
sx={{
color: theme =>
theme.palette.getContrastText(theme.palette.primary.main),
}}>
{refFields[idx]}
</Typography>
<AppBarLink
to={`/${URL_BROWSE3}/${params.entity}/${params.project}/${
params.tab
}/${params.itemName}/versions/${
params.version
}?path=${encodeURIComponent(
filePathParts.join('/')
)}&extra=${encodeURIComponent(
refFields.slice(0, idx + 2).join('/')
)}`}>
{refFields[idx + 1]}
</AppBarLink>
</React.Fragment>
))}
</Breadcrumbs>
);
};

0 comments on commit 444c04d

Please sign in to comment.