mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Moved propTypes and defaultProps as static properties in class components
This commit is contained in:
parent
47e6e1ca1f
commit
0b089e24de
18 changed files with 168 additions and 209 deletions
|
@ -9,12 +9,12 @@ import PropTypes from 'prop-types';
|
||||||
import { resetSelectedServer } from '../servers/reducers/selectedServer';
|
import { resetSelectedServer } from '../servers/reducers/selectedServer';
|
||||||
import './Home.scss';
|
import './Home.scss';
|
||||||
|
|
||||||
const propTypes = {
|
export class HomeComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
resetSelectedServer: PropTypes.func,
|
resetSelectedServer: PropTypes.func,
|
||||||
servers: PropTypes.object,
|
servers: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class HomeComponent extends React.Component {
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.resetSelectedServer();
|
this.props.resetSelectedServer();
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ export class HomeComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const Home = connect(pick([ 'servers' ]), { resetSelectedServer })(HomeComponent);
|
const Home = connect(pick([ 'servers' ]), { resetSelectedServer })(HomeComponent);
|
||||||
|
|
||||||
export default Home;
|
export default Home;
|
||||||
|
|
|
@ -10,11 +10,11 @@ import ServersDropdown from '../servers/ServersDropdown';
|
||||||
import './MainHeader.scss';
|
import './MainHeader.scss';
|
||||||
import shlinkLogo from './shlink-logo-white.png';
|
import shlinkLogo from './shlink-logo-white.png';
|
||||||
|
|
||||||
const propTypes = {
|
|
||||||
location: PropTypes.object,
|
|
||||||
};
|
|
||||||
|
|
||||||
export class MainHeaderComponent extends React.Component {
|
export class MainHeaderComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
|
location: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
state = { isOpen: false };
|
state = { isOpen: false };
|
||||||
handleToggle = () => {
|
handleToggle = () => {
|
||||||
this.setState(({ isOpen }) => ({
|
this.setState(({ isOpen }) => ({
|
||||||
|
@ -64,8 +64,6 @@ export class MainHeaderComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainHeaderComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const MainHeader = withRouter(MainHeaderComponent);
|
const MainHeader = withRouter(MainHeaderComponent);
|
||||||
|
|
||||||
export default MainHeader;
|
export default MainHeader;
|
||||||
|
|
|
@ -17,14 +17,14 @@ import TagsList from '../tags/TagsList';
|
||||||
import { serverType } from '../servers/prop-types';
|
import { serverType } from '../servers/prop-types';
|
||||||
import AsideMenu from './AsideMenu';
|
import AsideMenu from './AsideMenu';
|
||||||
|
|
||||||
const propTypes = {
|
export class MenuLayoutComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
selectServer: PropTypes.func,
|
selectServer: PropTypes.func,
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class MenuLayoutComponent extends React.Component {
|
|
||||||
state = { showSideBar: false };
|
state = { showSideBar: false };
|
||||||
|
|
||||||
// FIXME Shouldn't use componentWillMount, but this code has to be run before children components are rendered
|
// FIXME Shouldn't use componentWillMount, but this code has to be run before children components are rendered
|
||||||
|
@ -105,8 +105,6 @@ export class MenuLayoutComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuLayoutComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const MenuLayout = compose(
|
const MenuLayout = compose(
|
||||||
connect(pick([ 'selectedServer', 'shortUrlsListParams' ]), { selectServer }),
|
connect(pick([ 'selectedServer', 'shortUrlsListParams' ]), { selectServer }),
|
||||||
withRouter
|
withRouter
|
||||||
|
|
|
@ -2,18 +2,18 @@ import React from 'react';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
const propTypes = {
|
export class ScrollToTopComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
window: PropTypes.shape({
|
window: PropTypes.shape({
|
||||||
scrollTo: PropTypes.func,
|
scrollTo: PropTypes.func,
|
||||||
}),
|
}),
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
static defaultProps = {
|
||||||
window,
|
window,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ScrollToTopComponent extends React.Component {
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
const { location, window } = this.props;
|
const { location, window } = this.props;
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@ export class ScrollToTopComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollToTopComponent.defaultProps = defaultProps;
|
|
||||||
ScrollToTopComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const ScrollToTop = withRouter(ScrollToTopComponent);
|
const ScrollToTop = withRouter(ScrollToTopComponent);
|
||||||
|
|
||||||
export default ScrollToTop;
|
export default ScrollToTop;
|
||||||
|
|
|
@ -5,12 +5,12 @@ import PropTypes from 'prop-types';
|
||||||
import DeleteServerModal from './DeleteServerModal';
|
import DeleteServerModal from './DeleteServerModal';
|
||||||
import { serverType } from './prop-types';
|
import { serverType } from './prop-types';
|
||||||
|
|
||||||
const propTypes = {
|
export default class DeleteServerButton extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
server: serverType,
|
server: serverType,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class DeleteServerButton extends React.Component {
|
|
||||||
state = { isModalOpen: false };
|
state = { isModalOpen: false };
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -37,5 +37,3 @@ export default class DeleteServerButton extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteServerButton.propTypes = propTypes;
|
|
||||||
|
|
|
@ -9,10 +9,11 @@ import serversExporter from '../servers/services/ServersExporter';
|
||||||
import { listServers } from './reducers/server';
|
import { listServers } from './reducers/server';
|
||||||
import { serverType } from './prop-types';
|
import { serverType } from './prop-types';
|
||||||
|
|
||||||
const defaultProps = {
|
export class ServersDropdownComponent extends React.Component {
|
||||||
|
static defaultProps = {
|
||||||
serversExporter,
|
serversExporter,
|
||||||
};
|
};
|
||||||
const propTypes = {
|
static propTypes = {
|
||||||
servers: PropTypes.object,
|
servers: PropTypes.object,
|
||||||
serversExporter: PropTypes.shape({
|
serversExporter: PropTypes.shape({
|
||||||
exportServers: PropTypes.func,
|
exportServers: PropTypes.func,
|
||||||
|
@ -20,9 +21,8 @@ const propTypes = {
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
selectServer: PropTypes.func,
|
selectServer: PropTypes.func,
|
||||||
listServers: PropTypes.func,
|
listServers: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ServersDropdownComponent extends React.Component {
|
|
||||||
renderServers = () => {
|
renderServers = () => {
|
||||||
const { servers, selectedServer, selectServer, serversExporter } = this.props;
|
const { servers, selectedServer, selectServer, serversExporter } = this.props;
|
||||||
|
|
||||||
|
@ -70,9 +70,6 @@ export class ServersDropdownComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServersDropdownComponent.defaultProps = defaultProps;
|
|
||||||
ServersDropdownComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const ServersDropdown = connect(
|
const ServersDropdown = connect(
|
||||||
pick([ 'servers', 'selectedServer' ]),
|
pick([ 'servers', 'selectedServer' ]),
|
||||||
{ listServers, selectServer }
|
{ listServers, selectServer }
|
||||||
|
|
|
@ -7,18 +7,18 @@ import PropTypes from 'prop-types';
|
||||||
import { createServers } from '../reducers/server';
|
import { createServers } from '../reducers/server';
|
||||||
import serversImporter, { serversImporterType } from '../services/ServersImporter';
|
import serversImporter, { serversImporterType } from '../services/ServersImporter';
|
||||||
|
|
||||||
const defaultProps = {
|
export class ImportServersBtnComponent extends React.Component {
|
||||||
|
static defaultProps = {
|
||||||
serversImporter,
|
serversImporter,
|
||||||
onImport: () => ({}),
|
onImport: () => ({}),
|
||||||
};
|
};
|
||||||
const propTypes = {
|
static propTypes = {
|
||||||
onImport: PropTypes.func,
|
onImport: PropTypes.func,
|
||||||
serversImporter: serversImporterType,
|
serversImporter: serversImporterType,
|
||||||
createServers: PropTypes.func,
|
createServers: PropTypes.func,
|
||||||
fileRef: PropTypes.oneOfType([ PropTypes.object, PropTypes.node ]),
|
fileRef: PropTypes.oneOfType([ PropTypes.object, PropTypes.node ]),
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ImportServersBtnComponent extends React.Component {
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.fileRef = props.fileRef || React.createRef();
|
this.fileRef = props.fileRef || React.createRef();
|
||||||
|
@ -58,9 +58,6 @@ export class ImportServersBtnComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportServersBtnComponent.defaultProps = defaultProps;
|
|
||||||
ImportServersBtnComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const ImportServersBtn = connect(null, { createServers })(ImportServersBtnComponent);
|
const ImportServersBtn = connect(null, { createServers })(ImportServersBtnComponent);
|
||||||
|
|
||||||
export default ImportServersBtn;
|
export default ImportServersBtn;
|
||||||
|
|
|
@ -20,7 +20,8 @@ import { serverType } from '../servers/prop-types';
|
||||||
import { getShortUrlVisits, shortUrlVisitsType } from './reducers/shortUrlVisits';
|
import { getShortUrlVisits, shortUrlVisitsType } from './reducers/shortUrlVisits';
|
||||||
import './ShortUrlVisits.scss';
|
import './ShortUrlVisits.scss';
|
||||||
|
|
||||||
const propTypes = {
|
export class ShortUrlsVisitsComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
processOsStats: PropTypes.func,
|
processOsStats: PropTypes.func,
|
||||||
processBrowserStats: PropTypes.func,
|
processBrowserStats: PropTypes.func,
|
||||||
processCountriesStats: PropTypes.func,
|
processCountriesStats: PropTypes.func,
|
||||||
|
@ -29,15 +30,14 @@ const propTypes = {
|
||||||
getShortUrlVisits: PropTypes.func,
|
getShortUrlVisits: PropTypes.func,
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
shortUrlVisits: shortUrlVisitsType,
|
shortUrlVisits: shortUrlVisitsType,
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
static defaultProps = {
|
||||||
processOsStats,
|
processOsStats,
|
||||||
processBrowserStats,
|
processBrowserStats,
|
||||||
processCountriesStats,
|
processCountriesStats,
|
||||||
processReferrersStats,
|
processReferrersStats,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ShortUrlsVisitsComponent extends React.Component {
|
|
||||||
state = { startDate: undefined, endDate: undefined };
|
state = { startDate: undefined, endDate: undefined };
|
||||||
loadVisits = () => {
|
loadVisits = () => {
|
||||||
const { match: { params }, getShortUrlVisits } = this.props;
|
const { match: { params }, getShortUrlVisits } = this.props;
|
||||||
|
@ -210,9 +210,6 @@ export class ShortUrlsVisitsComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortUrlsVisitsComponent.propTypes = propTypes;
|
|
||||||
ShortUrlsVisitsComponent.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
const ShortUrlsVisits = connect(
|
const ShortUrlsVisits = connect(
|
||||||
pick([ 'selectedServer', 'shortUrlVisits' ]),
|
pick([ 'selectedServer', 'shortUrlVisits' ]),
|
||||||
{ getShortUrlVisits }
|
{ getShortUrlVisits }
|
||||||
|
|
|
@ -20,7 +20,8 @@ const SORTABLE_FIELDS = {
|
||||||
visits: 'Visits',
|
visits: 'Visits',
|
||||||
};
|
};
|
||||||
|
|
||||||
const propTypes = {
|
export class ShortUrlsListComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
listShortUrls: PropTypes.func,
|
listShortUrls: PropTypes.func,
|
||||||
shortUrlsListParams: shortUrlsListParamsType,
|
shortUrlsListParams: shortUrlsListParamsType,
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
|
@ -29,9 +30,8 @@ const propTypes = {
|
||||||
error: PropTypes.bool,
|
error: PropTypes.bool,
|
||||||
shortUrlsList: PropTypes.arrayOf(shortUrlType),
|
shortUrlsList: PropTypes.arrayOf(shortUrlType),
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ShortUrlsListComponent extends React.Component {
|
|
||||||
refreshList = (extraParams) => {
|
refreshList = (extraParams) => {
|
||||||
const { listShortUrls, shortUrlsListParams } = this.props;
|
const { listShortUrls, shortUrlsListParams } = this.props;
|
||||||
|
|
||||||
|
@ -186,8 +186,6 @@ export class ShortUrlsListComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortUrlsListComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const ShortUrlsList = connect(
|
const ShortUrlsList = connect(
|
||||||
pick([ 'selectedServer', 'shortUrlsListParams' ]),
|
pick([ 'selectedServer', 'shortUrlsListParams' ]),
|
||||||
{ listShortUrls }
|
{ listShortUrls }
|
||||||
|
|
|
@ -9,13 +9,13 @@ import { createShortUrlResultType } from '../reducers/shortUrlCreationResult';
|
||||||
import { stateFlagTimeout } from '../../utils/utils';
|
import { stateFlagTimeout } from '../../utils/utils';
|
||||||
import './CreateShortUrlResult.scss';
|
import './CreateShortUrlResult.scss';
|
||||||
|
|
||||||
const propTypes = {
|
export default class CreateShortUrlResult extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
resetCreateShortUrl: PropTypes.func,
|
resetCreateShortUrl: PropTypes.func,
|
||||||
error: PropTypes.bool,
|
error: PropTypes.bool,
|
||||||
result: createShortUrlResultType,
|
result: createShortUrlResultType,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class CreateShortUrlResult extends React.Component {
|
|
||||||
state = { showCopyTooltip: false };
|
state = { showCopyTooltip: false };
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -62,5 +62,3 @@ export default class CreateShortUrlResult extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateShortUrlResult.propTypes = propTypes;
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ import {
|
||||||
import ExternalLink from '../../utils/ExternalLink';
|
import ExternalLink from '../../utils/ExternalLink';
|
||||||
import { shortUrlType } from '../reducers/shortUrlsList';
|
import { shortUrlType } from '../reducers/shortUrlsList';
|
||||||
|
|
||||||
const propTypes = {
|
export class EditTagsModalComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
toggle: PropTypes.func.isRequired,
|
toggle: PropTypes.func.isRequired,
|
||||||
url: PropTypes.string.isRequired,
|
url: PropTypes.string.isRequired,
|
||||||
|
@ -22,9 +23,8 @@ const propTypes = {
|
||||||
editShortUrlTags: PropTypes.func,
|
editShortUrlTags: PropTypes.func,
|
||||||
shortUrlTagsEdited: PropTypes.func,
|
shortUrlTagsEdited: PropTypes.func,
|
||||||
resetShortUrlsTags: PropTypes.func,
|
resetShortUrlsTags: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class EditTagsModalComponent extends React.Component {
|
|
||||||
saveTags = () => {
|
saveTags = () => {
|
||||||
const { editShortUrlTags, shortUrl, toggle } = this.props;
|
const { editShortUrlTags, shortUrl, toggle } = this.props;
|
||||||
|
|
||||||
|
@ -90,8 +90,6 @@ export class EditTagsModalComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditTagsModalComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const EditTagsModal = connect(
|
const EditTagsModal = connect(
|
||||||
pick([ 'shortUrlTags' ]),
|
pick([ 'shortUrlTags' ]),
|
||||||
{ editShortUrlTags, resetShortUrlsTags, shortUrlTagsEdited }
|
{ editShortUrlTags, resetShortUrlsTags, shortUrlTagsEdited }
|
||||||
|
|
|
@ -11,14 +11,14 @@ import { stateFlagTimeout } from '../../utils/utils';
|
||||||
import { ShortUrlsRowMenu } from './ShortUrlsRowMenu';
|
import { ShortUrlsRowMenu } from './ShortUrlsRowMenu';
|
||||||
import './ShortUrlsRow.scss';
|
import './ShortUrlsRow.scss';
|
||||||
|
|
||||||
const propTypes = {
|
export class ShortUrlsRow extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
refreshList: PropTypes.func,
|
refreshList: PropTypes.func,
|
||||||
shortUrlsListParams: shortUrlsListParamsType,
|
shortUrlsListParams: shortUrlsListParamsType,
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
shortUrl: shortUrlType,
|
shortUrl: shortUrlType,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ShortUrlsRow extends React.Component {
|
|
||||||
state = { copiedToClipboard: false };
|
state = { copiedToClipboard: false };
|
||||||
|
|
||||||
renderTags(tags) {
|
renderTags(tags) {
|
||||||
|
@ -73,5 +73,3 @@ export class ShortUrlsRow extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortUrlsRow.propTypes = propTypes;
|
|
||||||
|
|
|
@ -17,14 +17,14 @@ import QrCodeModal from './QrCodeModal';
|
||||||
import './ShortUrlsRowMenu.scss';
|
import './ShortUrlsRowMenu.scss';
|
||||||
import EditTagsModal from './EditTagsModal';
|
import EditTagsModal from './EditTagsModal';
|
||||||
|
|
||||||
const propTypes = {
|
export class ShortUrlsRowMenu extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
completeShortUrl: PropTypes.string,
|
completeShortUrl: PropTypes.string,
|
||||||
onCopyToClipboard: PropTypes.func,
|
onCopyToClipboard: PropTypes.func,
|
||||||
selectedServer: serverType,
|
selectedServer: serverType,
|
||||||
shortUrl: shortUrlType,
|
shortUrl: shortUrlType,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ShortUrlsRowMenu extends React.Component {
|
|
||||||
state = {
|
state = {
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
isQrModalOpen: false,
|
isQrModalOpen: false,
|
||||||
|
@ -91,5 +91,3 @@ export class ShortUrlsRowMenu extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortUrlsRowMenu.propTypes = propTypes;
|
|
||||||
|
|
|
@ -10,16 +10,16 @@ import './TagCard.scss';
|
||||||
import DeleteTagConfirmModal from './helpers/DeleteTagConfirmModal';
|
import DeleteTagConfirmModal from './helpers/DeleteTagConfirmModal';
|
||||||
import EditTagModal from './helpers/EditTagModal';
|
import EditTagModal from './helpers/EditTagModal';
|
||||||
|
|
||||||
const propTypes = {
|
export default class TagCard extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
tag: PropTypes.string,
|
tag: PropTypes.string,
|
||||||
currentServerId: PropTypes.string,
|
currentServerId: PropTypes.string,
|
||||||
colorGenerator: colorGeneratorType,
|
colorGenerator: colorGeneratorType,
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
static defaultProps = {
|
||||||
colorGenerator,
|
colorGenerator,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class TagCard extends React.Component {
|
|
||||||
state = { isDeleteModalOpen: false, isEditModalOpen: false };
|
state = { isDeleteModalOpen: false, isEditModalOpen: false };
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -69,6 +69,3 @@ export default class TagCard extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TagCard.propTypes = propTypes;
|
|
||||||
TagCard.defaultProps = defaultProps;
|
|
||||||
|
|
|
@ -9,16 +9,17 @@ import TagCard from './TagCard';
|
||||||
|
|
||||||
const { ceil } = Math;
|
const { ceil } = Math;
|
||||||
const TAGS_GROUP_SIZE = 4;
|
const TAGS_GROUP_SIZE = 4;
|
||||||
const propTypes = {
|
|
||||||
|
export class TagsListComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
filterTags: PropTypes.func,
|
filterTags: PropTypes.func,
|
||||||
listTags: PropTypes.func,
|
listTags: PropTypes.func,
|
||||||
tagsList: PropTypes.shape({
|
tagsList: PropTypes.shape({
|
||||||
loading: PropTypes.bool,
|
loading: PropTypes.bool,
|
||||||
}),
|
}),
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class TagsListComponent extends React.Component {
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { listTags } = this.props;
|
const { listTags } = this.props;
|
||||||
|
|
||||||
|
@ -85,8 +86,6 @@ export class TagsListComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TagsListComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const TagsList = connect(pick([ 'tagsList' ]), { listTags, filterTags })(TagsListComponent);
|
const TagsList = connect(pick([ 'tagsList' ]), { listTags, filterTags })(TagsListComponent);
|
||||||
|
|
||||||
export default TagsList;
|
export default TagsList;
|
||||||
|
|
|
@ -5,16 +5,16 @@ import PropTypes from 'prop-types';
|
||||||
import { pick } from 'ramda';
|
import { pick } from 'ramda';
|
||||||
import { deleteTag, tagDeleted, tagDeleteType } from '../reducers/tagDelete';
|
import { deleteTag, tagDeleted, tagDeleteType } from '../reducers/tagDelete';
|
||||||
|
|
||||||
const propTypes = {
|
export class DeleteTagConfirmModalComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
tag: PropTypes.string.isRequired,
|
tag: PropTypes.string.isRequired,
|
||||||
toggle: PropTypes.func.isRequired,
|
toggle: PropTypes.func.isRequired,
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
deleteTag: PropTypes.func,
|
deleteTag: PropTypes.func,
|
||||||
tagDelete: tagDeleteType,
|
tagDelete: tagDeleteType,
|
||||||
tagDeleted: PropTypes.func,
|
tagDeleted: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DeleteTagConfirmModalComponent extends React.Component {
|
|
||||||
doDelete = () => {
|
doDelete = () => {
|
||||||
const { tag, toggle, deleteTag } = this.props;
|
const { tag, toggle, deleteTag } = this.props;
|
||||||
|
|
||||||
|
@ -68,8 +68,6 @@ export class DeleteTagConfirmModalComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteTagConfirmModalComponent.propTypes = propTypes;
|
|
||||||
|
|
||||||
const DeleteTagConfirmModal = connect(
|
const DeleteTagConfirmModal = connect(
|
||||||
pick([ 'tagDelete' ]),
|
pick([ 'tagDelete' ]),
|
||||||
{ deleteTag, tagDeleted }
|
{ deleteTag, tagDeleted }
|
||||||
|
|
|
@ -10,7 +10,8 @@ import colorGenerator, { colorGeneratorType } from '../../utils/ColorGenerator';
|
||||||
import { editTag, tagEdited } from '../reducers/tagEdit';
|
import { editTag, tagEdited } from '../reducers/tagEdit';
|
||||||
import './EditTagModal.scss';
|
import './EditTagModal.scss';
|
||||||
|
|
||||||
const propTypes = {
|
export class EditTagModalComponent extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
tag: PropTypes.string,
|
tag: PropTypes.string,
|
||||||
editTag: PropTypes.func,
|
editTag: PropTypes.func,
|
||||||
toggle: PropTypes.func,
|
toggle: PropTypes.func,
|
||||||
|
@ -21,12 +22,11 @@ const propTypes = {
|
||||||
error: PropTypes.bool,
|
error: PropTypes.bool,
|
||||||
editing: PropTypes.bool,
|
editing: PropTypes.bool,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
static defaultProps = {
|
||||||
colorGenerator,
|
colorGenerator,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class EditTagModalComponent extends React.Component {
|
|
||||||
saveTag = (e) => {
|
saveTag = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const { tag: oldName, editTag, toggle } = this.props;
|
const { tag: oldName, editTag, toggle } = this.props;
|
||||||
|
@ -133,9 +133,6 @@ export class EditTagModalComponent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditTagModalComponent.propTypes = propTypes;
|
|
||||||
EditTagModalComponent.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
const EditTagModal = connect(pick([ 'tagEdit' ]), { editTag, tagEdited })(EditTagModalComponent);
|
const EditTagModal = connect(pick([ 'tagEdit' ]), { editTag, tagEdited })(EditTagModalComponent);
|
||||||
|
|
||||||
export default EditTagModal;
|
export default EditTagModal;
|
||||||
|
|
|
@ -6,17 +6,18 @@ import classnames from 'classnames';
|
||||||
import './SearchField.scss';
|
import './SearchField.scss';
|
||||||
|
|
||||||
const DEFAULT_SEARCH_INTERVAL = 500;
|
const DEFAULT_SEARCH_INTERVAL = 500;
|
||||||
const propTypes = {
|
|
||||||
|
export default class SearchField extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
static defaultProps = {
|
||||||
className: '',
|
className: '',
|
||||||
placeholder: 'Search...',
|
placeholder: 'Search...',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class SearchField extends React.Component {
|
|
||||||
state = { showClearBtn: false, searchTerm: '' };
|
state = { showClearBtn: false, searchTerm: '' };
|
||||||
timer = null;
|
timer = null;
|
||||||
|
|
||||||
|
@ -64,6 +65,3 @@ export default class SearchField extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchField.propTypes = propTypes;
|
|
||||||
SearchField.defaultProps = defaultProps;
|
|
||||||
|
|
Loading…
Reference in a new issue