aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vnext/package.json1
-rw-r--r--vnext/src/api/index.js1
-rw-r--r--vnext/src/ui/Feeds.js71
-rw-r--r--vnext/src/ui/SearchBox.js12
-rw-r--r--vnext/src/ui/Settings.js20
-rw-r--r--vnext/yarn.lock15
6 files changed, 54 insertions, 66 deletions
diff --git a/vnext/package.json b/vnext/package.json
index d60d042f..b1025efc 100644
--- a/vnext/package.json
+++ b/vnext/package.json
@@ -36,7 +36,6 @@
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
- "react-router-prop-types": "^1.0.4",
"react-test-renderer": "^16.8.6",
"style-loader": "^0.23.1",
"stylelint": "^10.1.0",
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js
index 330b3f9e..50a9d5f9 100644
--- a/vnext/src/api/index.js
+++ b/vnext/src/api/index.js
@@ -57,6 +57,7 @@ const apiBaseUrl = 'https://juick.com';
* @property {string=} attach
* @property {string=} timestamp
* @property {boolean=} ReadOnly
+ * @property {number=} replyto
*/
diff --git a/vnext/src/ui/Feeds.js b/vnext/src/ui/Feeds.js
index 39c1296b..8c79f779 100644
--- a/vnext/src/ui/Feeds.js
+++ b/vnext/src/ui/Feeds.js
@@ -11,6 +11,26 @@ import UserInfo from './UserInfo';
import { getMessages } from '../api';
+/**
+ * @typedef {Object} Query
+ * @property {string} baseUrl
+ * @property {Object=} search
+ * @property {string} pageParam
+ */
+
+/**
+ * @typedef {Object} PageProps
+ * @property {import('history').History} history
+ * @property {import('history').Location} location
+ * @property {import('react-router').match} match
+ * @property {string} search
+ * @property {import('../api').SecureUser} visitor
+ * @property {import('../api').Message[]} msgs
+ */
+
+/**
+ * @param {PageProps} props
+ */
export function Discover(props) {
let search = qs.parse(props.location.search.substring(1));
const query = {
@@ -21,6 +41,9 @@ export function Discover(props) {
return (<Feed authRequired={false} query={query} {...props} />);
}
+/**
+ * @param {PageProps} props
+ */
export function Discussions(props) {
const query = {
baseUrl: '/api/messages/discussions',
@@ -30,8 +53,7 @@ export function Discussions(props) {
}
/**
- * Blog page
- * @param {{match: import('react-router').match, location: import('history').Location}} props
+ * @param {PageProps} props
*/
export function Blog(props) {
const { user } = props.match.params;
@@ -52,6 +74,9 @@ export function Blog(props) {
);
}
+/**
+ * @param {PageProps} props
+ */
export function Tag(props) {
const { tag } = props.match.params;
const query = {
@@ -64,6 +89,9 @@ export function Tag(props) {
return (<Feed authRequired={false} query={query} {...props} />);
}
+/**
+ * @param {PageProps} props
+ */
export function Home(props) {
const query = {
baseUrl: '/api/home',
@@ -72,6 +100,16 @@ export function Home(props) {
return (<Feed authRequired={true} query={query} {...props} />);
}
+/**
+ * @param {{
+ authRequired?: boolean,
+ visitor: import('../api').SecureUser,
+ history: import('history').History,
+ location: import('history').Location,
+ msgs: import('../api').Message[],
+ query: Query
+}} props
+ */
function Feed(props) {
const [msgs, setMsgs] = useState([]);
const [loading, setLoading] = useState(true);
@@ -144,32 +182,3 @@ function Feed(props) {
<div className="msgs">{nodes}</div>
) : error ? <div>error</div> : loading ? <div className="msgs"><Spinner /><Spinner /><Spinner /><Spinner /></div> : <div>No more messages</div>;
}
-/*
-Discover.propTypes = {
- location: ReactRouterPropTypes.location.isRequired,
- search: PropTypes.string
-};
-
-Blog.propTypes = {
- match: ReactRouterPropTypes.match.isRequired,
- location: ReactRouterPropTypes.location.isRequired,
- search: PropTypes.string
-};
-
-Tag.propTypes = {
- match: ReactRouterPropTypes.match.isRequired
-};
-
-Feed.propTypes = {
- authRequired: PropTypes.bool,
- visitor: UserType,
- history: ReactRouterPropTypes.history.isRequired,
- location: ReactRouterPropTypes.location.isRequired,
- msgs: PropTypes.array,
- query: PropTypes.shape({
- baseUrl: PropTypes.string.isRequired,
- search: PropTypes.object,
- pageParam: PropTypes.string.isRequired
- })
-};
-*/ \ No newline at end of file
diff --git a/vnext/src/ui/SearchBox.js b/vnext/src/ui/SearchBox.js
index a79100cd..3f0b884b 100644
--- a/vnext/src/ui/SearchBox.js
+++ b/vnext/src/ui/SearchBox.js
@@ -1,9 +1,10 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import ReactRouterPropTypes from 'react-router-prop-types';
import { withRouter } from 'react-router-dom';
import { useFormState } from 'react-use-form-state';
+/**
+ * @param {{ pathname: string, onSearch: function, history: import('history').History }} props
+ */
function SearchBox({ onSearch, history, pathname }) {
let onSubmit = (event) => {
event.preventDefault();
@@ -13,14 +14,9 @@ function SearchBox({ onSearch, history, pathname }) {
return (
<form onSubmit={onSubmit}>
<input name="search" className="text"
- placeholder="Search..." value={ formState.values.search } {...text('search')} />
+ placeholder="Search..." value={formState.values.search} {...text('search')} />
</form>
);
}
-SearchBox.propTypes = {
- pathname: PropTypes.string.isRequired,
- onSearch: PropTypes.func.isRequired,
- history: ReactRouterPropTypes.history.isRequired
-};
export default withRouter(SearchBox);
diff --git a/vnext/src/ui/Settings.js b/vnext/src/ui/Settings.js
index 61ac91d4..72537d86 100644
--- a/vnext/src/ui/Settings.js
+++ b/vnext/src/ui/Settings.js
@@ -7,6 +7,9 @@ import Icon from './Icon';
import UploadButton from './UploadButton';
import Avatar from './Avatar';
+/**
+ * @param {{ visitor: import('../api').User, onChange: function }} props
+ */
function ChangeAvatarForm({ visitor, onChange }) {
const [avatar, setAvatar] = useState('');
const [preview, setPreview] = useState();
@@ -48,12 +51,10 @@ function ChangeAvatarForm({ visitor, onChange }) {
</form>
);
}
-/*
-ChangeAvatarForm.propTypes = {
- visitor: UserType.isRequired,
- onChange: PropTypes.func.isRequired
-};
-*/
+
+/**
+ * @param {{ visitor: import('../api').User, onChange: React.ChangeEvent }} props
+ */
export default function Settings({ visitor, onChange }) {
let passwordChanged = (event) => {
@@ -243,10 +244,5 @@ export default function Settings({ visitor, onChange }) {
</div>
);
}
-/*
-Settings.propTypes = {
- visitor: UserType.isRequired,
- onChange: PropTypes.func.isRequired
-};
-*/
+
diff --git a/vnext/yarn.lock b/vnext/yarn.lock
index 4760502b..ec162e06 100644
--- a/vnext/yarn.lock
+++ b/vnext/yarn.lock
@@ -1053,11 +1053,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.2.tgz#a5ccec6abb6060d5f20d256fb03ed743e9774999"
integrity sha512-gojym4tX0FWeV2gsW4Xmzo5wxGjXGm550oVUII7f7G5o4BV6c7DBdiG1RRQd+y1bvqRyYtPfMK85UM95vsapqQ==
-"@types/prop-types@^15.5.3":
- version "15.7.1"
- resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6"
- integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==
-
"@types/q@^1.5.1":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
@@ -7603,7 +7598,7 @@ prompts@^2.0.1:
kleur "^3.0.2"
sisteransi "^1.0.0"
-prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
+prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -7842,14 +7837,6 @@ react-router-dom@^5.0.1:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
-react-router-prop-types@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/react-router-prop-types/-/react-router-prop-types-1.0.4.tgz#74716e92d014bb51ee4376ee198f34903cf8dc1d"
- integrity sha512-tXDQe0pnBTXjFivBa69hYibtgI3hz+Q/VmhMT7vIzYVPv574dd+lIuBIWOBH9dZkHeSuD6iur6zkmss3QVTeew==
- dependencies:
- "@types/prop-types" "^15.5.3"
- prop-types "^15.6.1"
-
react-router@5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.0.1.tgz#04ee77df1d1ab6cb8939f9f01ad5702dbadb8b0f"