Skip to content

Commit

Permalink
fix: navigation tree working
Browse files Browse the repository at this point in the history
Signed-off-by: alejogm18 <[email protected]>
  • Loading branch information
alejoGM18 authored and Akarshit committed Aug 4, 2021
1 parent 79fee07 commit 87af77a
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 27,308 deletions.
6 changes: 3 additions & 3 deletions imports/client/ui/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ThemeProvider } from "styled-components";
import { ThemeProvider as MuiThemeProvider } from "@material-ui/core/styles";
import { ApolloProvider } from "react-apollo";
import { DndProvider } from "react-dnd";
import HTML5Backend from "react-dnd-html5-backend";
import { HTML5Backend } from "react-dnd-html5-backend";
import { ComponentsProvider } from "@reactioncommerce/components-context";
import { TranslationProvider } from "/imports/plugins/core/ui/client/providers";
import initApollo from "/imports/plugins/core/graphql/lib/helpers/initApollo";
Expand Down Expand Up @@ -68,7 +68,7 @@ Meteor.startup(() => {

Tracker.autorun((computation) => {
const primaryShopSub = Meteor.subscribe("PrimaryShop");

const el = document.getElementsByTagName("body");
if (primaryShopSub.ready()) {
ReactDOM.render(
(
Expand All @@ -80,7 +80,7 @@ Meteor.startup(() => {
<ThemeProvider theme={theme}>
<MuiThemeProvider theme={defaultTheme}>
<SnackbarProvider anchorOrigin={snackbarPosition} maxSnack={3}>
<DndProvider backend={HTML5Backend}>
<DndProvider backend={HTML5Backend} options={{ rootElement: el }}>
<Route>
{(routeProps) => (
<RouterContext.Provider value={routeProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React, { Component } from "react";
import PropTypes from "prop-types";
import withStyles from "@material-ui/core/styles/withStyles";
import Button from "@material-ui/core/Button";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import NavigationItemCard from "./NavigationItemCard";


const styles = (theme) => ({
root: {
display: "flex",
Expand Down Expand Up @@ -63,16 +64,18 @@ class NavigationItemList extends Component {
render() {
const { classes, onClickAddNavigationItem } = this.props;
return (
<div className={classes.root}>
<div className={classes.header}>
<Button color="primary" variant="outlined" onClick={onClickAddNavigationItem}>Add navigation item</Button>
</div>
<div className={classes.list}>
<div className={classes.listContent}>
{this.renderNavigationItems()}
<DndProvider backend={HTML5Backend}>
<div className={classes.root}>
<div className={classes.header}>
<Button color="primary" variant="outlined" onClick={onClickAddNavigationItem}>Add navigation item</Button>
</div>
<div className={classes.list}>
<div className={classes.listContent}>
{this.renderNavigationItems()}
</div>
</div>
</div>
</div>
</DndProvider>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IconButton from "@material-ui/core/IconButton";
import withStyles from "@material-ui/core/styles/withStyles";
import PencilIcon from "mdi-material-ui/Pencil";
import CloseIcon from "mdi-material-ui/Close";
import { SortableTreeWithoutDndContext as SortableTree, removeNodeAtPath } from "react-sortable-tree";
import SortableTree, { removeNodeAtPath } from "react-sortable-tree";
import "react-sortable-tree/style.css";
import ConfirmDialog from "@reactioncommerce/catalyst/ConfirmDialog";
import SortableTheme from "./SortableTheme";
Expand All @@ -30,7 +30,7 @@ class NavigationTreeContainer extends Component {
}

static defaultProps = {
onSetSortableNavigationTree() {}
onSetSortableNavigationTree() { }
}

getNodeKey = ({ treeIndex }) => treeIndex;
Expand Down
Loading

0 comments on commit 87af77a

Please sign in to comment.