mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ci: lint for ui
This commit is contained in:
1 parent
c2db7d7797
commit
8bb072a5a4
11 files changed
+73
-91
No files matched your search
@@ -4,11 +4,11 @@ export default function reducer(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
|
||||
const { messages } = action.payload;
|
||||
return {...state, ..._.keyBy(messages, 'udoc._id')};
|
||||
return { ...state, ..._.keyBy(messages, 'udoc._id') };
|
||||
}
|
||||
case 'DIALOGUES_CREATE': {
|
||||
const { user } = action.payload;
|
||||
if (state[user._id]) return state
|
||||
if (state[user._id]) return state;
|
||||
return {
|
||||
...state,
|
||||
[user._id]: {
|
||||
|
||||
@@ -40,10 +40,10 @@ export function setLocaleData(data) {
|
||||
CURRENT_LOCALE_DATA = data;
|
||||
}
|
||||
|
||||
export function loadMessageBundle(file) {
|
||||
export function loadMessageBundle() {
|
||||
return localize;
|
||||
}
|
||||
|
||||
export function config(opt) {
|
||||
export function config() {
|
||||
return loadMessageBundle;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default class DomComponent extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
this.refs.dom.appendChild(this.props.childDom);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
$(this.refs.dom).empty();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
childDom,
|
||||
...rest
|
||||
} = this.props;
|
||||
return (
|
||||
<div {...rest} ref="dom"></div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DomComponent.propTypes = {
|
||||
childDom: PropTypes.instanceOf(HTMLElement).isRequired,
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement }) {
|
||||
const ref = React.useRef<HTMLDivElement>();
|
||||
React.useEffect(() => {
|
||||
ref.current.appendChild(props.childDom);
|
||||
return () => {
|
||||
$(ref.current).empty();
|
||||
};
|
||||
});
|
||||
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
||||
}
|
||||
Reference in new issue
Block a user