From 050ac675c030b9de6abde874d63c54aaaa80d0d6 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 26 Jul 2019 15:08:26 +0300
Subject: more jsdoc
---
vnext/src/ui/Feeds.js | 71 +++++++++++++++++++++++++++++----------------------
1 file changed, 40 insertions(+), 31 deletions(-)
(limited to 'vnext/src/ui/Feeds.js')
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 ();
}
+/**
+ * @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 ();
}
+/**
+ * @param {PageProps} props
+ */
export function Home(props) {
const query = {
baseUrl: '/api/home',
@@ -72,6 +100,16 @@ export function Home(props) {
return ();
}
+/**
+ * @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) {
{nodes}
) : error ? error
: loading ?
: No more messages
;
}
-/*
-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
--
cgit v1.2.3