Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #11

Merged
merged 7 commits into from
Apr 12, 2019
Merged

Dev #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- '10'
- '8'
script:
- npm run build
- npx @rollup-umd/build
# Job: Test
- stage: test
node_js:
Expand All @@ -52,8 +52,7 @@ jobs:
sonarcloud:
organization: $(echo $TRAVIS_REPO_SLUG | awk -F '/' '{print $1}')
script:
- npm run test
- if [[ "$TRAVIS_BRANCH" != greenkeeper* && -n "$SONAR_TOKEN" ]]; then sonar-scanner -Dsonar.projectVersion=${SONAR_VERSION}; fi
- npx @rollup-umd/test

# Job: Release
- stage: release
Expand All @@ -72,7 +71,7 @@ jobs:
script:
- targetVersion=$(git describe --tags `git rev-list --tags --max-count=1`)
- npx @rollup-umd/deploy --target-version "${targetVersion}"
# this is necessary to place the demo
# this is will add the demo site to the pages build
- npm install --prefix examples/demo
- npm run build --prefix examples/demo
- mv examples/demo/build public/demo
Expand Down
3 changes: 2 additions & 1 deletion examples/demo/src/dashboard/CardIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const styles = {
margin: '-20px 20px 0 15px',
zIndex: 100,
borderRadius: 3,
display: 'block',
kopax marked this conversation as resolved.
Show resolved Hide resolved
},
icon: {
float: 'right',
Expand All @@ -18,7 +19,7 @@ const styles = {
};

const CardIcon = ({ Icon, bgColor }) => (
<Card style={{ backgroundColor: bgColor, float: 'left', margin: '-20px 20px 0 15px', zIndex: '100', borderRadius: 3 }}>
<Card style={{ backgroundColor: bgColor, float: 'left', margin: '-20px 20px 0 15px', zIndex: '100', borderRadius: 3, display: 'block' }}>
kopax marked this conversation as resolved.
Show resolved Hide resolved
<Icon style={styles.icon}/>
</Card>
);
Expand Down
109 changes: 52 additions & 57 deletions examples/demo/src/dashboard/PendingReviews.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
import React from 'react';
import compose from 'recompose/compose';
import Card from '@material-ui/core/Card';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import Avatar from '@material-ui/core/Avatar';
import CommentIcon from '@material-ui/icons/Comment';
import Divider from '@material-ui/core/Divider';
import { Link } from 'react-router-dom';
import { translate } from 'react-admin';

import { Card, H3, P, ListGroup, ListGroupItem, ListGroupItemText } from '@bootstrap-styled/v4';
import styled from 'styled-components';
import CardIcon from './CardIcon';

import StarRatingField from '../reviews/StarRatingField';

// const styles = theme => ({
// main: {
// flex: '1',
// marginRight: '1em',
// marginTop: 20,
// },
// titleLink: { textDecoration: 'none', color: 'inherit' },
// card: {
// padding: '16px 0',
// overflow: 'inherit',
// textAlign: 'right',
// },
// title: {
// padding: '0 16px',
// },
// value: {
// padding: '0 16px',
// minHeight: 48,
// },
// avatar: {
// background: theme.palette.background.avatar,
// },
// listItemText: {
// overflowY: 'hidden',
// height: '4em',
// display: '-webkit-box',
// WebkitLineClamp: 2,
// WebkitBoxOrient: 'vertical',
// },
// });
const styles = theme => ({
main: {
flex: '1',
marginRight: '1em',
marginTop: 20,
},
titleLink: { textDecoration: 'none', color: 'inherit' },
card: {
padding: '16px 0',
overflow: 'inherit',
textAlign: 'right',
display: 'block',
minHeight: 52,
},
title: {
padding: '0 16px',
},
value: {
padding: '0 16px',
minHeight: 48,
},
avatar: {
background: theme.palette.background.avatar,
},
})

const ListItemTextWrapper = styled.div`
overflow-y: hidden;
height: 4em;
display: -webkit-box;
Webkit-line-clamp: 2;
Webkit-box-orient: vertical;
margin-left: 16px;
`;

const location = {
pathname: 'reviews',
Expand All @@ -56,25 +57,19 @@ const PendingReviews = ({
nb,
translate,
}) => (
<div>
<div style={styles.main}>
<CardIcon Icon={CommentIcon} bgColor="#f44336" />
<Card>
<p>
{translate('pos.dashboard.pending_reviews')}
</p>
<h2>
<Link to={location}>
{nb}
</Link>
</h2>
<Card style={styles.card}>
<P>{translate('pos.dashboard.pending_reviews')}</P>
<H3><Link to={location}>{nb}</Link></H3>
<Divider />
<List>
<ListGroup>
{reviews.map(record => (
<ListItem
<ListGroupItem
key={record.id}
button
component={Link}
tag={Link}
to={`/reviews/${record.id}`}
style={{ textDecoration: 'none', fontSize: '13px', flexFlow: 'unset' }}
>
{customers[record.customer_id] ? (
<Avatar
Expand All @@ -85,15 +80,15 @@ const PendingReviews = ({
) : (
<Avatar />
)}

<ListItemText
primary={<StarRatingField record={record} />}
secondary={record.comment}
style={{ paddingRight: 0 }}
/>
</ListItem>
<ListItemTextWrapper>
<ListGroupItemText className="d-flex flex-column">
<StarRatingField record={record} />
{record.comment}
</ListGroupItemText>
</ListItemTextWrapper>
</ListGroupItem>
))}
</List>
</ListGroup>
</Card>
</div>
);
Expand Down
61 changes: 31 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,45 +210,45 @@
"lint-staged"
],
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.4.0",
"@babel/plugin-transform-modules-commonjs": "^7.4.0",
"@babel/plugin-transform-modules-commonjs": "^7.4.3",
"@babel/plugin-transform-react-constant-elements": "^7.2.0",
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"@bootstrap-styled/documentation": "^2.0.0",
"@rollup-umd/documentation": "^2.0.1",
"@rollup-umd/documentation": "^2.0.2",
"@rollup-umd/ncu": "^1.0.9",
"@rollup-umd/rollup": "^1.0.10",
"@semantic-release/changelog": "^3.0.2",
"@semantic-release/git": "^7.0.8",
"@semantic-release/github": "^5.2.10",
"@semantic-release/npm": "^5.1.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-jest": "^24.7.1",
"babel-loader": "8.0.5",
"babel-merge": "^2.0.1",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-inline-react-svg": "^1.0.1",
"babel-plugin-inline-react-svg": "^1.1.0",
"babel-plugin-react-transform": "^3.0.0",
"babel-plugin-styled-components": "^1.10.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"cz-conventional-changelog": "^2.1.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "5.15.3",
"enzyme-adapter-react-16": "^1.12.1",
"eslint": "5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
Expand All @@ -257,7 +257,7 @@
"file-api": "^0.10.4",
"istanbul-api": "^2.1.1",
"istanbul-reports": "^2.1.1",
"jest-cli": "^24.5.0",
"jest-cli": "^24.7.1",
"jest-sonar-reporter": "^2.0.0",
"lint-staged": "^8.1.5",
"lodash": "^4.17.11",
Expand All @@ -270,48 +270,49 @@
"react-router": "~4.2.0",
"react-router-dom": "~4.2.2",
"react-router-redux": "^4.0.8",
"react-test-renderer": "^16.8.5",
"react-transition-group": "^2.7.0",
"react-test-renderer": "^16.8.6",
"react-transition-group": "^2.9.0",
"redux": "~3.7.2",
"redux-form": "~7.4.0",
"rollup": "^1.7.0",
"rollup": "^1.10.0",
"semantic-release": "^15.13.3",
"styled-components": "^4.1.3",
"styled-components": "^4.2.0",
"toctoc": "^0.3.2",
"webpack": "4.29.6"
},
"dependencies": {
"@babel/runtime": "^7.4.2",
"@babel/runtime": "^7.4.3",
"@bootstrap-styled/css-mixins": "^2.0.6",
"@bootstrap-styled/provider": "^1.4.2",
"@bootstrap-styled/v4": "^3.0.12",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@fortawesome/react-fontawesome": "^0.1.4",
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^3.0.2",
"@material-ui/core": "^1.5.1",
"@material-ui/icons": "^1.1.1",
"autosuggest-highlight": "^3.1.1",
"bootstrap-styled": "^2.4.13",
"react-dropzone": "~4.0.1",
"react-headroom": "^2.2.7",
"classnames": "^2.2.6",
"history": "^4.7.2",
"inflection": "~1.12.0",
"react-autosuggest": "^9.4.2",
"material-ui-chip-input": "1.0.0-beta.6 - 1.0.0-beta.8",
"papaparse": "^4.1.4",
"prop-types": "^15.7.2",
"react-transition-group": "^2.7.0",
"react-autosuggest": "^9.4.2",
"react-dropzone": "~4.0.1",
"react-headroom": "^2.2.7",
"react-transition-group": "^2.9.0",
"recompose": "~0.26.0",
"reselect": "^3.0.0"
},
"peerDependencies": {
"react": "^16.8.5",
"react-dom": "^16.8.5",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"ra-core": "^2.6.4",
"redux-form": "~7.4.0",
"styled-components": "^4.1.3",
"redux": "~3.7.2",
"react-redux": "~5.0.7",
"@bootstrap-styled/redux": "^1.1.2"
"redux-form": "~7.0.0",
"styled-components": "^4.0.0",
"redux": "~3.0.0",
"react-redux": "~5.0.0",
"@bootstrap-styled/redux": "^1.0.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
Expand Down
6 changes: 3 additions & 3 deletions src/components/field/tests/BooleanField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('<BooleanField />', () => {
<BooleanField record={{ published: true }} source="published" />
);
assert.ok(wrapper.first().is('BooleanField__BooleanTypography'));
assert.equal(wrapper.first().find('pure(DoneIcon)').length, 1);
assert.equal(wrapper.first().find('pure(Done)').length, 1);
});

it('should display cross if value is false', () => {
Expand All @@ -18,7 +18,7 @@ describe('<BooleanField />', () => {
);

assert.ok(wrapper.first().is('BooleanField__BooleanTypography'));
assert.equal(wrapper.first().find('pure(ClearIcon)').length, 1);
assert.equal(wrapper.first().find('pure(Clear)').length, 1);
});

it('should not display anything if value is null', () => {
Expand All @@ -45,6 +45,6 @@ describe('<BooleanField />', () => {
<BooleanField record={{ foo: { bar: true } }} source="foo.bar" />
);
assert.ok(wrapper.first().is('BooleanField__BooleanTypography'));
assert.equal(wrapper.first().find('pure(DoneIcon)').length, 1);
assert.equal(wrapper.first().find('pure(Done)').length, 1);
});
});
1 change: 1 addition & 0 deletions src/components/layout/DashboardMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DashboardMenuItem = ({
...props
}) => (
<MenuItemLink
className={className}
onClick={onClick}
to="/"
primaryText={translate('ra.page.dashboard')}
Expand Down
5 changes: 3 additions & 2 deletions src/components/layout/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ const Menu = ({
logout,
...rest
}) => (
<ListGroup className={classnames(className, 'd-flex flex-column flex-start pl-4')} style={{ width: DRAWER_WIDTH }} {...rest}>
{hasDashboard && <DashboardMenuItem onClick={onMenuClick} />}
<ListGroup className={classnames(className, 'd-flex flex-column flex-start pl-4 mt-2')} style={{ width: DRAWER_WIDTH }} {...rest}>
{hasDashboard && <DashboardMenuItem onClick={onMenuClick} className="border-0 rounded-0 d-flex flex-start pl-2" />}
{resources
.filter(r => r.hasList)
.map(resource => (
<MenuItemLink
className="border-0 rounded-0 d-flex flex-start pl-2"
key={resource.name}
to={`/${resource.name}`}
primaryText={translatedResourceName(resource, translate)}
Expand Down
Loading