Skip to content

Commit

Permalink
Add sample graph cord 19.
Browse files Browse the repository at this point in the history
  • Loading branch information
RSLi committed Jun 8, 2020
1 parent 3c30b23 commit bfb690b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
26 changes: 18 additions & 8 deletions argo-lite/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import argologo from '../images/argologo.png';

import {LOGO_URL, GITHUB_URL} from '../constants';
import {LOGO_URL, GITHUB_URL, SAMPLE_GRAPH_SNAPSHOTS} from '../constants';

@observer
class RegularNavbar extends React.Component {
Expand Down Expand Up @@ -49,13 +49,23 @@ class RegularNavbar extends React.Component {
content={
<Menu>
<MenuItem text="Load Sample" iconName="graph">
<MenuItem
iconName="graph"
text="Les Miserables"
onClick={() => {
window.loadAndDisplaySnapshotFromURL("https://argo-graph-lite.s3.amazonaws.com/lesmiserables.json");
}}
/>
{
SAMPLE_GRAPH_SNAPSHOTS.map((sample) => {
const sampleSnapshotTitle = sample[0];
const sampleSnapshotStrapiUuid = sample[1];

return (
<MenuItem
iconName="graph"
text={sampleSnapshotTitle}
onClick={() => {
window.loadAndDisplaySnapshotFromStrapi(sampleSnapshotStrapiUuid);
}}
/>
);
})
}

</MenuItem>
<MenuDivider />
<MenuItem
Expand Down
4 changes: 4 additions & 0 deletions argo-lite/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export const GITHUB_URL = "https://github.com/poloclub/argo-graph-lite";
export const BACKEND_URL = "https://argo-share.herokuapp.com"; // for production
// export const BACKEND_URL = "https://sleepy-brushlands-57948.herokuapp.com"; // for free heroku
// export const BACKEND_URL = "http://localhost:1337"; // for local strapi development
export const SAMPLE_GRAPH_SNAPSHOTS = [
["Les Miserables", "3b5f746f-19a5-44d1-99ea-407ff9e47a0e"],
["CORD-19 Citation Graph 06-02", "4bf882d3-8966-4f41-a590-acafeb998d2a"]
];

// When resizing window or running on mobile,
// used to determine whether screen
Expand Down
1 change: 1 addition & 0 deletions argo-lite/src/stores/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const loadAndDisplaySnapshotFromStrapi = (uuid) => {
};

window.loadAndDisplaySnapshotFromURL = loadAndDisplaySnapshotFromURL;
window.loadAndDisplaySnapshotFromStrapi = loadAndDisplaySnapshotFromStrapi;

window.loadInitialSampleGraph = async () => {
// default fallback url
Expand Down

0 comments on commit bfb690b

Please sign in to comment.