Skip to content

Commit

Permalink
refactored user component routes into one
Browse files Browse the repository at this point in the history
  • Loading branch information
jalajcodes committed Sep 24, 2020
1 parent 2653da8 commit 83ce28e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
17 changes: 10 additions & 7 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ApolloClient, InMemoryCache, ApolloProvider, useMutation, createHttpLin
import { setContext } from '@apollo/client/link/context';
import { LOG_IN } from './lib/graphql/mutations/LogIn';
import { LogIn as LogInData, LogInVariables } from './lib/graphql/mutations/LogIn/__generated__/LogIn';
import './styles/index.less';
import { Layout, Affix, Spin } from 'antd';
import { Viewer } from './lib/types';
import ViewerStateContext from '../src/lib/context/ViewerStateContext';
import * as serviceWorker from './serviceWorker';
import './styles/index.less';

// Components
import { AppHeader, Home, User, Listings, Listing, Host, NotFound, Login, Stripe, EditListing } from './sections';
Expand Down Expand Up @@ -110,15 +110,18 @@ const App = () => {
<Route exact path="/login">
<Login />
</Route>
<Route exact path="/user/:id">
<Route exact path="/user/:id/">
<User />
</Route>
<Route exact path="/user/:id/listings">
<User />
</Route>
<Route exact path="/user/:id/bookings">
<User />
<Route exact path={['/user/:id/', '/user/:id/listings', '/user/:id/bookings']}>
<User /> {/* User components handles the ".../listings" & ".../bookings" routes */}
</Route>
{/* <Route exact path="/user/:id/listings">
<User />
</Route>
<Route exact path="/user/:id/bookings">
<User />
</Route> */}
<Route exact path="/stripe">
<Stripe />
</Route>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/User/Components/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const UserProfile = ({ user, viewerIsUser, refetch }: Props) => {
setViewer({ ...viewer, hasWallet: data.stripeDisconnect.hasWallet });
displaySuccessNotification(
`You have successfully disconnected from Stripe`,
`You'll to reconnect Stripe to continue to create listings`
`You'll have to reconnect Stripe to continue to create listings.`
);
refetch();
}
Expand Down
3 changes: 2 additions & 1 deletion src/sections/User/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ export const User = () => {
? ['2']
: match.path === '/user/:id/bookings'
? ['3']
: ['']
: ['1']
}>
<div className="user-sider__menuitem-avatar">
{/* <Avatar size={100} style={{ backgroundColor: iconColor }} icon={<UserOutlined />} /> */}
<Avatar size={100} src={user?.avatar} />
</div>
<Menu.Item key="1" icon={<UserOutlined />}>
Expand Down

0 comments on commit 83ce28e

Please sign in to comment.