Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e65c8ae
Added semantic ui css build step
RoseannaM Aug 9, 2018
5f5ad38
Remove old semantic css import
RoseannaM Aug 9, 2018
4c6f2d3
RoseannaM Aug 10, 2018
b0374ae
RoseannaM Aug 10, 2018
a4987cc
RoseannaM Aug 10, 2018
375f79d
Aligning login form correctly
RoseannaM Aug 10, 2018
4dec549
Changed npm scripts to yarn
RoseannaM Aug 14, 2018
0568e84
Merge pull request #7 from RoseannaM/semantic-ui-theming
bcomnes Aug 14, 2018
246b9f7
Apply prettier formatting
RoseannaM Aug 14, 2018
358b20a
Created navigation bar
RoseannaM Aug 15, 2018
d7ff82f
Fixing formatting
RoseannaM Aug 16, 2018
78cafac
WIP Customer layout screen.
RoseannaM Aug 20, 2018
f377386
Merge pull request #8 from RoseannaM/login-layout-update
bcomnes Aug 20, 2018
e270d81
Merge pull request #9 from RoseannaM/top-nav
bcomnes Aug 20, 2018
cf8314b
WIP: Reports design changes
RoseannaM Aug 26, 2018
f156867
Reports design changes
RoseannaM Oct 3, 2018
1e12e0b
Added Container Div
RoseannaM Oct 3, 2018
0fd36be
Updated readme with semantic ui info
RoseannaM Oct 4, 2018
f3b80ad
Orders Layout Changes
RoseannaM Oct 16, 2018
93764e9
Merge pull request #12 from RoseannaM/documentation-update
bcomnes Oct 23, 2018
3b75bab
Order Layout Changes
RoseannaM Oct 25, 2018
9989ef3
Merge pull request #14 from RoseannaM/orders-layout
bcomnes Oct 25, 2018
c823fc0
Merge branch 'dev' into order-layout
RoseannaM Oct 26, 2018
f241897
Merge branch 'dev' into reports-layout
RoseannaM Oct 26, 2018
29a7896
Fixing merge conflict
RoseannaM Oct 26, 2018
e1d8191
Fixing merge conflict
RoseannaM Oct 26, 2018
0874211
Added Number of Orders
RoseannaM Oct 26, 2018
25f44a7
Merge pull request #15 from RoseannaM/order-layout
bcomnes Oct 26, 2018
b5b5103
Merge branch 'dev' into reports-layout
RoseannaM Oct 26, 2018
46a43bd
Merge pull request #11 from RoseannaM/reports-layout
bcomnes Oct 26, 2018
d5fa300
Small fixes
RoseannaM Oct 27, 2018
b072d13
Merge branch 'dev' into orders-layout-fixes
RoseannaM Oct 28, 2018
55fc500
Merge pull request #16 from RoseannaM/orders-layout-fixes
bcomnes Nov 1, 2018
f90fd68
Fixed merge conflicts
RoseannaM Nov 2, 2018
79ac5f2
Merge pull request #10 from RoseannaM/customer-layout
bcomnes Nov 5, 2018
c727d78
Added Filtering
RoseannaM Nov 9, 2018
2011e48
Merge branch 'dev' into orders-layout-filtering
RoseannaM Nov 9, 2018
a99b06f
Merge pull request #17 from RoseannaM/orders-layout-filtering
bcomnes Nov 14, 2018
68ffbaa
Added not Eu filter
RoseannaM Dec 13, 2018
79ed3b0
Added delete user data button
RoseannaM Dec 14, 2018
79191ae
Added export customer data button
RoseannaM Dec 14, 2018
8b6db72
Updated gocommerce-js to latest version
RoseannaM Dec 14, 2018
14aee7b
Merge pull request #20 from RoseannaM/not-eu-filter
bcomnes Dec 18, 2018
59b3156
Merge pull request #21 from RoseannaM/customer-bulk-edit
bcomnes Dec 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ node_modules
coverage

# production
build
/build

# misc
.DS_Store
.env
npm-debug.log
.vscode
yarn-error.log

#semantic build
src/semantic/dist
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,25 @@ To use against a production gocommerce install, make sure to set environment var
* **REACT_APP_SITE_URL** the URL of the ecommerce website
* **REACT_APP_NETLIFY_AUTH** the URL of the GoTrue instance used to manage authentication
* **REACT_APP_NETLIFY_COMMERCE** The URL of the GoCommerce instance

