-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from public-accountability/develop
interlocks2
- Loading branch information
Showing
21 changed files
with
410 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import React, { useCallback } from "react" | ||
import { useDispatch } from "react-redux" | ||
import IconButton from "@mui/material/IconButton" | ||
|
||
import { MdClose } from "react-icons/md" | ||
|
||
export default function HideAnnotationsButton() { | ||
const dispatch = useDispatch() | ||
const hide = useCallback(() => dispatch({ type: "TOGGLE_ANNOTATIONS" }), [dispatch]) | ||
|
||
return ( | ||
<div className="oligrapher-annotations-hide" onClick={hide} title="Hide annotations"> | ||
<IconButton aria-label="Hide annotations" title="Hide annotations" onClick={hide}> | ||
<MdClose /> | ||
</div> | ||
</IconButton> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react" | ||
import { useDispatch } from "react-redux" | ||
import IconButton from "@mui/material/IconButton" | ||
import { MdAddCircle, MdSelectAll } from "react-icons/md" | ||
|
||
export default function InterlocksActionButton({ interlocksState }) { | ||
const dispatch = useDispatch() | ||
|
||
const selectPreviousBatch = | ||
interlocksState.previousNodes && | ||
interlocksState.previousNodes.length > 0 && | ||
interlocksState.nodes === null | ||
|
||
if (selectPreviousBatch) { | ||
return ( | ||
<IconButton | ||
aria-label="select added nodes" | ||
onClick={() => dispatch({ type: "SELECT_PREVIOUS_INTERLOCKS" })} | ||
> | ||
<MdSelectAll /> | ||
</IconButton> | ||
) | ||
} else { | ||
return ( | ||
<IconButton | ||
aria-label="add all to map" | ||
disabled={interlocksState.nodes === null || interlocksState.nodes.length === 0} | ||
onClick={() => dispatch({ type: "ADD_ALL_INTERLOCKS" })} | ||
> | ||
<MdAddCircle /> | ||
</IconButton> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react" | ||
import List from "@mui/material/List" | ||
import ListItemText from "@mui/material/ListItemText" | ||
import ListItemButton from "@mui/material/ListItemButton" | ||
import type { LsNode } from "../datasources/littlesis3" | ||
import { useDispatch } from "react-redux" | ||
|
||
function NodeListItem({ node }) { | ||
const dispatch = useDispatch() | ||
|
||
return ( | ||
<ListItemButton | ||
alignItems="flex-start" | ||
dense={true} | ||
onClick={() => dispatch({ type: "ADD_INTERLOCKS_NODE", id: node.id })} | ||
> | ||
<ListItemText primary={node.name} secondary={node.description} /> | ||
</ListItemButton> | ||
) | ||
} | ||
|
||
export default function InterlocksNodeList({ nodes }: { nodes: LsNode[] }) { | ||
return ( | ||
<List className="oligrapher-interlocks-node-list"> | ||
{nodes.map(n => ( | ||
<NodeListItem key={n.id} node={n} /> | ||
))} | ||
</List> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.