Skip to content

Commit

Permalink
Merge branch 'main' into 426-donut-marker-config-panel
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Sep 13, 2023
2 parents 2cb2efc + ebe2137 commit 7d936b9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/libs/eda/src/lib/map/analysis/MapAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ function MapAnalysisImpl(props: ImplProps) {
>
<MapSideNavigation
isExpanded={sideNavigationIsExpanded}
isUserLoggedIn={userLoggedIn}
onToggleIsExpanded={() =>
setSideNavigationIsExpanded((isExpanded) => !isExpanded)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/eda/src/lib/map/analysis/MapHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function HeaderContent({
{safeHtml(studyName)}
</span>
<SaveableTextEditor
displayValue={() => <span>{analysisName}</span>}
displayValue={analysisName}
maxLength={ANALYSIS_NAME_MAX_LENGTH}
onSave={onAnalysisNameEdit}
value={analysisName}
Expand Down
26 changes: 21 additions & 5 deletions packages/libs/eda/src/lib/map/analysis/MapSideNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ChevronRight } from '@veupathdb/coreui';
import { Launch, LockOpen } from '@material-ui/icons';
import { Launch, LockOpen, Person } from '@material-ui/icons';
import {
mapNavigationBackgroundColor,
mapNavigationBorder,
SiteInformationProps,
} from '..';
import { Link } from 'react-router-dom';

export type MapSideNavigationProps = {
/** The navigation is stateless. */
Expand All @@ -14,6 +15,7 @@ export type MapSideNavigationProps = {
onToggleIsExpanded: () => void;
activeNavigationMenu?: React.ReactNode;
siteInformationProps: SiteInformationProps;
isUserLoggedIn: boolean | undefined;
};

const bottomLinkStyles: React.CSSProperties = {
Expand All @@ -34,6 +36,7 @@ export function MapSideNavigation({
isExpanded,
onToggleIsExpanded,
siteInformationProps,
isUserLoggedIn,
}: MapSideNavigationProps) {
const sideMenuExpandButtonWidth = 20;

Expand Down Expand Up @@ -168,10 +171,23 @@ export function MapSideNavigation({
</a>
</li>
<li>
<a style={bottomLinkStyles} href={siteInformationProps.loginUrl}>
<LockOpen />
<p style={{ margin: '0 0 0 5px' }}>Login</p>
</a>
{isUserLoggedIn == null ? null : isUserLoggedIn ? (
<Link style={bottomLinkStyles} to="/user/profile">
<Person />
<p style={{ margin: '0 0 0 5px' }}>My profile</p>
</Link>
) : (
<Link
style={bottomLinkStyles}
to={
siteInformationProps.loginUrl +
`?destination=${window.location.href}`
}
>
<LockOpen />
<p style={{ margin: '0 0 0 5px' }}>Login</p>
</Link>
)}
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ interface Props extends InputPropsWithoutOnChange {
onSave: (value: string) => void;
multiLine?: boolean;
className?: string;
displayValue?: (value: string, handleEdit: () => void) => React.ReactNode;
displayValue?:
| React.ReactNode
| ((value: string, handleEdit: () => void) => React.ReactNode);
emptyText?: string;
}

Expand Down

0 comments on commit 7d936b9

Please sign in to comment.