aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-07-26 15:08:26 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commit050ac675c030b9de6abde874d63c54aaaa80d0d6 (patch)
tree553efe6bb6cf609ccd92e2de29bff6940a88d4ca /vnext/src
parent7f5b17162587953307c71da1b137e5f416de11bb (diff)
more jsdoc
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 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
-};
-*/
+