From c344dfbe108c95a18c40ec57c63a3190e23fcd5e Mon Sep 17 00:00:00 2001 From: Mohammad Jafari <66924476+MMDJafari@users.noreply.github.com> Date: Wed, 24 Aug 2022 19:11:07 +0430 Subject: [PATCH 01/23] Redesigned and improved Notification page --- config/default.js | 2 +- src/components/fontawesome-icons.jsx | 2 + src/components/notification-body.jsx | 52 ++++++ src/components/notifications.jsx | 239 +++++++++++++++++++++------ src/redux/action-creators.js | 18 ++ src/redux/action-types.js | 2 + src/redux/reducers.js | 10 ++ src/redux/reducers/posts.js | 11 ++ src/services/api.js | 6 + styles/shared/post.scss | 10 +- 10 files changed, 295 insertions(+), 57 deletions(-) create mode 100644 src/components/notification-body.jsx diff --git a/config/default.js b/config/default.js index e10a78296..47d81b636 100644 --- a/config/default.js +++ b/config/default.js @@ -6,7 +6,7 @@ const DAY_IN_MILLISECONDS = 1000 * 60 * 60 * 24; export default { api: { - root: 'https://candy.freefeed.net', + root: 'https://freefeed.net', }, siteTitle: 'FreeFeed', diff --git a/src/components/fontawesome-icons.jsx b/src/components/fontawesome-icons.jsx index fe68da783..9cf1d3b7d 100644 --- a/src/components/fontawesome-icons.jsx +++ b/src/components/fontawesome-icons.jsx @@ -6,6 +6,7 @@ import { faGlobeAmericas, faUserFriends, faPaperclip, + faClock, } from '@fortawesome/free-solid-svg-icons'; import { faComment, faHeart as faHeartO, faImage } from '@fortawesome/free-regular-svg-icons'; import { faCommentPlus } from './fontawesome-custom-icons'; @@ -24,6 +25,7 @@ const preloadedIcons = [ faUserFriends, faImage, faPaperclip, + faClock, ]; export const SVGSymbolDeclarations = memo(function SVGSymbolDeclarations() { diff --git a/src/components/notification-body.jsx b/src/components/notification-body.jsx new file mode 100644 index 000000000..4d3e3be06 --- /dev/null +++ b/src/components/notification-body.jsx @@ -0,0 +1,52 @@ +import { useEffect } from 'react'; +import { useDispatch, useSelector} from 'react-redux'; + +import { getSinglePostBody, getSingleComment} from '../redux/action-creators'; + +/** + * @param {string} id + */ + +export function getCommentBody(id) { + const dispatch = useDispatch(); + useEffect(() => void dispatch(getSingleComment(id)), [dispatch, id]); + return useSelector((state) => { + return { + cmBody: state.comments[id] + }; + }); +} + +export function getPostBody(id) { + const dispatch = useDispatch(); + useEffect(() => void dispatch(getSinglePostBody(id)), [dispatch, id]); + return useSelector((state) => { + return { + psBody: state.posts[id] + }; + }); +} + +export function SingleComment({id = null}) { + if (id) { + const { cmBody } = getCommentBody(id); + var commentBody = {}; + Object.assign(commentBody, cmBody); + return
+ To confirm {create ? 'your' : 'updated'} email address, please click{' '} + {' '} + and enter the code that we will send to {emailField.input.value}. +
+ {sendStatus.loading && ( ++ Sending code to {lastSentTo}... +
+ )} + {sendStatus.success && ( ++ Code was sent to {lastSentTo}, please check your mailbox (and, + probably, the Spam folder) +
+ )} + {sendStatus.error && ( ++ Error sending to {lastSentTo}: {sendStatus.errorText} +
+ )} ++ +
++ Blocked users cannot write posts to the group. They can still see and comment the + posts in the group while it is not private. +
+Loading list…
)} + {blockedUsersStatus.error &&{blockedUsersStatus.errorText}
}This group has no blocked users.
+ )}