Skip to content

Commit

Permalink
[MergeDups] Add ? icon in sidebar linking to User Guide (#2969)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Apr 4, 2024
1 parent 8131431 commit 61eac07
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 15 deletions.
Binary file modified docs/user_guide/assets/images/mergeSidebar.es.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user_guide/assets/images/mergeSidebar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user_guide/assets/images/mergeSidebar.zh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user_guide/assets/images/mergeSidebarMove.es.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user_guide/assets/images/mergeSidebarMove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/AppBar/UserGuideButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function UserGuideButton(): ReactElement {
<Button
color="inherit"
id="app-bar-guide"
onClick={openUserGuide}
onClick={() => openUserGuide()}
style={{
background: themeColors.lightShade,
margin: 5,
Expand Down
2 changes: 1 addition & 1 deletion src/components/InvalidLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function InvalidLink(props: InvalidLinkProps): ReactElement {
{/* User Guide, Sign Up, and Log In buttons */}
<Grid container justifyContent="flex-end" spacing={2}>
<Grid item xs={4} sm={6}>
<Button id={`${idAffix}-guide`} onClick={openUserGuide}>
<Button id={`${idAffix}-guide`} onClick={() => openUserGuide()}>
<Help />
</Button>
</Grid>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export default function Login(): ReactElement {
{/* User Guide, Sign Up, and Log In buttons */}
<Grid container justifyContent="space-between">
<Grid item xs={1}>
<Button id={LoginId.ButtonUserGuide} onClick={openUserGuide}>
<Button
id={LoginId.ButtonUserGuide}
onClick={() => openUserGuide()}
>
<Help />
</Button>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArrowForwardIos } from "@mui/icons-material";
import { IconButton, Typography } from "@mui/material";
import { ArrowForwardIos, HelpOutline } from "@mui/icons-material";
import { Grid, IconButton, Typography } from "@mui/material";
import { ReactElement } from "react";
import { Droppable } from "react-beautiful-dnd";

Expand All @@ -8,6 +8,7 @@ import { MergeTreeSense } from "goals/MergeDuplicates/MergeDupsTreeTypes";
import { setSidebar } from "goals/MergeDuplicates/Redux/MergeDupsActions";
import { StoreState } from "types";
import { useAppDispatch, useAppSelector } from "types/hooks";
import { openUserGuide } from "utilities/pathUtilities";

export default function SidebarDrop(): ReactElement {
const dispatch = useAppDispatch();
Expand All @@ -30,13 +31,20 @@ export default function SidebarDrop(): ReactElement {
{...providedDroppable.droppableProps}
style={{ backgroundColor: "lightblue", height: "100%", padding: 20 }}
>
<IconButton
onClick={() => dispatch(setSidebar())}
id="sidebar-close"
size="large"
>
<ArrowForwardIos />
</IconButton>
<Grid container justifyContent="space-between">
<IconButton
id="sidebar-close"
onClick={() => dispatch(setSidebar())}
>
<ArrowForwardIos />
</IconButton>
<IconButton
id="sidebar-help"
onClick={() => openUserGuide("goals.html#merge-a-sense")}
>
<HelpOutline />
</IconButton>
</Grid>
<Typography variant="h5">{vernacular}</Typography>
{sidebar.mergeSenses.map((ms: MergeTreeSense, i: number) => (
<SidebarDragSense key={ms.sense.guid} index={i} mergeSense={ms} />
Expand Down
6 changes: 3 additions & 3 deletions src/utilities/pathUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function getWindowOrigin(): string {

/** Open the user guide in a new tab.
* Leads to a 404 in development.
*/
export function openUserGuide(): void {
* Optional `page` could be, e.g., "account.html#log-in". */
export function openUserGuide(page = ""): void {
const origin = getWindowOrigin();
window.open(`${origin}/docs/`);
window.open(`${origin}/docs/${page}`);
}

/**
Expand Down

0 comments on commit 61eac07

Please sign in to comment.