aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src')
-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
4 files changed, 53 insertions, 51 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js
index 330b3f9e3..50a9d5f91 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 39c1296b5..8c79f7791 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 a79100cd1..3f0b884b9 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 61ac91d46..72537d865 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
-};
-*/
+