+ rows={rows || 1} placeholder={children} value={body} />
@@ -108,6 +110,9 @@ export default function MessageInput({ text, data, rows, children, onSend }) {
);
}
+/**
+ * @type {React.CSSProperties}
+ */
const commentStyle = {
display: 'flex',
flexDirection: 'column',
@@ -115,6 +120,9 @@ const commentStyle = {
marginTop: '10px'
};
+/**
+ * @type {React.CSSProperties}
+ */
const inputBarStyle = {
display: 'flex',
alignItems: 'center',
@@ -122,6 +130,9 @@ const inputBarStyle = {
padding: '3px'
};
+/**
+ * @type {React.CSSProperties}
+ */
const textInputStyle = {
overflow: 'hidden',
resize: 'none',
diff --git a/vnext/src/ui/SearchBox.js b/vnext/src/ui/SearchBox.js
index 3f0b884b..aab49757 100644
--- a/vnext/src/ui/SearchBox.js
+++ b/vnext/src/ui/SearchBox.js
@@ -3,9 +3,22 @@ import { withRouter } from 'react-router-dom';
import { useFormState } from 'react-use-form-state';
/**
- * @param {{ pathname: string, onSearch: function, history: import('history').History }} props
+ * @typedef {Object} SearchBoxPropsFields
+ * @property {string} pathname
+ * @property {function} onSearch
+ */
+
+ /**
+ * @typedef {import('react-router-dom').RouteComponentProps & SearchBoxPropsFields} SearchBoxProps
+ */
+
+/**
+ * @param {SearchBoxProps} props
*/
function SearchBox({ onSearch, history, pathname }) {
+ /**
+ * @type {(React.FormEvent
)}
+ */
let onSubmit = (event) => {
event.preventDefault();
onSearch(history, pathname, formState.values.search);
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index e469b8cf..cbd40c4c 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -16,6 +16,10 @@ import { bubbleStyle, chatItemStyle } from './helpers/BubbleStyle';
import './Thread.css';
let isMounted;
+/**
+ * @type import('../api').Message
+ */
+const emptyMessage = {};
/**
* @param {{
@@ -122,7 +126,8 @@ export default function Thread(props) {
const [replies, setReplies] = useState([]);
const [loading, setLoading] = useState(false);
const [active, setActive] = useState(0);
- const [editing, setEditing] = useState({});
+
+ const [editing, setEditing] = useState(emptyMessage);
const [hash, setHash] = useState(props.visitor.hash);
const { mid } = props.match.params;
@@ -162,7 +167,7 @@ export default function Thread(props) {
const { mid, rid, body, attach } = template;
let commentAction = editing.rid ? update(mid, editing.rid, body) : comment(mid, rid, body, attach);
commentAction.then(res => {
- setEditing({});
+ setEditing(emptyMessage);
loadReplies();
})
.catch(console.log);
diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js
index 6ff64931..ccdd5c04 100644
--- a/vnext/src/ui/UserInfo.js
+++ b/vnext/src/ui/UserInfo.js
@@ -86,7 +86,9 @@ function Summary({ user }) {
let presentItems = [read, readers, mybl].filter(Boolean);
return (
- {presentItems.length > 0 && presentItems.reduce((prev, curr) => [prev, ' ', curr])}
+ {presentItems.length > 0 && presentItems.reduce((prev, curr) =>
+ // @ts-ignore
+ [prev, ' ', curr])}
);
}
--
cgit v1.2.3