Skip to content

Commit

Permalink
Admin View Revamp (#1698)
Browse files Browse the repository at this point in the history
* update package.json with version 0.19.0

* added body class for current route based on theme and routeName

* PR #1655 re-merge (#1658)

* Variants without media to inherit media from their parents (#1664)

* optimised method by setting/getting session

* fixed import order

* React no-ui Slider implementation

* React MultiSelect component implementation

* add admin settings translation for templates (#1661)

* React MultiSelect component implementation (#1681)

* React no-ui Slider implementation (#1680)

* Route theme body class (#1672)

* added body class for current route based on theme and routeName

* optimised method by setting/getting session

* fixed import order

* get Registry for Current route for enabled package only

* Moving toolbars

Moved Admin toolbar (vertical one) to the left
Moved DashboardHeader template region to top
Moved ProductDetailsSimple toolbar into own component ( ProductToolbar )
Moved ProductToolbar to DashboardHeader template region in registry

* Adding react switch control

Updating button component to allow for better toggling
Update product toolbar and publish bar

* Improve layout and styles for switch component

* Clean up styles related to publish bar

* Toolbar reorg (#1713)

* Move dashboard to admin controls drawer

* admin links in account dropdown to open action view

* Added navigation stack to action view

Added back button to settings panel

* Added package list component for dashboard package list

Added List and ListItem components

* Code cleanup
Added basic styles for lists

* Adding react ActionView component

* Variable cleanup (#1712)

* removed old unused styles

* updated brand color hex: 1c98d5 -> 1999dd

* killed @brand-muted-color (for now, as it's currently unused)

* update font to Source Sans Pro in emails

* update search variables

* variables.less cleanup

* bright colors for secondary, accent, vivid color for easy visibility

* Added blaze react package

Fixing imports for actionView

* Added admin context provider

AdminContextProvider provides context props to all components wrapped
as Admin() components.

* CSS-IN-JS styles for admin view header with animations

* Added add product button

Added icon button with Reaction logo to open actionView

* Package list re-org

* Filter entries with a template

* Update package.json

* Added detail view to action view

* cleanup
  • Loading branch information
mikemurray authored Jan 17, 2017
1 parent f799a20 commit 6abf924
Show file tree
Hide file tree
Showing 71 changed files with 1,808 additions and 292 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ johanbrook:publication-collector


# Custom Packages
gadicc:blaze-react-component
1 change: 1 addition & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ email@1.1.18
es5-shim@4.6.15
facebook@1.2.10
fastclick@1.0.13
gadicc:blaze-react-component@1.4.0
geojson-utils@1.0.10
google@1.1.15
hot-code-push@1.0.4
Expand Down
5 changes: 4 additions & 1 deletion client/modules/accounts/templates/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ Template.loginDropdown.events({
});
}
});
} else if (this.route || this.name) {
} else if (this.name !== "account/profile") {
event.preventDefault();
/** TMP **/
Reaction.showActionView(this);
} else if (this.route || this.name) {
const route = this.name || this.route;
Reaction.Router.go(route);
}
Expand Down
94 changes: 89 additions & 5 deletions client/modules/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default {

setActionView(viewData) {
if (viewData) {
Session.set("admin/actionView", viewData);
Session.set("admin/actionView", [viewData]);
} else {
const registryItem = this.getRegistryForCurrentRoute(
"settings");
Expand All @@ -266,19 +266,102 @@ export default {
}
},

pushActionView(viewData) {
Session.set("admin/showActionView", true);

const actionViewStack = Session.get("admin/actionView");

if (viewData) {
actionViewStack.push(viewData);
Session.set("admin/actionView", actionViewStack);
} else {
const registryItem = this.getRegistryForCurrentRoute(
"settings");

if (registryItem) {
this.pushActionView(registryItem);
} else {
this.pushActionView({ template: "blankControls" });
}
}
},

isActionViewAtRootView() {
const actionViewStack = Session.get("admin/actionView");

if (Array.isArray(actionViewStack) && actionViewStack.length === 1) {
return true;
}

return false;
},

popActionView() {
const actionViewStack = Session.get("admin/actionView");
actionViewStack.pop();

Session.set("admin/actionView", actionViewStack);

this.setActionViewDetail({});
},

setActionViewDetail(viewData) {
if (viewData) {
Session.set("admin/detailView", [viewData]);
}
},

pushActionViewDetail(viewData) {
Session.set("admin/showActionView", true);

const detailViewStack = Session.get("admin/detailView");

if (viewData) {
detailViewStack.push(viewData);
Session.set("admin/detailView", detailViewStack);
}
},

popActionViewDetail() {
const detailViewStack = Session.get("admin/detailView");
detailViewStack.pop();

Session.set("admin/detailView", detailViewStack);
},

getActionView() {
return Session.get("admin/actionView") || {};
const actionViewStack = Session.get("admin/actionView");

if (Array.isArray(actionViewStack) && actionViewStack.length) {
return actionViewStack.pop();
}

return {};
},

getActionViewDetail() {
const detailViewStack = Session.get("admin/detailView");

if (Array.isArray(detailViewStack) && detailViewStack.length) {
return detailViewStack.pop();
}

return {};
},

hideActionView() {
Session.set("admin/showActionView", false);
},

clearActionView() {
Session.set("admin/actionView", {
Session.set("admin/actionView", [{
label: "",
i18nKeyLabel: ""
});
}]);
Session.set("admin/detailView", [{
label: "",
i18nKeyLabel: ""
}]);
},

getCurrentTag() {
Expand All @@ -295,7 +378,8 @@ export default {
// find registry entries for routeName
const reactionApp = Packages.findOne({
"registry.name": currentRouteName,
"registry.provides": provides
"registry.provides": provides,
"enabled": true
}, {
enabled: 1,
registry: 1,
Expand Down
227 changes: 227 additions & 0 deletions imports/plugins/core/dashboard/client/components/actionView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
import React, { Component, PropTypes } from "react";
import classnames from "classnames";
import Blaze from "meteor/gadicc:blaze-react-component";
import {
IconButton,
Translation
} from "/imports/plugins/core/ui/client/components";
import { Admin } from "/imports/plugins/core/ui/client/providers";
import Radium from "radium";
import Velocity from "velocity-animate";
import "velocity-animate/velocity.ui";
import { VelocityTransitionGroup } from "velocity-react";

const getStyles = (props) => {
let viewSize = 400;
// if (props.actionView && props.actionView.priority === 1 && props.actionView.provides === "dashboard") {
if (props.actionView && props.actionView.provides === "dashboard") {
viewSize = "90vw";
}

return {
base: {
display: "flex",
flexDirection: "column",
height: "100vh",
position: "relative",
width: viewSize
},
header: {
display: "flex",
alignItems: "center",
position: "relative",
height: "56px",
padding: "0 20px",
margin: 0
},
heading: {
display: "flex",
alignItems: "center",
flex: "1 1 auto",
position: "relative",
margin: 0,
height: "100%"
},
body: {
display: "flex",
webkitOverflowScrolling: "touch"
},
masterView: {
flex: "1 1 auto",
height: "100%",
overflow: "auto",
webkitOverflowScrolling: "touch"
},
detailView: {
width: "400px",
height: "100%",
overflow: "auto",
webkitOverflowScrolling: "touch"
},
title: {
margin: 0,
transition: "200ms all"
},
titleWithBackButton: {
paddingLeft: 40
},
backButton: {
height: "100%",
position: "absolute",
top: 0,
zIndex: 1
},
backButtonContainers: {
display: "flex",
alignItems: "center",
height: "100%"
}
};
};

class ActionView extends Component {
static propTypes = {
actionView: PropTypes.object,
actionViewIsOpen: PropTypes.bool,
buttons: PropTypes.array,
isActionViewAtRootView: PropTypes.bool
}

renderControlComponent() {
if (this.props.actionView && typeof this.props.actionView.template === "string") {
return (
<div style={this.styles.masterView} className="master">
<Blaze
template={this.props.actionView.template}
/>
</div>
);
}

return null;
}

renderDetailComponent() {
if (this.props.detailView && typeof this.props.detailView.template === "string") {
return (
<div style={this.styles.detailView} className="detail">
<Blaze
template={this.props.detailView.template}
data={this.props.detailView.data}
/>
</div>
);
}

return null;
}

renderFooter() {
// if (this.props.footerTemplate) {
// return (
// <Blaze template={this.props.footerTemplate} />
// );
// }
}

renderBackButton() {
if (this.props.isActionViewAtRootView === false) {
return (
<div style={this.styles.backButton}>
<div style={this.styles.backButtonContainers}>
<IconButton
icon="fa fa-arrow-left"
onClick={this.props.handleActionViewBack}
/>
</div>
</div>
);
}
}

get styles() {
return getStyles(this.props);
}

get backButtonEnterAnimation() {
return {
animation: {
display: "flex",
position: "absolute",
left: 20,
opaticy: 1
},
duration: 200
};
}

get backButtonLeaveAnimaton() {
return {
animation: {
display: "flex",
position: "absolute",
left: -30,
opaticy: 0
},
duration: 200

};
}

render() {
const { actionView } = this.props;
const baseClassName = classnames({
"admin-controls": true,
"show-settings": this.props.actionViewIsOpen
});


return (
<div style={this.styles.base} className={baseClassName}>
<div style={this.styles.header} className="admin-controls-heading--">
<VelocityTransitionGroup
enter={this.backButtonEnterAnimation}
leave={this.backButtonLeaveAnimaton}
>
{this.renderBackButton()}
</VelocityTransitionGroup>

<div style={this.styles.heading} className="nav-settings-heading--">
<h3
className="nav-settings-title--"
style={[
this.styles.title,
!this.props.isActionViewAtRootView ? this.styles.titleWithBackButton : {}
]}
>
<Translation
defaultValue={actionView.label || "Dashboard"}
i18nKey={actionView.i18nKeyLabel || "dashboard.coreTitle"}
/>
</h3>
</div>

<div className="nav-settings-controls--">
<IconButton
icon="fa fa-times"
onClick={this.props.handleActionViewClose}
/>
</div>
</div>
<div style={this.styles.body} className="admin-controls-content action-view-body">

{this.renderControlComponent()}
{this.renderDetailComponent()}
</div>
<div className="admin-controls-footer">
<div className="admin-controls-container">
{this.renderFooter()}
</div>
</div>

</div>
);
}
}

export default Admin()(Radium(ActionView));
2 changes: 2 additions & 0 deletions imports/plugins/core/dashboard/client/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ActionView } from "./actionView";
export { default as PackageList } from "./packageList";
Loading

0 comments on commit 6abf924

Please sign in to comment.