From ca183cb7cf2cfcc33b95482f368febb4ae602cd3 Mon Sep 17 00:00:00 2001 From: Qolzam Date: Fri, 21 Jul 2017 12:57:04 +0430 Subject: [PATCH] Remove some unused action & Add commentActions,globalActions docs. --- app/actions/globalActions.jsx | 55 +-------- docs/layers/actions.md | 224 +++++++++++++++++++++++++++++++--- 2 files changed, 209 insertions(+), 70 deletions(-) diff --git a/app/actions/globalActions.jsx b/app/actions/globalActions.jsx index 154e213..1bfdc28 100644 --- a/app/actions/globalActions.jsx +++ b/app/actions/globalActions.jsx @@ -21,9 +21,8 @@ export const progressChange = (percent, visible) => { /** * Default data loaded status will be true - * @param {boolean} status */ -export const defaultDataEnable = (status) => { +export const defaultDataEnable = () => { return{ type: types.DEFAULT_DATA_ENABLE } @@ -33,61 +32,22 @@ export const defaultDataEnable = (status) => { * Default data loaded status will be false * @param {boolean} status */ -export const defaultDataDisable = (status) => { +export const defaultDataDisable = () => { return{ type: types.DEFAULT_DATA_DISABLE } } - -/** - * Show notification normally - * @param {string} message - */ -export const showNotificationNormal = (message) => { - return (dispatch,getState) => { - dispatch(showNormalMessage(message)) - - } -} - - -// - Show global normal message -export const showNormalMessage = (message) => { - return{ - type: types.SHOW_NORMAL_MESSAGE_GLOBAL, - message - } - -} - // - Show notification of request export const showNotificationRequest = () => { - return (dispatch,getState) => { - dispatch(showSendRequestMessage()) - } -} - - -// - Show global request sent message -export const showSendRequestMessage = () => { return{ type: types.SHOW_SEND_REQUEST_MESSAGE_GLOBAL } - } // - Show notification of success export const showNotificationSuccess = () => { - return (dispatch,getState) => { - dispatch(showRequestSuccessMessage()) - - } -} - -// - Show global request successful message -export const showRequestSuccessMessage = () => { return{ type: types.SHOW_REQUEST_SUCCESS_MESSAGE_GLOBAL } @@ -204,15 +164,6 @@ export const temp = (data) => { // - Load data for guest export const loadDataGuest = () => { return (dispatch,getState) => { - var userString = "{\"avatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"contact\":\"amir.gholzam@live.com\",\"email\":\"amir.gholzam@live.com\",\"fullName\":\"React Social Blog\",\"password\":\"123qwe\",\"summary\":\" The React Social Blog (RSB) Application is a diary app blog\"}" - var postString = '[{"id":"-KkauHBOZXlALsHIrNsvsq","body":"The React Social Blog (RSB) Application is a diary app blog based on Semantic ui React for UI, Redux with react-redux for managing states and React for managing DOM .It is an open source project as a portfolio.\\n\\nI will be really grateful to receive any issue: \\nhttps://github.com/Qolzam/react-blog/issues\\n\\n \\n","commentCounter":0,"creationDate":1495301432,"deletationDate":"","deleted":false,"image":"http://www.freeimageslive.com/galleries/nature/abstract/preview/frosty_grass.jpg","lastEditDate":"","ownerAvatar":"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg","ownerDisplayName":"React Social Blog","ownerUserId":"5flWuB1RieZR7GIAwHYMPYaI5o33","postTypeId":1,"score":0,"video":"","viewCount":0},{"id":"-KkauHBOZXlALsHIrNIq","body":"It is a demo website","commentCounter":0,"creationDate":1495301432,"deletationDate":"","deleted":false,"image":"http://www.freeimageslive.com/galleries/nature/environment/pics/eaten%20_flower0905.jpg","lastEditDate":"","ownerAvatar":"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg","ownerDisplayName":"React Social Blog","ownerUserId":"5flWuB1RieZR7GIAwHYMPYaI5o33","postTypeId":1,"score":0,"video":"","viewCount":0},{"id":"-KkauHBOZXlsLsHIrNIq","body":"This is an open source project","commentCounter":0,"creationDate":1495301432,"deletationDate":"","deleted":false,"image":"http://www.freeimageslive.com/galleries/nature/environment/pics/eaten%20_flower0905.jpg","lastEditDate":"","ownerAvatar":"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg","ownerDisplayName":"React Social Blog","ownerUserId":"5flWuB1RieZR7GIAwHYMPYaI5o33","postTypeId":1,"score":0,"video":"","viewCount":0},{"id":"-KkaurBOZXlALsHIrNIq","body":"I have documentaion, testing, add some features DEBUG in my todo list","commentCounter":0,"creationDate":1495301432,"deletationDate":"","deleted":false,"image":"http://www.freeimageslive.com/galleries/nature/environment/pics/eaten%20_flower0905.jpg","lastEditDate":"","ownerAvatar":"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg","ownerDisplayName":"React Social Blog","ownerUserId":"5flWuB1RieZR7GIAwHYMPYaI5o33","postTypeId":1,"score":0,"video":"","viewCount":0}]' - var postCommentString = "{\"postComments\":{\"-KkauHBOZXlALsHIrNIq\":{\"-KkaxkH1WmfcQaidsNHK3R\":{\"creationDate\":1495302341,\"postId\":\"-KkauHBOZXlALsHIrNIq\",\"score\":0,\"text\":\"On developing :)\",\"userAvatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"userDisplayName\":\"React Social Blog\",\"userId\":\"5flWuB1RieZR7GIAwHYMPYaI5o33\"},\"-KkafsdfxkH1WmfcQaiNHK3R\":{\"creationDate\":1495302341,\"postId\":\"-KkauHBOZXlALsHIrNIq\",\"score\":0,\"text\":\"This is a good project for lorem if you want to learn more and deeply about react and ui frameworkes. I'm preparing a good document for lorem :)\",\"userAvatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"userDisplayName\":\"React Social Blog\",\"userId\":\"5flWuB1RieZR7GIAwHYMPYaI5o33\"},\"-KkaxkH1WfrmfcQaiNHK3R\":{\"creationDate\":1495302341,\"postId\":\"-KkauHBOZXlALsHIrNIq\",\"score\":0,\"text\":\"On I'm so happy now that I have you react-blog so far I was looking for you oh it's just lorem so don't make it serious :)\",\"userAvatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"userDisplayName\":\"React Social Blog\",\"userId\":\"5flWuB1RieZR7GIAwHYMPYaI5o33\"},\"-KkaxkH1WmfcQakeiNHK3R\":{\"creationDate\":1495302341,\"postId\":\"-KkauHBOZXlALsHIrNIq\",\"score\":0,\"text\":\"On developing :)\",\"userAvatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"userDisplayName\":\"React Social Blog\",\"userId\":\"5flWuB1RieZR7GIAwHYMPYaI5o33\"},\"-KkaxkH1WmfcQpraiNHK3R\":{\"creationDate\":1495302341,\"postId\":\"-KkauHBOZXlALsHIrNIq\",\"score\":0,\"text\":\"On developing :)\",\"userAvatar\":\"http://www.freeimageslive.com/galleries/nature/abstract/preview/frostyleaves00406.jpg\",\"userDisplayName\":\"React Social Blog\",\"userId\":\"5flWuB1RieZR7GIAwHYMPYaI5o33\"}}}}" - var user = JSON.parse(userString) - dispatch(userActions.addUserInfo(user)) - var post = JSON.parse(postString) - dispatch(postActions.addPosts(post)) - var postComment = JSON.parse(postCommentString) - dispatch(commentActions.addCommentList(postComment.postComments)) -} + } } diff --git a/docs/layers/actions.md b/docs/layers/actions.md index 853fb04..59bff34 100644 --- a/docs/layers/actions.md +++ b/docs/layers/actions.md @@ -8,49 +8,49 @@ We provide some actions to authorize a user. The authorize actions include singu ### Authorize Action Functions -```jsx +```javascript dbLogin = (email, password) => {} ``` This action check a user by `email` and `password` to authorize a user to login website. -```jsx +```javascript dbLogout = () => {} ``` This action is responsible to logout the user. -```jsx +```javascript dbSignup = (user) => {} ``` This action is responsible to register user on the server. `user` parameter is a user object with user information. -```jsx +```javascript dbUpdatePassword = (newPassword) => {} ``` This action is responsible to change user passwaord on the server. `newPassword` parameter is the password that user wants to replace with current password. -```jsx +```javascript login = (uid) => {} ``` This action is responsible to change user state to login state on reducer. `uid` is the user identifire. -```jsx +```javascript logout = () => {} ``` This action is responsible to change user state to logout state on reducer. -```jsx +```javascript signup = (user) => {} ``` This action is responsible to create new user state on reducer. -```jsx +```javascript updatePassword = () => {} ``` @@ -62,74 +62,262 @@ We provide some actions to authorize a user. The authorize actions include singu ### Circle Action Functions -```jsx +```javascript dbAddCircle = (circleName) => {} ``` Add a circle on the database. `circleName` is the name of the circle. -```jsx +```javascript dbAddFollowingUser = (cid, userFollowing) => {} ``` Add a user in a circle on the server. `cid` is the identifier of that circle. `userFollowing` is an object of the user which we want to add in a circle. -```jsx +```javascript dbDeleteFollowingUser = (cid, followingId) => {} ``` Delete a user from a circle on the server. `cid` is the identifier of that circle. `userFollowing` is an object of the user which we want to from a circle. -```jsx +```javascript dbUpdateCircle = (newCircle) => {} ``` Update a circle. `newCircle` is a circle object which should be updated. -```jsx +```javascript dbDeleteCircle = (id) => {} ``` Update a circle on the server. `id` is the circle identifier. -```jsx +```javascript dbGetCircles = () => {} ``` Get all circles of current user from server. -```jsx +```javascript dbGetCirclesByUserId = (uid) => {} ``` Get all circles of a specific user from server. `uid` is the user identifier. -```jsx +```javascript addCircle = (uid, circle) => {} ``` Add a circle in redux store. `uid` is the user identifier which we want to add `circle` to, from redux store. -```jsx +```javascript updateCircle = (uid, circle) => {} ``` Add a circle in redux store. `uid` is the user identifier which we want to update `circle` for, from redux store. -```jsx +```javascript deleteCircle = (uid, id)} ``` Delete a circle with `id` identifier which the user with `uid` identifier is the owner of that circle, from redux store. +```javascript +addCircles = (uid, circles) => {} +``` + +Add a list of `cricles` for the user with `uid` identifier on redux store. + +```javascript +openCircleSettings = (uid, id) => {} +``` + +Indicate a circle with `id` identifier for a user with `uid` identifier should be open. + +```javascript +closeCircleSettings = (uid, id) => {} +``` + +Indicate a circle with `id` identifier for a user with `uid` identifier should be close. + +```javascript +addFollowingUser = (uid, cid, followingId, userCircle) => {} +``` + +Add a user in a circle. +Add a user with `followingId` identifier in a circle with `cid` identifier belong to the user with `uid` identifier. `userCircle` is an object of user information which we want to add in a circle. + +```javascript +deleteFollowingUser = (uid, cid, followingId) => {} +``` + +Delete a user from a circle. +Delete a user with `followingId` identifier from a circle with `cid` identifier belong to the user with `uid` identifier. `userCircle` is an object of user information which we want to delete from a circle. + ## commentActions.jsx ### Comment Action Functions +```javascript +dbAddComment = (newComment, callBack) => {} +``` + +Add a comment on a post. `newComment` is an object of comment. `callBack` is a function callback which will be fired when comment add successfully. + +```javascript +dbGetComments = () => {} +``` + +Get whole comments of current user who is logged in. + +```javascript +dbUpdateComment = (id, postId, text) => {} +``` + +Update a comment content with `id` identifier on a post with `postId` identifier. `text` is the new content of the comment. + +```javascript +dbDeleteComment = (id, postId) => {} +``` + +Delete a comment content with `id` identifier on a post with `postId` identifier. + +```javascript +addComment = (data) => {} +``` + +Add a comment on redux store. Data is an object with comment information. + +```javascript +updateComment = (data) => {} +``` + +Update a comment on redux store. Data is an object with updated comment information. + +```javascript +addCommentList = (postComments) => {} +``` + +Add a list of comment on redux store. `postComments` is a list of comments. + +```javascript +deleteComment = (id, postId) => {} +``` + +Delete a comment with `id` identifier on a post with `postId` identifier on redux store. Data is an object with comment information. + +```javascript +clearAllData = () => {} +``` + +Delete all comments from redux store. + +```javascript +openCommentEditor = (comment) => {} +``` + +Open comment editor of a comment. `comment` include comment information. + +```javascript +closeCommentEditor = (comment) => {} +``` + +Comment comment editor of a comment. `comment` include comment information. + ## globalActions.jsx ### Global Action Functions +```javascript +progressChange = (percent, visible) => {} +``` + +Changes progress bar percentage. `percent` is a number of percentage. `visible` indicate if progress bar should be visible or not. + +```javascript +defaultDataEnable = (status) => {} +``` + +Sets dafault data loaded. + +```javascript +defaultDataDisable = () => {} +``` + +Sets dafault data has not loaded. + +```javascript +showNotificationRequest = () => {} +``` + +Show a notification popup that request has been sent. + +```javascript +showNotificationSuccess = () => {} +``` + +Show a notification popup that request has been processed successfully. + +```javascript +hideMessage = () => {} +``` + +Hide notification popup. + +```javascript +showErrorMessage = (message) => {} +``` + +Show notification popup with error `message`. + +```javascript +setHeaderTitleOpt = (opt,payload) => {} +``` + +Sets the title of site header. According `opt` we can set the title. `payload` is an object depend on `opt`. + +```javascript +setHeaderTitle = (text) => {} +``` + +Sets the title of site header. `text` is the text of title. + +```javascript +openPostWrite = () => {} +``` + +Show the dialog of writing post. + +```javascript +closePostWrite = () => {} +``` + +Close the dialog of writing post. + +```javascript +showTopLoading = () => {} +``` + +Show top loading popup. + +```javascript +hideTopLoading = () => {} +``` + +Hide top loading popup. + +```javascript +temp = (data) => {} +``` + +Stor temprory data on redux store. + +```javascript +loadDataGuest = () => {} +``` + +Execute some procedure like load essential data the time user is unauthorized. + ## imageGalleryActions.jsx ### Image Gallery Action Functions