Skip to content

Commit

Permalink
Merge pull request #41 from acelaya/feature/1.1.0
Browse files Browse the repository at this point in the history
Feature/1.1.0
  • Loading branch information
acelaya authored Sep 16, 2018
2 parents 47e6e1c + bc8eaaa commit 606397b
Show file tree
Hide file tree
Showing 63 changed files with 1,495 additions and 576 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": [
"adidas-env/browser",
"adidas-env/module",
"adidas-env/node",
"adidas-es6",
"adidas-babel",
"adidas-react"
Expand Down Expand Up @@ -35,6 +36,7 @@
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
"react/jsx-closing-bracket-location": ["error", "tag-aligned"],
"react/no-array-index-key": "off",
"react/no-did-update-set-state": "off"
"react/no-did-update-set-state": "off",
"react/display-name": "off"
}
}
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# CHANGELOG

## 1.1.0 - 2018-09-16

#### Added

* [#47](https://github.com/shlinkio/shlink-web-client/issues/47) Added support to delete short URLs (requires [shlink v1.12.0](https://github.com/shlinkio/shlink/releases/tag/v1.12.0) or greater).

#### Changed

* [#35](https://github.com/shlinkio/shlink-web-client/issues/35) Visits component split into two, which makes the header not to be refreshed when filtering by date, and also the visits global counter now reflects the actual number of visits which fulfill current filter.
* [#36](https://github.com/shlinkio/shlink-web-client/issues/36) Tags selector now autocompletes existing tag names, to prevent typos and ease reusing existing tags.
* [#39](https://github.com/shlinkio/shlink-web-client/issues/39) Defined `propTypes` as static properties in class components.

#### Deprecated

* *Nothing*

#### Removed

* *Nothing*

#### Fixed

* [#49](https://github.com/shlinkio/shlink-web-client/issues/49) Ensured filtering parameters are reseted when list component is unmounted so that params are not mixed when coming back.
* [#45](https://github.com/shlinkio/shlink-web-client/issues/45) Ensured graphs x-axis start at `0` and don't use decimals.
* [#51](https://github.com/shlinkio/shlink-web-client/issues/51) When editing short URL tags, the value returned form server is used when refreshing the list, which is normalized.


## 1.0.1 - 2018-09-02

#### Added
Expand Down Expand Up @@ -33,7 +60,7 @@
* Export all servers in a CSV file.
* Import the CSV in a different device.

* [#4](https://github.com/shlinkio/shlink-web-client/issues/4) Added tags management.
* [#3](https://github.com/shlinkio/shlink-web-client/issues/3) Added tags management.

* List existing tags, and filter the list.
* Change their name and color.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/shlinkio/shlink-web-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-web-client/?branch=master)
[![GitHub release](https://img.shields.io/github/release/shlinkio/shlink-web-client.svg?style=flat-square)](https://github.com/shlinkio/shlink-web-client/releases/latest)
[![GitHub license](https://img.shields.io/github/license/shlinkio/shlink-web-client.svg?style=flat-square)](https://github.com/shlinkio/shlink-web-client/blob/master/LICENSE)
[![Paypal Donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=cccccc)](https://acel.me/donate)

A ReactJS-based progressive web application for [Shlink](https://shlink.io).

Expand Down
33 changes: 33 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: [
'src/**/*.{js,jsx,mjs}',
'!src/registerServiceWorker.js',
'!src/index.js',
],
setupFiles: [
'<rootDir>/config/polyfills.js',
'<rootDir>/config/setupEnzyme.js',
],
testMatch: [ '<rootDir>/test/**/*.test.{js,jsx,mjs}' ],
testEnvironment: 'node',
testURL: 'http://localhost',
transform: {
'^.+\\.(js|jsx|mjs)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js',
'^(?!.*\\.(js|jsx|mjs|css|json)$)': '<rootDir>/config/jest/fileTransform.js',
},
transformIgnorePatterns: [ '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$' ],
moduleNameMapper: {
'^react-native$': 'react-native-web',
},
moduleFileExtensions: [
'web.js',
'js',
'json',
'web.jsx',
'jsx',
'node',
'mjs',
],
};
38 changes: 2 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lint": "yarn lint:js && yarn lint:css",
"lint:js": "eslint src test scripts config",
"lint:js:fix": "yarn lint:js --fix",
"lint:css": "stylelint src/**/*.scss",
"lint:css": "stylelint src/*.scss src/**/*.scss",
"lint:css:fix": "yarn lint:css --fix",
"start": "node scripts/start.js",
"build": "node scripts/build.js",
Expand All @@ -31,6 +31,7 @@
"qs": "^6.5.2",
"ramda": "^0.25.0",
"react": "^16.3.2",
"react-autosuggest": "^9.4.0",
"react-chartjs-2": "^2.7.4",
"react-color": "^2.14.1",
"react-copy-to-clipboard": "^5.0.1",
Expand Down Expand Up @@ -101,41 +102,6 @@
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
},
"jest": {
"coverageDirectory": "<rootDir>/coverage",
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js",
"<rootDir>/config/setupEnzyme.js"
],
"testMatch": [
"<rootDir>/test/**/*.test.{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"babel": {
"presets": [
"react-app"
Expand Down
5 changes: 5 additions & 0 deletions src/api/ShlinkApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export class ShlinkApiClient {
.then((resp) => resp.data)
.catch((e) => this._handleAuthError(e, this.getShortUrl, [ shortCode ]));

deleteShortUrl = (shortCode) =>
this._performRequest(`/short-codes/${shortCode}`, 'DELETE')
.then(() => ({}))
.catch((e) => this._handleAuthError(e, this.deleteShortUrl, [ shortCode ]));

updateShortUrlTags = (shortCode, tags) =>
this._performRequest(`/short-codes/${shortCode}/tags`, 'PUT', {}, { tags })
.then((resp) => resp.data.tags)
Expand Down
8 changes: 4 additions & 4 deletions src/common/DateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import calendarIcon from '@fortawesome/fontawesome-free-regular/faCalendarAlt';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import React from 'react';
import DatePicker from 'react-datepicker';
import './DateInput.scss';
import { isNil } from 'ramda';
import './DateInput.scss';

export default class DateInput extends React.Component {
constructor(props) {
super(props);
this.inputRef = React.createRef();
this.inputRef = props.ref || React.createRef();
}

render() {
const { isClearable, selected } = this.props;
const { className, isClearable, selected } = this.props;
const showCalendarIcon = !isClearable || isNil(selected);

return (
<div className="date-input-container">
<DatePicker
{...this.props}
className={`date-input-container__input form-control ${this.props.className || ''}`}
className={`date-input-container__input form-control ${className || ''}`}
dateFormat="YYYY-MM-DD"
readOnly
ref={this.inputRef}
Expand Down
12 changes: 5 additions & 7 deletions src/common/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import PropTypes from 'prop-types';
import { resetSelectedServer } from '../servers/reducers/selectedServer';
import './Home.scss';

const propTypes = {
resetSelectedServer: PropTypes.func,
servers: PropTypes.object,
};

export class HomeComponent extends React.Component {
static propTypes = {
resetSelectedServer: PropTypes.func,
servers: PropTypes.object,
};

componentDidMount() {
this.props.resetSelectedServer();
}
Expand Down Expand Up @@ -51,8 +51,6 @@ export class HomeComponent extends React.Component {
}
}

HomeComponent.propTypes = propTypes;

const Home = connect(pick([ 'servers' ]), { resetSelectedServer })(HomeComponent);

export default Home;
10 changes: 4 additions & 6 deletions src/common/MainHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import ServersDropdown from '../servers/ServersDropdown';
import './MainHeader.scss';
import shlinkLogo from './shlink-logo-white.png';

const propTypes = {
location: PropTypes.object,
};

export class MainHeaderComponent extends React.Component {
static propTypes = {
location: PropTypes.object,
};

state = { isOpen: false };
handleToggle = () => {
this.setState(({ isOpen }) => ({
Expand Down Expand Up @@ -64,8 +64,6 @@ export class MainHeaderComponent extends React.Component {
}
}

MainHeaderComponent.propTypes = propTypes;

const MainHeader = withRouter(MainHeaderComponent);

export default MainHeader;
18 changes: 8 additions & 10 deletions src/common/MenuLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import burgerIcon from '@fortawesome/fontawesome-free-solid/faBars';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import classnames from 'classnames';
import * as PropTypes from 'prop-types';
import ShortUrlsVisits from '../short-urls/ShortUrlVisits';
import ShortUrlsVisits from '../visits/ShortUrlVisits';
import { selectServer } from '../servers/reducers/selectedServer';
import CreateShortUrl from '../short-urls/CreateShortUrl';
import ShortUrls from '../short-urls/ShortUrls';
Expand All @@ -17,14 +17,14 @@ import TagsList from '../tags/TagsList';
import { serverType } from '../servers/prop-types';
import AsideMenu from './AsideMenu';

const propTypes = {
match: PropTypes.object,
selectServer: PropTypes.func,
location: PropTypes.object,
selectedServer: serverType,
};

export class MenuLayoutComponent extends React.Component {
static propTypes = {
match: PropTypes.object,
selectServer: PropTypes.func,
location: PropTypes.object,
selectedServer: serverType,
};

state = { showSideBar: false };

// FIXME Shouldn't use componentWillMount, but this code has to be run before children components are rendered
Expand Down Expand Up @@ -105,8 +105,6 @@ export class MenuLayoutComponent extends React.Component {
}
}

MenuLayoutComponent.propTypes = propTypes;

const MenuLayout = compose(
connect(pick([ 'selectedServer', 'shortUrlsListParams' ]), { selectServer }),
withRouter
Expand Down
25 changes: 11 additions & 14 deletions src/common/ScrollToTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import React from 'react';
import { withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';

const propTypes = {
location: PropTypes.object,
window: PropTypes.shape({
scrollTo: PropTypes.func,
}),
children: PropTypes.node,
};
const defaultProps = {
window,
};

export class ScrollToTopComponent extends React.Component {
static propTypes = {
location: PropTypes.object,
window: PropTypes.shape({
scrollTo: PropTypes.func,
}),
children: PropTypes.node,
};
static defaultProps = {
window,
};

componentDidUpdate(prevProps) {
const { location, window } = this.props;

Expand All @@ -27,9 +27,6 @@ export class ScrollToTopComponent extends React.Component {
}
}

ScrollToTopComponent.defaultProps = defaultProps;
ScrollToTopComponent.propTypes = propTypes;

const ScrollToTop = withRouter(ScrollToTopComponent);

export default ScrollToTop;
7 changes: 2 additions & 5 deletions src/common/react-tagsinput.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
overflow: hidden;
min-height: 2.6rem;
padding: 6px 0 0 6px;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.react-tagsinput--focused {
border-color: #80bdff;
-webkit-box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
-webkit-transition: border-color .15s ease-in-out, -webkit-box-shadow .15s ease-in-out;
-o-transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out, -webkit-box-shadow .15s ease-in-out;
}

.react-tagsinput-tag {
Expand Down Expand Up @@ -44,6 +41,6 @@
border: 0;
outline: none;
padding: 3px 5px;
width: 155px;
width: 100%;
margin-bottom: 6px;
}
9 changes: 5 additions & 4 deletions src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
html,
body,
#root {
height: 100%
height: 100%;
}

* {
Expand All @@ -21,9 +21,11 @@ body,
.dropdown-item {
cursor: pointer;
}

.dropdown-item.active,
.dropdown-item:active {
@extend .bg-main;
background-color: $lightGrey !important;
color: inherit !important;
}

.shlink-container {
Expand All @@ -46,7 +48,6 @@ body,

.navbar-brand {
@media (max-width: $smMax) {
margin-right: auto !important; // This is needed to override a third party style
margin: 0 auto;
margin: 0 auto !important;
}
}
Loading

0 comments on commit 606397b

Please sign in to comment.