## Semantic UI Styling
This UI uses a custom theme built using [Semantic UI React](https://react.semantic-ui.com/theming) framework.

To make changes to the theme, modifiy the variable and override files (which are stored inside the `collections`, `elements`, `globals`, `modules` and `views` folders) inside the site folder.
```
src/semantic/src/site
```
It is inside here you will find the files for all component styles and variables.
More information about how to create and work with Semantic's theming can be found here:
[Semantic theming](https://semantic-ui.com/usage/theming.html)

To build all css files run:
```
yarn build:css
```
This compiles the variable and overide files to css files.

To watch for css changes run:
```
yarn watch:css
```
43 changes: 35 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,58 @@
"eslint": "^3.19.0",
"eslint-plugin-flowtype": "^2.32.1",
"flow-bin": "^0.37.4",
"react-scripts": "0.9.5"
"react-scripts": "0.9.5",
"react-to-print": "^2.0.0-alpha-4"
},
"dependencies": {
"better-console": "^1.0.1",
"csvexport": "^1.0.2",
"date-fns": "^1.21.0",
"director": "^1.2.8",
"gocommerce-js": "^3.9.0",
"gocommerce-js": "^4.4.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-chmod": "^2.0.0",
"gulp-clean-css": "^3.7.0",
"gulp-clone": "^1.1.3",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^2.3.0",
"gulp-dedupe": "^0.0.2",
"gulp-flatten": "^0.3.1",
"gulp-header": "^1.8.9",
"gulp-help": "^1.6.1",
"gulp-if": "^2.0.2",
"gulp-less": "^3.3.2",
"gulp-plumber": "^1.1.0",
"gulp-print": "^2.0.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-rtlcss": "^1.0.0",
"gulp-uglify": "^3.0.0",
"gulp-watch": "^4.3.11",
"history": "^4.5.0",
"jwt-decode": "^2.1.0",
"lodash": "^4.17.4",
"mdi-react": "^4.1.0",
"money": "^0.2.0",
"netlify-auth-js": "^0.5.2",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-gravatar": "^2.6.1",
"semantic-ui-css": "^2.2.4",
"semantic-ui-react": "^0.62.1"
"require-dot-file": "^0.4.0",
"run-sequence": "^2.1.0",
"semantic-ui-react": "^0.62.1",
"yamljs": "^0.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build:css": "cd src/semantic && gulp build",
"start": "yarn build:css && react-scripts start",
"build": "yarn build:css && react-scripts build",
"watch:css": "cd src/semantic && gulp watch",
"test": "react-scripts test --env=jsdom",
"lint": "npm run lint:js",
"lint": "yarn lint:js",
"lint:js": "eslint .",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:js:fix": "yarn lint:js -- --fix",
"eject": "react-scripts eject",
"flow": "flow"
}
Expand Down
11 changes: 10 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.App {}
.Main {
margin-left: 15rem;
margin: 0 7rem 0 7rem;
padding: 1rem;
margin-top: 50px;
}

.tr-clickable {
Expand All @@ -15,3 +16,11 @@
.search-padding {
padding-bottom: 1rem;
}

@media only screen and (max-width: 767px){
.Main {
overflow-x: hidden;
margin: 0;
padding: 0;
}
}
137 changes: 83 additions & 54 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
// @flow
import type {User} from './Types';
import React, {PropTypes, Component} from 'react';
import director from 'director';
import Auth from 'netlify-auth-js';
import Commerce from 'gocommerce-js';
import Sidebar from './Components/Sidebar';
import {WithAuthentication, Customers, Discounts, Order, Orders, Reports} from './Components';
import 'semantic-ui-css/semantic.css';
import './App.css';
import config from './config/default.json';

const env = process.env.REACT_APP_ENV || 'dev';
import type { User } from "./Types";
import React, { PropTypes, Component } from "react";
import director from "director";
import Auth from "netlify-auth-js";
import Commerce from "gocommerce-js";
import {
WithAuthentication,
Navigation,
Customers,
Discounts,
Order,
Orders,
Reports
} from "./Components";
import "./semantic/dist/semantic.min.css";
import "./App.css";
import config from "./config/default.json";

const env = process.env.REACT_APP_ENV || "dev";
if (process.env.REACT_APP_SITE_URL) {
config.siteURL = process.env.REACT_APP_SITE_URL;
}
Expand All @@ -27,12 +34,12 @@ if (process.env.REACT_APP_RECEIPT_TEMPLATE) {
config.receiptTemplate = process.env.REACT_APP_RECEIPT_TEMPLATE;
}

const auth = new Auth({APIUrl: config.netlifyAuth});
const commerce = new Commerce({APIUrl: config.netlifyCommerce});
const auth = new Auth({ APIUrl: config.netlifyAuth });
const commerce = new Commerce({ APIUrl: config.netlifyCommerce });

type Router = {
init: () => void,
setRoute: (string) => void
setRoute: string => void
};

function NotFound(props) {
Expand All @@ -51,8 +58,8 @@ class App extends Component {
props: {};
state: {
user: ?User,
route: 'reports' | 'orders' | 'order' | 'customers',
active: 'Reports' | 'Orders' | 'Customers',
route: "reports" | "orders" | "order" | "customers",
active: "Reports" | "Orders" | "Customers",
params: {},
query: ?{}
};
Expand All @@ -63,43 +70,55 @@ class App extends Component {
router: PropTypes.object
};

constructor(props : {}) {
constructor(props: {}) {
super(props);
const user = auth.currentUser();
const user = auth.currentUser();
commerce.setUser(user);
this.state = {user, route: "reports", active: "Reports", params: {}, query: null};
this.state = {
user,
route: "reports",
active: "Reports",
params: {},
query: null
};
}

componentDidMount() {
this.router = new director.Router({
"/": () => this.setState({route: "reports", active: "Reports"}),
"/orders": () => this.setState({route: "orders", active: "Orders"}),
"/orders/:id": (id) => this.setState({route: "order", active: "Orders", params: {id}}),
"/orders/:id/:item": (id, item) => this.setState({route: "order", active: "Orders", params: {id, item}}),
"/customers": () => this.setState({route: "customers", active: "Customers"}),
}).configure({html5history: true});
"/": () => this.setState({ route: "reports", active: "Reports" }),
"/orders": () => this.setState({ route: "orders", active: "Orders" }),
"/orders/:id": id =>
this.setState({ route: "order", active: "Orders", params: { id } }),
"/orders/:id/:item": (id, item) =>
this.setState({
route: "order",
active: "Orders",
params: { id, item }
}),
"/customers": () =>
this.setState({ route: "customers", active: "Customers" })
}).configure({ html5history: true });
this.router.init();
}

handleLogin = (email: string, password: string) => {
return auth.login(email, password)
.then((user) => {
user.persistSession(user);
commerce.setUser(user);
this.setState({user});
return user;
});
return auth.login(email, password).then(user => {
user.persistSession(user);
commerce.setUser(user);
this.setState({ user });
return user;
});
};

handleLogout = () => {
const {user} = this.state;
const { user } = this.state;
user && user.logout();
this.setState({user: null});
this.setState({ user: null });
};

handleLink = (e: SyntheticInputEvent) => {
e.preventDefault();
const path = e.target.getAttribute('href');
const path = e.target.getAttribute("href");
if (path) {
this.handlePush(path);
}
Expand All @@ -110,27 +129,37 @@ class App extends Component {
};

render() {
const {user, route, active, params, query} = this.state;
const { user, route, active, params, query } = this.state;

const component = MainComponent[route] || null;

return (<div className="App">
<WithAuthentication user={user} onLogin={this.handleLogin}>
<Sidebar
active={active}
config={config}
user={user}
route={route}
onLink={this.handleLink}
onLogout={this.handleLogout}
/>
<div className="Main">
{component && React.createElement(component, {
config, route, commerce, user, params, query, push: this.handlePush, onLink: this.handleLink
})}
</div>
</WithAuthentication>
</div>);
return (
<div className="App">
<WithAuthentication user={user} onLogin={this.handleLogin}>
<Navigation
active={active}
config={config}
user={user}
route={route}
onLink={this.handleLink}
onLogout={this.handleLogout}
/>
<div className="Main">
{component &&
React.createElement(component, {
config,
route,
commerce,
user,
params,
query,
push: this.handlePush,
onLink: this.handleLink
})}
</div>
</WithAuthentication>
</div>
);
}
}

Expand Down
Loading