Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
make data page the home page
Browse files Browse the repository at this point in the history
  • Loading branch information
erinz2020 committed Jan 16, 2024
1 parent 7b087d1 commit d6e9081
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 176 deletions.
7 changes: 5 additions & 2 deletions src/AuthenticatedSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,12 @@ export default function AuthenticatedSwitch({
<Route path="/welcome">
<Welcome />
</Route>
<Route path="/" exact>
<Route path="/user-profile" exact>
<Home />
</Route>
<Route path="/" exact>
<DataPage />
</Route>
<Route>
<FourOhFour />
</Route>
Expand All @@ -235,4 +238,4 @@ export default function AuthenticatedSwitch({
/>
</main>
);
}
}
2 changes: 1 addition & 1 deletion src/components/AuthenticatedAppHeader/ActionsPane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function NotificationsPane({
onClose={closePopover}
>
<MenuList style={{ minWidth: 270 }}>
<Link href="/" onClick={closePopover} noUnderline>
<Link href="/user-profile" onClick={closePopover} noUnderline>
<MenuItem style={{ minHeight: 'auto' }}>
<Avatar
style={{ height: 52, width: 52 }}
Expand Down
277 changes: 112 additions & 165 deletions src/components/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import CardContent from '@material-ui/core/CardContent';
import { Typography } from '@material-ui/core';
import { getHighestRoleLabelId } from '../utils/roleUtils';
import useUserMetadataSchemas from '../models/users/useUserMetadataSchemas';
import useGetUserSightings from '../models/users/useGetUserSightings';
import useGetUserUnprocessedAssetGroupSightings from '../models/users/useGetUserUnproccessedAssetGroupSightings';
import { formatDate, formatUserMessage } from '../utils/formatters';
import EntityHeader from './EntityHeader';
import BigAvatar from './profilePhotos/BigAvatar';
Expand All @@ -22,7 +20,6 @@ import SadScreen from './SadScreen';
import EditUserMetadata from './EditUserMetadata';
import Text from './Text';
import RequestCollaborationButton from './RequestCollaborationButton';
import SightingsCard from './cards/SightingsCard';
import MyCollaborationsCard from './cards/MyCollaborationsCard';
import UserManagerCollaborationsCard from './cards/UserManagerCollaborationsCard';
import CardContainer from './cards/CardContainer';
Expand All @@ -40,13 +37,9 @@ export default function UserProfile({
viewerIsUserManager,
noCollaborate = false,
}) {
const { data: sightingsData, loading: sightingsLoading } =
useGetUserSightings(userId);
const intl = useIntl();
const [editingProfile, setEditingProfile] = useState(false);
const metadataSchemas = useUserMetadataSchemas(userId);
const { data: agsData, loading: agsLoading } =
useGetUserUnprocessedAssetGroupSightings(userId);

const metadata = useMemo(() => {
if (!userData || !metadataSchemas) return [];
Expand Down Expand Up @@ -104,120 +97,108 @@ export default function UserProfile({
open={preferenceModalOpen}
onClose={() => setPreferenceModalOpen(false)}
/>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
marginTop: 90,
marginLeft: 8,
marginRight: 8,
}}
>
<CardContainer size="large" style={{ padding: 20 }}>
<Card size="large" style={{ width: '100%' }}>
<CardContent>
<EntityHeader
name={name}
editable
noDivider
onSettingsClick={
() => setEditingProfile(true) // ???
}
renderAvatar={
<BigAvatar
// editable
userId={userId}
imageGuid={imageGuid}
imageSrc={imageSrc}
name={name}
refreshUserData={refreshUserData}
userDataLoading={userDataLoading}
/>
}
renderOptions={
noCollaborate ? undefined : (
<RequestCollaborationButton
otherUserId={userId}
/>
)
}

<CardContainer size="large" style={{ padding: 20 }}>
<Card size="large" style={{ width: '100%' }}>
<CardContent>
<EntityHeader
name={name}
editable
noDivider
onSettingsClick={
() => setEditingProfile(true) // ???
}
renderAvatar={
<BigAvatar
userId={userId}
imageGuid={imageGuid}
imageSrc={imageSrc}
name={name}
refreshUserData={refreshUserData}
userDataLoading={userDataLoading}
/>
}
renderOptions={
noCollaborate ? undefined : (
<RequestCollaborationButton otherUserId={userId} />
)
}
>
<div
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
}}
>
<div
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
}}
style={{ display: 'flex', flexDirection: 'row' }}
>
<div
style={{ display: 'flex', flexDirection: 'row' }}
{communityUsername && (
<>
<Typography variant="body2">
{`@${communityUsername}`}
</Typography>
<div
style={{
height: '20px',
width: '2px',
backgroundColor: 'gray',
margin: '0 10px',
}}
/>
</>
)}

<Text
variant="body2"
domId="selenium-user-since"
id="USER_SINCE"
values={{ date: dateCreated }}
/>
</div>
<div
style={{ display: 'flex', flexDirection: 'row' }}
>
<Button
display="primary"
style={{ marginRight: 10 }}
onClick={() => setEditingProfile(true)}
>
{communityUsername && <>
<Typography
variant="body2"
>
{`@${communityUsername}`}
</Typography>
<div
style={{
height: '20px',
width: '2px',
backgroundColor: 'gray',
margin: '0 10px',
}}
/>
</>}

<Text
variant="body2"
domId="selenium-user-since"
id="USER_SINCE"
values={{ date: dateCreated }}
/>
</div>
<div
style={{ display: 'flex', flexDirection: 'row' }}
<EditOutlined />
</Button>
<Button
display="primary"
style={{ marginRight: 10 }}
onClick={() => setPreferenceModalOpen(true)}
>
<Button
display="primary"
style={{ marginRight: 10 }}
onClick={() => setEditingProfile(true)}
>
<EditOutlined />
</Button>
<Button
display="primary"
style={{ marginRight: 10 }}
onClick={() => setPreferenceModalOpen(true)}
>
<SettingsOutlined />
</Button>
</div>
<SettingsOutlined />
</Button>
</div>
<Chip
label={highestRoleLabelId}
style={{
marginTop: 14,
color: theme.palette.common.black,
backgroundColor:
theme.palette.primary.main + '26',
}}
/>
</EntityHeader>
<UserProfileMetaDataDisplay
email={email}
location={location}
affiliation={affiliation}
</div>
<Chip
label={highestRoleLabelId}
style={{
marginTop: 14,
color: theme.palette.common.black,
backgroundColor: theme.palette.primary.main + '26',
}}
/>
</CardContent>
</Card>
</CardContainer>
</div>
</EntityHeader>
<UserProfileMetaDataDisplay
email={email}
location={location}
affiliation={affiliation}
/>
</CardContent>
</Card>
</CardContainer>

{children}
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
<CardContainer size="large">

<CardContainer size="large" style={{ padding: 20 }}>
<div style={{ height: 10 }} />

{/* <UserProjectCard
renderActions={<IconButton><AddIcon /></IconButton>}
projects={[
Expand All @@ -227,60 +208,26 @@ export default function UserProfile({
]}
/> */}
</CardContainer>
<CardContainer size="large">
{!someoneElse && (
<Grid item xs={12} id="collab-card">
<MyCollaborationsCard userData={userData} />
</Grid>
)}
{someoneElse && viewerIsUserManager && (
<Grid item xs={12} id="collab-card">
<UserManagerCollaborationsCard userData={userData} />
</Grid>
)}
{/* <SightingsCard
id="pending-sightings-card"
title={
someoneElse
? intl.formatMessage(
{ id: 'USERS_UNPROCESSED_AGS' },
{ name },
)
: intl.formatMessage({ id: 'PENDING_SIGHTINGS' })
}
columns={['date', 'location', 'actions']}
sightings={agsData || []}
linkPath="pending-sightings"
noSightingsMsg={
someoneElse
? 'NO_PENDING_SIGHTINGS_NON_SELF'
: 'NO_PENDING_SIGHTINGS'
}
loading={agsLoading}
/>
<SightingsCard
id="sightings-card"
title={
someoneElse
? intl.formatMessage(
{ id: 'USERS_SIGHTINGS' },
{ name },
)
: intl.formatMessage({ id: 'SIGHTINGS' })
}
columns={[
'individual',
'date',
'locationIdValue',
'actions',
]}
hideSubmitted
sightings={sightingsData || []}
loading={sightingsLoading}
noSightingsMsg={
someoneElse ? 'NO_SIGHTINGS_NON_SELF' : 'NO_SIGHTINGS'
}
/> */}
<CardContainer
size="large"
style={{ padding: 20, marginTop: 30 }}
>
<Card size="large" style={{ width: '100%' }}>
<CardContent>
{!someoneElse && (
<Grid item xs={12} id="collab-card">
<MyCollaborationsCard userData={userData} />
</Grid>
)}
{someoneElse && viewerIsUserManager && (
<Grid item xs={12} id="collab-card">
<UserManagerCollaborationsCard
userData={userData}
/>
</Grid>
)}
</CardContent>
</Card>
</CardContainer>
</div>
</MainColumn>
Expand Down
15 changes: 7 additions & 8 deletions src/pages/dataPage/DataPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import SightingsCard from '../../components/cards/SightingsCard';
import CardContainer from '../../components/cards/CardContainer';
import useGetMe from '../../models/users/useGetMe';
import Text from '../../components/Text';
import HomeBreadcrumbs from '../home/HomeBreadcrumbs';
import ButtonLink from '../../components/ButtonLink';
import LoadingScreen from '../../components/LoadingScreen';

import useDeleteSighting from '../../models/sighting/useDeleteSighting';
Expand Down Expand Up @@ -107,12 +105,13 @@ export default function DataPage() {

return (
<MainColumn fullWidth>
<Text
variant="h3"
component="h3"
style={{ padding: '16px 0 16px 0px' }}
id="DATA_PAGE"
/>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<ButtonLink href="/" display="back" id="DATA_PAGE" />
<HomeBreadcrumbs
currentPageText="Data"
currentPageTextId="DATA_PAGE"
/>
<ConfirmDelete
open={deleteDialogOpen}
onClose={() => {
Expand Down Expand Up @@ -218,7 +217,7 @@ export default function DataPage() {
<Text
id={intl.formatMessage({ id: 'MY_PENDING_SIGHTINGS' })}
variant="h6"
style={{ marginLeft: 8 }}
// style={{ marginLeft: 8 }}
/>
</div>

Expand Down

0 comments on commit d6e9081

Please sign in to comment.