aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Feeds.js
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/ui/Feeds.js
parent7f5b17162587953307c71da1b137e5f416de11bb (diff)
more jsdoc
Diffstat (limited to 'vnext/src/ui/Feeds.js')
-rw-r--r--vnext/src/ui/Feeds.js71
1 files changed, 40 insertions, 31 deletions
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