Skip to content

Commit

Permalink
removed unused files, deleted DrawerNavigationComponent since it was …
Browse files Browse the repository at this point in the history
…no longer needed
  • Loading branch information
sarahkeh committed Jan 16, 2025
1 parent c8f0b8b commit 5420a9b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 268 deletions.
70 changes: 25 additions & 45 deletions src/app/components/drawer/DrawerNavigation.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
/* eslint-disable relay/unused-fields */
import React from 'react';
import Relay from 'react-relay/classic';
import { QueryRenderer, graphql } from 'react-relay/compat';
import Drawer from '@material-ui/core/Drawer';
import DrawerRail from './DrawerRail';
import DrawerNavigationComponent from './DrawerNavigationComponent';
import FindPublicTeamRoute from '../../relay/FindPublicTeamRoute';
import teamPublicFragment from '../../relay/teamPublicFragment';
import ErrorBoundary from '../error/ErrorBoundary';

const DrawerNavigationContainer = Relay.createContainer(DrawerNavigationComponent, {
fragments: {
team: () => teamPublicFragment,
},
});
import DrawerContent from './index.js';
import styles from './Drawer.module.css';

const getBooleanPref = (key, fallback) => {
const inStore = window.storage.getValue(key);
Expand All @@ -33,10 +26,6 @@ const DrawerNavigation = (parentProps) => {
if (parentProps.teamSlug) {
const { teamSlug } = parentProps;

const route = new FindPublicTeamRoute({ teamSlug });

console.log(teamSlug); //eslint-disable-line

return (
<>
<ErrorBoundary component="DrawerNavigation">
Expand All @@ -45,30 +34,33 @@ const DrawerNavigation = (parentProps) => {
query={graphql`
query DrawerNavigationQuery($teamSlug: String!) {
find_public_team(slug: $teamSlug) {
id,
name,
avatar,
dbid,
private,
slug,
team_graphql_id,
trash_count,
spam_count,
pusher_channel,
...DrawerRail_team
}
}
`}
render={({ error, props }) => {
if (!error && props) {
return (
<DrawerRail
currentUserIsMember={parentProps.currentUserIsMember}
drawerOpen={drawerOpen}
drawerType={drawerType}
team={props.find_public_team}
onDrawerOpenChange={setDrawerOpen}
onDrawerTypeChange={setDrawerType}
/>
<>
<DrawerRail
currentUserIsMember={parentProps.currentUserIsMember}
drawerOpen={drawerOpen}
drawerType={drawerType}
team={props.find_public_team}
onDrawerOpenChange={setDrawerOpen}
onDrawerTypeChange={setDrawerType}
/>
<Drawer
anchor="left"
className={[styles.drawer, drawerOpen ? styles.drawerOpen : styles.drawerClosed].join(' ')}
open={Boolean(drawerOpen)}
variant="persistent"
>
{parentProps.currentUserIsMember ? (
<DrawerContent drawerType={drawerType} />
) : null }
</Drawer>
</>
);
}
return null;
Expand All @@ -78,23 +70,11 @@ const DrawerNavigation = (parentProps) => {
}}
/>
</ErrorBoundary>
<Relay.RootContainer
Component={DrawerNavigationContainer}
renderFetched={
data => (<DrawerNavigationContainer
drawerOpen={drawerOpen}
drawerType={drawerType}
{...parentProps}
{...data}
/>)
}
route={route}
/>
</>
);
}

return <><DrawerRail {...parentProps} /><DrawerNavigationComponent {...parentProps} /></>;
return <><DrawerRail {...parentProps} /></>;
};

export default DrawerNavigation;
114 changes: 0 additions & 114 deletions src/app/components/drawer/DrawerNavigationComponent.js

This file was deleted.

76 changes: 0 additions & 76 deletions src/app/components/drawer/DrawerNavigationComponent.test.js

This file was deleted.

11 changes: 9 additions & 2 deletions src/app/components/drawer/DrawerRail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
import { injectIntl, defineMessages } from 'react-intl';
import { createFragmentContainer, graphql } from 'react-relay/compat';
import cx from 'classnames/bind';
import Tooltip from '../cds/alerts-and-prompts/Tooltip';
import TeamAvatar from '../team/TeamAvatar';
Expand Down Expand Up @@ -147,7 +148,7 @@ const DrawerRail = ({
<div className={styles.railIconLink}>
<ChevronLeftIcon />
</div>
<TeamAvatar className={styles.teamLogo} size="44px" team={team} />
<TeamAvatar className={styles.teamLogo} size="44px" team={{ avatar: team.avatar }} />
</button>
</Tooltip>
<ContentFilterControls />
Expand Down Expand Up @@ -303,4 +304,10 @@ DrawerRail.propTypes = {
onDrawerTypeChange: PropTypes.func.isRequired,
};

export default injectIntl(DrawerRail);
export default createFragmentContainer(injectIntl(DrawerRail), graphql`
fragment DrawerRail_team on PublicTeam {
slug
private
avatar
}
`);
13 changes: 0 additions & 13 deletions src/app/relay/FindPublicTeamRoute.js

This file was deleted.

18 changes: 0 additions & 18 deletions src/app/relay/teamPublicFragment.js

This file was deleted.

0 comments on commit 5420a9b

Please sign in to comment.