├── .firebase └── hosting.YnVpbGQ.cache ├── .firebaserc ├── .github ├── ISSUE_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .snyk ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.cn.md ├── README.md ├── _config.yml ├── book.json ├── codecov.yml ├── docs ├── README.md ├── SUMMARY.md ├── _config.yml ├── app │ ├── configure │ │ ├── development.env │ │ └── production.env │ ├── firestore.png │ ├── firestore2.png │ ├── layer-1.png │ ├── layer-2.png │ ├── layer-3.png │ ├── layer-4.png │ ├── layer-5.png │ ├── layer-6.png │ ├── layer.png │ ├── logo.png │ └── multi-device.png ├── layers.md ├── layers │ ├── actions.md │ ├── api.md │ ├── components.md │ ├── constants.md │ ├── reducers.md │ ├── store.md │ └── tests.md └── motivation.md ├── firebase.json ├── index.d.ts ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── images │ └── flags.png └── index.html ├── server.js ├── src ├── api │ ├── CommentAPI.ts │ ├── CommonAPI.ts │ ├── FileAPI.ts │ ├── PostAPI.ts │ └── StringAPI.ts ├── assets │ ├── fonts │ │ ├── Flaticon.eot │ │ ├── Flaticon.ttf │ │ └── Flaticon.woff │ └── images │ │ └── Flaticon.svg ├── components │ ├── circle │ │ ├── CircleComponent.tsx │ │ ├── ICircleComponentProps.ts │ │ ├── ICircleComponentState.ts │ │ └── index.ts │ ├── comment │ │ ├── CommentComponent.tsx │ │ ├── ICommentComponentProps.ts │ │ ├── ICommentComponentState.ts │ │ └── index.ts │ ├── commentGroup │ │ ├── CommentGroupComponent.tsx │ │ ├── ICommentGroupComponentProps.ts │ │ ├── ICommentGroupComponentState.ts │ │ └── index.ts │ ├── commentList │ │ ├── CommentListComponent.tsx │ │ ├── ICommentListComponentProps.ts │ │ ├── ICommentListComponentState.ts │ │ └── index.ts │ ├── editProfile │ │ ├── EditProfileComponent.tsx │ │ ├── IEditProfileComponentProps.ts │ │ ├── IEditProfileComponentState.ts │ │ └── index.ts │ ├── findPeople │ │ ├── FindPeopleComponent.tsx │ │ ├── IFindPeopleComponentProps.ts │ │ ├── IFindPeopleComponentState.ts │ │ └── index.ts │ ├── followers │ │ ├── FollowersComponent.tsx │ │ ├── IFollowersComponentProps.ts │ │ ├── IFollowersComponentState.ts │ │ └── index.ts │ ├── following │ │ ├── FollowingComponent.tsx │ │ ├── IFollowingComponentProps.ts │ │ ├── IFollowingComponentState.ts │ │ └── index.ts │ ├── homeHeader │ │ ├── HomeHeaderComponent.tsx │ │ ├── IHomeHeaderComponentProps.ts │ │ ├── IHomeHeaderComponentState.ts │ │ └── index.ts │ ├── imageGallery │ │ ├── IImageGalleryComponentProps.ts │ │ ├── IImageGalleryComponentState.ts │ │ ├── ImageGalleryComponent.tsx │ │ └── index.ts │ ├── img │ │ ├── IImgComponentProps.ts │ │ ├── IImgComponentState.ts │ │ ├── ImgComponent.tsx │ │ └── index.ts │ ├── imgCover │ │ ├── IImgCoverComponentProps.ts │ │ ├── IImgCoverComponentState.ts │ │ ├── ImgCoverComponent.tsx │ │ └── index.ts │ ├── masterLoading │ │ ├── IMasterLoadingComponentProps.ts │ │ ├── IMasterLoadingComponentState.ts │ │ ├── MasterLoadingComponent.tsx │ │ └── index.ts │ ├── notify │ │ ├── INotifyComponentProps.ts │ │ ├── INotifyComponentState.ts │ │ ├── NotifyComponent.tsx │ │ └── index.ts │ ├── notifyItem │ │ ├── INotifyItemComponentProps.ts │ │ ├── INotifyItemComponentState.ts │ │ ├── NotifyItemComponent.tsx │ │ └── index.ts │ ├── post │ │ ├── IPostComponentProps.ts │ │ ├── IPostComponentState.ts │ │ ├── PostComponent.tsx │ │ └── index.ts │ ├── postWrite │ │ ├── IPostWriteComponentProps.ts │ │ ├── IPostWriteComponentState.ts │ │ ├── PostWriteComponent.tsx │ │ └── index.ts │ ├── profileHeader │ │ ├── IProfileHeaderComponentProps.ts │ │ ├── IProfileHeaderComponentState.ts │ │ ├── ProfileHeaderComponent.tsx │ │ └── index.ts │ ├── sendFeedback │ │ ├── ISendFeedbackComponentProps.ts │ │ ├── ISendFeedbackComponentState.ts │ │ ├── SendFeedbackComponent.tsx │ │ └── index.ts │ ├── shareDialog │ │ ├── IShareDialogComponentProps.ts │ │ ├── IShareDialogComponentState.ts │ │ ├── ShareDialogComponent.tsx │ │ └── index.ts │ ├── sidebar │ │ ├── ISidebarComponentProps.ts │ │ ├── ISidebarComponentState.ts │ │ ├── SidebarComponent.tsx │ │ └── index.ts │ ├── sidebarContent │ │ ├── ISidebarContentComponentProps.ts │ │ ├── ISidebarContentComponentState.ts │ │ ├── SidebarContentComponent.tsx │ │ └── index.ts │ ├── sidebarMain │ │ ├── ISidebarMainComponentProps.ts │ │ ├── ISidebarMainComponentState.ts │ │ ├── SidebarMainComponent.tsx │ │ └── index.ts │ ├── userAvatar │ │ ├── IUserAvatarComponentProps.ts │ │ ├── IUserAvatarComponentState.ts │ │ ├── UserAvatarComponent.tsx │ │ └── index.ts │ ├── userBox │ │ ├── IUserBoxComponentProps.ts │ │ ├── IUserBoxComponentState.ts │ │ ├── UserBoxComponent.tsx │ │ └── index.ts │ ├── userBoxList │ │ ├── IUserBoxListComponentProps.ts │ │ ├── IUserBoxListComponentState.ts │ │ ├── UserBoxListComponent.tsx │ │ └── index.ts │ └── yourCircles │ │ ├── IYourCirclesComponentProps.ts │ │ ├── IYourCirclesComponentState.ts │ │ ├── YourCirclesComponent.tsx │ │ └── index.ts ├── config │ ├── environment.dev.ts │ ├── environment.prod.ts │ └── index.ts ├── constants │ ├── authorizeActionType.ts │ ├── circleActionType.ts │ ├── commentActionType.ts │ ├── globalActionType.ts │ ├── imageGalleryActionType.ts │ ├── notificationActionType.ts │ ├── postActionType.ts │ ├── serverActionType.ts │ ├── serverRequestType.ts │ ├── userActionType.ts │ └── voteActionType.ts ├── containers │ ├── emailVerification │ │ ├── EmailVerificationComponent.tsx │ │ ├── IEmailVerificationComponentProps.ts │ │ ├── IEmailVerificationComponentState.ts │ │ └── index.ts │ ├── home │ │ ├── HomeComponent.tsx │ │ ├── IHomeComponentProps.ts │ │ ├── IHomeComponentState.ts │ │ └── index.ts │ ├── login │ │ ├── ILoginComponentProps.ts │ │ ├── ILoginComponentState.ts │ │ ├── LoginComponent.tsx │ │ └── index.ts │ ├── master │ │ ├── IMasterComponentProps.ts │ │ ├── IMasterComponentState.ts │ │ ├── MasterComponent.tsx │ │ └── index.ts │ ├── people │ │ ├── IPeopleComponentProps.ts │ │ ├── IPeopleComponentState.ts │ │ ├── PeopleComponent.tsx │ │ └── index.ts │ ├── postPage │ │ ├── IPostPageComponentProps.ts │ │ ├── IPostPageComponentState.ts │ │ ├── PostPageComponent.tsx │ │ └── index.ts │ ├── profile │ │ ├── IProfileComponentProps.ts │ │ ├── IProfileComponentState.ts │ │ ├── ProfileComponent.tsx │ │ ├── dialogTitle │ │ │ ├── DialogTitleComponent.tsx │ │ │ ├── IDialogTitleComponentProps.ts │ │ │ ├── IDialogTitleComponentState.ts │ │ │ └── index.ts │ │ └── index.ts │ ├── resetPassword │ │ ├── IResetPasswordComponentProps.ts │ │ ├── IResetPasswordComponentState.ts │ │ ├── ResetPasswordComponent.tsx │ │ └── index.ts │ ├── setting │ │ ├── ISettingComponentProps.ts │ │ ├── ISettingComponentState.ts │ │ ├── SettingComponent.tsx │ │ └── index.ts │ ├── signup │ │ ├── ISignupComponentProps.ts │ │ ├── ISignupComponentState.ts │ │ ├── SignupComponent.tsx │ │ └── index.ts │ └── stream │ │ ├── IStreamComponentProps.ts │ │ ├── IStreamComponentState.ts │ │ ├── StreamComponent.tsx │ │ └── index.ts ├── core │ ├── domain │ │ ├── authorize │ │ │ ├── index.ts │ │ │ ├── loginUser.ts │ │ │ ├── oauthType.ts │ │ │ └── registerUserResult.ts │ │ ├── circles │ │ │ ├── circle.ts │ │ │ ├── index.ts │ │ │ └── userTie.ts │ │ ├── comments │ │ │ ├── comment.ts │ │ │ └── index.ts │ │ ├── common │ │ │ ├── baseDomain.ts │ │ │ ├── feed.ts │ │ │ ├── feedType.ts │ │ │ ├── index.ts │ │ │ └── socialError.ts │ │ ├── graphs │ │ │ ├── graph.ts │ │ │ └── index.ts │ │ ├── imageGallery │ │ │ ├── image.ts │ │ │ └── index.ts │ │ ├── notifications │ │ │ ├── index.ts │ │ │ └── notification.ts │ │ ├── posts │ │ │ ├── index.ts │ │ │ └── post.ts │ │ ├── users │ │ │ ├── index.ts │ │ │ ├── profile.ts │ │ │ ├── user.ts │ │ │ └── userProvider.ts │ │ └── votes │ │ │ ├── index.ts │ │ │ └── vote.ts │ ├── environment.ts │ ├── factories │ │ ├── IServiceProvider.ts │ │ ├── index.ts │ │ └── serviceProvide.ts │ ├── services │ │ ├── authorize │ │ │ ├── IAuthorizeService.ts │ │ │ └── index.ts │ │ ├── circles │ │ │ ├── ICircleService.ts │ │ │ ├── IUserTieService.ts │ │ │ └── index.ts │ │ ├── comments │ │ │ ├── ICommentService.ts │ │ │ └── index.ts │ │ ├── common │ │ │ ├── ICommonService.ts │ │ │ └── index.ts │ │ ├── files │ │ │ ├── IStorageService.ts │ │ │ └── index.ts │ │ ├── imageGallery │ │ │ ├── IImageGalleryService.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── notifications │ │ │ ├── INotificationService.ts │ │ │ └── index.ts │ │ ├── posts │ │ │ ├── IPostService.ts │ │ │ └── index.ts │ │ ├── users │ │ │ ├── IUserService.ts │ │ │ └── index.ts │ │ └── votes │ │ │ ├── IVoteService.ts │ │ │ └── index.ts │ └── socialProviderTypes.ts ├── data │ └── firestoreClient │ │ ├── dependecyRegisterar.ts │ │ ├── firestoreClientTypes.ts │ │ ├── index.ts │ │ └── services │ │ ├── authorize │ │ ├── AuthorizeService.ts │ │ └── index.ts │ │ ├── circles │ │ ├── CircleService.ts │ │ ├── UserTieService.ts │ │ └── index.ts │ │ ├── comments │ │ ├── CommentService.ts │ │ └── index.ts │ │ ├── common │ │ ├── CommonService.ts │ │ └── index.ts │ │ ├── files │ │ ├── StorageService.ts │ │ └── index.ts │ │ ├── graphs │ │ ├── GraphService.ts │ │ ├── IGraphService.ts │ │ └── index.ts │ │ ├── imageGallery │ │ ├── ImageGalleryService.ts │ │ └── index.ts │ │ ├── index.ts │ │ ├── notifications │ │ ├── index.ts │ │ └── notificationService.ts │ │ ├── posts │ │ ├── PostService.ts │ │ └── index.ts │ │ ├── users │ │ ├── UserService.ts │ │ └── index.ts │ │ └── votes │ │ ├── VoteService.ts │ │ └── index.ts ├── index.tsx ├── layouts │ ├── appInput │ │ ├── AppInputComponent.tsx │ │ ├── IAppInputComponentProps.ts │ │ ├── IAppInputComponentState.ts │ │ └── index.ts │ ├── dialogTitle │ │ ├── DialogTitleComponent.tsx │ │ ├── IDialogTitleComponentProps.ts │ │ ├── IDialogTitleComponentState.ts │ │ └── index.ts │ ├── iconButtonElement │ │ ├── IconButtonElementComponent.tsx │ │ └── index.ts │ └── loadMoreProgress │ │ ├── LoadMoreProgressComponent.tsx │ │ └── index.ts ├── locale │ ├── ch.json │ ├── en.json │ └── es.json ├── models │ ├── comments │ │ └── commentTypes.ts │ ├── files │ │ ├── fileResult.ts │ │ └── index.ts │ ├── server │ │ ├── index.ts │ │ └── serverRequestModel.ts │ └── users │ │ ├── index.ts │ │ └── userRegisterModel.ts ├── registerServiceWorker.js ├── registerServiceWorker.ts ├── routes │ ├── HomeRouter.tsx │ ├── IRoute.ts │ ├── IRouterProps.ts │ ├── MasterRouter.tsx │ ├── PrivateRoute.tsx │ ├── PublicRoute.tsx │ └── index.ts ├── socialEngine.ts ├── store │ ├── actions │ │ ├── authorizeActions.ts │ │ ├── circleActions.ts │ │ ├── commentActions.ts │ │ ├── globalActions.ts │ │ ├── imageGalleryActions.ts │ │ ├── index.ts │ │ ├── localeActions.ts │ │ ├── notifyActions.ts │ │ ├── postActions.ts │ │ ├── serverActions.ts │ │ ├── serverRequestStatusType.ts │ │ ├── userActions.ts │ │ └── voteActions.ts │ ├── configureStore.dev.ts │ ├── configureStore.prod.ts │ ├── configureStore.ts │ ├── devTools.tsx │ ├── reducers │ │ ├── authorize │ │ │ ├── AuthorizeState.ts │ │ │ ├── IAuthorizeAction.ts │ │ │ ├── authorizeReducer.ts │ │ │ ├── authorizeSelector.ts │ │ │ └── index.ts │ │ ├── circles │ │ │ ├── CircleState.ts │ │ │ ├── ICircleAction.ts │ │ │ ├── circleReducer.ts │ │ │ └── index.ts │ │ ├── comments │ │ │ ├── CommentState.ts │ │ │ ├── ICommentAction.ts │ │ │ ├── commentReducer.ts │ │ │ └── index.ts │ │ ├── global │ │ │ ├── GlobalState.ts │ │ │ ├── IGlobalAction.ts │ │ │ ├── globalReducer.ts │ │ │ └── index.ts │ │ ├── imageGallery │ │ │ ├── IImageGalleryAction.ts │ │ │ ├── ImageGalleryState.ts │ │ │ ├── imageGalleryReducer.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── locale │ │ │ └── langugeType.ts │ │ ├── notifications │ │ │ ├── INotificationAction.ts │ │ │ ├── NotificationState.ts │ │ │ ├── index.ts │ │ │ └── notificationReducer.ts │ │ ├── posts │ │ │ ├── IPostAction.ts │ │ │ ├── PostState.ts │ │ │ ├── index.ts │ │ │ ├── postReducer.ts │ │ │ └── postSelector.ts │ │ ├── rootReducer.ts │ │ ├── server │ │ │ ├── IServerAction.ts │ │ │ ├── ServerState.ts │ │ │ ├── index.ts │ │ │ └── serverReducer.ts │ │ ├── users │ │ │ ├── IUserAction.ts │ │ │ ├── UserState.ts │ │ │ ├── index.ts │ │ │ └── userReducer.ts │ │ └── votes │ │ │ ├── IVoteAction.ts │ │ │ ├── VoteState.ts │ │ │ ├── index.ts │ │ │ └── voteReducer.ts │ └── sagas │ │ ├── commentSaga.ts │ │ ├── localeSaga.ts │ │ └── rootSaga.ts ├── styles │ ├── app.css │ ├── app.scss │ ├── base │ │ ├── _animate.scss │ │ ├── _flaticon.scss │ │ ├── _grid.scss │ │ ├── _icon.scss │ │ └── _variables.scss │ └── components │ │ ├── _blog.scss │ │ ├── _comment.scss │ │ ├── _global.scss │ │ ├── _home.scss │ │ ├── _homeHeader.scss │ │ ├── _imageGallery.scss │ │ ├── _login.scss │ │ ├── _master.scss │ │ ├── _masterLoading.scss │ │ ├── _people.scss │ │ ├── _post.scss │ │ ├── _postWrite.scss │ │ ├── _profile.scss │ │ ├── _sendFeedback.scss │ │ ├── _settings.scss │ │ ├── _sidebar.scss │ │ ├── _signup.scss │ │ └── _userBox.scss ├── tests │ └── app.test.ts └── typings │ ├── react-day-picker.d.ts │ ├── react-linkif.d.ts │ ├── react-loadable.d.ts │ ├── react-parallax.ts │ ├── react-share.ts │ └── react-string-replace.d.ts ├── tsconfig.json ├── tsconfig.prod.json └── tslint.json /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "test-4515a" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | ### Steps 3 | 4 | ### Expected Result 5 | 6 | ### Actual Result 7 | 8 | ### Version 9 | x.y.z 10 | 11 | ### Testcase -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | .vscode/ 24 | src/data/awsClient 25 | src/components/AWS.tsx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Amir Movahedi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Your checklist for this pull request 2 | 🚨Please review the [guidelines for contributing](../CONTRIBUTING.md) to this repository. 3 | 4 | - [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). Don't request your master! 5 | - [ ] Make sure you are making a pull request against the **canary branch** (left side). Also you should start *your branch* off *our canary*. 6 | - [ ] Check the commit's or even all commits' message styles matches our requested structure. 7 | - [ ] Check your code additions will fail neither code linting checks nor unit test. 8 | 9 | ### Description 10 | Please describe your pull request. 11 | 12 | 💔Thank you! 13 | -------------------------------------------------------------------------------- /README.cn.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | 5 | 6 |

7 | 8 |

9 | React Social Network :rocket: Version NEXT! :rocket: 10 |

11 | 12 | [![Gitter](https://badges.gitter.im/react-social-network/Lobby.svg)](https://gitter.im/react-social-network/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 13 | 14 | React Social Network是一个open source 项目,利用React强大的javascript库来构建用户界面。在这个项目中,我用社交网络为个例子来显示 react/react components 的一些试功能。这个项目的结构使帮助 开发人员能够根据自己的想法和环境发展他们自己项目。 15 |

16 | 17 | 18 | 19 |

20 | 21 | ## 🌟新升级 22 | React Social Network正在发展基于redux-saga,但我们在 v0.5分支中保留了React Social Network的redux-thunk版本。 ❤️我们非常感谢任何贡献。 23 | 24 | > 有关更多信息,请参阅CHANGELOG及相关问题 25 | 26 | 这个项目遵守“贡献者公约”行为准则。通过参与,您应该支持此代码。请向amir.gholzam@live.com报告不可接受的行为。 27 | 28 | ## 在开始之前 29 | 首先,这是一个React社交网络模板,其目的是找到通过React找到社交网络等大型项目的最佳方式。我们已经了解一些技术和算法对我们项目可以带来更好解决方案。请用这些想法来实现这个项目,如果你觉得你有更好的解决方案,我们非常高兴和感谢你的贡献。 30 | 31 | - 您是React的新手,你正在寻找一些想法,用一些基本的东西来启动React项目。您也是React Semantic UI的粉丝。我建议您从React Blog Project开始。 32 | 33 | 34 | - 您是具有React基础知识(在React Blog Project中提供)的您.您是社交网络项目,Material-UI的粉丝。你是喜欢JS / JSX的人。我建议您试试js-react-social-tutorial项目。 35 | 36 | 37 | - 你是纯Redux的粉丝,redux-thunk,TypeScript,InversifyJS IOC container,你对js-react-social-tutorial中的东西有足够的了解。React社交网络版本0.5.0分支可能是您 38 | 要找到的地方。 39 | 40 | 41 | - 你处于React的高手,你喜欢学习有关React的高级技术,比如Async Component / Lazy loading,redux-saga和其他超酷的东西,我们很高兴你到达这里。我们继续前进 42 | 43 | ## 例子 44 | [Love Open Social](https://love-social.firebaseapp.com) 45 | 46 | ## 所需的知识 47 | 48 | 我建议您在使用React Social Network之前了解React。 React社交网络由React components 构建,因此了解React如何适应Web发展非常重要。 49 | 50 | (如果您不熟悉Single Page Applications(SPA)的概念,请在阅读之前先到此处进行快速介绍。 51 | 52 | ## 中文的支持 🇨🇳🌏 53 | - [梁国辉](https://github.com/HuyQLuong) 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | markdown: kramdown -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": "./docs", 3 | "plugins": [ "theme-api" ], 4 | "pluginsConfig": { 5 | "theme-api": { 6 | "languages": [ 7 | { 8 | "lang": "js", 9 | "name": "JavaScript", 10 | "default": true 11 | } 12 | ] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | patch: 4 | default: 5 | threshold: 0.0% 6 | comment: false 7 | -------------------------------------------------------------------------------- /docs/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Readme](README.md) 4 | * [Motivation](motivation.md) 5 | 6 | ## Layers 7 | 8 | * [Overview](layers.md) 9 | * [Components](layers/components.md) 10 | * [API](layers/api.md) 11 | * [Actions](layers/actions.md) 12 | * [Reducers](layers/reducers.md) 13 | * [Store](layers/store.md) 14 | * [Constants](layers/constants.md) 15 | * [Tests](layers/tests.md) 16 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /docs/app/configure/development.env: -------------------------------------------------------------------------------- 1 | API_KEY=AIzsdfyDi-7MRiJNqGsdfg7WXuTyqsdMtpRjRFhOwD8 2 | AUTH_DOMAIN=test-6bdc1.firebaseapp.com 3 | DATABASE_URL=https://test-6bdc1.firebaseio.com 4 | PROJECT_ID=test-6bdc1 5 | STORAGE_BUCKET=test-6bdc1.appspot.com 6 | MESSAGING_SENDER_ID=416549341075 7 | PORT= 4000 -------------------------------------------------------------------------------- /docs/app/configure/production.env: -------------------------------------------------------------------------------- 1 | API_KEY=[API_KEY]
2 | AUTH_DOMAIN=[PROJECT_ID].firebaseapp.com
3 | DATABASE_URL=https://[DATABASE_NAME].firebaseio.com
4 | PROJECT_ID=[PROJECT_ID]
5 | STORAGE_BUCKET=[BUCKET].appspot.com
6 | MESSAGING_SENDER_ID=[SENDER_ID]HOST_URL
7 | -------------------------------------------------------------------------------- /docs/app/firestore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/firestore.png -------------------------------------------------------------------------------- /docs/app/firestore2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/firestore2.png -------------------------------------------------------------------------------- /docs/app/layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-1.png -------------------------------------------------------------------------------- /docs/app/layer-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-2.png -------------------------------------------------------------------------------- /docs/app/layer-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-3.png -------------------------------------------------------------------------------- /docs/app/layer-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-4.png -------------------------------------------------------------------------------- /docs/app/layer-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-5.png -------------------------------------------------------------------------------- /docs/app/layer-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer-6.png -------------------------------------------------------------------------------- /docs/app/layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/layer.png -------------------------------------------------------------------------------- /docs/app/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/logo.png -------------------------------------------------------------------------------- /docs/app/multi-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/docs/app/multi-device.png -------------------------------------------------------------------------------- /docs/layers.md: -------------------------------------------------------------------------------- 1 | # Layers 2 | 3 | 4 | 5 | ## Supporting multiple data platforms. 6 | With dependency injection and new structure we have tried to support variety of data platforms such as Google Cloud Firebase, AWS, Azure or using backend such as ASP.NET, PHP, JAVA, etc. 7 | 8 | 9 | 10 | ## Easy and fast to scale in structure 11 | Layers are organized in the way we have easy and less changes for adding/removing features. It could be integrated with server side too. As a result we are faster in developing in both side. 12 | ### Core 13 | - The infrastructure, 14 | - Providing interfaces for services 15 | - Domain 16 | ### Data 17 | * Firebase Data Client 18 | * AWS Data Client 19 | * Azure Data Client 20 | * ASP.NET Data Client 21 | * PHP Data Client 22 | ### Components 23 | 24 | 25 | ## Integrating and reusability in both mobile and web app 26 | With new structure we are able to develop the mobile app in parallel with web app **only** with changing `Components` layer. It means we can keep `Core`, `Data` layers, `Actions`, `Reducers`, etc. What we have high reusability and fast in producing the products. 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/layers/api.md: -------------------------------------------------------------------------------- 1 | # API 2 | 3 | Is a decoupled layer of interfaces to data and/or functionality of one or more components. 4 | -------------------------------------------------------------------------------- /docs/layers/components.md: -------------------------------------------------------------------------------- 1 | # Components 2 | 3 | This layer include [React components](https://facebook.github.io/react/docs/react-component.html) that let you split the UI into independent, reusable pieces, and think about each piece in isolation. 4 | -------------------------------------------------------------------------------- /docs/layers/constants.md: -------------------------------------------------------------------------------- 1 | # Constatnts 2 | 3 | This layer is responsible for setting constant virables, such as action type names for redux actions. Actions must have a type property that indicates the type of action being performed. Types should typically be defined as string constants. 4 | -------------------------------------------------------------------------------- /docs/layers/reducers.md: -------------------------------------------------------------------------------- 1 | # Reducers 2 | 3 | This layer is included reducers of entities. [Reducers](http://redux.js.org/docs/basics/Reducers.html) specify how the application's state changes in response. 4 | 5 | ## authorizeReducer 6 | 7 | This reducer is responsible to change user authorization state on reducer. 8 | 9 | ## circleReducer 10 | 11 | This reducer is responsible to change user's circle state on reducer, insert/update/delete circle and insert/update/delete follower/following. 12 | 13 | ## commentReducer 14 | 15 | This reducer is responsible to change user comment state on reducer, insert/update/delete comment. 16 | 17 | ## fileReducer 18 | 19 | This reducer is responsible to change files state on reducer. 20 | 21 | ## globalReducer 22 | 23 | This reducer is responsible to change global states on reducer. Like changing loding visibility or notification text. 24 | 25 | ## imageGalleryReducer 26 | 27 | This reducer is responsible to change images state on reducer, insert/update/delete image and cache image's url. 28 | 29 | ## imageUploaderReducer 30 | 31 | This reducer is responsible to change user upload state on reducer. 32 | 33 | ## notifyReducer 34 | 35 | This reducer is responsible to change user notification state on reducer, insert/update/delete notificaion and change seen state for notification. 36 | 37 | ## postReducer 38 | 39 | This reducer is responsible to change user post state on reducer, insert/update/delete post. 40 | 41 | ## userReducer 42 | 43 | This reducer is responsible to change user information state on reducer, insert/update/delete user information. 44 | 45 | ## voteReducer 46 | 47 | This reducer is responsible to change user vote state on reducer. insert/update/delete vote. -------------------------------------------------------------------------------- /docs/layers/store.md: -------------------------------------------------------------------------------- 1 | # Store 2 | 3 | This layer is responsible for configuring of redux store, such as setting reducers and midelwares. A [store](http://redux.js.org/docs/api/Store.html) holds the whole state tree of your application. 4 | -------------------------------------------------------------------------------- /docs/layers/tests.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | This layer is responsible to test each layer of application. Each test file name follow `[file-name].test.jsx` pattern for naming. We use [expect](https://github.com/mjackson/expect) to write assertion for each test case. We use [Karma](https://karma-runner.github.io/1.0/index.html) to run our tests. We use [Mocha](https://mochajs.org/) which tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. 4 | 5 | ## Test Actions 6 | 7 | ## Test Reducers 8 | 9 | ## Test Components 10 | 11 | ## Test API -------------------------------------------------------------------------------- /docs/motivation.md: -------------------------------------------------------------------------------- 1 | # Motivation 2 | 3 | In this project we follow [loosely coupled](https://en.wikipedia.org/wiki/Loose_coupling) system principle with the idea each part of this project be independent from others. For example if you want to use [frontend](https://en.wikipedia.org/wiki/Front_and_back_ends) you are not depend on [backend](https://en.wikipedia.org/wiki/Front_and_back_ends) as you can use Firbase so easy which we have provided in this project. You also can use any kind of backend such as php, python, javascript and etc, completely independent of frontend or you can use [ASP.NET Core 2](https://docs.microsoft.com/en-us/dotnet/core/) backend that we provided in this project. 4 | As my target in this project, I've intended to build a social network with features of new and powerful web technologies such as [React](https://facebook.github.io/react/) as a front-end tool in [React Social Network](https://github.com/Qolzam/react-social-network) project and build a powerful backend by [ASP.NET Core 2](https://docs.microsoft.com/en-us/dotnet/core/) with its cool new features in [ASP.NET Core Social Network](https://github.com/Qolzam/aspnet-core-social-network). I also use [React Native](https://facebook.github.io/react-native/) to build a powerful mobile social app in [React Mobile Social](https://github.com/Qolzam/react-mobile-social). All cool new features are providing as an open source project under MIT LICENSE and it's so great ;). -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "build", 4 | "headers": [ 5 | { 6 | "source": "**/*.@(eot|otf|ttf|ttc|woff|font.css)", 7 | "headers": [ 8 | { 9 | "key": "Access-Control-Allow-Origin", 10 | "value": "*" 11 | } 12 | ] 13 | }, 14 | { 15 | "source": "**/*.@(jpg|jpeg|gif|png)", 16 | "headers": [ 17 | { 18 | "key": "Cache-Control", 19 | "value": "max-age=7200" 20 | } 21 | ] 22 | }, 23 | { 24 | "source": "**/*.js", 25 | "headers": [ 26 | { 27 | "key": "Cache-Control", 28 | "value": "no-cache" 29 | } 30 | ] 31 | } 32 | ], 33 | "rewrites": [ 34 | { 35 | "source": "/favicon.ico", 36 | "destination": "/favicon.ico" 37 | }, 38 | { 39 | "source": "**", 40 | "destination": "/index.html" 41 | } 42 | ] 43 | } 44 | } -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'redux-offline' 2 | declare module 'redux-offline/lib/defaults' 3 | declare module 'redux-offline-immutable-config' 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/public/favicon.ico -------------------------------------------------------------------------------- /public/images/flags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/public/images/flags.png -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var morgan = require('morgan'); 3 | var path = require('path'); 4 | var webpack = require('webpack'); 5 | var webpackConfig = require('./webpack.config'); 6 | var compiler = webpack(webpackConfig); 7 | 8 | // Create our app 9 | var app = express(); 10 | const PORT = process.env.PORT || 3000; 11 | 12 | // Setup logger 13 | app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms')); 14 | 15 | 16 | app.use(require("webpack-dev-middleware")(compiler, { 17 | noInfo: true, 18 | publicPath: webpackConfig.output.publicPath 19 | })); 20 | 21 | app.use(require("webpack-hot-middleware")(compiler)); 22 | 23 | app.use(function(req, res, next) { 24 | if (req.headers['x-forwarded-proto'] === 'https') { 25 | res.redirect('http://' + req.hostname + req.url); 26 | } else { 27 | next(); 28 | } 29 | }); 30 | 31 | app.use(function(req, res, next) { 32 | var userAgent = req.get('User-Agent'); 33 | console.log(userAgent); 34 | next(); 35 | }); 36 | 37 | app.use(express.static('public')); 38 | 39 | 40 | // Always return the main index.html, so react-router render the route in the client 41 | app.get('*', (req, res) => { 42 | res.sendFile(path.resolve('public', 'index.html')); 43 | 44 | }); 45 | 46 | 47 | app.listen(PORT, function() { 48 | console.log('Express server is up on port ' + PORT); 49 | }); -------------------------------------------------------------------------------- /src/api/CommentAPI.ts: -------------------------------------------------------------------------------- 1 | import StringAPI from 'api/StringAPI' 2 | import { ServerRequestType } from 'constants/serverRequestType' 3 | import { ServerRequestModel } from 'models/server' 4 | import { ServerRequestStatusType } from 'store/actions/serverRequestStatusType' 5 | import { comments } from 'models/comments/commentTypes' 6 | import * as _ from 'lodash' 7 | 8 | /** 9 | * Create get comments server request model 10 | */ 11 | const createGetCommentsRequest = (postId: string) => { 12 | const requestId = StringAPI.createServerRequestId(ServerRequestType.CommentGetComments, postId) 13 | return new ServerRequestModel( 14 | ServerRequestType.CommentGetComments, 15 | requestId, 16 | '', 17 | ServerRequestStatusType.Sent 18 | ) 19 | } 20 | 21 | const sortCommentsByDate = (sortedObjects: comments) => { 22 | const commentKeys = Object.keys(sortedObjects) 23 | if (commentKeys.length > 1) { 24 | return _.fromPairs(_.toPairs(sortedObjects) 25 | .sort((a: any, b: any) => parseInt(b[1].creationDate, 10) - parseInt(a[1].creationDate, 10)).slice(0, 3)) 26 | 27 | } 28 | return sortedObjects 29 | } 30 | 31 | export default { 32 | createGetCommentsRequest, 33 | sortCommentsByDate 34 | } -------------------------------------------------------------------------------- /src/api/CommonAPI.ts: -------------------------------------------------------------------------------- 1 | import * as moment from 'moment/moment' 2 | /** 3 | * Log the data 4 | * @param title log title 5 | * @param data log data object 6 | */ 7 | const logger = (title: string, ...data: any[]) => { 8 | const randomColor = getRandomColor() 9 | 10 | window['console']['log'](`\n\n%c ======= ${title} ======= %c${moment().format('HH:mm:ss SSS')} \n`, `color:${randomColor};font-size:15` 11 | , `color:${getRandomColor()};font-size:15`) 12 | window['console']['log'](``) 13 | window['console']['log'](` `, data) 14 | window['console']['log'](`\n =========================================`) 15 | 16 | } 17 | 18 | /** 19 | * Get random color in hex 20 | */ 21 | const getRandomColor = () => { 22 | let letters = '0123456789ABCDEF' 23 | let color = '#' 24 | for (let i = 0; i < 6; i++) { 25 | color += letters[Math.floor(Math.random() * 16)] 26 | } 27 | return color 28 | } 29 | 30 | const updateObject = (oldObject: any, updatedProperties: any) => { 31 | return { 32 | ...oldObject, 33 | ...updatedProperties 34 | } 35 | } 36 | 37 | const getStateSlice = (state: any) => state.toJS()['locale'] 38 | 39 | export default { 40 | logger, 41 | getRandomColor, 42 | updateObject, 43 | getStateSlice 44 | } 45 | -------------------------------------------------------------------------------- /src/api/PostAPI.ts: -------------------------------------------------------------------------------- 1 | import {List} from 'immutable' 2 | 3 | // Get tags from post content 4 | export const detectTags: (content: string, character: string) => string[] = (content: string, character: string) => { 5 | 6 | return content.split(' ').filter((word) => { 7 | return (word.slice(0,1) === character) 8 | }) 9 | 10 | } 11 | export const getContentTags = (content: string) => { 12 | let newTags: string[] = [] 13 | let tags = detectTags(content,'#') 14 | tags.forEach((tag) => { 15 | newTags.push(tag.slice(1)) 16 | }) 17 | return newTags 18 | } 19 | 20 | export const sortObjectsDate = (objects: any) => { 21 | let sortedObjects = objects 22 | 23 | // Sort posts with creation date 24 | sortedObjects.sort((a: any, b: any) => { 25 | return parseInt(b.creationDate,10) - parseInt(a.creationDate,10) 26 | 27 | }) 28 | 29 | return sortedObjects 30 | } 31 | 32 | export const sortImuObjectsDate = (objects: List>) => { 33 | let sortedObjects = objects 34 | 35 | // Sort posts with creation date 36 | return sortedObjects.sort((a: any, b: any) => { 37 | return parseInt(b.get('creationDate'),10) - parseInt(a.get('creationDate'),10) 38 | 39 | }) 40 | 41 | // return sortedObjects 42 | } 43 | -------------------------------------------------------------------------------- /src/api/StringAPI.ts: -------------------------------------------------------------------------------- 1 | import { ServerRequestType } from 'constants/serverRequestType' 2 | 3 | // - Import actions 4 | 5 | const isValidEmail = (email: string) => { 6 | let re = /^(([^<>()\[\]\\.,:\s@"]+(\.[^<>()\[\]\\.,:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 7 | return re.test(email) 8 | } 9 | 10 | const createServerRequestId = (requestType: ServerRequestType, uniqueId: string) => { 11 | return `${requestType}:${uniqueId}` 12 | } 13 | 14 | function queryString (name: string, url: string = window.location.href) { 15 | name = name.replace(/[[]]/g, '\\$&') 16 | 17 | const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i') 18 | const results = regex.exec(url) 19 | 20 | if (!results) { 21 | return null 22 | } 23 | if (!results[2]) { 24 | return '' 25 | } 26 | 27 | return decodeURIComponent(results[2].replace(/\+/g, ' ')) 28 | } 29 | 30 | export default { 31 | isValidEmail, 32 | queryString, 33 | createServerRequestId 34 | } 35 | -------------------------------------------------------------------------------- /src/assets/fonts/Flaticon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/assets/fonts/Flaticon.eot -------------------------------------------------------------------------------- /src/assets/fonts/Flaticon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/assets/fonts/Flaticon.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Flaticon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/assets/fonts/Flaticon.woff -------------------------------------------------------------------------------- /src/components/circle/ICircleComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Comment } from 'core/domain/comments' 2 | import { Profile } from 'core/domain/users' 3 | import { Circle, UserTie } from 'core/domain/circles' 4 | import {Map} from 'immutable' 5 | 6 | export interface ICircleComponentProps { 7 | 8 | /** 9 | * Circle 10 | */ 11 | circle: Map 12 | 13 | /** 14 | * Circle identifier 15 | */ 16 | id: string 17 | 18 | /** 19 | * User identifier 20 | */ 21 | uid: string 22 | 23 | /** 24 | * Update circle 25 | */ 26 | updateCircle?: Function 27 | 28 | /** 29 | * Delete circle 30 | */ 31 | deleteCircle?: Function 32 | 33 | /** 34 | * Users of current circle 35 | */ 36 | usersOfCircle?: Map 37 | 38 | /** 39 | * Close setting box of circle 40 | */ 41 | closeCircleSettings?: any 42 | 43 | /** 44 | * Circle setting dialog is open {true} or not {false} 45 | */ 46 | openSetting?: boolean 47 | 48 | /** 49 | * Change route location 50 | */ 51 | goTo?: (url: string) => void 52 | 53 | /** 54 | * Open setting box for a circle 55 | */ 56 | openCircleSettings?: () => any 57 | 58 | /** 59 | * Styles 60 | */ 61 | classes?: any 62 | } 63 | -------------------------------------------------------------------------------- /src/components/circle/ICircleComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ICircleComponentState { 3 | 4 | /** 5 | * Circle name 6 | * 7 | * @type {string} 8 | * @memberof ICircleComponentState 9 | */ 10 | circleName: string 11 | 12 | /** 13 | * If circle user list is open {true} or not {false} 14 | * 15 | * @type {boolean} 16 | * @memberof ICircleComponentState 17 | */ 18 | open: boolean 19 | 20 | /** 21 | * Save button is disabled {true} or not false 22 | * 23 | * @type {boolean} 24 | * @memberof ICircleComponentState 25 | */ 26 | disabledSave: boolean 27 | 28 | /** 29 | * Keep menu anchor 30 | */ 31 | anchorElMenu: any 32 | } 33 | -------------------------------------------------------------------------------- /src/components/circle/index.ts: -------------------------------------------------------------------------------- 1 | import CircleComponent from './CircleComponent' 2 | export default CircleComponent 3 | -------------------------------------------------------------------------------- /src/components/comment/ICommentComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ICommentComponentState { 3 | 4 | /** 5 | * Initialt text comment 6 | * 7 | * @type {string} 8 | * @memberof ICommentComponentProps 9 | */ 10 | initialText?: string 11 | 12 | /** 13 | * Initialt text comment 14 | * 15 | * @type {string} 16 | * @memberof ICommentComponentProps 17 | */ 18 | text: string 19 | 20 | /** 21 | * Comment is in edit state {true} or not {false} 22 | * 23 | * @type {boolean} 24 | * @memberof ICommentComponentState 25 | */ 26 | editDisabled: boolean 27 | 28 | /** 29 | * Current user is the post owner {true} or not falses 30 | * 31 | * @type {boolean} 32 | * @memberof ICommentComponentState 33 | */ 34 | isPostOwner: boolean 35 | 36 | /** 37 | * Display comment {true} or not {false} 38 | * 39 | * @type {boolean} 40 | * @memberof ICommentComponentState 41 | */ 42 | display?: boolean 43 | 44 | /** 45 | * Wheter comment menu is open 46 | */ 47 | openMenu?: boolean 48 | 49 | /** 50 | * Anchor element 51 | */ 52 | anchorEl: any 53 | } 54 | -------------------------------------------------------------------------------- /src/components/comment/index.ts: -------------------------------------------------------------------------------- 1 | import CommentComponent from './CommentComponent' 2 | export default CommentComponent 3 | -------------------------------------------------------------------------------- /src/components/commentGroup/ICommentGroupComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ICommentGroupComponentState { 3 | 4 | /** 5 | * Comment text 6 | * 7 | * @type {string} 8 | * @memberof ICommentGroupComponentState 9 | */ 10 | commentText: string 11 | 12 | /** 13 | * Disable post comment 14 | * 15 | * @type {boolean} 16 | * @memberof ICommentGroupComponentState 17 | */ 18 | postDisable: boolean 19 | } 20 | -------------------------------------------------------------------------------- /src/components/commentGroup/index.ts: -------------------------------------------------------------------------------- 1 | import CommentGroupComponent from './CommentGroupComponent' 2 | export default CommentGroupComponent 3 | -------------------------------------------------------------------------------- /src/components/commentList/ICommentListComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Comment } from 'core/domain/comments' 2 | import {Map} from 'immutable' 3 | 4 | export interface ICommentListComponentProps { 5 | 6 | /** 7 | * Ad dictionary of comment 8 | * 9 | * @type {{[commentId: string]: Comment}} 10 | * @memberof ICommentListComponentProps 11 | */ 12 | comments: Map 13 | 14 | /** 15 | * Comments editor status 16 | */ 17 | commentsEditorStatus?: {[commentId: string]: boolean} 18 | 19 | /** 20 | * Current user is post the post owner {true} or not false 21 | * 22 | * @type {boolean} 23 | * @memberof ICommentListComponentProps 24 | */ 25 | isPostOwner: boolean 26 | 27 | /** 28 | * The post identifier comments belong to 29 | */ 30 | postId: string 31 | 32 | /** 33 | * Comment on the post is disabled {false} or not {true} 34 | * 35 | * @type {boolean} 36 | * @memberof ICommentListComponentProps 37 | */ 38 | disableComments: boolean 39 | 40 | /** 41 | * Styles 42 | */ 43 | classes?: any 44 | } 45 | -------------------------------------------------------------------------------- /src/components/commentList/ICommentListComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ICommentListComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/commentList/index.ts: -------------------------------------------------------------------------------- 1 | import CommentListComponent from './CommentListComponent' 2 | export default CommentListComponent 3 | -------------------------------------------------------------------------------- /src/components/editProfile/IEditProfileComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Profile } from 'core/domain/users' 2 | 3 | export interface IEditProfileComponentProps { 4 | 5 | /** 6 | * User profile 7 | * 8 | * @type {Profile} 9 | * @memberof IEditProfileComponentProps 10 | */ 11 | info?: Profile 12 | 13 | /** 14 | * User profile banner addresss 15 | * 16 | * @type {string} 17 | * @memberof IEditProfileComponentProps 18 | */ 19 | banner: string 20 | 21 | /** 22 | * User avatar address 23 | * 24 | * @type {string} 25 | * @memberof IEditProfileComponentProps 26 | */ 27 | avatar: string 28 | 29 | /** 30 | * User full name 31 | * 32 | * @type {string} 33 | * @memberof IEditProfileComponentProps 34 | */ 35 | fullName: string 36 | 37 | /** 38 | * Edit profile dialog is open {true} or not {false} 39 | * 40 | * @type {boolean} 41 | * @memberof IEditProfileComponentProps 42 | */ 43 | open?: boolean 44 | 45 | /** 46 | * Update user profile 47 | * 48 | * @memberof IEditProfileComponentProps 49 | */ 50 | update?: (profile: Profile) => void 51 | 52 | /** 53 | * On edit profile dialog close event 54 | * 55 | * @memberof IEditProfileComponentProps 56 | */ 57 | onRequestClose?: () => void 58 | 59 | /** 60 | * Styles 61 | */ 62 | classes?: any 63 | 64 | /** 65 | * Translate to locale string 66 | */ 67 | translate?: (state: any) => any 68 | 69 | /** 70 | * Current locale language 71 | */ 72 | currentLanguage?: string 73 | } 74 | -------------------------------------------------------------------------------- /src/components/editProfile/IEditProfileComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IEditProfileComponentState { 3 | 4 | [key: string]: any 5 | 6 | /** 7 | * Full name input value 8 | */ 9 | fullNameInput: string 10 | 11 | /** 12 | * Full name input error message 13 | */ 14 | fullNameInputError: string 15 | 16 | /** 17 | * Tag line input value 18 | */ 19 | tagLineInput: string 20 | 21 | /** 22 | * Edit profile page is small size {true} or big {false} 23 | * 24 | * @type {boolean} 25 | * @memberof IEditProfileComponentState 26 | */ 27 | isSmall: boolean 28 | 29 | /** 30 | * User's banner URL 31 | */ 32 | banner: string 33 | 34 | /** 35 | * User's avatar URL address 36 | */ 37 | avatar: string 38 | 39 | /** 40 | * Image gallery dialog is open for choosing banner image {true} or not {false} 41 | * 42 | * @type {boolean} 43 | * @memberof IEditProfileComponentState 44 | */ 45 | openBanner: boolean 46 | 47 | /** 48 | * Image gallery dialog is open for choosing avatar image {true} or not {false} 49 | * 50 | * @type {boolean} 51 | * @memberof IEditProfileComponentState 52 | */ 53 | openAvatar: boolean 54 | 55 | /** 56 | * Default birth day 57 | */ 58 | defaultBirthday: any 59 | 60 | /** 61 | * Seleted birth day 62 | */ 63 | selectedBirthday: number 64 | 65 | /** 66 | * Web URL 67 | */ 68 | webUrl: string 69 | 70 | /** 71 | * User company name 72 | */ 73 | companyName: string 74 | 75 | /** 76 | * User twitter id 77 | */ 78 | twitterId: string 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/components/editProfile/index.ts: -------------------------------------------------------------------------------- 1 | import EditProfileComponent from './EditProfileComponent' 2 | export default EditProfileComponent 3 | -------------------------------------------------------------------------------- /src/components/findPeople/IFindPeopleComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Profile } from 'core/domain/users/profile' 2 | import { UserTie } from 'core/domain/circles' 3 | 4 | export interface IFindPeopleComponentProps { 5 | 6 | /** 7 | * Load users' profile 8 | * 9 | * @memberof IFindPeopleComponentProps 10 | */ 11 | loadPeople?: (page: number, limit: number) => any 12 | 13 | /** 14 | * Users' profile 15 | */ 16 | peopleInfo?: Map 17 | 18 | /** 19 | * If there are more people {true} or not {false} 20 | */ 21 | hasMorePeople?: boolean 22 | 23 | /** 24 | * Translate to locale string 25 | */ 26 | translate?: (state: any) => any 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/components/findPeople/IFindPeopleComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IFindPeopleComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/findPeople/index.ts: -------------------------------------------------------------------------------- 1 | import FindPeopleComponent from './FindPeopleComponent' 2 | export default FindPeopleComponent 3 | -------------------------------------------------------------------------------- /src/components/followers/IFollowersComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { UserTie } from 'core/domain/circles' 2 | import {Map} from 'immutable' 3 | 4 | export interface IFollowersComponentProps { 5 | 6 | /** 7 | * User followers info 8 | */ 9 | followers?: Map 10 | 11 | /** 12 | * Translate to locale string 13 | */ 14 | translate?: (state: any) => any 15 | } 16 | -------------------------------------------------------------------------------- /src/components/followers/IFollowersComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IFollowersComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/followers/index.ts: -------------------------------------------------------------------------------- 1 | import FollowersComponent from './FollowersComponent' 2 | export default FollowersComponent 3 | -------------------------------------------------------------------------------- /src/components/following/IFollowingComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { UserTie } from 'core/domain/circles' 2 | import {Map} from 'immutable' 3 | 4 | export interface IFollowingComponentProps { 5 | 6 | followingUsers?: Map 7 | 8 | /** 9 | * Translate to locale string 10 | */ 11 | translate?: (state: any) => any 12 | } 13 | -------------------------------------------------------------------------------- /src/components/following/IFollowingComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IFollowingComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/following/index.ts: -------------------------------------------------------------------------------- 1 | import FollowingComponent from './FollowingComponent' 2 | export default FollowingComponent 3 | -------------------------------------------------------------------------------- /src/components/homeHeader/IHomeHeaderComponentProps.ts: -------------------------------------------------------------------------------- 1 | import StringAPI from 'api/StringAPI' 2 | export interface IHomeHeaderComponentProps { 3 | 4 | /** 5 | * Sidebar is open {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IHomeHeaderComponentProps 9 | */ 10 | drawerStatus: boolean 11 | 12 | /** 13 | * Logout user 14 | * 15 | * @memberof IHomeHeaderComponentProps 16 | */ 17 | logout?: () => void 18 | 19 | /** 20 | * Handle on resize window event 21 | * 22 | * @memberof IHomeHeaderComponentProps 23 | */ 24 | handleResize?: (event: any) => void 25 | 26 | /** 27 | * Number of notifications 28 | * 29 | * @memberof IHomeHeaderComponentProps 30 | */ 31 | notifyCount?: number 32 | 33 | /** 34 | * User full name 35 | * 36 | * @type {string} 37 | * @memberof IHomeHeaderComponentProps 38 | */ 39 | fullName?: string 40 | 41 | /** 42 | * User's avatar URL address 43 | * 44 | * @type {string} 45 | * @memberof IHomeHeaderComponentProps 46 | */ 47 | avatar?: string 48 | 49 | /** 50 | * Top bar title 51 | * 52 | * @type {string} 53 | * @memberof IHomeHeaderComponentProps 54 | */ 55 | title?: string 56 | 57 | /** 58 | * Toggle sidebar 59 | * 60 | * @memberof IHomeHeaderComponentProps 61 | */ 62 | onToggleDrawer: () => void 63 | 64 | /** 65 | * Material ui theme style 66 | */ 67 | classes?: any 68 | 69 | /** 70 | * Theme 71 | */ 72 | theme?: any 73 | 74 | /** 75 | * Translate to locale string 76 | */ 77 | translate?: (state: any) => any 78 | } 79 | -------------------------------------------------------------------------------- /src/components/homeHeader/IHomeHeaderComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IHomeHeaderComponentState { 3 | 4 | /** 5 | * Popover menu on avatar is open {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IHomeHeaderComponentState 9 | */ 10 | openAvatarMenu: boolean 11 | 12 | /** 13 | * Show top bar title {true} or not {false} 14 | * 15 | * @type {boolean} 16 | * @memberof IHomeHeaderComponentState 17 | */ 18 | showTitle: boolean 19 | 20 | /** 21 | * Notification menu is open {true} or not {false} 22 | * 23 | * @type {boolean} 24 | * @memberof IHomeHeaderComponentState 25 | */ 26 | openNotifyMenu: boolean 27 | 28 | /** 29 | * This is the DOM element that will be used to set the position of the popover. 30 | * 31 | * @type {*} 32 | * @memberof IHomeHeaderComponentState 33 | */ 34 | anchorEl?: HTMLElement | null 35 | } 36 | -------------------------------------------------------------------------------- /src/components/homeHeader/index.ts: -------------------------------------------------------------------------------- 1 | import HomeHeaderComponent from './HomeHeaderComponent' 2 | export default HomeHeaderComponent 3 | -------------------------------------------------------------------------------- /src/components/imageGallery/IImageGalleryComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Image } from 'core/domain/imageGallery' 2 | import {Map, Collection, List} from 'immutable' 3 | 4 | export interface IImageGalleryComponentProps { 5 | 6 | /** 7 | * Select image from image gallery 8 | * 9 | * @type {(URL: string,fullPath: string)} 10 | * @memberof IImageGalleryComponentProps 11 | */ 12 | set: (URL: string,fullPath: string) => void 13 | 14 | /** 15 | * Delete an image 16 | * 17 | * @memberof IImageGalleryComponentProps 18 | */ 19 | deleteImage?: (imageId: string) => void 20 | 21 | /** 22 | * Upload image to the server 23 | * 24 | * @memberof IImageGalleryComponentProps 25 | */ 26 | uploadImage?: (image: any, imageName: string) => any 27 | 28 | /** 29 | * Close image gallery 30 | * 31 | * @memberof IImageGalleryComponentProps 32 | */ 33 | close: () => void 34 | 35 | /** 36 | * List of image in image gallery 37 | */ 38 | images?: List 39 | 40 | /** 41 | * Styles 42 | */ 43 | classes?: any 44 | 45 | /** 46 | * Translate to locale string 47 | */ 48 | translate?: (state: any) => any 49 | } 50 | -------------------------------------------------------------------------------- /src/components/imageGallery/IImageGalleryComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IImageGalleryComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/imageGallery/index.ts: -------------------------------------------------------------------------------- 1 | import ImageGalleryComponent from './ImageGalleryComponent' 2 | export default ImageGalleryComponent 3 | -------------------------------------------------------------------------------- /src/components/img/IImgComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IImgComponentProps { 2 | 3 | /** 4 | * Image file name 5 | * 6 | * @type {string} 7 | * @memberof IImgComponentProps 8 | */ 9 | fileName: string 10 | 11 | /** 12 | * Image style sheet 13 | * 14 | * @type {{}} 15 | * @memberof IImgComponentProps 16 | */ 17 | style?: {} 18 | 19 | /** 20 | * Styles 21 | */ 22 | classes?: any 23 | 24 | /** 25 | * Translate to locale string 26 | */ 27 | translate?: (state: any) => any 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/components/img/IImgComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IImgComponentState { 3 | 4 | /** 5 | * Image is loaded {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IImgComponentProps 9 | */ 10 | isImageLoaded?: boolean 11 | } 12 | -------------------------------------------------------------------------------- /src/components/img/index.ts: -------------------------------------------------------------------------------- 1 | import ImgComponent from './ImgComponent' 2 | export default ImgComponent 3 | -------------------------------------------------------------------------------- /src/components/imgCover/IImgCoverComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IImgCoverComponentProps { 2 | 3 | /** 4 | * Image file name 5 | * 6 | * @type {string} 7 | * @memberof IImgCoverComponentProps 8 | */ 9 | fileName: string 10 | 11 | /** 12 | * Image style sheet 13 | * 14 | * @type {{}} 15 | * @memberof IImgCoverComponentProps 16 | */ 17 | style?: {} 18 | 19 | /** 20 | * Image with 21 | * 22 | * @type {string} 23 | * @memberof IImgCoverComponentProps 24 | */ 25 | width?: string 26 | 27 | /** 28 | * Image height 29 | * 30 | * @type {string} 31 | * @memberof IImgCoverComponentProps 32 | */ 33 | height?: string 34 | 35 | /** 36 | * Image border radius 37 | * 38 | * @type {string} 39 | * @memberof IImgCoverComponentProps 40 | */ 41 | borderRadius?: string 42 | 43 | /** 44 | * Translate to locale string 45 | */ 46 | translate?: (state: any) => any 47 | } 48 | -------------------------------------------------------------------------------- /src/components/imgCover/IImgCoverComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IImgCoverComponentState { 3 | 4 | /** 5 | * Image is loaded {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IImgCoverComponentProps 9 | */ 10 | isImageLoaded: boolean 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/components/imgCover/index.ts: -------------------------------------------------------------------------------- 1 | import ImgCoverComponent from './ImgCoverComponent' 2 | export default ImgCoverComponent 3 | -------------------------------------------------------------------------------- /src/components/masterLoading/IMasterLoadingComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IMasterLoadingComponentProps { 2 | error?: boolean 3 | timedOut?: boolean 4 | pastDelay?: boolean 5 | } 6 | -------------------------------------------------------------------------------- /src/components/masterLoading/IMasterLoadingComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IMasterLoadingComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/masterLoading/index.ts: -------------------------------------------------------------------------------- 1 | import MasterLoadingComponent from './MasterLoadingComponent' 2 | export default MasterLoadingComponent 3 | -------------------------------------------------------------------------------- /src/components/notify/INotifyComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Profile } from 'core/domain/users' 2 | import { Notification } from 'core/domain/notifications' 3 | import {Map} from 'immutable' 4 | export interface INotifyComponentProps { 5 | 6 | /** 7 | * Notifications 8 | */ 9 | notifications?: Map 10 | 11 | /** 12 | * Users' profile 13 | */ 14 | info?: Map 15 | 16 | /** 17 | * Close notification 18 | */ 19 | onRequestClose: () => void 20 | 21 | /** 22 | * User notifications popover is opem {true} or not {false} 23 | */ 24 | open: boolean 25 | 26 | /** 27 | * Keep element 28 | */ 29 | anchorEl?: any 30 | 31 | /** 32 | * Material ui styles 33 | */ 34 | classes?: any 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/components/notify/INotifyComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface INotifyComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/notify/index.ts: -------------------------------------------------------------------------------- 1 | import NotifyComponent from './NotifyComponent' 2 | export default NotifyComponent 3 | -------------------------------------------------------------------------------- /src/components/notifyItem/INotifyItemComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface INotifyItemComponentProps { 2 | 3 | /** 4 | * Notification description 5 | * 6 | * @type {string} 7 | * @memberof INotifyItemComponentProps 8 | */ 9 | description: string 10 | 11 | /** 12 | * User full name 13 | * 14 | * @type {string} 15 | * @memberof INotifyItemComponentProps 16 | */ 17 | fullName: string 18 | 19 | /** 20 | * User avatar 21 | * 22 | * @type {string} 23 | * @memberof INotifyItemComponentProps 24 | */ 25 | avatar: string 26 | 27 | /** 28 | * Notification has seen {true} or not {false} 29 | * 30 | * @type {boolean} 31 | * @memberof INotifyItemComponentProps 32 | */ 33 | isSeen: boolean 34 | 35 | /** 36 | * Notification identifier 37 | * 38 | * @type {string} 39 | * @memberof INotifyItemComponentProps 40 | */ 41 | id: string 42 | 43 | /** 44 | * Rediret to {url} route 45 | * 46 | * @memberof INotifyItemComponentProps 47 | */ 48 | goTo?: (url: string) => any 49 | 50 | /** 51 | * Close a notification 52 | * 53 | * @memberof INotifyItemComponentProps 54 | */ 55 | closeNotify?: () => void 56 | 57 | /** 58 | * Notifier identifier 59 | * 60 | * @type {string} 61 | * @memberof INotifyItemComponentProps 62 | */ 63 | notifierUserId: string 64 | 65 | /** 66 | * The URL which notification mention 67 | * 68 | * @type {string} 69 | * @memberof INotifyItemComponentProps 70 | */ 71 | url: string 72 | 73 | /** 74 | * Delete a notification 75 | * 76 | * @memberof INotifyItemComponentProps 77 | */ 78 | deleteNotiy?: (notificationId: string) => any 79 | 80 | /** 81 | * Change notification status to has seen 82 | * 83 | * @memberof INotifyItemComponentProps 84 | */ 85 | seenNotify?: (notificationId: string) => any 86 | 87 | /** 88 | * Material ui styles 89 | */ 90 | classes?: any 91 | } 92 | -------------------------------------------------------------------------------- /src/components/notifyItem/INotifyItemComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface INotifyItemComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/notifyItem/index.ts: -------------------------------------------------------------------------------- 1 | import NotifyItemComponent from './NotifyItemComponent' 2 | export default NotifyItemComponent 3 | -------------------------------------------------------------------------------- /src/components/post/IPostComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IPostComponentState { 3 | 4 | /** 5 | * Post text 6 | */ 7 | text: string 8 | /** 9 | * It's true if whole the text post is visible 10 | */ 11 | readMoreState: boolean 12 | /** 13 | * Handle open comment from parent component 14 | */ 15 | openComments: boolean 16 | /** 17 | * If it's true, share dialog will be open 18 | */ 19 | shareOpen: boolean 20 | /** 21 | * If it's true comment will be disabled on post 22 | */ 23 | disableComments: boolean 24 | /** 25 | * If it's true share will be disabled on post 26 | */ 27 | disableSharing: boolean 28 | /** 29 | * Title of share post 30 | */ 31 | shareTitle: string 32 | /** 33 | * If it's true, post link will be visible in share post dialog 34 | */ 35 | openCopyLink: boolean 36 | /** 37 | * If it's true, post write will be open 38 | */ 39 | openPostWrite: boolean 40 | 41 | /** 42 | * Open the comment group 43 | */ 44 | openCommentGroup?: () => void 45 | 46 | /** 47 | * Post menu anchor element 48 | */ 49 | postMenuAnchorEl?: any 50 | 51 | /** 52 | * Whether post menu open 53 | */ 54 | isPostMenuOpen?: boolean 55 | } 56 | -------------------------------------------------------------------------------- /src/components/post/index.ts: -------------------------------------------------------------------------------- 1 | import PostComponent from './PostComponent' 2 | export default PostComponent 3 | -------------------------------------------------------------------------------- /src/components/postWrite/IPostWriteComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'core/domain/posts' 2 | import {Map} from 'immutable' 3 | export interface IPostWriteComponentProps { 4 | 5 | /** 6 | * If it's true post writing page will be open 7 | */ 8 | open: boolean 9 | /** 10 | * Recieve request close function 11 | */ 12 | onRequestClose: () => void 13 | /** 14 | * Post write style 15 | */ 16 | style?: {} 17 | /** 18 | * If it's true, post will be in edit view 19 | */ 20 | edit?: boolean 21 | /** 22 | * The text of post in editing state 23 | */ 24 | text?: string 25 | /** 26 | * The image of post in editing state 27 | */ 28 | image?: string 29 | /** 30 | * If post state is editing this id sould be filled with post identifier 31 | */ 32 | id?: string 33 | 34 | /** 35 | * The post has image {true} or not {false} 36 | * 37 | * @type {boolean} 38 | * @memberof IPostWriteComponentProps 39 | */ 40 | postImageState?: boolean 41 | 42 | /** 43 | * User avatar address 44 | * 45 | * @type {string} 46 | * @memberof IPostWriteComponentProps 47 | */ 48 | ownerAvatar?: string 49 | 50 | /** 51 | * The post owner name 52 | */ 53 | ownerDisplayName?: string 54 | 55 | /** 56 | * Post model 57 | */ 58 | postModel?: Map 59 | 60 | /** 61 | * Save a post 62 | * 63 | * @memberof IPostWriteComponentProps 64 | */ 65 | post?: (post: Post, callback: Function) => any 66 | 67 | /** 68 | * Update a post 69 | * 70 | * @memberof IPostWriteComponentProps 71 | */ 72 | update?: (post: Map, callback: Function) => any 73 | 74 | /** 75 | * Styles 76 | */ 77 | classes?: any 78 | 79 | /** 80 | * Translate to locale string 81 | */ 82 | translate?: (state: any) => any 83 | } 84 | -------------------------------------------------------------------------------- /src/components/postWrite/IPostWriteComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IPostWriteComponentState { 3 | 4 | /** 5 | * Post text 6 | */ 7 | postText: string 8 | /** 9 | * The URL image of the post 10 | */ 11 | image?: string 12 | /** 13 | * The path identifier of image on the server 14 | */ 15 | imageFullPath: string 16 | /** 17 | * If it's true gallery will be open 18 | */ 19 | galleryOpen: boolean 20 | /** 21 | * If it's true post button will be disabled 22 | */ 23 | disabledPost: boolean 24 | /** 25 | * If it's true comment will be disabled on post 26 | */ 27 | disableComments: boolean 28 | /** 29 | * If it's true share will be disabled on post 30 | */ 31 | disableSharing: boolean, 32 | 33 | /** 34 | * Whether menu is open 35 | */ 36 | menuOpen: boolean 37 | 38 | /** 39 | * Menu anchor element 40 | */ 41 | menuAnchorEl: any 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/components/postWrite/index.ts: -------------------------------------------------------------------------------- 1 | import PostWriteComponent from './PostWriteComponent' 2 | export default PostWriteComponent 3 | -------------------------------------------------------------------------------- /src/components/profileHeader/IProfileHeaderComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IProfileHeaderComponentProps { 2 | 3 | /** 4 | * Profile for current user {true} or not {false} 5 | * 6 | * @type {boolean} 7 | * @memberof IProfileHeaderComponentProps 8 | */ 9 | isAuthedUser: boolean 10 | 11 | /** 12 | * Image cover address 13 | * 14 | * @type {string} 15 | * @memberof IProfileHeaderComponentProps 16 | */ 17 | banner: string 18 | 19 | /** 20 | * User full name 21 | * 22 | * @type {string} 23 | * @memberof IProfileHeaderComponentProps 24 | */ 25 | fullName: string 26 | 27 | /** 28 | * User tag line 29 | * 30 | * @type {string} 31 | * @memberof IProfileHeaderComponentProps 32 | */ 33 | tagLine: string 34 | 35 | /** 36 | * User's avatar address 37 | * 38 | * @type {string} 39 | * @memberof IProfileHeaderComponentProps 40 | */ 41 | avatar: string 42 | 43 | /** 44 | * Open edit profile dialog 45 | * 46 | * @memberof IProfileHeaderComponentProps 47 | */ 48 | openEditor?: () => void 49 | 50 | /** 51 | * Number of user followers 52 | * 53 | * @type {number} 54 | * @memberof IProfileHeaderComponentProps 55 | */ 56 | followerCount?: number 57 | 58 | /** 59 | * User identifier 60 | * 61 | * @type {string} 62 | * @memberof IProfileHeaderComponentProps 63 | */ 64 | userId: string 65 | 66 | /** 67 | * Whether edit profile is open 68 | */ 69 | editProfileOpen?: boolean 70 | 71 | /** 72 | * Translate to locale string 73 | */ 74 | translate?: (state: any) => any 75 | } 76 | -------------------------------------------------------------------------------- /src/components/profileHeader/IProfileHeaderComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IProfileHeaderComponentState { 3 | 4 | /** 5 | * Window size is small {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IProfileHeaderComponentState 9 | */ 10 | isSmall: boolean 11 | } 12 | -------------------------------------------------------------------------------- /src/components/profileHeader/index.ts: -------------------------------------------------------------------------------- 1 | import ProfileHeaderComponent from './ProfileHeaderComponent' 2 | export default ProfileHeaderComponent 3 | -------------------------------------------------------------------------------- /src/components/sendFeedback/ISendFeedbackComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Feed } from 'core/domain/common/feed' 2 | import { ServerRequestModel } from 'models/server/serverRequestModel' 3 | import { Profile } from 'core/domain/users' 4 | import { ServerRequestStatusType } from 'store/actions/serverRequestStatusType' 5 | 6 | export interface ISendFeedbackComponentProps { 7 | /** 8 | * Whether send feedback is diplayed 9 | */ 10 | sendFeedbackStatus?: boolean 11 | 12 | /** 13 | * Send feedback 14 | */ 15 | sendFeed?: (feed: Feed) => any 16 | 17 | /** 18 | * Hide feedback form 19 | */ 20 | hideFeedback?: () => any 21 | 22 | /** 23 | * The server request of send feedback 24 | */ 25 | sendFeedbackRequestType?: ServerRequestStatusType 26 | 27 | /** 28 | * Current user profile 29 | */ 30 | currentUser?: Profile 31 | 32 | /** 33 | * Styles 34 | */ 35 | classes?: any 36 | 37 | /** 38 | * Translate to locale string 39 | */ 40 | translate?: (state: any, param?: {}) => any 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/components/sendFeedback/ISendFeedbackComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISendFeedbackComponentState { 3 | /** 4 | * Feedback text 5 | */ 6 | feedText: string 7 | } 8 | -------------------------------------------------------------------------------- /src/components/sendFeedback/index.ts: -------------------------------------------------------------------------------- 1 | import SendFeedbackComponent from './SendFeedbackComponent' 2 | export default SendFeedbackComponent 3 | -------------------------------------------------------------------------------- /src/components/shareDialog/IShareDialogComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'core/domain/posts' 2 | import {Map} from 'immutable' 3 | 4 | export interface IShareDialogComponentProps { 5 | 6 | /** 7 | * Whether share dialog is open 8 | */ 9 | shareOpen: boolean 10 | 11 | /** 12 | * On close share dialog 13 | */ 14 | onClose: () => void 15 | 16 | /** 17 | * Whether copy link is displayed 18 | */ 19 | openCopyLink: boolean 20 | 21 | /** 22 | * On copy link 23 | */ 24 | onCopyLink: () => void 25 | 26 | /** 27 | * The post object for sharing 28 | */ 29 | post: Map 30 | 31 | /** 32 | * Styles 33 | */ 34 | classes?: any 35 | 36 | /** 37 | * Translate to locale string 38 | */ 39 | translate?: (state: any) => any 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/components/shareDialog/IShareDialogComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IShareDialogComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/shareDialog/index.ts: -------------------------------------------------------------------------------- 1 | import ShareDialogComponent from './ShareDialogComponent' 2 | export default ShareDialogComponent 3 | -------------------------------------------------------------------------------- /src/components/sidebar/ISidebarComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface ISidebarComponentProps { 2 | 3 | /** 4 | * Change sidebar status 5 | * 6 | * @type {boolean} 7 | * @memberof ISidebarComponentProps 8 | */ 9 | status: (status: boolean) => void 10 | 11 | /** 12 | * Change sidebar overlay status 13 | * 14 | * @memberof ISidebarComponentProps 15 | */ 16 | overlay: (status: boolean) => void 17 | 18 | /** 19 | * Open sidebar callback function 20 | * 21 | * @memberof ISidebarComponentProps 22 | */ 23 | open: (openCallback: (status: boolean, source: string) => void ) => void 24 | } 25 | -------------------------------------------------------------------------------- /src/components/sidebar/ISidebarComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISidebarComponentState { 3 | 4 | sidebarClass?: string 5 | overlay?: boolean 6 | mainStyle?: {} 7 | // Is sidebar open or not 8 | open?: boolean 9 | // If sidebar is closed by resizing or not 10 | auto?: boolean 11 | // If overlay should be open or not 12 | overlayOpen?: boolean 13 | // If side bar should be closed 14 | shouldBeClosed?: boolean 15 | 16 | /** 17 | * Sidebar style sheet 18 | * 19 | * @type {{}} 20 | * @memberof ISidebarComponentState 21 | */ 22 | sidebarStyle?: {} 23 | } 24 | -------------------------------------------------------------------------------- /src/components/sidebar/index.ts: -------------------------------------------------------------------------------- 1 | import SidebarComponent from './SidebarComponent' 2 | export default SidebarComponent 3 | -------------------------------------------------------------------------------- /src/components/sidebarContent/ISidebarContentComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface ISidebarContentComponentProps { 2 | 3 | /** 4 | * Change sidbar status to open/close 5 | * 6 | * @memberof ISidebarContentComponentProps 7 | */ 8 | sidebar?: (status: boolean, source: string) => void 9 | 10 | /** 11 | * Show sidebar is in overlay status {true} or not {false} 12 | * 13 | * @type {boolean} 14 | * @memberof ISidebarContentComponentProps 15 | */ 16 | overlay?: boolean 17 | 18 | /** 19 | * Sidebar content class name 20 | * 21 | * @type {string} 22 | * @memberof ISidebarContentComponentProps 23 | */ 24 | className?: string 25 | 26 | /** 27 | * Sidebar content style 28 | * 29 | * @type {{}} 30 | * @memberof ISidebarContentComponentProps 31 | */ 32 | cstyle?: {} 33 | } 34 | -------------------------------------------------------------------------------- /src/components/sidebarContent/ISidebarContentComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISidebarContentComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/sidebarContent/index.ts: -------------------------------------------------------------------------------- 1 | import SidebarContentComponent from './SidebarContentComponent' 2 | export default SidebarContentComponent 3 | -------------------------------------------------------------------------------- /src/components/sidebarMain/ISidebarMainComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface ISidebarMainComponentProps { 2 | 3 | /** 4 | * Main sidebar style 5 | * 6 | * @type {{}} 7 | * @memberof ISidebarMainComponentProps 8 | */ 9 | cstyle?: {} 10 | } 11 | -------------------------------------------------------------------------------- /src/components/sidebarMain/ISidebarMainComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISidebarMainComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/sidebarMain/SidebarMainComponent.tsx: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import React, { Component } from 'react' 3 | import { ISidebarMainComponentProps } from './ISidebarMainComponentProps' 4 | import { ISidebarMainComponentState } from './ISidebarMainComponentState' 5 | 6 | // - Import components 7 | 8 | // - Import actions 9 | 10 | // - Create component class 11 | export default class SidebarMainComponent extends Component { 12 | 13 | static qcName = 'SidebarMain' 14 | 15 | /** 16 | * Component constructor 17 | * @param {object} props is an object properties of component 18 | */ 19 | constructor (props: ISidebarMainComponentProps) { 20 | super(props) 21 | 22 | // Default state 23 | this.state = {} 24 | } 25 | 26 | /** 27 | * Reneder component DOM 28 | * @return {react element} return the DOM which rendered by component 29 | */ 30 | render () { 31 | return ( 32 |
33 |
34 | {this.props.children} 35 |
36 | ) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/components/sidebarMain/index.ts: -------------------------------------------------------------------------------- 1 | import SidebarMainComponent from './SidebarMainComponent' 2 | export default SidebarMainComponent 3 | -------------------------------------------------------------------------------- /src/components/userAvatar/IUserAvatarComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IUserAvatarComponentProps { 2 | 3 | /** 4 | * Use for getting url address from server 5 | */ 6 | fileName: string 7 | /** 8 | * User full name 9 | */ 10 | fullName: string 11 | /** 12 | * Avatar style 13 | */ 14 | style?: {} 15 | /** 16 | * Avatar size 17 | */ 18 | size?: number 19 | /** 20 | * Trigger on touch tap 21 | */ 22 | onClick?: (event: any) => any 23 | } 24 | -------------------------------------------------------------------------------- /src/components/userAvatar/IUserAvatarComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IUserAvatarComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/userAvatar/index.ts: -------------------------------------------------------------------------------- 1 | import UserAvatarComponent from './UserAvatarComponent' 2 | export default UserAvatarComponent 3 | -------------------------------------------------------------------------------- /src/components/userBox/IUserBoxComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IUserBoxComponentState { 3 | 4 | /** 5 | * Create new circle button is disabled {true} or not {false} 6 | * 7 | * @type {boolean} 8 | * @memberof IUserBoxComponentState 9 | */ 10 | disabledCreateCircle: boolean 11 | 12 | /** 13 | * The button of add user in a circle is disabled {true} or not {false} 14 | * 15 | * @type {boolean} 16 | * @memberof IUserBoxComponentState 17 | */ 18 | disabledAddToCircle: boolean 19 | 20 | /** 21 | * Circle name 22 | * 23 | * @type {string} 24 | * @memberof IUserBoxComponentState 25 | */ 26 | circleName: string 27 | 28 | /** 29 | * Keep element 30 | * 31 | * @type {*} 32 | * @memberof IUserBoxComponentState 33 | */ 34 | anchorEl?: any 35 | 36 | /** 37 | * Whether current user changed the selected circles for referer user 38 | * 39 | */ 40 | disabledDoneCircles: boolean 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/components/userBox/index.ts: -------------------------------------------------------------------------------- 1 | import UserBoxComponent from './UserBoxComponent' 2 | export default UserBoxComponent 3 | -------------------------------------------------------------------------------- /src/components/userBoxList/IUserBoxListComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { UserTie } from 'core/domain/circles' 3 | import {Map} from 'immutable' 4 | 5 | export interface IUserBoxListComponentProps { 6 | 7 | /** 8 | * Users in the circle 9 | * 10 | * @type {{[userId: string]: User}} 11 | * @memberof IUserBoxListComponentProps 12 | */ 13 | users: Map 14 | 15 | /** 16 | * User identifier 17 | * 18 | * @type {string} 19 | * @memberof IUserBoxListComponentProps 20 | */ 21 | uid?: string 22 | } 23 | -------------------------------------------------------------------------------- /src/components/userBoxList/IUserBoxListComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IUserBoxListComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/userBoxList/index.ts: -------------------------------------------------------------------------------- 1 | import UserBoxListComponent from './UserBoxListComponent' 2 | export default UserBoxListComponent 3 | -------------------------------------------------------------------------------- /src/components/yourCircles/IYourCirclesComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Circle } from 'core/domain/circles' 2 | import {Map} from 'immutable' 3 | export interface IYourCirclesComponentProps { 4 | 5 | /** 6 | * Circles 7 | */ 8 | circles?: Map> 9 | 10 | /** 11 | * User identifier 12 | */ 13 | uid?: string 14 | } 15 | -------------------------------------------------------------------------------- /src/components/yourCircles/IYourCirclesComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IYourCirclesComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/components/yourCircles/index.ts: -------------------------------------------------------------------------------- 1 | import YourCirclesComponent from './YourCirclesComponent' 2 | export default YourCirclesComponent 3 | -------------------------------------------------------------------------------- /src/config/environment.dev.ts: -------------------------------------------------------------------------------- 1 | import { LanguageType } from 'store/reducers/locale/langugeType' 2 | 3 | export const environment = { 4 | firebase: { 5 | apiKey: 'AIzaSyAHOZ7rWGDODCwJMB3WIt63CAIa90qI-jg', 6 | authDomain: 'test-4515a.firebaseapp.com', 7 | databaseURL: 'https://test-4515a.firebaseio.com', 8 | projectId: 'test-4515a', 9 | storageBucket: 'test-4515a.appspot.com', 10 | messagingSenderId: '964743099489' 11 | }, 12 | settings: { 13 | enabledOAuthLogin: true, 14 | enabledOffline: true, 15 | appName: 'Green', 16 | defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57', 17 | defaultLanguage: LanguageType.English 18 | }, 19 | theme: { 20 | primaryColor: '#00b1b3', 21 | secondaryColor: '#4d545d' 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/config/environment.prod.ts: -------------------------------------------------------------------------------- 1 | import { LanguageType } from 'store/reducers/locale/langugeType' 2 | 3 | export const environment = { 4 | firebase: { 5 | apiKey: 'AIzaSyAHOZ7rWGDODCwJMB3WIt63CAIa90qI-jg', 6 | authDomain: 'test-4515a.firebaseapp.com', 7 | databaseURL: 'https://test-4515a.firebaseio.com', 8 | projectId: 'test-4515a', 9 | storageBucket: 'test-4515a.appspot.com', 10 | messagingSenderId: '964743099489' 11 | }, 12 | settings: { 13 | enabledOAuthLogin: true, 14 | enabledOffline: true, 15 | appName: 'Green', 16 | defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57', 17 | defaultLanguage: LanguageType.English 18 | }, 19 | theme: { 20 | primaryColor: '#00b1b3', 21 | secondaryColor: '#4d545d' 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/config/index.ts: -------------------------------------------------------------------------------- 1 | 2 | import {environment as prod } from './environment.prod' 3 | import {environment as dev } from './environment.dev' 4 | 5 | const config = { 6 | // Add common config values here 7 | } 8 | 9 | const configEnv = process.env.NODE_ENV === 'production' 10 | ? prod 11 | : dev 12 | 13 | export default { 14 | // Add common config values here 15 | ...config, 16 | ...configEnv 17 | } 18 | -------------------------------------------------------------------------------- /src/constants/authorizeActionType.ts: -------------------------------------------------------------------------------- 1 | export enum AuthorizeActionType { 2 | 3 | LOGIN = 'LOGIN', 4 | LOGOUT = 'LOGOUT', 5 | SIGNUP = 'SIGNUP', 6 | UPDATE_PASSWORD = 'UPDATE_PASSWORD' 7 | } 8 | -------------------------------------------------------------------------------- /src/constants/circleActionType.ts: -------------------------------------------------------------------------------- 1 | export enum CircleActionType { 2 | 3 | ADD_CIRCLE = 'ADD_CIRCLE', 4 | DELETE_CIRCLE = 'DELETE_CIRCLE', 5 | UPDATE_CIRCLE = 'UPDATE_CIRCLE', 6 | ADD_LIST_CIRCLE = 'ADD_LIST_CIRCLE', 7 | CLEAR_ALL_CIRCLES = 'CLEAR_ALL_CIRCLES', 8 | OPEN_CIRCLE_SETTINGS = 'OPEN_CIRCLE_SETTINGS', 9 | CLOSE_CIRCLE_SETTINGS = 'CLOSE_CIRCLE_SETTINGS', 10 | ADD_FOLLOWING_USER = 'ADD_FOLLOWING_USER', 11 | DELETE_FOLLOWING_USER = 'DELETE_FOLLOWING_USER', 12 | UPDATE_USER_TIE = 'UPDATE_USER_TIE', 13 | ADD_USER_TIE_LIST = 'ADD_USER_TIE_LIST', 14 | ADD_USER_TIED_LIST = 'ADD_USER_TIED_LIST', 15 | DELETE_USER_FROM_CIRCLE = 'DELETE_USER_FROM_CIRCLE', 16 | SHOW_SELECT_CIRCLE_BOX = 'SHOW_SELECT_CIRCLE_BOX', 17 | HIDE_SELECT_CIRCLE_BOX = 'HIDE_SELECT_CIRCLE_BOX', 18 | SET_SELECTED_CIRCLES_USER_BOX_COMPONENT = 'SET_SELECTED_CIRCLES_USER_BOX_COMPONENT', 19 | REMOVE_SELECTED_CIRCLES_USER_BOX_COMPONENT = 'REMOVE_SELECTED_CIRCLES_USER_BOX_COMPONENT', 20 | OPEN_SELECT_CIRCLES_USER_BOX_COMPONENT = 'OPEN_SELECT_CIRCLES_USER_BOX_COMPONENT', 21 | CLOSE_SELECT_CIRCLES_USER_BOX_COMPONENT = 'CLOSE_SELECT_CIRCLES_USER_BOX_COMPONENT', 22 | SHOW_FOLLOWING_USER_LOADING = 'SHOW_FOLLOWING_USER_LOADING', 23 | HIDE_FOLLOWING_USER_LOADING = 'HIDE_FOLLOWING_USER_LOADING' 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/constants/commentActionType.ts: -------------------------------------------------------------------------------- 1 | export enum CommentActionType { 2 | 3 | ADD_COMMENT = 'ADD_COMMENT', 4 | ADD_COMMENT_LIST = 'ADD_COMMENT_LIST', 5 | DELETE_COMMENT = 'DELETE_COMMENT', 6 | CLEAR_ALL_DATA_COMMENT = 'CLEAR_ALL_DATA_COMMENT', 7 | UPDATE_COMMENT = 'UPDATE_COMMENT', 8 | CLOSE_COMMENT_EDITOR = 'CLOSE_COMMENT_EDITOR', 9 | OPEN_COMMENT_EDITOR = 'OPEN_COMMENT_EDITOR', 10 | DB_FETCH_COMMENTS = 'DB_FETCH_COMMENTS', 11 | } -------------------------------------------------------------------------------- /src/constants/globalActionType.ts: -------------------------------------------------------------------------------- 1 | export enum GlobalActionType { 2 | 3 | PROGRESS_CHANGE = 'PROGRESS_CHANGE', 4 | DEFAULT_DATA_DISABLE = 'DEFAULT_DATA_DISABLE', 5 | DEFAULT_DATA_ENABLE = 'DEFAULT_DATA_ENABLE', 6 | LOADING = 'LOADING', 7 | HIDE_MESSAGE_GLOBAL = 'HIDE_MESSAGE_GLOBAL', 8 | SHOW_MESSAGE_GLOBAL = 'SHOW_MESSAGE_GLOBAL', 9 | SHOW_NORMAL_MESSAGE_GLOBAL = 'SHOW_NORMAL_MESSAGE_GLOBAL', 10 | SET_HEADER_TITLE = 'SET_HEADER_TITLE', 11 | SHOW_TOP_LOADING = 'SHOW_TOP_LOADING', 12 | HIDE_TOP_LOADING = 'HIDE_TOP_LOADING', 13 | SHOW_MASTER_LOADING = 'SHOW_MASTER_LOADING', 14 | HIDE_MASTER_LOADING = 'HIDE_MASTER_LOADING', 15 | SHOW_SEND_FEEDBACK = 'SHOW_SEND_FEEDBACK', 16 | HIDE_SEND_FEEDBACK = 'HIDE_SEND_FEEDBACK', 17 | TEMP = 'TEMP', 18 | CLEAR_ALL_GLOBAL = 'CLEAR_ALL_GLOBAL', 19 | OPEN_POST_WRITE = 'OPEN_POST_WRITE', 20 | CLOSE_POST_WRITE = 'CLOSE_POST_WRITE', 21 | INIT_LOCALE = 'INIT_LOCALE' 22 | 23 | } -------------------------------------------------------------------------------- /src/constants/imageGalleryActionType.ts: -------------------------------------------------------------------------------- 1 | export enum ImageGalleryActionType { 2 | 3 | ADD_IMAGE_GALLERY = 'ADD_IMAGE_GALLERY', 4 | ADD_IMAGE_LIST_GALLERY = 'ADD_IMAGES_LIST_GALLERY', 5 | CLEAT_ALL_DATA_IMAGE_GALLERY = 'CLEAT_ALL_DATA_IMAGE_GALLERY', 6 | DELETE_IMAGE = 'DELETE_IMAGE', 7 | SET_IMAGE_URL = 'SET_IMAGE_URL', 8 | SEND_IMAGE_REQUEST = 'SEND_IMAGE_REQUEST' 9 | } -------------------------------------------------------------------------------- /src/constants/notificationActionType.ts: -------------------------------------------------------------------------------- 1 | export enum NotificationActionType { 2 | 3 | ADD_NOTIFY = 'ADD_NOTIFY', 4 | ADD_NOTIFY_LIST = 'ADD_NOTIFY_LIST', 5 | DELETE_NOTIFY = 'DELETE_NOTIFY', 6 | SEEN_NOTIFY = 'SEEN_NOTIFY', 7 | CLEAR_ALL_DATA_NOTIFY = 'CLEAR_ALL_DATA_NOTIFY' 8 | 9 | } -------------------------------------------------------------------------------- /src/constants/postActionType.ts: -------------------------------------------------------------------------------- 1 | export enum PostActionType { 2 | 3 | ADD_IMAGE_POST = 'ADD_IMAGE_POST', 4 | HAS_MORE_DATA_STREAM = 'HAS_MORE_DATA_STREAM', 5 | NOT_MORE_DATA_STREAM = 'NOT_MORE_DATA_STREAM', 6 | REQUEST_PAGE_STREAM = 'REQUEST_PAGE_STREAM', 7 | LAST_POST_STREAM = 'LAST_POST_STREAM', 8 | HAS_MORE_DATA_PROFILE = 'HAS_MORE_DATA_PROFILE', 9 | NOT_MORE_DATA_PROFILE = 'NOT_MORE_DATA_PROFILE', 10 | REQUEST_PAGE_PROFILE = 'REQUEST_PAGE_PROFILE', 11 | LAST_POST_PROFILE = 'LAST_POST_PROFILE', 12 | ADD_VIDEO_POST = 'ADD_VIDEO_POST', 13 | ADD_POST = 'ADD_POST', 14 | UPDATE_POST = 'UPDATE_POST', 15 | UPDATE_POST_COMMENTS = 'UPDATE_POST_COMMENTS', 16 | UPDATE_POST_VOTES = 'UPDATE_POST_VOTES', 17 | DELETE_POST = 'DELETE_POST', 18 | ADD_LIST_POST = 'ADD_LIST_POST', 19 | CLEAR_ALL_DATA_POST = 'CLEAR_ALL_DATA_POST' 20 | } 21 | -------------------------------------------------------------------------------- /src/constants/serverActionType.ts: -------------------------------------------------------------------------------- 1 | export enum ServerActionType { 2 | 3 | ADD_REQUEST = 'ADD_REQUEST', 4 | DELETE_REQUEST = 'DELETE_REQUEST', 5 | ERROR_REQUEST = 'ERROR_REQUEST', 6 | OK_REQUEST = 'OK_REQUEST', 7 | CLEAR_ALL_DATA_REQUEST = 'CLEAR_ALL_DATA_REQUEST' 8 | } -------------------------------------------------------------------------------- /src/constants/serverRequestType.ts: -------------------------------------------------------------------------------- 1 | export enum ServerRequestType { 2 | CircleAddToCircle = 'CircleAddToCircle', 3 | CircleFollowUser = 'CircleFollowUser', 4 | CircleCreateTieUser = 'CircleCreateTieUser', 5 | CircleDeleteFollowingUser = 'CircleDeleteFollowingUser', 6 | CommonSendFeedback = 'CommonSendFeedback', 7 | CommentGetComments = 'CommentGetComments' 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/constants/userActionType.ts: -------------------------------------------------------------------------------- 1 | export enum UserActionType { 2 | 3 | ADD_USERS = 'ADD_USERS', 4 | ADD_USER_INFO = 'ADD_USER_INFO', 5 | UPDATE_USER_INFO = 'UPDATE_USER_INFO', 6 | USER_INFO = 'USER_INFO', 7 | CLEAR_ALL_DATA_USER = 'CLEAR_ALL_DATA_USER', 8 | OPEN_EDIT_PROFILE = 'OPEN_EDIT_PROFILE', 9 | CLOSE_EDIT_PROFILE = 'CLOSE_EDIT_PROFILE', 10 | ADD_PEOPLE_INFO = 'ADD_PEOPLE_INFO', 11 | HAS_MORE_DATA_PEOPLE = 'HAS_MORE_DATA_PEOPLE', 12 | NOT_MORE_DATA_PEOPLE = 'NOT_MORE_DATA_PEOPLE', 13 | REQUEST_PAGE_PEOPLE = 'REQUEST_PAGE_PEOPLE', 14 | LAST_USER_PEOPLE = 'LAST_POST_PEOPLE' 15 | } 16 | -------------------------------------------------------------------------------- /src/constants/voteActionType.ts: -------------------------------------------------------------------------------- 1 | export enum VoteActionType { 2 | 3 | ADD_VOTE = 'ADD_VOTE', 4 | DELETE_VOTE = 'DELETE_VOTE', 5 | ADD_VOTE_LIST = 'ADD_VOTE_LIST', 6 | CLEAR_ALL_DATA_VOTE = 'CLEAR_ALL_DATA_VOTE' 7 | } -------------------------------------------------------------------------------- /src/containers/emailVerification/IEmailVerificationComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IEmailVerificationComponentProps { 2 | 3 | /** 4 | * Send email for verification 5 | */ 6 | sendEmailVerification: () => any 7 | 8 | /** 9 | * Redirect to home page 10 | */ 11 | homePage: () => any 12 | 13 | /** 14 | * Styles 15 | */ 16 | classes?: any 17 | 18 | /** 19 | * Translate to locale string 20 | */ 21 | translate?: (state: any, param?: {}) => any 22 | } 23 | -------------------------------------------------------------------------------- /src/containers/emailVerification/IEmailVerificationComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IEmailVerificationComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/containers/emailVerification/index.ts: -------------------------------------------------------------------------------- 1 | import EmailVerificationComponent from './EmailVerificationComponent' 2 | export default EmailVerificationComponent 3 | -------------------------------------------------------------------------------- /src/containers/home/IHomeComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IHomeComponentState { 3 | 4 | /** 5 | * Whether drawer is open 6 | */ 7 | drawerOpen: boolean 8 | } 9 | -------------------------------------------------------------------------------- /src/containers/home/index.ts: -------------------------------------------------------------------------------- 1 | import HomeComponent from './HomeComponent' 2 | export default HomeComponent 3 | -------------------------------------------------------------------------------- /src/containers/login/ILoginComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { OAuthType } from 'src/core/domain/authorize' 2 | export interface ILoginComponentProps { 3 | 4 | /** 5 | * Login a user 6 | * 7 | * @memberof ILoginComponentProps 8 | */ 9 | login?: (email: string , password: string) => any 10 | 11 | /** 12 | * Login user with OAuth 13 | * 14 | * @memberof ILoginComponentProps 15 | */ 16 | loginWithOAuth?: (type: OAuthType) => any 17 | 18 | /** 19 | * Redirect to signup page 20 | * 21 | * @memberof ILoginComponentProps 22 | */ 23 | signupPage?: () => any 24 | 25 | /** 26 | * Styles 27 | */ 28 | classes?: any 29 | 30 | /** 31 | * Translate to locale string 32 | */ 33 | translate?: (state: any, param?: {}) => any 34 | } 35 | -------------------------------------------------------------------------------- /src/containers/login/ILoginComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ILoginComponentState { 3 | 4 | [key: string]: any 5 | 6 | /** 7 | * Email input value 8 | */ 9 | emailInput: string 10 | 11 | /** 12 | * Email input error text 13 | */ 14 | emailInputError: string 15 | 16 | /** 17 | * Password input value 18 | */ 19 | passwordInput: string 20 | 21 | /** 22 | * Password input error text 23 | */ 24 | passwordInputError: string 25 | 26 | /** 27 | * Confirm input error text 28 | */ 29 | confirmInputError: string 30 | } 31 | -------------------------------------------------------------------------------- /src/containers/login/index.ts: -------------------------------------------------------------------------------- 1 | import LoginComponent from './LoginComponent' 2 | export default LoginComponent 3 | -------------------------------------------------------------------------------- /src/containers/master/IMasterComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IMasterComponentState { 3 | /** 4 | * Loding will be appeared if it's true 5 | * 6 | * @type {boolean} 7 | * @memberof IMasterState 8 | */ 9 | loading: boolean, 10 | /** 11 | * It's true if user is authorized 12 | * 13 | * @type {boolean} 14 | * @memberof IMasterState 15 | */ 16 | authed: boolean 17 | /** 18 | * It's true if all default data loaded from database 19 | * 20 | * @type {boolean} 21 | * @memberof IMasterState 22 | */ 23 | dataLoaded: boolean 24 | 25 | /** 26 | * If user verifide it's email {true} or not {false} 27 | * 28 | * @type {boolean} 29 | * @memberof IMasterComponentState 30 | */ 31 | isVerifide: boolean 32 | } 33 | -------------------------------------------------------------------------------- /src/containers/master/index.ts: -------------------------------------------------------------------------------- 1 | import MasterComponent from './MasterComponent' 2 | export default MasterComponent 3 | -------------------------------------------------------------------------------- /src/containers/people/IPeopleComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IPeopleComponentProps { 2 | 3 | /** 4 | * Router match 5 | * 6 | * @type {*} 7 | * @memberof IPeopleComponentProps 8 | */ 9 | match?: any 10 | 11 | /** 12 | * Circles loaded {true} or not {false} 13 | * 14 | * @type {boolean} 15 | * @memberof IPeopleComponentProps 16 | */ 17 | circlesLoaded?: boolean 18 | 19 | /** 20 | * Rediret to another route 21 | * 22 | * @memberof IPeopleComponentProps 23 | */ 24 | goTo?: (url: string) => any 25 | 26 | /** 27 | * Set title of top bar 28 | * 29 | * @memberof IPeopleComponentProps 30 | */ 31 | setHeaderTitle?: (title: string) => any 32 | 33 | /** 34 | * Translate to locale string 35 | */ 36 | translate?: (state: any) => any 37 | } 38 | -------------------------------------------------------------------------------- /src/containers/people/IPeopleComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IPeopleComponentState { 3 | 4 | /** 5 | * Tab index 6 | */ 7 | tabIndex: number 8 | } 9 | -------------------------------------------------------------------------------- /src/containers/people/index.ts: -------------------------------------------------------------------------------- 1 | import PeopleComponent from './PeopleComponent' 2 | export default PeopleComponent 3 | -------------------------------------------------------------------------------- /src/containers/postPage/IPostPageComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'src/core/domain/posts' 2 | 3 | export interface IPostPageComponentProps { 4 | 5 | /** 6 | * Load the post 7 | * 8 | * @memberof IPostPageComponentProps 9 | */ 10 | loadPost?: () => any 11 | 12 | /** 13 | * Load user profile 14 | * 15 | * @memberof IPostPageComponentProps 16 | */ 17 | loadUserInfo?: () => any 18 | 19 | /** 20 | * Route match 21 | * 22 | * @type {*} 23 | * @memberof IPostPageComponentProps 24 | */ 25 | match?: any 26 | 27 | posts: {[postId: string]: Post} 28 | } 29 | -------------------------------------------------------------------------------- /src/containers/postPage/IPostPageComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IPostPageComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/containers/postPage/index.ts: -------------------------------------------------------------------------------- 1 | import PostPageComponent from './PostPageComponent' 2 | export default PostPageComponent 3 | -------------------------------------------------------------------------------- /src/containers/profile/IProfileComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'src/core/domain/posts' 2 | 3 | export interface IProfileComponentProps { 4 | 5 | /** 6 | * Router match 7 | * 8 | * @type {*} 9 | * @memberof IProfileComponentProps 10 | */ 11 | match: any 12 | 13 | /** 14 | * User's post 15 | * 16 | * @type {{[postId: string]: Post}} 17 | * @memberof IProfileComponentProps 18 | */ 19 | posts: {[postId: string]: Post} 20 | 21 | /** 22 | * String user full name 23 | * 24 | * @type {string} 25 | * @memberof IProfileComponentProps 26 | */ 27 | name: string 28 | 29 | /** 30 | * User tag line 31 | * 32 | * @type {string} 33 | * @memberof IProfileComponentProps 34 | */ 35 | tagLine: string 36 | 37 | /** 38 | * User's avatar address 39 | * 40 | * @type {string} 41 | * @memberof IProfileComponentProps 42 | */ 43 | avatar: string 44 | 45 | /** 46 | * It's current user profile {true} or not {false} 47 | * 48 | * @type {boolean} 49 | * @memberof IProfileComponentProps 50 | */ 51 | isAuthedUser: boolean 52 | 53 | /** 54 | * User's banner 55 | * 56 | * @type {string} 57 | * @memberof IProfileComponentProps 58 | */ 59 | banner: string 60 | 61 | /** 62 | * User identifier 63 | * 64 | * @type {string} 65 | * @memberof IProfileComponentProps 66 | */ 67 | userId: string 68 | 69 | /** 70 | * Load user's post 71 | * 72 | * @memberof IProfileComponentProps 73 | */ 74 | loadPosts: () => any 75 | 76 | /** 77 | * Load user's profile 78 | * 79 | * @memberof IProfileComponentProps 80 | */ 81 | loadUserInfo: () => any 82 | 83 | /** 84 | * If there is more posts to show in profile 85 | */ 86 | hasMorePosts: boolean 87 | 88 | /** 89 | * Translate to locale string 90 | */ 91 | translate?: (state: any, params?: {}) => any 92 | } 93 | -------------------------------------------------------------------------------- /src/containers/profile/IProfileComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IProfileComponentState { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /src/containers/profile/dialogTitle/IDialogTitleComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IDialogTitleComponentProps { 2 | 3 | /** 4 | * Lable of the button 5 | * 6 | * @type {string} 7 | * @memberof IDialogTitleComponentProps 8 | */ 9 | buttonLabel?: string 10 | 11 | /** 12 | * Dialog tile 13 | * 14 | * @type {string} 15 | * @memberof IDialogTitleComponentProps 16 | */ 17 | title: string 18 | 19 | /** 20 | * Button is disabled {true} or not {false} 21 | * 22 | * @type {boolean} 23 | * @memberof IDialogTitleComponentProps 24 | */ 25 | disabledButton?: boolean 26 | 27 | /** 28 | * On click event 29 | * 30 | * @memberof IDialogTitleComponentProps 31 | */ 32 | onClickButton?: (event: any) => void 33 | 34 | /** 35 | * On request close event 36 | * 37 | * @memberof IDialogTitleComponentProps 38 | */ 39 | onRequestClose: (event: any) => void 40 | } 41 | -------------------------------------------------------------------------------- /src/containers/profile/dialogTitle/IDialogTitleComponentState.ts: -------------------------------------------------------------------------------- 1 | export interface IDialogTitleComponentState { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/containers/profile/dialogTitle/index.ts: -------------------------------------------------------------------------------- 1 | import DialogTitleComponent from './DialogTitleComponent' 2 | export default DialogTitleComponent 3 | -------------------------------------------------------------------------------- /src/containers/profile/index.ts: -------------------------------------------------------------------------------- 1 | import ProfileComponent from './ProfileComponent' 2 | export default ProfileComponent 3 | -------------------------------------------------------------------------------- /src/containers/resetPassword/IResetPasswordComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IResetPasswordComponentProps { 2 | 3 | /** 4 | * Reset password 5 | * 6 | * @memberof IResetPasswordComponentProps 7 | */ 8 | resetPassword?: (email: string) => any 9 | 10 | /** 11 | * Redirect to login page 12 | * 13 | * @memberof IResetPasswordComponentProps 14 | */ 15 | loginPage?: () => void 16 | 17 | /** 18 | * Styles 19 | */ 20 | classes?: any 21 | 22 | /** 23 | * Translate to locale string 24 | */ 25 | translate?: (state: any, param?: {}) => any 26 | } 27 | -------------------------------------------------------------------------------- /src/containers/resetPassword/IResetPasswordComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IResetPasswordComponentState { 3 | 4 | [key: string]: any 5 | 6 | /** 7 | * Email input value 8 | */ 9 | emailInput: string 10 | 11 | /** 12 | * Email input error text 13 | */ 14 | emailInputError: string 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/containers/resetPassword/index.ts: -------------------------------------------------------------------------------- 1 | import ResetPasswordComponent from './ResetPasswordComponent' 2 | export default ResetPasswordComponent 3 | -------------------------------------------------------------------------------- /src/containers/setting/ISettingComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface ISettingComponentProps { 2 | 3 | /** 4 | * Login user 5 | * 6 | * @memberof ISettingComponentProps 7 | */ 8 | login?: (email: string, password: string) => any 9 | 10 | /** 11 | * Redirect to home page 12 | * 13 | * @memberof ISettingComponentProps 14 | */ 15 | homePage?: () => void 16 | 17 | /** 18 | * Styles 19 | */ 20 | classes?: any 21 | 22 | /** 23 | * Translate to locale string 24 | */ 25 | translate?: (state: any, param?: {}) => any 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/containers/setting/ISettingComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISettingComponentState { 3 | 4 | [key: string]: any 5 | 6 | /** 7 | * Password input value 8 | */ 9 | passwordInput: string 10 | 11 | /** 12 | * Password input error text 13 | */ 14 | passwordInputError: string 15 | 16 | /** 17 | * Confirm input value 18 | */ 19 | confirmInput: string 20 | 21 | /** 22 | * Confirm input error 23 | */ 24 | confirmInputError: string 25 | } 26 | -------------------------------------------------------------------------------- /src/containers/setting/index.ts: -------------------------------------------------------------------------------- 1 | import SettingComponent from './SettingComponent' 2 | export default SettingComponent 3 | -------------------------------------------------------------------------------- /src/containers/signup/ISignupComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface ISignupComponentProps { 2 | 3 | /** 4 | * Display error 5 | * 6 | * @memberof ISignupComponentState 7 | */ 8 | showError?: (message: string) => any 9 | 10 | /** 11 | * Register user 12 | * 13 | * @memberof ISignupComponentState 14 | */ 15 | register?: (data: any) => any 16 | 17 | /** 18 | * Login 19 | * 20 | * @memberof ISignupComponentState 21 | */ 22 | loginPage?: () => any 23 | 24 | /** 25 | * Styles 26 | */ 27 | classes?: any 28 | 29 | /** 30 | * Translate to locale string 31 | */ 32 | translate?: (state: any, param?: {}) => any 33 | } 34 | -------------------------------------------------------------------------------- /src/containers/signup/ISignupComponentState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISignupComponentState { 3 | 4 | [key: string]: any 5 | 6 | /** 7 | * Full name input value 8 | */ 9 | fullNameInput: string 10 | 11 | /** 12 | * Full name input error text 13 | */ 14 | fullNameInputError: string 15 | 16 | /** 17 | * Email input value 18 | */ 19 | emailInput: string 20 | 21 | /** 22 | * Email input error text 23 | */ 24 | emailInputError: string 25 | 26 | /** 27 | * Password input value 28 | */ 29 | passwordInput: string 30 | 31 | /** 32 | * Passwor input error text 33 | */ 34 | passwordInputError: string 35 | 36 | /** 37 | * Confirm input value 38 | */ 39 | confirmInput: string 40 | 41 | /** 42 | * Confirm input error text 43 | */ 44 | confirmInputError: string 45 | 46 | /** 47 | * Checkbox input error text 48 | */ 49 | checkInputError?: string 50 | } 51 | -------------------------------------------------------------------------------- /src/containers/signup/index.ts: -------------------------------------------------------------------------------- 1 | import SignupComponent from './SignupComponent' 2 | export default SignupComponent 3 | -------------------------------------------------------------------------------- /src/containers/stream/IStreamComponentProps.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'src/core/domain/posts' 2 | import {Map} from 'immutable' 3 | 4 | export interface IStreamComponentProps { 5 | 6 | /** 7 | * Comment on a post is disables {true} or not {false} 8 | * 9 | * @type {boolean} 10 | * @memberof IStreamComponentState 11 | */ 12 | disableComments?: boolean 13 | 14 | /** 15 | * Sharing post is disabled {true} or not {false} 16 | * 17 | * @type {boolean} 18 | * @memberof IStreamComponentState 19 | */ 20 | disableSharing?: boolean 21 | 22 | /** 23 | * Post writing input is displayed {true} or not {false} 24 | * 25 | * @type {boolean} 26 | * @memberof IStreamComponentProps 27 | */ 28 | displayWriting?: boolean 29 | 30 | /** 31 | * Array of tags in a post 32 | * 33 | * @type {string[]} 34 | * @memberof IStreamComponentProps 35 | */ 36 | tag?: string[] 37 | 38 | /** 39 | * The tile of top bar 40 | * 41 | * @type {string} 42 | * @memberof IStreamComponentState 43 | */ 44 | homeTitle?: string 45 | 46 | /** 47 | * Set home title 48 | * 49 | * @type {Function} 50 | * @memberof IStreamComponentProps 51 | */ 52 | setHomeTitle?: () => void 53 | 54 | /** 55 | * User full name 56 | * 57 | * @type {string} 58 | * @memberof IStreamComponentProps 59 | */ 60 | fullName?: string 61 | 62 | /** 63 | * User avatar URL 64 | * 65 | * @type {string} 66 | * @memberof IStreamComponentProps 67 | */ 68 | avatar?: string 69 | 70 | /** 71 | * Load the data for stream 72 | */ 73 | loadStream?: (page: number, limit: number) => any 74 | 75 | /** 76 | * If there is more post {true} or not {false} 77 | */ 78 | hasMorePosts?: boolean 79 | 80 | /** 81 | * Posts for stream 82 | * 83 | * @type {{[postId: string]: Post}} 84 | * @memberof IStreamComponentProps 85 | */ 86 | posts: Map> 87 | 88 | /** 89 | * Router match property 90 | */ 91 | match?: any 92 | 93 | /** 94 | * Translate to locale string 95 | */ 96 | translate?: (state: any) => any 97 | } 98 | -------------------------------------------------------------------------------- /src/containers/stream/IStreamComponentState.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'src/core/domain/posts' 2 | 3 | export interface IStreamComponentState { 4 | 5 | /** 6 | * Writing post box is open {true} or not false 7 | * 8 | * @type {boolean} 9 | * @memberof IStreamComponentState 10 | */ 11 | openPostWrite: boolean 12 | 13 | /** 14 | * Comment on a post is disables {true} or not {false} 15 | * 16 | * @type {boolean} 17 | * @memberof IStreamComponentState 18 | */ 19 | disableComments: boolean 20 | 21 | /** 22 | * Sharing post is disabled {true} or not {false} 23 | * 24 | * @type {boolean} 25 | * @memberof IStreamComponentState 26 | */ 27 | disableSharing: boolean 28 | 29 | /** 30 | * Post should be in two columns {true} or not false 31 | * 32 | * @type {boolean} 33 | * @memberof IStreamComponentState 34 | */ 35 | divided: boolean 36 | 37 | /** 38 | * If there is more post to show 39 | * 40 | * @type {boolean} 41 | * @memberof IStreamComponentState 42 | */ 43 | hasMorePosts: boolean 44 | 45 | /** 46 | * The title of top bar 47 | * 48 | * @type {string} 49 | * @memberof IStreamComponentState 50 | */ 51 | homeTitle: string 52 | } 53 | -------------------------------------------------------------------------------- /src/containers/stream/index.ts: -------------------------------------------------------------------------------- 1 | import StreamComponent from './StreamComponent' 2 | export default StreamComponent 3 | -------------------------------------------------------------------------------- /src/core/domain/authorize/index.ts: -------------------------------------------------------------------------------- 1 | import { OAuthType } from './oauthType' 2 | import { LoginUser } from './loginUser' 3 | import { RegisterUserResult } from './registerUserResult' 4 | 5 | export { 6 | LoginUser, 7 | RegisterUserResult, 8 | OAuthType 9 | } 10 | -------------------------------------------------------------------------------- /src/core/domain/authorize/loginUser.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class LoginUser extends BaseDomain { 4 | 5 | constructor ( 6 | private _uid: string, 7 | private _emailVerified: boolean, 8 | private _providerId: string = '', 9 | private _displayName: string = '', 10 | private _email: string = '', 11 | private _avatarURL: string = '' 12 | 13 | ) { 14 | super() 15 | } 16 | 17 | /** 18 | * User identifier 19 | * 20 | * @type {string} 21 | * @memberof LoginUser 22 | */ 23 | public get uid (): string { 24 | return this._uid 25 | } 26 | 27 | /** 28 | * If user's email is verifide {true} or not {false} 29 | * 30 | * @readonly 31 | * @type {boolean} 32 | * @memberof LoginUser 33 | */ 34 | public get emailVerified (): boolean { 35 | return this._emailVerified 36 | } 37 | 38 | public get providerId (): string { 39 | return this._providerId 40 | } 41 | 42 | public get displayName (): string { 43 | return this._displayName 44 | } 45 | 46 | public get email (): string { 47 | return this.email 48 | } 49 | 50 | public get avatarURL (): string { 51 | return this._avatarURL 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/core/domain/authorize/oauthType.ts: -------------------------------------------------------------------------------- 1 | export enum OAuthType { 2 | GITHUB = 'GITHUB', 3 | FACEBOOK = 'FACEBOOK', 4 | GOOGLE = 'GOOGLE' 5 | } 6 | -------------------------------------------------------------------------------- /src/core/domain/authorize/registerUserResult.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class RegisterUserResult extends BaseDomain { 4 | 5 | private _uid: string 6 | constructor (uid: string) { 7 | super() 8 | 9 | this._uid = uid 10 | } 11 | /** 12 | * User identifier 13 | * 14 | * @type {string} 15 | * @memberof LoginUser 16 | */ 17 | 18 | public get uid (): string { 19 | return this._uid 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/core/domain/circles/circle.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Circle extends BaseDomain { 4 | 5 | /** 6 | * Circle identifier 7 | * 8 | * @type {string} 9 | * @memberof User 10 | */ 11 | public id?: string | null 12 | 13 | /** 14 | * Circle creation date time 15 | * 16 | * @type {Date} 17 | * @memberof Circle 18 | */ 19 | public creationDate?: number 20 | 21 | /** 22 | * Circle owner identifier 23 | * 24 | * @type {string} 25 | * @memberof Circle 26 | */ 27 | public ownerId?: string | null 28 | 29 | /** 30 | * Circle name 31 | * 32 | * @type {string} 33 | * @memberof User 34 | */ 35 | public name: string 36 | 37 | /** 38 | * Whether it's configured by system 39 | */ 40 | public isSystem: boolean 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/core/domain/circles/index.ts: -------------------------------------------------------------------------------- 1 | import { Circle } from './circle' 2 | import { UserTie } from './userTie' 3 | 4 | export { 5 | Circle, 6 | UserTie 7 | } 8 | -------------------------------------------------------------------------------- /src/core/domain/circles/userTie.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class UserTie extends BaseDomain { 4 | 5 | constructor ( 6 | /** 7 | * User identifier 8 | * 9 | * @type {string} 10 | * @memberof UserTie 11 | */ 12 | public userId?: string, 13 | 14 | /** 15 | * Circle creation date time 16 | * 17 | * @type {Date} 18 | * @memberof Circle 19 | */ 20 | public creationDate?: number, 21 | 22 | /** 23 | * User full name 24 | * 25 | * @type {string} 26 | * @memberof UserTie 27 | */ 28 | public fullName?: string, 29 | 30 | /** 31 | * Avatar URL address 32 | * 33 | * @type {string} 34 | * @memberof UserTie 35 | */ 36 | public avatar?: string, 37 | 38 | /** 39 | * If following user approved {true} or not {false} 40 | * 41 | * @type {Boolean} 42 | * @memberof UserTie 43 | */ 44 | public approved?: Boolean, 45 | 46 | /** 47 | * List of circles identifire which this user belong to 48 | */ 49 | public circleIdList?: string[] 50 | ) { 51 | super() 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/core/domain/comments/comment.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Comment extends BaseDomain { 4 | 5 | /** 6 | * Comment identifier 7 | */ 8 | public id?: string | null 9 | 10 | /** 11 | * Post identifier that comment belong to 12 | */ 13 | public postId: string 14 | 15 | /** 16 | * Comment text 17 | */ 18 | public text?: string | null 19 | 20 | /** 21 | * Comment score 22 | */ 23 | public score?: number | null 24 | 25 | /** 26 | * Comment creation date 27 | */ 28 | public creationDate?: number 29 | 30 | /** 31 | * Comment owner full name 32 | */ 33 | public userDisplayName?: string 34 | 35 | /** 36 | * Comment owner avater address 37 | */ 38 | public userAvatar?: string 39 | 40 | /** 41 | * Comment owner identifier 42 | */ 43 | public userId?: string 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/core/domain/comments/index.ts: -------------------------------------------------------------------------------- 1 | import {Comment} from './comment' 2 | 3 | export { 4 | Comment 5 | } -------------------------------------------------------------------------------- /src/core/domain/common/baseDomain.ts: -------------------------------------------------------------------------------- 1 | 2 | export class BaseDomain { 3 | 4 | } -------------------------------------------------------------------------------- /src/core/domain/common/feed.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | import { FeedType } from './feedType' 3 | import { User } from 'core/domain/users' 4 | 5 | export class Feed { 6 | 7 | /** 8 | * Constructor 9 | */ 10 | constructor ( 11 | /** 12 | * Feed identifier 13 | */ 14 | public id?: string, 15 | 16 | /** 17 | * Feed text 18 | */ 19 | public text?: string, 20 | 21 | /** 22 | * Feed type 23 | */ 24 | public feedType?: FeedType, 25 | 26 | /** 27 | * The user who send the feedback 28 | */ 29 | public user?: User 30 | 31 | ) { 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/core/domain/common/feedType.ts: -------------------------------------------------------------------------------- 1 | export enum FeedType { 2 | Awesome = 'Awesome', 3 | Happy = 'Happy', 4 | Acceptable = 'Acceptable', 5 | Sad = 'Sad', 6 | Bug = 'Bug' 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/core/domain/common/index.ts: -------------------------------------------------------------------------------- 1 | import { SocialError } from './socialError' 2 | import { BaseDomain } from './baseDomain' 3 | import { Feed } from './feed' 4 | 5 | export { 6 | SocialError, 7 | BaseDomain, 8 | Feed 9 | } 10 | -------------------------------------------------------------------------------- /src/core/domain/common/socialError.ts: -------------------------------------------------------------------------------- 1 | export class SocialError extends Error { 2 | private _isError: Boolean 3 | 4 | constructor (private _code: string, private _message: string) { 5 | super(_message) 6 | this._isError = true 7 | } 8 | /** 9 | * Error code 10 | * 11 | * @type {string} 12 | * @memberof SocialError 13 | */ 14 | public get code (): string { 15 | return this._code 16 | } 17 | 18 | /** 19 | * Error message 20 | * 21 | * @type {string} 22 | * @memberof SocialError 23 | */ 24 | public get message (): string { 25 | return this._message 26 | } 27 | 28 | /** 29 | * If is error {true} if not {false} 30 | * 31 | * @type {Boolean} 32 | * @memberof SocialError 33 | */ 34 | 35 | public get isError (): Boolean { 36 | return this._isError 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/core/domain/graphs/graph.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Graph extends BaseDomain { 4 | 5 | constructor ( 6 | /** 7 | * Left node of graph 8 | * 9 | * @type {string} 10 | * @memberof Graph 11 | */ 12 | public leftNode: string, 13 | 14 | /** 15 | * Graph relationship type 16 | * 17 | * @type {number} 18 | * @memberof Graph 19 | */ 20 | public edgeType: string, 21 | 22 | /** 23 | * Right node of graph 24 | * 25 | * @type {string} 26 | * @memberof Graph 27 | */ 28 | public rightNode: string, 29 | 30 | /** 31 | * Graph left node metadata 32 | * 33 | * @memberof Graph 34 | */ 35 | public LeftMetadata: any, 36 | 37 | /** 38 | * Graph right node metadata 39 | * 40 | * @memberof Graph 41 | */ 42 | public rightMetadata: any, 43 | 44 | /** 45 | * Graph metadata 46 | * 47 | * @type {string} 48 | * @memberof Graph 49 | */ 50 | public graphMetadata: any, 51 | 52 | /** 53 | * Graph node identifier 54 | * 55 | * @type {string} 56 | * @memberof Graph 57 | */ 58 | public nodeId?: string 59 | 60 | ) { super() } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/core/domain/graphs/index.ts: -------------------------------------------------------------------------------- 1 | import {Graph} from './graph' 2 | 3 | export { 4 | Graph 5 | } 6 | -------------------------------------------------------------------------------- /src/core/domain/imageGallery/image.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Image extends BaseDomain { 4 | 5 | /** 6 | * Image identifier 7 | * 8 | * @type {string} 9 | * @memberof Image 10 | */ 11 | public id?: string | null 12 | 13 | /** 14 | * Image creation date 15 | * 16 | * @type {number} 17 | * @memberof Image 18 | */ 19 | public creationDate: number 20 | 21 | /** 22 | * Image delete date 23 | * 24 | * @type {string} 25 | * @memberof Image 26 | */ 27 | public deleteDate: string 28 | 29 | /** 30 | * Image URL address 31 | * 32 | * @type {string} 33 | * @memberof Image 34 | */ 35 | public URL: string 36 | 37 | /** 38 | * Image folder name with image name {folderName/imageName} 39 | * 40 | * @type {string} 41 | * @memberof Image 42 | */ 43 | public fullPath: string 44 | 45 | /** 46 | * Image owner identifier 47 | * 48 | * @type {string} 49 | * @memberof Image 50 | */ 51 | public ownerUserId: string 52 | 53 | /** 54 | * Last edit date 55 | * 56 | * @type {number} 57 | * @memberof Image 58 | */ 59 | public lastEditDate: number 60 | 61 | /** 62 | * If the image was deleted {true} or not {false} 63 | * 64 | * @type {Boolean} 65 | * @memberof Image 66 | */ 67 | public deleted: Boolean 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/core/domain/imageGallery/index.ts: -------------------------------------------------------------------------------- 1 | import { Image } from './image' 2 | 3 | export { 4 | Image 5 | } -------------------------------------------------------------------------------- /src/core/domain/notifications/index.ts: -------------------------------------------------------------------------------- 1 | import {Notification} from './notification' 2 | 3 | export { 4 | Notification 5 | } -------------------------------------------------------------------------------- /src/core/domain/notifications/notification.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Notification extends BaseDomain { 4 | 5 | /** 6 | * Notification identifier 7 | * 8 | * @type {string} 9 | * @memberof Notification 10 | */ 11 | public id?: string 12 | 13 | /** 14 | * Description of notification 15 | * 16 | * @type {string} 17 | * @memberof Notification 18 | */ 19 | public description: string 20 | 21 | /** 22 | * The URL which notification refer to 23 | * 24 | * @type {string} 25 | * @memberof Notification 26 | */ 27 | public url: string 28 | 29 | /** 30 | * The identifier of the user who makes the notification 31 | * 32 | * @type {string} 33 | * @memberof Notification 34 | */ 35 | public notifierUserId: string 36 | 37 | /** 38 | * The identifier of the user who receive the notification 39 | * 40 | * @type {string} 41 | * @memberof Notification 42 | */ 43 | public notifyRecieverUserId: string 44 | 45 | /** 46 | * If the notification is seen {true} or not {false} 47 | * 48 | * @type {Boolean} 49 | * @memberof Notification 50 | */ 51 | public isSeen: boolean 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/core/domain/posts/index.ts: -------------------------------------------------------------------------------- 1 | import {Post} from './post' 2 | 3 | export { 4 | Post 5 | } -------------------------------------------------------------------------------- /src/core/domain/users/index.ts: -------------------------------------------------------------------------------- 1 | import { User } from './user' 2 | import { Profile } from './profile' 3 | import { UserProvider } from './userProvider' 4 | 5 | export { 6 | User, 7 | Profile, 8 | UserProvider 9 | } 10 | -------------------------------------------------------------------------------- /src/core/domain/users/profile.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Profile extends BaseDomain { 4 | constructor ( 5 | public avatar: string, 6 | public fullName: string, 7 | public banner: string, 8 | public tagLine: string, 9 | public creationDate: number, 10 | public email?: string | null, 11 | public birthday?: number, 12 | public webUrl?: string, 13 | public companyName?: string, 14 | public twitterId?: string 15 | ) { 16 | super() 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/core/domain/users/user.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class User extends BaseDomain { 4 | 5 | /** 6 | * Full name of user 7 | * 8 | * @type {string} 9 | * @memberof User 10 | */ 11 | public fullName: string 12 | 13 | /** 14 | * User avatar address 15 | * 16 | * @type {string} 17 | * @memberof User 18 | */ 19 | public avatar: string 20 | 21 | /** 22 | * Email of the user 23 | * 24 | * @type {string} 25 | * @memberof User 26 | */ 27 | public email?: string | null 28 | 29 | /** 30 | * Password of the user 31 | * 32 | * @type {string} 33 | * @memberof User 34 | */ 35 | public password?: string | null 36 | 37 | /** 38 | * User identifier 39 | * 40 | * @type {string} 41 | * @memberof User 42 | */ 43 | public userId?: string | null 44 | 45 | /** 46 | * User creation date 47 | * 48 | * @type {number} 49 | * @memberof User 50 | */ 51 | public creationDate: number 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/core/domain/users/userProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * User provide data 3 | * 4 | * @export 5 | * @class UserProvider 6 | */ 7 | export class UserProvider { 8 | 9 | constructor ( 10 | public userId: string, 11 | public email: string, 12 | public fullName: string, 13 | public avatar: string, 14 | public providerId: string, 15 | public provider: string, 16 | public accessToken: string 17 | ) {} 18 | } 19 | -------------------------------------------------------------------------------- /src/core/domain/votes/index.ts: -------------------------------------------------------------------------------- 1 | import {Vote} from './vote' 2 | 3 | export { 4 | Vote 5 | } -------------------------------------------------------------------------------- /src/core/domain/votes/vote.ts: -------------------------------------------------------------------------------- 1 | import { BaseDomain } from 'core/domain/common' 2 | 3 | export class Vote extends BaseDomain { 4 | 5 | /** 6 | * Post identifire which vote on 7 | * 8 | * @type {string} 9 | * @memberof Vote 10 | */ 11 | public postId: string 12 | 13 | /** 14 | * Vote date 15 | * 16 | * @type {number} 17 | * @memberof Vote 18 | */ 19 | public creationDate: number 20 | 21 | /** 22 | * Voter full name 23 | * 24 | * @type {string} 25 | * @memberof Vote 26 | */ 27 | public userDisplayName: string 28 | 29 | /** 30 | * Avatar of voter 31 | * 32 | * @type {string} 33 | * @memberof Vote 34 | */ 35 | public userAvatar: string 36 | 37 | /** 38 | * Voter identifier 39 | * 40 | * @type {string} 41 | * @memberof Vote 42 | */ 43 | public userId: string 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/core/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | appName : 'Green Social' 3 | } 4 | -------------------------------------------------------------------------------- /src/core/factories/IServiceProvider.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IAuthorizeService, 3 | ICircleService, 4 | ICommentService, 5 | ICommonService, 6 | IImageGalleryService, 7 | INotificationService, 8 | IPostService, 9 | IUserService, 10 | IVoteService, 11 | IStorageService 12 | } from 'core/services' 13 | 14 | export interface IServiceProvider { 15 | 16 | /** 17 | * Create authorize service 18 | * 19 | * @memberof IServiceProvider 20 | */ 21 | createAuthorizeService: () => IAuthorizeService 22 | 23 | /** 24 | * Create instant for Circle Service 25 | * 26 | * @memberof ServiceProvide 27 | */ 28 | createCircleService: () => ICircleService 29 | 30 | /** 31 | * Create instant for Comment Service 32 | * 33 | * @memberof ServiceProvide 34 | */ 35 | createCommentService: () => ICommentService 36 | 37 | /** 38 | * Create instant for Common Service 39 | * 40 | * @memberof ServiceProvide 41 | */ 42 | createCommonService: () => ICommonService 43 | 44 | /** 45 | * Create instant for ImageGallery Service 46 | * 47 | * @memberof ServiceProvide 48 | */ 49 | createImageGalleryService: () => IImageGalleryService 50 | 51 | /** 52 | * Create instant for Notification Service 53 | * 54 | * @memberof ServiceProvide 55 | */ 56 | createNotificationService: () => INotificationService 57 | 58 | /** 59 | * Create instant for Post Service 60 | * 61 | * @memberof ServiceProvide 62 | */ 63 | createPostService: () => IPostService 64 | 65 | /** 66 | * Create instant for User Service 67 | * 68 | * @memberof ServiceProvide 69 | */ 70 | createUserService: () => IUserService 71 | 72 | /** 73 | * Create instant for Vote Service 74 | * 75 | * @memberof ServiceProvide 76 | */ 77 | createVoteService: () => IVoteService 78 | 79 | /** 80 | * Create instant for Vote Service 81 | * 82 | * @memberof ServiceProvide 83 | */ 84 | createStorageService: () => IStorageService 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/core/factories/index.ts: -------------------------------------------------------------------------------- 1 | import { IServiceProvider } from './IServiceProvider' 2 | import { ServiceProvide } from './serviceProvide' 3 | 4 | export { 5 | IServiceProvider, 6 | ServiceProvide 7 | } 8 | -------------------------------------------------------------------------------- /src/core/services/authorize/IAuthorizeService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { LoginUser, RegisterUserResult, OAuthType } from 'core/domain/authorize' 3 | 4 | /** 5 | * Authentication service interface 6 | * 7 | * @export 8 | * @interface IAuthorizeService 9 | */ 10 | export interface IAuthorizeService { 11 | 12 | /** 13 | * Login the user 14 | * 15 | * @returns {Promise} 16 | * @memberof IAuthorizeService 17 | */ 18 | login: (email: string, password: string) => Promise 19 | 20 | /** 21 | * Logs out the user 22 | * 23 | * @returns {Promise} 24 | * @memberof IAuthorizeService 25 | */ 26 | logout: () => Promise 27 | 28 | /** 29 | * @returns {Promise} 30 | */ 31 | updatePassword: (newPassword: string) => Promise 32 | 33 | /** 34 | * @returns {Promise} 35 | */ 36 | registerUser: (user: User) => Promise 37 | 38 | /** 39 | * On user authorization changed event 40 | * 41 | * @memberof IAuthorizeService 42 | */ 43 | onAuthStateChanged: (callBack: (isVerifide: boolean, user: User) => void) => void 44 | 45 | /** 46 | * Reset user password 47 | * 48 | * @memberof IAuthorizeService 49 | */ 50 | resetPassword: (email: string) => Promise 51 | 52 | /** 53 | * Send email verification 54 | * 55 | * @memberof IAuthorizeService 56 | */ 57 | sendEmailVerification: () => Promise 58 | 59 | /** 60 | * Login user by OAuth authentication 61 | * 62 | * @memberof IAuthorizeService 63 | */ 64 | loginWithOAuth: (type: OAuthType) => Promise 65 | } 66 | -------------------------------------------------------------------------------- /src/core/services/authorize/index.ts: -------------------------------------------------------------------------------- 1 | import { IAuthorizeService } from './IAuthorizeService' 2 | 3 | export { 4 | IAuthorizeService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/circles/ICircleService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { Circle, UserTie } from 'core/domain/circles' 3 | 4 | /** 5 | * Circle service interface 6 | * 7 | * @export 8 | * @interface ICircleService 9 | */ 10 | export interface ICircleService { 11 | 12 | addCircle: (userId: string, circle: Circle) => Promise 13 | updateCircle: (userId: string, circleId: string, circle: Circle) => Promise 14 | deleteCircle: (userId: string, circleId: string) => Promise 15 | getCircles: (userId: string) => Promise<{ [circleId: string]: Circle }> 16 | } 17 | -------------------------------------------------------------------------------- /src/core/services/circles/IUserTieService.ts: -------------------------------------------------------------------------------- 1 | import { User, Profile } from 'core/domain/users' 2 | import { UserTie } from 'core/domain/circles' 3 | 4 | /** 5 | * User tie service interface 6 | * 7 | * @export 8 | * @interface IUserTieService 9 | */ 10 | export interface IUserTieService { 11 | 12 | /** 13 | * Tie users 14 | */ 15 | tieUseres: (userTieSenderInfo: UserTie, userTieReceiveInfo: UserTie, circleIds: string[]) 16 | => Promise 17 | 18 | /** 19 | * Update users tie 20 | */ 21 | updateUsersTie: (userTieSenderInfo: UserTie, userTieReceiveInfo: UserTie, circleIds: string[]) 22 | => Promise 23 | 24 | /** 25 | * Remove users' tie 26 | */ 27 | removeUsersTie: (firstUserId: string, secondUserId: string) 28 | => Promise 29 | 30 | /** 31 | * Get user ties 32 | */ 33 | getUserTies: (userId: string) 34 | => Promise<{[userId: string]: UserTie}> 35 | 36 | /** 37 | * Get the users who tied current user 38 | */ 39 | getUserTieSender: (userId: string) 40 | => Promise<{[userId: string]: UserTie}> 41 | } 42 | -------------------------------------------------------------------------------- /src/core/services/circles/index.ts: -------------------------------------------------------------------------------- 1 | import { ICircleService } from './ICircleService' 2 | import { IUserTieService } from './IUserTieService' 3 | 4 | export { 5 | ICircleService, 6 | IUserTieService 7 | } -------------------------------------------------------------------------------- /src/core/services/comments/ICommentService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import {Map} from 'immutable' 3 | import { Comment } from 'core/domain/comments' 4 | import { postComments } from 'models/comments/commentTypes' 5 | 6 | /** 7 | * Comment service interface 8 | * 9 | * @export 10 | * @interface ICommentService 11 | */ 12 | export interface ICommentService { 13 | 14 | addComment: (comment: Comment) => Promise 15 | getComments: (postId: string, next: (resultComments: Map>) => void) => () => void 16 | updateComment: (comment: Comment) => Promise 17 | deleteComment: (commentId: string) => Promise 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/core/services/comments/index.ts: -------------------------------------------------------------------------------- 1 | import { ICommentService } from './ICommentService' 2 | 3 | export { 4 | ICommentService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/common/ICommonService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { Feed } from 'core/domain/common' 3 | 4 | /** 5 | * Common service interface 6 | * 7 | * @export 8 | * @interface ICommonService 9 | */ 10 | export interface ICommonService { 11 | 12 | /** 13 | * Post feedback 14 | */ 15 | addFeed: (feed: Feed) => Promise 16 | } 17 | -------------------------------------------------------------------------------- /src/core/services/common/index.ts: -------------------------------------------------------------------------------- 1 | import { ICommonService } from './ICommonService' 2 | 3 | export { 4 | ICommonService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/files/IStorageService.ts: -------------------------------------------------------------------------------- 1 | import { FileResult } from 'models/files/fileResult' 2 | 3 | export interface IStorageService { 4 | 5 | /** 6 | * Storage file service 7 | * 8 | * @memberof IStorageService 9 | */ 10 | uploadFile: (file: any, fileName: string, progress: (percentage: number, status: boolean) => void) => Promise 11 | } 12 | -------------------------------------------------------------------------------- /src/core/services/files/index.ts: -------------------------------------------------------------------------------- 1 | import { IStorageService } from './IStorageService' 2 | 3 | export { 4 | IStorageService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/imageGallery/IImageGalleryService.ts: -------------------------------------------------------------------------------- 1 | import { FileResult } from 'models/files/fileResult' 2 | import { User } from 'core/domain/users' 3 | import { Image } from 'core/domain/imageGallery' 4 | 5 | /** 6 | * Image gallery service interface 7 | * 8 | * @export 9 | * @interface IImageGalleryService 10 | */ 11 | export interface IImageGalleryService { 12 | getImageGallery: (userId: string) => Promise 13 | saveImage: (userId: string, image: Image) => Promise 14 | deleteImage: (userId: string, imageId: string) => Promise 15 | uploadImage: (file: any, fileName: string, progressCallback: (percentage: number, status: boolean) => void) => Promise 16 | downloadImage: (fileName: string) => Promise 17 | } 18 | -------------------------------------------------------------------------------- /src/core/services/imageGallery/index.ts: -------------------------------------------------------------------------------- 1 | import { IImageGalleryService } from './IImageGalleryService' 2 | 3 | export { 4 | IImageGalleryService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/index.ts: -------------------------------------------------------------------------------- 1 | import { IAuthorizeService } from './authorize' 2 | import { ICircleService } from './circles' 3 | import { ICommentService } from './comments' 4 | import { ICommonService } from './common' 5 | import { IImageGalleryService } from './imageGallery' 6 | import { INotificationService } from './notifications' 7 | import { IPostService } from './posts' 8 | import { IUserService } from './users' 9 | import { IVoteService } from './votes' 10 | import { IStorageService } from './files' 11 | 12 | export { 13 | IAuthorizeService, 14 | ICircleService, 15 | ICommentService, 16 | ICommonService, 17 | IImageGalleryService, 18 | INotificationService, 19 | IPostService, 20 | IUserService, 21 | IVoteService, 22 | IStorageService 23 | } 24 | -------------------------------------------------------------------------------- /src/core/services/notifications/INotificationService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | 3 | import { Notification } from 'core/domain/notifications' 4 | 5 | /** 6 | * Notification service interface 7 | * 8 | * @export 9 | * @interface INotificationService 10 | */ 11 | export interface INotificationService { 12 | addNotification: (notification: Notification) => Promise 13 | getNotifications: (userId: string, callback: (resultNotifications: {[notifyId: string]: Notification}) => void) => void 14 | deleteNotification: (notificationId: string, userId: string) => Promise 15 | setSeenNotification: (notificationId: string, userId: string, notification: Notification) => Promise 16 | } 17 | -------------------------------------------------------------------------------- /src/core/services/notifications/index.ts: -------------------------------------------------------------------------------- 1 | import { INotificationService } from './INotificationService' 2 | 3 | export { 4 | INotificationService 5 | } -------------------------------------------------------------------------------- /src/core/services/posts/IPostService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { Post } from 'core/domain/posts' 3 | 4 | /** 5 | * Post service interface 6 | * 7 | * @export 8 | * @interface IPostService 9 | */ 10 | export interface IPostService { 11 | addPost: (post: Post) => Promise 12 | updatePost: (post: Post) => Promise 13 | deletePost: (postId: string) => Promise 14 | getPosts: (currentUserId: string,lastPostId: string, page: number, limit: number) 15 | => Promise<{posts: {[postId: string]: Post }[], newLastPostId: string}> 16 | 17 | /** 18 | * Get list of post by user identifier 19 | */ 20 | getPostsByUserId: (userId: string, lastPostId?: string, page?: number, limit?: number) 21 | => Promise<{ posts: { [postId: string]: Post }[], newLastPostId: string }> 22 | 23 | /** 24 | * Get post by the post identifier 25 | */ 26 | getPostById: (postId: string) => Promise 27 | } 28 | -------------------------------------------------------------------------------- /src/core/services/posts/index.ts: -------------------------------------------------------------------------------- 1 | import { IPostService } from './IPostService' 2 | 3 | export { 4 | IPostService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/users/IUserService.ts: -------------------------------------------------------------------------------- 1 | import { User, Profile } from 'core/domain/users' 2 | 3 | /** 4 | * User service interface 5 | * 6 | * @export 7 | * @interface IUserService 8 | */ 9 | export interface IUserService { 10 | getUserProfile: (userId: string) => Promise 11 | updateUserProfile: (userId: string, profile: Profile) => Promise 12 | getUsersProfile: (userId: string, lastUserId?: string, page?: number, limit?: number) 13 | => Promise<{ users: { [userId: string]: Profile }[], newLastUserId: string }> 14 | } 15 | -------------------------------------------------------------------------------- /src/core/services/users/index.ts: -------------------------------------------------------------------------------- 1 | import { IUserService } from './IUserService' 2 | 3 | export { 4 | IUserService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/services/votes/IVoteService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { Vote } from 'core/domain/votes' 3 | 4 | /** 5 | * Vote service interface 6 | * 7 | * @export 8 | * @interface IVoteService 9 | */ 10 | export interface IVoteService { 11 | addVote: (vote: Vote) => Promise 12 | getVotes: (postId: string) => Promise<{[postId: string]: {[voteId: string]: Vote}}> 13 | deleteVote: (userId: string, voteId: string) => Promise 14 | } 15 | -------------------------------------------------------------------------------- /src/core/services/votes/index.ts: -------------------------------------------------------------------------------- 1 | import { IVoteService } from './IVoteService' 2 | 3 | export { 4 | IVoteService 5 | } 6 | -------------------------------------------------------------------------------- /src/core/socialProviderTypes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * InversifyJS need to use the type as identifiers at runtime. 3 | * We use symbols as identifiers but you can also use classes and or string literals. 4 | */ 5 | export const SocialProviderTypes = { 6 | AuthorizeService: Symbol('AuthorizeService'), 7 | UserTieService: Symbol('UserTieService'), 8 | CircleService: Symbol('CircleService'), 9 | CommentService: Symbol('CommentService'), 10 | CommonService: Symbol('CommonService'), 11 | StorageService: Symbol('StorageService'), 12 | ImageGalleryService: Symbol('ImageGalleryService'), 13 | NotificationService: Symbol('NotificationService'), 14 | PostService: Symbol('PostService'), 15 | UserService: Symbol('UserService'), 16 | VoteService: Symbol('VoteService') 17 | } 18 | -------------------------------------------------------------------------------- /src/data/firestoreClient/firestoreClientTypes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * InversifyJS need to use the type as identifiers at runtime. 3 | * We use symbols as identifiers but you can also use classes and or string literals. 4 | */ 5 | export const FirestoreClientTypes = { 6 | GraphService: Symbol('GraphService') 7 | } 8 | -------------------------------------------------------------------------------- /src/data/firestoreClient/index.ts: -------------------------------------------------------------------------------- 1 | import firebase from 'firebase/app' 2 | import 'firebase/firestore' 3 | import 'firebase/storage' 4 | import 'firebase/auth' 5 | import 'firebase/functions' 6 | import config from 'src/config' 7 | try { 8 | let firebaseConfig = { 9 | apiKey: config.firebase.apiKey, 10 | authDomain: config.firebase.authDomain, 11 | databaseURL: config.firebase.databaseURL, 12 | projectId: config.firebase.projectId, 13 | storageBucket: config.firebase.storageBucket, 14 | messagingSenderId: config.firebase.messagingSenderId 15 | } 16 | 17 | firebase.initializeApp(firebaseConfig) 18 | } catch (error) { 19 | console.log('=========Firebase firestore initializer==============') 20 | console.log(error) 21 | console.log('====================================') 22 | } 23 | 24 | // - Storage reference 25 | export let storageRef = firebase.storage().ref() 26 | 27 | // Initialize Cloud Firestore through Firebase 28 | const db = firebase.firestore() 29 | const settings = {} 30 | db.settings(settings) 31 | export { 32 | db 33 | } 34 | // - Database authorize 35 | export let firebaseAuth = firebase.auth 36 | export let functions = firebase.functions() 37 | // export let firebaseRef = firebase.database().ref() 38 | 39 | // - Firebase default 40 | export default firebase 41 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/authorize/index.ts: -------------------------------------------------------------------------------- 1 | import { AuthorizeService } from './AuthorizeService' 2 | 3 | export { 4 | AuthorizeService 5 | } 6 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/circles/index.ts: -------------------------------------------------------------------------------- 1 | import { CircleService } from './CircleService' 2 | 3 | export { 4 | CircleService 5 | } 6 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/comments/index.ts: -------------------------------------------------------------------------------- 1 | import { CommentService } from './CommentService' 2 | 3 | export { 4 | CommentService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/common/CommonService.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import { firebaseAuth, db } from 'data/firestoreClient' 3 | 4 | import { SocialError, Feed } from 'core/domain/common' 5 | import { ICommonService } from 'core/services/common' 6 | import { injectable } from 'inversify' 7 | 8 | /** 9 | * Firbase common service 10 | * 11 | * @export 12 | * @class CommonService 13 | * @implements {ICommonService} 14 | */ 15 | @injectable() 16 | export class CommonService implements ICommonService { 17 | 18 | /** 19 | * Post feedback 20 | */ 21 | public addFeed: (feed: Feed) 22 | => Promise = (feed) => { 23 | return new Promise((resolve, reject) => { 24 | let feedRef = db.collection(`feeds`).doc() 25 | feedRef.set({ ...feed, id: feedRef.id }) 26 | .then(() => { 27 | resolve(feedRef.id) 28 | }) 29 | .catch((error: any) => { 30 | reject(new SocialError(error.code, error.message)) 31 | }) 32 | }) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/common/index.ts: -------------------------------------------------------------------------------- 1 | import { CommonService } from './CommonService' 2 | 3 | export { 4 | CommonService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/files/StorageService.ts: -------------------------------------------------------------------------------- 1 | import { storageRef } from 'data/firestoreClient' 2 | import { IStorageService } from 'core/services/files' 3 | import { FileResult } from 'models/files/fileResult' 4 | import { injectable } from 'inversify' 5 | 6 | @injectable() 7 | export class StorageService implements IStorageService { 8 | 9 | /** 10 | * Upload image on the server 11 | * @param {file} file 12 | * @param {string} fileName 13 | */ 14 | public uploadFile = (file: any, fileName: string, progress: (percentage: number, status: boolean) => void) => { 15 | 16 | return new Promise((resolve, reject) => { 17 | // Create a storage refrence 18 | let storegeFile = storageRef.child(`images/${fileName}`) 19 | 20 | // Upload file 21 | let task = storegeFile.put(file) 22 | task.then((result) => { 23 | result.ref.getDownloadURL() 24 | .then((downloadURL) => { 25 | resolve(new FileResult(downloadURL, result.metadata.fullPath)) 26 | }) 27 | .catch((error) => { 28 | reject(error) 29 | }) 30 | }).catch((error) => { 31 | reject(error) 32 | }) 33 | 34 | // Upload storage bar 35 | task.on('state_changed', (snapshot: any) => { 36 | let percentage: number = (snapshot.bytesTransferred / snapshot.totalBytes) * 100 37 | progress(percentage, true) 38 | }, (error) => { 39 | console.log('========== Upload Image ============') 40 | console.log(error) 41 | console.log('====================================') 42 | 43 | }, () => { 44 | progress(100, false) 45 | }) 46 | }) 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/files/index.ts: -------------------------------------------------------------------------------- 1 | import { StorageService } from './StorageService' 2 | 3 | export { 4 | StorageService 5 | } 6 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/graphs/IGraphService.ts: -------------------------------------------------------------------------------- 1 | import { User } from 'core/domain/users' 2 | import { Graph } from 'core/domain/graphs' 3 | import firebase from 'firebase' 4 | 5 | /** 6 | * Graph service interface 7 | * 8 | * @export 9 | * @interface IGraphService 10 | */ 11 | export interface IGraphService { 12 | /** 13 | * Add graph 14 | */ 15 | addGraph: (graph: Graph, collection: string) => Promise 16 | 17 | /** 18 | * Update graph 19 | */ 20 | updateGraph: (graph: Graph, collection: string) => Promise 21 | 22 | /** 23 | * Get graphs data 24 | */ 25 | getGraphs: (collection: string, leftNode?: string | null, edgeType?: string, rightNode?: string | null) => Promise 26 | 27 | /** 28 | * Delete graph by node identifier 29 | */ 30 | deleteGraphByNodeId: (nodeId: string) => Promise 31 | 32 | /** 33 | * Delete graph 34 | */ 35 | deleteGraph: (collection: string, leftNode?: string | null, edgeType?: string, rightNode?: string | null) => Promise 36 | } 37 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/graphs/index.ts: -------------------------------------------------------------------------------- 1 | import { GraphService } from './GraphService' 2 | 3 | export { 4 | GraphService 5 | } 6 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/imageGallery/index.ts: -------------------------------------------------------------------------------- 1 | import { ImageGalleryService } from './ImageGalleryService' 2 | 3 | export { 4 | ImageGalleryService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/index.ts: -------------------------------------------------------------------------------- 1 | import { AuthorizeService } from './authorize' 2 | import { CircleService } from './circles' 3 | import { CommentService } from './comments' 4 | import { CommonService } from './common' 5 | import { ImageGalleryService } from './imageGallery' 6 | import { NotificationService } from './notifications' 7 | import { PostService } from './posts' 8 | import { UserService } from './users' 9 | import { VoteService } from './votes' 10 | import { StorageService } from './files' 11 | 12 | export { 13 | AuthorizeService, 14 | CircleService, 15 | CommentService, 16 | CommonService, 17 | ImageGalleryService, 18 | NotificationService, 19 | PostService, 20 | UserService, 21 | VoteService, 22 | StorageService 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/data/firestoreClient/services/notifications/index.ts: -------------------------------------------------------------------------------- 1 | import { NotificationService } from './notificationService' 2 | 3 | export { 4 | NotificationService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/posts/index.ts: -------------------------------------------------------------------------------- 1 | import { PostService } from './PostService' 2 | 3 | export { 4 | PostService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/users/index.ts: -------------------------------------------------------------------------------- 1 | import { UserService } from './UserService' 2 | 3 | export { 4 | UserService 5 | } -------------------------------------------------------------------------------- /src/data/firestoreClient/services/votes/index.ts: -------------------------------------------------------------------------------- 1 | import { VoteService } from './VoteService' 2 | 3 | export { 4 | VoteService 5 | } 6 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | // Import external components refrence 2 | import React from 'react' 3 | import ReactDOM from 'react-dom' 4 | import injectTapEventPlugin from 'react-tap-event-plugin' 5 | import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles' 6 | import 'reflect-metadata' 7 | import 'typeface-roboto' 8 | import registerServiceWorker from './registerServiceWorker' 9 | import config from 'src/config' 10 | 11 | import { Provider } from 'react-redux' 12 | import configureStore from 'store/configureStore' 13 | import { ConnectedRouter } from 'connected-react-router/immutable' 14 | 15 | // - Actions 16 | import * as localeActions from 'store/actions/localeActions' 17 | import * as globalActions from 'store/actions/globalActions' 18 | 19 | // - Import app components 20 | import Master from 'containers/master' 21 | // import { App } from 'components/AWS' 22 | // App css 23 | import './styles/app.css' 24 | 25 | /** 26 | * Execute startup functions 27 | */ 28 | import './socialEngine' 29 | import rootSaga from 'store/sagas/rootSaga' 30 | 31 | configureStore.runSaga(rootSaga) 32 | 33 | // Set default data 34 | // tslint:disable-next-line:no-empty 35 | configureStore.store.subscribe(() => { }) 36 | 37 | // - Initialize languages 38 | configureStore.store.dispatch(globalActions.initLocale()) 39 | 40 | // Needed for onClick 41 | // http://stackoverflow.com/a/34015469/988941 42 | try { injectTapEventPlugin() } catch (e) { } 43 | 44 | const theme = createMuiTheme({ 45 | palette: { 46 | primary: { main: config.theme.primaryColor }, 47 | secondary: { main: config.theme.secondaryColor }, 48 | }, 49 | typography: { 50 | useNextVariants: true, 51 | }, 52 | }) 53 | 54 | const supportsHistory = 'pushState' in window.history 55 | ReactDOM.render( 56 | 57 | 58 | 59 | 60 | 61 | 62 | , 63 | document.getElementById('app') as HTMLElement 64 | ) 65 | registerServiceWorker() 66 | -------------------------------------------------------------------------------- /src/layouts/appInput/AppInputComponent.tsx: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import React, { Component } from 'react' 3 | import PropTypes from 'prop-types' 4 | import { grey } from '@material-ui/core/colors' 5 | import SvgClose from '@material-ui/icons/Close' 6 | import Button from '@material-ui/core/Button' 7 | import Divider from '@material-ui/core/Divider' 8 | import { IAppInputComponentProps } from './IAppInputComponentProps' 9 | import { IAppInputComponentState } from './IAppInputComponentState' 10 | import { TextField } from '@material-ui/core' 11 | 12 | /** 13 | * Create component class 14 | */ 15 | export default class AppInputComponent extends Component { 16 | 17 | /** 18 | * Fields 19 | */ 20 | input: any 21 | 22 | /** 23 | * Component constructor 24 | * @param {object} props is an object properties of component 25 | */ 26 | constructor(props: IAppInputComponentProps) { 27 | super(props) 28 | 29 | // Defaul state 30 | this.state = { 31 | } 32 | 33 | // Binding functions to `this` 34 | 35 | } 36 | focus = () => { 37 | this.input.focus() 38 | } 39 | 40 | /** 41 | * Reneder component DOM 42 | * @return {react element} return the DOM which rendered by component 43 | */ 44 | render() { 45 | 46 | return ( 47 | (this.input = el)} 49 | fullWidth 50 | {...this.props} 51 | /> 52 | ) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/layouts/appInput/IAppInputComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IAppInputComponentProps { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/layouts/appInput/IAppInputComponentState.ts: -------------------------------------------------------------------------------- 1 | export interface IAppInputComponentState { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/layouts/appInput/index.ts: -------------------------------------------------------------------------------- 1 | import AppInputComponent from './AppInputComponent' 2 | export default AppInputComponent 3 | -------------------------------------------------------------------------------- /src/layouts/dialogTitle/IDialogTitleComponentProps.ts: -------------------------------------------------------------------------------- 1 | export interface IDialogTitleComponentProps { 2 | 3 | /** 4 | * Lable of the button 5 | * 6 | * @type {string} 7 | * @memberof IDialogTitleComponentProps 8 | */ 9 | buttonLabel?: string 10 | 11 | /** 12 | * Dialog tile 13 | * 14 | * @type {string} 15 | * @memberof IDialogTitleComponentProps 16 | */ 17 | title: string 18 | 19 | /** 20 | * Button is disabled {true} or not {false} 21 | * 22 | * @type {boolean} 23 | * @memberof IDialogTitleComponentProps 24 | */ 25 | disabledButton?: boolean 26 | 27 | /** 28 | * On click event 29 | * 30 | * @memberof IDialogTitleComponentProps 31 | */ 32 | onClickButton?: (event: any) => void 33 | 34 | /** 35 | * On request close event 36 | * 37 | * @memberof IDialogTitleComponentProps 38 | */ 39 | onRequestClose: (event: any) => void 40 | } 41 | -------------------------------------------------------------------------------- /src/layouts/dialogTitle/IDialogTitleComponentState.ts: -------------------------------------------------------------------------------- 1 | export interface IDialogTitleComponentState { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/layouts/dialogTitle/index.ts: -------------------------------------------------------------------------------- 1 | import DialogTitleComponent from './DialogTitleComponent' 2 | export default DialogTitleComponent 3 | -------------------------------------------------------------------------------- /src/layouts/iconButtonElement/IconButtonElementComponent.tsx: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import React, { Component } from 'react' 3 | import IconButton from '@material-ui/core/IconButton' 4 | import MoreVertIcon from '@material-ui/icons/MoreVert' 5 | import { grey } from '@material-ui/core/colors' 6 | 7 | /** 8 | * DOM styles 9 | * 10 | * 11 | * @memberof Post 12 | */ 13 | const styles = { 14 | 15 | } 16 | // TODO: Delete the component 17 | const IconButtonElementComponent = (
) 18 | 19 | export default IconButtonElementComponent 20 | -------------------------------------------------------------------------------- /src/layouts/iconButtonElement/index.ts: -------------------------------------------------------------------------------- 1 | import IconButtonElementComponent from './IconButtonElementComponent' 2 | export default IconButtonElementComponent 3 | -------------------------------------------------------------------------------- /src/layouts/loadMoreProgress/LoadMoreProgressComponent.tsx: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import React, { Component } from 'react' 3 | import { teal } from '@material-ui/core/colors' 4 | import CircularProgress from '@material-ui/core/CircularProgress' 5 | 6 | /** 7 | * Create component class 8 | */ 9 | export default class LoadMoreProgressComponent extends Component<{},{}> { 10 | 11 | /** 12 | * Reneder component DOM 13 | * @return {react element} return the DOM which rendered by component 14 | */ 15 | render () { 16 | return ( 17 |
18 | ) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/layouts/loadMoreProgress/index.ts: -------------------------------------------------------------------------------- 1 | import LoadMoreProgressComponent from './LoadMoreProgressComponent' 2 | export default LoadMoreProgressComponent 3 | -------------------------------------------------------------------------------- /src/models/comments/commentTypes.ts: -------------------------------------------------------------------------------- 1 | import {Comment} from 'core/domain/comments' 2 | export type postComments = {[postId: string]: {[commentId: string]: Comment}} 3 | export type comments = {[commentId: string]: Comment} -------------------------------------------------------------------------------- /src/models/files/fileResult.ts: -------------------------------------------------------------------------------- 1 | export class FileResult { 2 | 3 | constructor (private _fileURL: string, private _fileFullPath: string) { 4 | 5 | } 6 | 7 | public get fileURL (): string { 8 | return this._fileURL 9 | } 10 | 11 | public get fileFullPath (): string { 12 | return this._fileFullPath 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/models/files/index.ts: -------------------------------------------------------------------------------- 1 | export { FileResult } from './fileResult' 2 | -------------------------------------------------------------------------------- /src/models/server/index.ts: -------------------------------------------------------------------------------- 1 | export { ServerRequestModel } from './serverRequestModel' 2 | -------------------------------------------------------------------------------- /src/models/server/serverRequestModel.ts: -------------------------------------------------------------------------------- 1 | import { ServerRequestType } from 'constants/serverRequestType' 2 | import StringAPI from 'api/StringAPI' 3 | import { ServerRequestStatusType } from 'store/actions/serverRequestStatusType' 4 | 5 | export class ServerRequestModel { 6 | constructor ( 7 | public type: ServerRequestType, 8 | public id: string, 9 | public metadata: string, 10 | public status: ServerRequestStatusType = ServerRequestStatusType.Sent 11 | 12 | ) {} 13 | 14 | /** 15 | * Get unique key for request 16 | */ 17 | getKey (): string { 18 | return StringAPI.createServerRequestId(this.type, this.id) 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/models/users/index.ts: -------------------------------------------------------------------------------- 1 | export { UserRegisterModel } from './userRegisterModel' 2 | -------------------------------------------------------------------------------- /src/models/users/userRegisterModel.ts: -------------------------------------------------------------------------------- 1 | export class UserRegisterModel { 2 | 3 | /** 4 | * User identifier 5 | * 6 | * @type {string} 7 | * @memberof UserRegisterModel 8 | */ 9 | userId?: string 10 | 11 | /** 12 | * User full name 13 | * 14 | * @type {string} 15 | * @memberof UserRegisterModel 16 | */ 17 | fullName: string 18 | 19 | /** 20 | * User email 21 | * 22 | * @type {string} 23 | * @memberof UserRegisterModel 24 | */ 25 | email: string 26 | 27 | /** 28 | * User password 29 | * 30 | * @type {string} 31 | * @memberof UserRegisterModel 32 | */ 33 | password: string 34 | 35 | } -------------------------------------------------------------------------------- /src/routes/IRoute.ts: -------------------------------------------------------------------------------- 1 | import { Component } from 'react' 2 | 3 | /** 4 | * Route interface 5 | * 6 | * @export 7 | * @interface IRoute 8 | */ 9 | export interface IRoute { 10 | 11 | /** 12 | * React component that would be rendered in routing 13 | * 14 | * @type {Component} 15 | * @memberof IRoute 16 | */ 17 | component: any 18 | 19 | /** 20 | * Route path 21 | * 22 | * @type {string} 23 | * @memberof IRoute 24 | */ 25 | path: string 26 | 27 | /** 28 | * If user is authorized {true} or not {false} 29 | * 30 | * @type {boolean} 31 | * @memberof IRoute 32 | */ 33 | authed?: boolean 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/routes/IRouterProps.ts: -------------------------------------------------------------------------------- 1 | export interface IRouterProps { 2 | /** 3 | * Enable routing {true} or not {false} 4 | * 5 | * @type {boolean} 6 | * @memberof IRouterProps 7 | */ 8 | enabled: boolean 9 | 10 | /** 11 | * Router data for the components in routing 12 | * 13 | * @type {*} 14 | * @memberof IRouterProps 15 | */ 16 | data?: any 17 | 18 | /** 19 | * Routing match 20 | * 21 | * @type {*} 22 | * @memberof IRouterProps 23 | */ 24 | match?: any 25 | 26 | /** 27 | * Translate to locale strting 28 | */ 29 | translate?: (state: any) => any 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/routes/MasterRouter.tsx: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import PublicRoute from './PublicRoute' 3 | import PrivateRoute from './PrivateRoute' 4 | import React, { Component } from 'react' 5 | import PropTypes from 'prop-types' 6 | import { connect } from 'react-redux' 7 | import { Route, Switch, withRouter, Redirect, NavLink } from 'react-router-dom' 8 | import Loadable from 'react-loadable' 9 | 10 | import { IRouterProps } from './IRouterProps' 11 | import MasterLoadingComponent from 'components/masterLoading/MasterLoadingComponent' 12 | 13 | // - Async Components 14 | const AsyncHome: any = Loadable({ 15 | loader: () => import('containers/home'), 16 | loading: MasterLoadingComponent, 17 | }) 18 | const AsyncSignup = Loadable({ 19 | loader: () => import('containers/signup'), 20 | loading: MasterLoadingComponent, 21 | }) 22 | const AsyncEmailVerification = Loadable({ 23 | loader: () => import('containers/emailVerification'), 24 | loading: MasterLoadingComponent, 25 | }) 26 | const AsyncResetPassword = Loadable({ 27 | loader: () => import('containers/resetPassword'), 28 | loading: MasterLoadingComponent, 29 | }) 30 | const AsyncLogin = Loadable({ 31 | loader: () => import('containers/login'), 32 | loading: MasterLoadingComponent, 33 | }) 34 | const AsyncSetting = Loadable({ 35 | loader: () => import('containers/setting'), 36 | loading: MasterLoadingComponent, 37 | }) 38 | 39 | /** 40 | * Master router 41 | */ 42 | export class MasterRouter extends Component { 43 | render () { 44 | const { enabled, match, data } = this.props 45 | return ( 46 | enabled ? ( 47 | 48 | 49 | 50 | 51 | 52 | } /> 53 | } /> 54 | ) 55 | : '' 56 | 57 | ) 58 | } 59 | } 60 | export default withRouter(connect(null, null)(MasterRouter as any)) as typeof MasterRouter 61 | -------------------------------------------------------------------------------- /src/routes/PrivateRoute.tsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { connect } from 'react-redux' 3 | import { Route, Redirect } from 'react-router-dom' 4 | import { IRoute } from './IRoute' 5 | import { Map } from 'immutable' 6 | 7 | export class PrivateRoute extends Component { 8 | 9 | render () { 10 | const {authed, path, component} = this.props 11 | return ( 12 | { 13 | return ( 14 | authed 15 | ? (() => component)() 16 | : 17 | ) 18 | }} /> 19 | ) 20 | } 21 | } 22 | 23 | const mapStateToProps = (state: Map, nexProps: IRoute) => { 24 | 25 | return { 26 | authed: state.getIn(['authorize', 'authed']) 27 | } 28 | } 29 | 30 | export default connect(mapStateToProps)(PrivateRoute as any) 31 | -------------------------------------------------------------------------------- /src/routes/PublicRoute.tsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { connect } from 'react-redux' 3 | import { Route, Redirect } from 'react-router-dom' 4 | import { IRoute } from './IRoute' 5 | import {Map} from 'immutable' 6 | 7 | export class PublicRoute extends Component { 8 | 9 | render () { 10 | const {authed, path, component} = this.props 11 | return ( 12 | { 13 | return ( 14 | authed 15 | ? 16 | : (() => component)() 17 | ) 18 | }} /> 19 | ) 20 | } 21 | } 22 | 23 | const mapStateToProps = (state: Map, nexProps: IRoute) => { 24 | 25 | return { 26 | authed: state.getIn(['authorize', 'authed', false]) 27 | } 28 | } 29 | 30 | export default connect(mapStateToProps)(PublicRoute as any) 31 | -------------------------------------------------------------------------------- /src/routes/index.ts: -------------------------------------------------------------------------------- 1 | import MasterRouter from './MasterRouter' 2 | import HomeRouter from './HomeRouter' 3 | 4 | export { 5 | MasterRouter, 6 | HomeRouter 7 | } 8 | -------------------------------------------------------------------------------- /src/socialEngine.ts: -------------------------------------------------------------------------------- 1 | // import { useFirebase } from './data/firebaseClient/dependecyRegisterar' 2 | // import { useAws } from './data/awsClient/dependecyRegisterar' 3 | import { useFirestore } from './data/firestoreClient/dependecyRegisterar' 4 | import { Container } from 'inversify' 5 | import CommonAPI from 'api/CommonAPI' 6 | 7 | /** 8 | * Developer tools 9 | */ 10 | window['console']['trace'] = CommonAPI.logger 11 | 12 | /** 13 | * Initialize container 14 | */ 15 | export const provider = new Container() 16 | 17 | /** 18 | * Register dependencies 19 | */ 20 | // useFirebase(provider) 21 | // useAws(provider) 22 | useFirestore(provider) 23 | 24 | // Features on the roadmap 25 | // useAzure(provider) 26 | // userAspNet(provider) 27 | -------------------------------------------------------------------------------- /src/store/actions/index.ts: -------------------------------------------------------------------------------- 1 | import * as authorizeActions from './authorizeActions' 2 | import * as circleActions from './circleActions' 3 | import * as commentActions from './commentActions' 4 | import * as globalActions from './globalActions' 5 | import * as imageGalleryActions from './imageGalleryActions' 6 | import * as notifyActions from './notifyActions' 7 | import * as postActions from './postActions' 8 | import * as userActions from './userActions' 9 | import * as voteActions from './voteActions' 10 | import * as localeActions from './localeActions' 11 | import * as serverActions from './serverActions' 12 | 13 | export { 14 | authorizeActions, 15 | circleActions, 16 | commentActions, 17 | globalActions, 18 | imageGalleryActions, 19 | notifyActions, 20 | postActions, 21 | userActions, 22 | voteActions, 23 | localeActions, 24 | serverActions 25 | } 26 | -------------------------------------------------------------------------------- /src/store/actions/localeActions.ts: -------------------------------------------------------------------------------- 1 | import { initialize } from 'react-localize-redux' 2 | import { addTranslationForLanguage } from 'react-localize-redux' 3 | import { setActiveLanguage } from 'react-localize-redux' 4 | import { LanguageType } from 'store/reducers/locale/langugeType' 5 | import config from 'src/config' 6 | 7 | /** 8 | * Set active language for translation 9 | */ 10 | export const setLanguage = (language: LanguageType) => { 11 | return (dispatch: Function , getState: Function) => { 12 | 13 | // Dispatch `setActiveLanguage` and pass the language. 14 | dispatch(setActiveLanguage(language)) 15 | } 16 | } -------------------------------------------------------------------------------- /src/store/actions/serverActions.ts: -------------------------------------------------------------------------------- 1 | // - Import action types 2 | import { ServerActionType } from 'constants/serverActionType' 3 | 4 | // - Import domain 5 | 6 | // - Import actions 7 | import { ServerRequestModel } from 'src/models/server/serverRequestModel' 8 | import { SocialError } from 'src/core/domain/common/socialError' 9 | 10 | /** 11 | * Add a request 12 | * @param {Request} request 13 | */ 14 | export const sendRequest = (request: ServerRequestModel) => { 15 | return { type: ServerActionType.ADD_REQUEST, payload: {request} } 16 | 17 | } 18 | 19 | /** 20 | * delete a request 21 | */ 22 | export const deleteRequest = (requestId: string) => { 23 | return { type: ServerActionType.DELETE_REQUEST, payload: {requestId} } 24 | 25 | } 26 | 27 | /** 28 | * Update request stattus ti successful 29 | */ 30 | export const okRequest = (requestId: string) => { 31 | return { type: ServerActionType.OK_REQUEST, payload: {requestId} } 32 | 33 | } 34 | 35 | /** 36 | * Set error request 37 | */ 38 | export const errorRequest = (requestId: string, error: SocialError) => { 39 | return { type: ServerActionType.ERROR_REQUEST, payload: {requestId, error} } 40 | 41 | } 42 | 43 | /** 44 | * Clear all data 45 | */ 46 | export const clearAllrequests = () => { 47 | return { type: ServerActionType.CLEAR_ALL_DATA_REQUEST } 48 | } 49 | -------------------------------------------------------------------------------- /src/store/actions/serverRequestStatusType.ts: -------------------------------------------------------------------------------- 1 | export enum ServerRequestStatusType { 2 | Sent = 'Sent', 3 | NoAction = 'NoAction', 4 | OK = 'OK', 5 | Error = 'Error' 6 | } 7 | -------------------------------------------------------------------------------- /src/store/configureStore.prod.ts: -------------------------------------------------------------------------------- 1 | // - Import external components 2 | import * as redux from 'redux' 3 | import thunk from 'redux-thunk' 4 | import DevTools from './devTools' 5 | import createHistory from 'history/createBrowserHistory' 6 | import createSagaMiddleware, { END } from 'redux-saga' 7 | import { rootReducer } from 'store/reducers' 8 | import { fromJS } from 'immutable' 9 | import { routerMiddleware, connectRouter } from 'connected-react-router/immutable' 10 | import { offline } from '@redux-offline/redux-offline' 11 | import defaultConfig from '@redux-offline/redux-offline/lib/defaults' 12 | // replacing redux-offline defaults with immutable* counterparts 13 | import { persist, persistAutoRehydrate, offlineStateLens } from 'redux-offline-immutable-config' 14 | 15 | // Create a history of your choosing (we're using a browser history in this case) 16 | export const history = createHistory() 17 | 18 | // - Build the middleware for intercepting and dispatching navigation actions 19 | const sagaMiddleware = createSagaMiddleware() 20 | // - initial state 21 | let initialState = { 22 | 23 | } 24 | 25 | const persistOptions = {} 26 | const persistCallback = () => { 27 | console.log('rehydration completed') 28 | } 29 | 30 | const offlineConfig = { 31 | ...defaultConfig, 32 | persist, 33 | persistAutoRehydrate, 34 | persistOptions, 35 | persistCallback, 36 | offlineStateLens 37 | } 38 | 39 | // - Config and create store of redux 40 | let store: redux.Store = redux.createStore(rootReducer(history), fromJS(initialState), redux.compose( 41 | redux.applyMiddleware(thunk, routerMiddleware(history), sagaMiddleware), offline(offlineConfig) 42 | )) 43 | 44 | export default {store, runSaga: sagaMiddleware.run, close: () => store.dispatch(END), history} 45 | -------------------------------------------------------------------------------- /src/store/configureStore.ts: -------------------------------------------------------------------------------- 1 | import configureStoreDev from './configureStore.dev' 2 | import configureStoreProd from './configureStore.prod' 3 | 4 | const store = process.env.NODE_ENV === 'production' 5 | ? configureStoreProd 6 | : configureStoreDev 7 | 8 | export default store -------------------------------------------------------------------------------- /src/store/devTools.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { createDevTools } from 'redux-devtools' 3 | import LogMonitor from 'redux-devtools-log-monitor' 4 | import DockMonitor from 'redux-devtools-dock-monitor' 5 | 6 | export default createDevTools( 7 | 9 | 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /src/store/reducers/authorize/AuthorizeState.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Post state 3 | * 4 | * @export 5 | * @class AuthorizeState 6 | */ 7 | export class AuthorizeState { 8 | 9 | /** 10 | * Authorized user identifier 11 | * 12 | * @type {number} 13 | * @memberof AuthorizeState 14 | */ 15 | uid: number = 0 16 | 17 | /** 18 | * If user is authed {true} or not {false} 19 | * 20 | * @type {Boolean} 21 | * @memberof AuthorizeState 22 | */ 23 | authed: Boolean = false 24 | 25 | /** 26 | * If user is verifide {true} or not {false} 27 | * 28 | * @type {Boolean} 29 | * @memberof AuthorizeState 30 | */ 31 | isVerifide: Boolean = false 32 | 33 | /** 34 | * If user password is updated {true} or not {false} 35 | * 36 | * @type {Boolean} 37 | * @memberof AuthorizeState 38 | */ 39 | updatePassword: Boolean = false 40 | 41 | /** 42 | * If the user is guest {true} or not {false} 43 | * 44 | * @type {Boolean} 45 | * @memberof AuthorizeState 46 | */ 47 | guest: Boolean = false 48 | } 49 | -------------------------------------------------------------------------------- /src/store/reducers/authorize/IAuthorizeAction.ts: -------------------------------------------------------------------------------- 1 | // - Import action types 2 | import { AuthorizeActionType } from 'constants/authorizeActionType' 3 | 4 | /** 5 | * Authorize action interface 6 | * 7 | * @export 8 | * @interface IAuthorizeAction 9 | */ 10 | export interface IAuthorizeAction { 11 | payload: any 12 | type: AuthorizeActionType 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/store/reducers/authorize/authorizeReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import { Reducer, Action } from 'redux' 3 | 4 | // - Import action types 5 | import { AuthorizeActionType } from 'constants/authorizeActionType' 6 | 7 | import { IAuthorizeAction } from './IAuthorizeAction' 8 | import { AuthorizeState } from './AuthorizeState' 9 | import { Map } from 'immutable' 10 | 11 | /** 12 | * Authorize reducer 13 | * @param {object} state 14 | * @param {object} action 15 | */ 16 | export let authorizeReducer = (state = Map(new AuthorizeState() as any), action: IAuthorizeAction) => { 17 | const { payload } = action 18 | switch (action.type) { 19 | case AuthorizeActionType.LOGIN: 20 | return state 21 | .set('uid', payload.uid) 22 | .set('authed', true) 23 | .set('guest', false) 24 | .set('isVerifide', payload.isVerifide) 25 | 26 | case AuthorizeActionType.LOGOUT: 27 | return state 28 | .set('uid', 0) 29 | .set('authed', false) 30 | .set('guest', true) 31 | .set('isVerifide', false) 32 | case AuthorizeActionType.SIGNUP: 33 | return state 34 | .set('uid', payload.userId) 35 | case AuthorizeActionType.UPDATE_PASSWORD: 36 | return state 37 | .set('updatePassword', payload.updatePassword) 38 | default: 39 | return state 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/store/reducers/authorize/authorizeSelector.ts: -------------------------------------------------------------------------------- 1 | import {Map} from 'immutable' 2 | const getCurrentUser = (state: Map) => { 3 | const uid = state.getIn(['authorize', 'uid']) 4 | return state.getIn(['user', 'info', uid]) 5 | } 6 | 7 | export const authorizeSelector = { 8 | getCurrentUser 9 | } -------------------------------------------------------------------------------- /src/store/reducers/authorize/index.ts: -------------------------------------------------------------------------------- 1 | import { authorizeReducer } from './authorizeReducer' 2 | import {authorizeSelector} from './authorizeSelector' 3 | export { 4 | authorizeReducer, 5 | authorizeSelector 6 | } -------------------------------------------------------------------------------- /src/store/reducers/circles/CircleState.ts: -------------------------------------------------------------------------------- 1 | import { Circle, UserTie } from 'src/core/domain/circles' 2 | import {Map} from 'immutable' 3 | 4 | /** 5 | * Circle state 6 | */ 7 | export class CircleState { 8 | [key: string]: any 9 | /** 10 | * The list of users belong to users circle 11 | */ 12 | userTies: Map = Map({}) 13 | 14 | /** 15 | * The list of users belong to users circle 16 | */ 17 | userTieds: Map = Map({}) 18 | 19 | /** 20 | * The list of circle of current user 21 | */ 22 | circleList: Map = Map({}) 23 | 24 | /** 25 | * Whether select circle box is open for the selected user 26 | */ 27 | selectCircleStatus: { [userId: string]: boolean } 28 | 29 | /** 30 | * Whether following loading is shown for the selected user 31 | */ 32 | followingLoadingStatus: { [userId: string]: boolean } 33 | 34 | /** 35 | * Keep selected circles for refere user 36 | */ 37 | selectedCircles: Map = Map({}) 38 | 39 | /** 40 | * Whether the select circles box for referer user is open 41 | */ 42 | openSelecteCircles: { [userId: string]: boolean } 43 | 44 | /** 45 | * If user circles are loaded {true} or not {false} 46 | */ 47 | loaded: boolean = false 48 | 49 | /** 50 | * Circle stting state 51 | */ 52 | openSetting: {[circleId: string]: boolean } 53 | } 54 | -------------------------------------------------------------------------------- /src/store/reducers/circles/ICircleAction.ts: -------------------------------------------------------------------------------- 1 | 2 | import { CircleActionType } from 'constants/circleActionType' 3 | 4 | /** 5 | * Circle action interface 6 | * 7 | * @export 8 | * @interface ICircleAction 9 | */ 10 | export interface ICircleAction { 11 | payload: any, 12 | type: CircleActionType 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/store/reducers/circles/index.ts: -------------------------------------------------------------------------------- 1 | import { circleReducer } from './circleReducer' 2 | 3 | export {circleReducer} -------------------------------------------------------------------------------- /src/store/reducers/comments/CommentState.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Comment } from 'src/core/domain/comments' 3 | import {Map} from 'immutable' 4 | /** 5 | * Comment state 6 | * 7 | * @export 8 | * @class CommentState 9 | */ 10 | export class CommentState { 11 | 12 | [key: string]: any 13 | 14 | /** 15 | * The list of comments on the posts 16 | */ 17 | postComments: Map = Map({}) 18 | 19 | /** 20 | * Whether comment editor is open 21 | */ 22 | editorStatus: Map = Map({}) 23 | 24 | /** 25 | * If the comments are loaded {true} or not {false} 26 | */ 27 | loaded: Boolean = false 28 | } 29 | -------------------------------------------------------------------------------- /src/store/reducers/comments/ICommentAction.ts: -------------------------------------------------------------------------------- 1 | 2 | import {CommentActionType} from 'constants/commentActionType' 3 | 4 | /** 5 | * Comment action interface 6 | * 7 | * @export 8 | * @interface ICommentAction 9 | */ 10 | export interface ICommentAction { 11 | payload: any 12 | type: CommentActionType 13 | 14 | } -------------------------------------------------------------------------------- /src/store/reducers/comments/commentReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import moment from 'moment/moment' 3 | import _ from 'lodash' 4 | import { Map } from 'immutable' 5 | 6 | // - Import domain 7 | import { User } from 'src/core/domain/users' 8 | import { Comment } from 'src/core/domain/comments' 9 | 10 | // - Import action types 11 | import { CommentActionType } from 'constants/commentActionType' 12 | 13 | import { CommentState } from './CommentState' 14 | import { ICommentAction } from './ICommentAction' 15 | 16 | /** 17 | * Comment reducer 18 | * @param state 19 | * @param action 20 | */ 21 | export let commentReducer = (state = Map(new CommentState()), action: ICommentAction) => { 22 | let { payload } = action 23 | switch (action.type) { 24 | 25 | /* _____________ CRUD _____________ */ 26 | case CommentActionType.ADD_COMMENT: 27 | return state 28 | .setIn(['postComments', payload.get('postId'), payload.get('id')], payload) 29 | 30 | case CommentActionType.ADD_COMMENT_LIST: 31 | return state 32 | .mergeIn(['postComments'], payload) 33 | .set('loaded', true) 34 | 35 | case CommentActionType.UPDATE_COMMENT: 36 | const { comment } = payload 37 | return state 38 | .updateIn(['postComments', comment.postId, comment.id, 'text'], (text: string) => comment.text) 39 | 40 | case CommentActionType.DELETE_COMMENT: 41 | return state.deleteIn(['postComments', payload.postId, payload.id]) 42 | 43 | case CommentActionType.CLOSE_COMMENT_EDITOR: 44 | return state 45 | .setIn(['editorStatus', payload.postId, payload.id], false) 46 | 47 | case CommentActionType.OPEN_COMMENT_EDITOR: 48 | return state 49 | .setIn(['editorStatus', payload.postId, payload.id], true) 50 | 51 | case CommentActionType.CLEAR_ALL_DATA_COMMENT: 52 | return Map(new CommentState()) 53 | default: 54 | return state 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/store/reducers/comments/index.ts: -------------------------------------------------------------------------------- 1 | import { commentReducer } from './commentReducer' 2 | 3 | export {commentReducer} -------------------------------------------------------------------------------- /src/store/reducers/global/IGlobalAction.ts: -------------------------------------------------------------------------------- 1 | import { GlobalActionType } from 'constants/globalActionType' 2 | 3 | /** 4 | * Global action interface 5 | * 6 | * @export 7 | * @interface IGlobalAction 8 | */ 9 | export interface IGlobalAction { 10 | payload: any, 11 | type: GlobalActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/global/index.ts: -------------------------------------------------------------------------------- 1 | import { globalReducer } from './globalReducer' 2 | 3 | export {globalReducer} -------------------------------------------------------------------------------- /src/store/reducers/imageGallery/IImageGalleryAction.ts: -------------------------------------------------------------------------------- 1 | import { ImageGalleryActionType } from 'constants/imageGalleryActionType' 2 | 3 | /** 4 | * ImageGallery action interface 5 | * 6 | * @export 7 | * @interface IImageGalleryAction 8 | */ 9 | export interface IImageGalleryAction { 10 | payload: any, 11 | type: ImageGalleryActionType 12 | 13 | } -------------------------------------------------------------------------------- /src/store/reducers/imageGallery/ImageGalleryState.ts: -------------------------------------------------------------------------------- 1 | import { Image } from 'src/core/domain/imageGallery' 2 | import {Map, Collection, List} from 'immutable' 3 | 4 | /** 5 | * ImageGallery state 6 | * 7 | * @export 8 | * @class ImageGalleryState 9 | */ 10 | export class ImageGalleryState { 11 | 12 | [key: string]: any 13 | 14 | /** 15 | * Image gallery is open {true} or not {false} 16 | * 17 | * @type {Boolean} 18 | * @memberof ImageGalleryState 19 | */ 20 | status: Boolean = false 21 | 22 | /** 23 | * The list of image 24 | */ 25 | images: List = List() 26 | 27 | /** 28 | * Selected image name 29 | */ 30 | selectImage: string = '' 31 | 32 | /** 33 | * Selected image address 34 | */ 35 | selectURL: string = '' 36 | 37 | /** 38 | * If image gallery is loaded {true} or not false 39 | */ 40 | loaded: Boolean = false 41 | 42 | /** 43 | * Images address list 44 | */ 45 | imageURLList: any = {} 46 | 47 | /** 48 | * Store image requested 49 | */ 50 | imageRequests: any = {} 51 | 52 | } -------------------------------------------------------------------------------- /src/store/reducers/imageGallery/imageGalleryReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import _ from 'lodash' 3 | import { Map, List } from 'immutable' 4 | 5 | // - Import domain 6 | import { User } from 'src/core/domain/users' 7 | import { Image } from 'src/core/domain/imageGallery' 8 | 9 | // - Import image gallery action types 10 | import { ImageGalleryActionType } from 'constants/imageGalleryActionType' 11 | 12 | import { IImageGalleryAction } from './IImageGalleryAction' 13 | import { ImageGalleryState } from './ImageGalleryState' 14 | 15 | /** 16 | * Image gallery reducer 17 | */ 18 | export let imageGalleryReducer = (state = Map(new ImageGalleryState()), action: IImageGalleryAction) => { 19 | const { payload } = action 20 | 21 | switch (action.type) { 22 | /* ----------------- CRUD ----------------- */ 23 | case ImageGalleryActionType.ADD_IMAGE_GALLERY: 24 | return state 25 | .mergeIn(['images'], List([payload])) 26 | 27 | case ImageGalleryActionType.ADD_IMAGE_LIST_GALLERY: 28 | return state 29 | .set('images', List(payload)) 30 | .set('loaded', true) 31 | 32 | case ImageGalleryActionType.DELETE_IMAGE: 33 | return state 34 | .update('images', (images: List) => { 35 | return images.filter((image) => image!.id !== payload) 36 | }) 37 | 38 | case ImageGalleryActionType.SET_IMAGE_URL: 39 | return state 40 | .setIn(['imageURLList', payload.name], payload.url) 41 | 42 | case ImageGalleryActionType.SEND_IMAGE_REQUEST: 43 | return state 44 | .mergeIn(['imageRequests'], payload) 45 | 46 | case ImageGalleryActionType.CLEAT_ALL_DATA_IMAGE_GALLERY: 47 | return Map(new ImageGalleryState()) 48 | 49 | default: 50 | return state 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/store/reducers/imageGallery/index.ts: -------------------------------------------------------------------------------- 1 | import { imageGalleryReducer } from './imageGalleryReducer' 2 | 3 | export {imageGalleryReducer} -------------------------------------------------------------------------------- /src/store/reducers/index.ts: -------------------------------------------------------------------------------- 1 | import {rootReducer} from './rootReducer' 2 | 3 | export { 4 | rootReducer 5 | } 6 | -------------------------------------------------------------------------------- /src/store/reducers/notifications/INotificationAction.ts: -------------------------------------------------------------------------------- 1 | import {NotificationActionType} from 'constants/notificationActionType' 2 | 3 | /** 4 | * Notification action interface 5 | * 6 | * @export 7 | * @interface INotificationAction 8 | */ 9 | export interface INotificationAction { 10 | payload: any, 11 | type: NotificationActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/notifications/NotificationState.ts: -------------------------------------------------------------------------------- 1 | import { Notification } from 'src/core/domain/notifications' 2 | import {Map} from 'immutable' 3 | 4 | /** 5 | * Notification state 6 | * 7 | * @export 8 | * @class NotificationState 9 | */ 10 | export class NotificationState { 11 | 12 | [key: string]: any 13 | 14 | /** 15 | * The list of users notification 16 | */ 17 | userNotifies: Map> = Map({}) 18 | 19 | /** 20 | * If user notifications are loaded {true} or not {false} 21 | */ 22 | loaded: Boolean = false 23 | } -------------------------------------------------------------------------------- /src/store/reducers/notifications/index.ts: -------------------------------------------------------------------------------- 1 | import { notificationReducer } from './notificationReducer' 2 | 3 | export {notificationReducer} -------------------------------------------------------------------------------- /src/store/reducers/notifications/notificationReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import moment from 'moment/moment' 3 | import _ from 'lodash' 4 | import { Map } from 'immutable' 5 | 6 | // - Import domain 7 | import { Notification } from 'src/core/domain/notifications' 8 | 9 | // - Import action types 10 | import { NotificationActionType } from 'constants/notificationActionType' 11 | 12 | import { NotificationState } from './NotificationState' 13 | import { INotificationAction } from './INotificationAction' 14 | 15 | /** 16 | * Notify actions 17 | * @param {object} state 18 | * @param {object} action 19 | */ 20 | export let notificationReducer = (state = Map(new NotificationState()), action: INotificationAction) => { 21 | let { payload } = action 22 | switch (action.type) { 23 | 24 | /* _____________ CRUD _____________ */ 25 | case NotificationActionType.ADD_NOTIFY: 26 | return state 27 | 28 | case NotificationActionType.ADD_NOTIFY_LIST: 29 | return state 30 | .set('userNotifies', payload) 31 | .set('loaded', true) 32 | 33 | case NotificationActionType.SEEN_NOTIFY: 34 | return state 35 | .setIn(['userNotifies', payload, 'isSeen'], true) 36 | .set('loaded', true) 37 | 38 | case NotificationActionType.DELETE_NOTIFY: 39 | return state 40 | .deleteIn(['userNotifies', payload]) 41 | 42 | case NotificationActionType.CLEAR_ALL_DATA_NOTIFY: 43 | return Map(new NotificationState()) 44 | 45 | default: 46 | return state 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/store/reducers/posts/IPostAction.ts: -------------------------------------------------------------------------------- 1 | import { PostActionType } from 'constants/postActionType' 2 | 3 | /** 4 | * Post action interface 5 | * 6 | * @export 7 | * @interface IPostAction 8 | */ 9 | export interface IPostAction { 10 | payload: any, 11 | type: PostActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/posts/PostState.ts: -------------------------------------------------------------------------------- 1 | import { Post } from 'src/core/domain/posts' 2 | import { Map, fromJS, List } from 'immutable' 3 | 4 | /** 5 | * Post state 6 | * 7 | * @export 8 | * @class PostState 9 | */ 10 | export class PostState { 11 | [key: string]: any 12 | /** 13 | * The list of user posts 14 | * 15 | * @type {*} 16 | * @memberof PostState 17 | */ 18 | userPosts = Map({}) 19 | 20 | /** 21 | * If user posts are loaded {true} or not {false} 22 | * 23 | * @type {Boolean} 24 | * @memberof PostState 25 | */ 26 | loaded: Boolean = false 27 | 28 | /** 29 | * Stream data storage 30 | */ 31 | stream?: Map = 32 | Map({hasMoreData: true, lastPageRequest: -1, lastPostId: ''}) 33 | 34 | /** 35 | * Profile posts data storage 36 | */ 37 | profile?: Map = 38 | Map({}) 39 | } 40 | -------------------------------------------------------------------------------- /src/store/reducers/posts/index.ts: -------------------------------------------------------------------------------- 1 | import { postReducer } from './postReducer' 2 | import { postSelector } from './postSelector' 3 | 4 | export { 5 | postReducer, 6 | postSelector 7 | } -------------------------------------------------------------------------------- /src/store/reducers/posts/postSelector.ts: -------------------------------------------------------------------------------- 1 | import {Map} from 'immutable' 2 | 3 | const getPost = (state: Map, userId: string, postId: string) => { 4 | return state.getIn(['post', 'userPosts', userId, postId]) 5 | } 6 | 7 | export const postSelector = { 8 | getPost 9 | } -------------------------------------------------------------------------------- /src/store/reducers/rootReducer.ts: -------------------------------------------------------------------------------- 1 | import { localeReducer as locale } from 'react-localize-redux' 2 | import { 3 | combineReducers 4 | } from 'redux-immutable' 5 | 6 | // - Import reducers 7 | import { authorizeReducer } from './authorize' 8 | import { circleReducer } from './circles' 9 | import { commentReducer } from './comments' 10 | import { globalReducer } from './global' 11 | import { imageGalleryReducer } from './imageGallery' 12 | import { notificationReducer } from './notifications' 13 | import { postReducer } from './posts' 14 | import { userReducer } from './users' 15 | import { voteReducer } from './votes' 16 | import { serverReducer } from './server' 17 | import { connectRouter } from 'connected-react-router/immutable' 18 | 19 | // - Reducers 20 | export const rootReducer = (history: any) => combineReducers({ 21 | locale, 22 | imageGallery: imageGalleryReducer, 23 | post: postReducer, 24 | circle: circleReducer, 25 | comment: commentReducer, 26 | vote: voteReducer, 27 | server: serverReducer, 28 | authorize: authorizeReducer, 29 | router: connectRouter(history), 30 | user: userReducer, 31 | notify: notificationReducer, 32 | global: globalReducer 33 | } as any) -------------------------------------------------------------------------------- /src/store/reducers/server/IServerAction.ts: -------------------------------------------------------------------------------- 1 | import { ServerActionType } from 'constants/serverActionType' 2 | 3 | /** 4 | * Server action interface 5 | * 6 | * @export 7 | * @interface IServerAction 8 | */ 9 | export interface IServerAction { 10 | payload: any, 11 | type: ServerActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/server/ServerState.ts: -------------------------------------------------------------------------------- 1 | import { ServerRequestModel } from 'src/models/server' 2 | import {Map} from 'immutable' 3 | 4 | /** 5 | * Server state 6 | * 7 | * @export 8 | * @class ServerState 9 | */ 10 | export class ServerState { 11 | [key: string]: any 12 | /** 13 | * The list of posts server 14 | * @memberof ServerState 15 | */ 16 | request: Map = Map({}) 17 | } 18 | -------------------------------------------------------------------------------- /src/store/reducers/server/index.ts: -------------------------------------------------------------------------------- 1 | import { serverReducer } from './serverReducer' 2 | 3 | export {serverReducer} 4 | -------------------------------------------------------------------------------- /src/store/reducers/server/serverReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import _ from 'lodash' 3 | import { Map } from 'immutable' 4 | 5 | // - Import action types 6 | import { ServerActionType } from 'constants/serverActionType' 7 | 8 | // Import domain 9 | 10 | import { ServerState } from './ServerState' 11 | import { IServerAction } from './IServerAction' 12 | import { ServerRequestModel } from 'src/models/server/serverRequestModel' 13 | import { ServerRequestStatusType } from 'store/actions/serverRequestStatusType' 14 | 15 | /** 16 | * Server actions 17 | * @param {object} state 18 | * @param {object} action 19 | */ 20 | export let serverReducer = (state = Map(new ServerState()), action: IServerAction) => { 21 | let { payload } = action 22 | const request = (payload ? payload.request : {}) as ServerRequestModel 23 | switch (action.type) { 24 | 25 | /* _____________ CRUD _____________ */ 26 | case ServerActionType.ADD_REQUEST: 27 | return state 28 | .setIn(['request', request.id], request) 29 | 30 | case ServerActionType.DELETE_REQUEST: 31 | return state 32 | .deleteIn(['request', request.id]) 33 | 34 | case ServerActionType.ERROR_REQUEST: 35 | return state 36 | .setIn(['request', request.id, 'status'], ServerRequestStatusType.Error) 37 | 38 | case ServerActionType.OK_REQUEST: 39 | return state 40 | .setIn(['request', request.id, 'status'], ServerRequestStatusType.OK) 41 | 42 | case ServerActionType.CLEAR_ALL_DATA_REQUEST: 43 | return Map(new ServerState()) 44 | 45 | default: 46 | return state 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/store/reducers/users/IUserAction.ts: -------------------------------------------------------------------------------- 1 | import { UserActionType } from 'constants/userActionType' 2 | 3 | /** 4 | * User action interface 5 | * 6 | * @export 7 | * @interface IUserAction 8 | */ 9 | export interface IUserAction { 10 | payload: any, 11 | type: UserActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/users/UserState.ts: -------------------------------------------------------------------------------- 1 | import { User,Profile } from 'src/core/domain/users' 2 | import { Map, fromJS, List } from 'immutable' 3 | 4 | /** 5 | * User state 6 | * 7 | * @export 8 | * @class UserState 9 | */ 10 | export class UserState { 11 | [key: string]: any 12 | /** 13 | * The list of users information 14 | */ 15 | info: Map = Map({}) 16 | 17 | /** 18 | * If users profile are loaded 19 | */ 20 | loaded: Boolean = false 21 | 22 | /** 23 | * If edit profile is open {true} or not {false} 24 | */ 25 | openEditProfile: Boolean = false 26 | 27 | /** 28 | * People data storage 29 | */ 30 | people?: Map = Map({hasMoreData: true, lastPageRequest: -1, lastUserId: ''}) 31 | } 32 | -------------------------------------------------------------------------------- /src/store/reducers/users/index.ts: -------------------------------------------------------------------------------- 1 | import { userReducer } from './userReducer' 2 | 3 | export {userReducer} -------------------------------------------------------------------------------- /src/store/reducers/users/userReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import action types 2 | import { UserActionType } from 'constants/userActionType' 3 | import { Map } from 'immutable' 4 | 5 | // - Import domain 6 | import { User, Profile } from 'src/core/domain/users' 7 | 8 | import { UserState } from './UserState' 9 | import { IUserAction } from './IUserAction' 10 | 11 | /** 12 | * User reducer 13 | */ 14 | export let userReducer = (state = Map(new UserState()), action: IUserAction) => { 15 | const { payload } = action 16 | switch (action.type) { 17 | case UserActionType.USER_INFO: 18 | return state 19 | .setIn(['info', payload.uid], payload.info) 20 | 21 | case UserActionType.ADD_USER_INFO: 22 | return state 23 | .setIn(['info', payload.uid], payload.info) 24 | .set('loaded', true) 25 | 26 | case UserActionType.ADD_PEOPLE_INFO: 27 | return state 28 | .mergeIn(['info'], payload) 29 | 30 | case UserActionType.UPDATE_USER_INFO: 31 | return state 32 | .mergeIn(['info', payload.uid], payload.info) 33 | 34 | case UserActionType.CLEAR_ALL_DATA_USER: 35 | return Map(new UserState()) 36 | 37 | case UserActionType.CLOSE_EDIT_PROFILE: 38 | return state 39 | .set('openEditProfile', false) 40 | 41 | case UserActionType.OPEN_EDIT_PROFILE: 42 | return state 43 | .set('openEditProfile', true) 44 | 45 | case UserActionType.HAS_MORE_DATA_PEOPLE: 46 | return state 47 | .setIn(['people', 'hasMoreData'], true) 48 | 49 | case UserActionType.NOT_MORE_DATA_PEOPLE: 50 | return state 51 | .setIn(['people', 'hasMoreData'], false) 52 | 53 | case UserActionType.REQUEST_PAGE_PEOPLE: 54 | return state 55 | .setIn(['people', 'lastPageRequest'], payload.page) 56 | 57 | case UserActionType.LAST_USER_PEOPLE: 58 | return state 59 | .setIn(['people', 'lastUserId'], payload.lastUserId) 60 | 61 | default: 62 | return state 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/store/reducers/votes/IVoteAction.ts: -------------------------------------------------------------------------------- 1 | import { VoteActionType } from 'constants/voteActionType' 2 | 3 | /** 4 | * Vote action interface 5 | * 6 | * @export 7 | * @interface IVoteAction 8 | */ 9 | export interface IVoteAction { 10 | payload: any, 11 | type: VoteActionType 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/store/reducers/votes/VoteState.ts: -------------------------------------------------------------------------------- 1 | import { Vote } from 'src/core/domain/votes' 2 | 3 | /** 4 | * Vote state 5 | * 6 | * @export 7 | * @class VoteState 8 | */ 9 | export class VoteState { 10 | [key: string]: any 11 | /** 12 | * The list of posts vote 13 | * 14 | * @type {({[postId: string]: {[voteId: string]: Vote}} | null)} 15 | * @memberof VoteState 16 | */ 17 | postVotes: {[postId: string]: {[voteId: string]: Vote}} | null = null 18 | 19 | /** 20 | * If posts vote are loaded {true} or not {false} 21 | * 22 | * @type {Boolean} 23 | * @memberof VoteState 24 | */ 25 | loaded: Boolean = false 26 | } 27 | -------------------------------------------------------------------------------- /src/store/reducers/votes/index.ts: -------------------------------------------------------------------------------- 1 | import { voteReducer } from './voteReducer' 2 | 3 | export {voteReducer} 4 | -------------------------------------------------------------------------------- /src/store/reducers/votes/voteReducer.ts: -------------------------------------------------------------------------------- 1 | // - Import react components 2 | import moment from 'moment/moment' 3 | import _ from 'lodash' 4 | import { Map } from 'immutable' 5 | 6 | // - Import action types 7 | import { VoteActionType } from 'constants/voteActionType' 8 | 9 | // Import domain 10 | import { Vote } from 'src/core/domain/votes' 11 | 12 | import { VoteState } from './VoteState' 13 | import { IVoteAction } from './IVoteAction' 14 | 15 | /** 16 | * Vote actions 17 | * @param {object} state 18 | * @param {object} action 19 | */ 20 | export let voteReducer = (state = Map(new VoteState()), action: IVoteAction) => { 21 | let { payload } = action 22 | switch (action.type) { 23 | 24 | /* _____________ CRUD _____________ */ 25 | case VoteActionType.ADD_VOTE: 26 | return state 27 | .setIn(['postVotes', payload.postId, payload.userId], payload) 28 | 29 | case VoteActionType.ADD_VOTE_LIST: 30 | return state 31 | .set('postVotes', payload) 32 | .set('loaded', true) 33 | 34 | case VoteActionType.DELETE_VOTE: 35 | return state 36 | .deleteIn(['postVotes', payload.postId, payload.userId]) 37 | 38 | case VoteActionType.CLEAR_ALL_DATA_VOTE: 39 | return Map(new VoteState()) 40 | 41 | default: 42 | return state 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/store/sagas/localeSaga.ts: -------------------------------------------------------------------------------- 1 | 2 | import { take, fork, select, put, call, cancelled, all, takeLatest } from 'redux-saga/effects' 3 | import { eventChannel, Channel } from 'redux-saga' 4 | import { initialize } from 'react-localize-redux' 5 | import { addTranslationForLanguage } from 'react-localize-redux' 6 | import { setActiveLanguage } from 'react-localize-redux' 7 | import { LanguageType } from 'store/reducers/locale/langugeType' 8 | import config from 'src/config' 9 | import { GlobalActionType } from 'constants/globalActionType' 10 | /***************************** Subroutines ************************************/ 11 | 12 | /** 13 | * Initialize localization 14 | */ 15 | function* initLocalization() { 16 | const languages = [ 17 | { name: 'English', code: LanguageType.English }, 18 | { name: 'French', code: LanguageType.French }, 19 | { name: 'Spanish', code: LanguageType.Spanish } 20 | ] 21 | yield put(initialize(languages)) 22 | // To set a different default active language set the `defaultLanguage` option. 23 | yield put(initialize(languages, { defaultLanguage: config.settings.defaultLanguage })) 24 | const englishLocale = require('locale/en.json') 25 | const spanishLocale = require('locale/es.json') 26 | yield put(addTranslationForLanguage(englishLocale, LanguageType.English)) 27 | yield put(addTranslationForLanguage(spanishLocale, LanguageType.Spanish)) 28 | } 29 | 30 | export default function* localeSaga() { 31 | yield all([ 32 | takeLatest(GlobalActionType.INIT_LOCALE, initLocalization) 33 | ]) 34 | } 35 | -------------------------------------------------------------------------------- /src/store/sagas/rootSaga.ts: -------------------------------------------------------------------------------- 1 | import { all, fork } from 'redux-saga/effects' 2 | import commentSaga from './commentSaga' 3 | import localeSaga from './localeSaga' 4 | 5 | export default function* root() { 6 | yield all([ 7 | localeSaga(), 8 | commentSaga(), 9 | ]) 10 | } 11 | -------------------------------------------------------------------------------- /src/styles/app.scss: -------------------------------------------------------------------------------- 1 | @import "~react-day-picker/lib/style.css"; 2 | @import "base/variables"; 3 | @import 'base/grid'; 4 | @import 'base/animate'; 5 | @import 'base/icon'; 6 | @import 'base/flaticon'; 7 | // Component styles 8 | @import 'components/global'; 9 | @import 'components/master'; 10 | @import 'components/post'; 11 | @import 'components/profile'; 12 | @import 'components/sendFeedback'; 13 | @import 'components/userBox'; 14 | @import 'components/imageGallery'; 15 | @import 'components/postWrite'; 16 | @import 'components/homeHeader'; 17 | @import 'components/home'; 18 | @import 'components/sidebar'; 19 | @import 'components/blog'; 20 | @import 'components/comment'; 21 | @import 'components/people'; 22 | @import 'components/login'; 23 | @import 'components/signup'; 24 | @import 'components/masterLoading'; 25 | @import 'components/settings'; -------------------------------------------------------------------------------- /src/styles/base/_flaticon.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Flaticon icon font: Flaticon 3 | */ 4 | 5 | @font-face { 6 | font-family: "Flaticon"; 7 | src: url("../assets/fonts/Flaticon.eot"); 8 | src: url("../assets/fonts/Flaticon.eot?#iefix") format("embedded-opentype"), 9 | url("../assets/fonts/Flaticon.woff") format("woff"), 10 | url("../assets/fonts/Flaticon.ttf") format("truetype"), 11 | url("../assets/images/Flaticon.svg#Flaticon") format("svg"); 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | 16 | @media screen and (-webkit-min-device-pixel-ratio:0) { 17 | @font-face { 18 | font-family: "Flaticon"; 19 | src: url("../assets/images/Flaticon.svg#Flaticon") format("svg"); 20 | } 21 | } 22 | 23 | .fi:before{ 24 | display: inline-block; 25 | font-family: "Flaticon"; 26 | font-style: normal; 27 | font-weight: normal; 28 | font-variant: normal; 29 | line-height: 1; 30 | text-decoration: inherit; 31 | text-rendering: optimizeLegibility; 32 | text-transform: none; 33 | -moz-osx-font-smoothing: grayscale; 34 | -webkit-font-smoothing: antialiased; 35 | font-smoothing: antialiased; 36 | } 37 | 38 | .flaticon-sad-2:before { content: "\f100"; } 39 | .flaticon-sad-1:before { content: "\f101"; } 40 | .flaticon-neutral:before { content: "\f102"; } 41 | .flaticon-happy-2:before { content: "\f103"; } 42 | .flaticon-sad:before { content: "\f104"; } 43 | .flaticon-happy-1:before { content: "\f105"; } 44 | .flaticon-happy:before { content: "\f106"; } 45 | 46 | $font-Flaticon-sad-2: "\f100"; 47 | $font-Flaticon-sad-1: "\f101"; 48 | $font-Flaticon-neutral: "\f102"; 49 | $font-Flaticon-happy-2: "\f103"; 50 | $font-Flaticon-sad: "\f104"; 51 | $font-Flaticon-happy-1: "\f105"; 52 | $font-Flaticon-happy: "\f106"; -------------------------------------------------------------------------------- /src/styles/base/_variables.scss: -------------------------------------------------------------------------------- 1 | // Colors 2 | $grey: #333333; 3 | $light-grey: #fafafa; 4 | $light-grey2:#f7f7f7; 5 | $light-grey3:#ada7a7; 6 | $green-teal:#00ab6b; 7 | $teal:#58d09f; 8 | $gold: #FFD700; 9 | $green: #4CAF50; 10 | 11 | $light-grey-border: #eeeeee; 12 | $light-color: #aaa; 13 | 14 | // Navigation colors 15 | $nav-background: $grey; 16 | $nav-text-color: white; 17 | 18 | // Shadow 19 | $glob-box-shadow: 0 4px 10px 0 rgba(0,0,0,0.2), 0 4px 20px 0 rgba(0,0,0,0.19); 20 | 21 | -------------------------------------------------------------------------------- /src/styles/components/_blog.scss: -------------------------------------------------------------------------------- 1 | .blog__right-list{ 2 | 3 | @media (min-width: 993px) { 4 | margin-left: 2%; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/styles/components/_comment.scss: -------------------------------------------------------------------------------- 1 | .comment__list-show{ 2 | 3 | @mixin com{ 4 | position: absolute; 5 | top: 0; left: 0; 6 | background-color: white; 7 | height: 60px; 8 | width: 100%; 9 | } 10 | 11 | &>div:nth-of-type(1) { 12 | 13 | z-index: 3; 14 | animation: commentSlideShow 12s linear 0s infinite; 15 | 16 | @include com; 17 | } 18 | 19 | &>div:nth-of-type(2) { 20 | z-index: 2; 21 | animation: commentSlideShow 12s linear 4s infinite; 22 | 23 | @include com; 24 | } 25 | 26 | &>div:nth-of-type(3) { 27 | z-index: 1; 28 | animation: commentSlideShow 12s linear 8s infinite; 29 | 30 | @include com; 31 | } 32 | 33 | @keyframes commentSlideShow { 34 | 25% { opacity: 1;} 35 | 33.33% { opacity: 0;} 36 | 91.66% { opacity: 0;} 37 | 100% { opacity: 1;} 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/styles/components/_home.scss: -------------------------------------------------------------------------------- 1 | .home__main{ 2 | background-color: #eeeeee; 3 | transition: margin-left .4s; 4 | 5 | @media screen and (max-width: 750px){ 6 | margin-left: 0!important; 7 | margin-right: 0!important; 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/styles/components/_imageGallery.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/styles/components/_imageGallery.scss -------------------------------------------------------------------------------- /src/styles/components/_login.scss: -------------------------------------------------------------------------------- 1 | .login__button-box { 2 | display: flex; 3 | justify-content: space-around; 4 | } -------------------------------------------------------------------------------- /src/styles/components/_master.scss: -------------------------------------------------------------------------------- 1 | .master__progress { 2 | position: fixed; 3 | top: 0; 4 | z-index: 1501; 5 | width: 100%; 6 | } 7 | 8 | .master__loading { 9 | position: fixed; 10 | top: 67px; 11 | z-index: 1501; 12 | width: 100%; 13 | justify-content: center; 14 | div.title { 15 | color: rgb(255, 255, 255); 16 | font-size: 11px; 17 | text-align: center; 18 | font-weight: 500; 19 | white-space: nowrap; 20 | -webkit-flex-shrink: 1; 21 | flex-shrink: 1; 22 | min-width: 0; 23 | overflow: hidden; 24 | text-overflow: ellipsis; 25 | background-color: #db4437; 26 | padding: 7px; 27 | border-radius: 40px; 28 | } 29 | } 30 | 31 | .master__message { 32 | position: fixed; 33 | top: 5; 34 | left: 0; 35 | text-align: center; 36 | z-index: 1001; 37 | width: 100%; 38 | } 39 | -------------------------------------------------------------------------------- /src/styles/components/_masterLoading.scss: -------------------------------------------------------------------------------- 1 | .mLoading__body { 2 | background-color: rgb(216, 216, 216); 3 | } 4 | 5 | .mLoading__loading { 6 | position: fixed; 7 | z-index: 2001; 8 | height: 2em; 9 | width: 2em; 10 | overflow: show; 11 | margin: auto; 12 | top: 0; 13 | left: 0; 14 | bottom: 0; 15 | right: 0; 16 | } 17 | 18 | /* Transparent Overlay */ 19 | .mLoading__loading:before { 20 | content: ''; 21 | display: block; 22 | position: fixed; 23 | top: 0; 24 | left: 0; 25 | width: 100%; 26 | height: 100%; 27 | background-color: rgba(255, 255, 255, 0.65); 28 | } 29 | 30 | /* :not(:required) hides these rules from IE9 and below */ 31 | .mLoading__loading:not(:required) { 32 | /* hide "mLoading__loading..." text */ 33 | font: 0/0 a; 34 | color: transparent; 35 | text-shadow: none; 36 | background-color: transparent; 37 | border: 0; 38 | } -------------------------------------------------------------------------------- /src/styles/components/_people.scss: -------------------------------------------------------------------------------- 1 | .people__title{ 2 | @extend .profile__title 3 | } 4 | 5 | .people__name{ 6 | display: flex; 7 | word-break: break-word; 8 | max-width: 100%; 9 | align-items: center; 10 | padding: 10px; 11 | justify-content: center; 12 | div{ 13 | color: rgba(0,0,0,0.87); 14 | font-size: 16px; 15 | line-height: 20px; 16 | max-width: 100%; 17 | overflow: hidden; 18 | text-overflow: ellipsis; 19 | word-break: break-word; 20 | overflow: hidden; 21 | text-overflow: ellipsis; 22 | max-height: 40px; 23 | } 24 | } -------------------------------------------------------------------------------- /src/styles/components/_post.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/styles/components/_post.scss -------------------------------------------------------------------------------- /src/styles/components/_postWrite.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/styles/components/_postWrite.scss -------------------------------------------------------------------------------- /src/styles/components/_sendFeedback.scss: -------------------------------------------------------------------------------- 1 | .sendFeedback__content { 2 | 3 | position: fixed; 4 | right: 5px; 5 | bottom: 5px; 6 | z-index: 1101; 7 | .paper { 8 | height: 100%; 9 | text-align: center; 10 | 11 | } 12 | .main-box { 13 | padding: 26px 26px 0px 26px; 14 | } 15 | .buttons { 16 | margin-top: 20px; 17 | margin-left: 50px; 18 | position: relative; 19 | } 20 | .close { 21 | position: absolute; 22 | top: 13px; 23 | right: 13px; 24 | } 25 | .success { 26 | padding: 30px; 27 | } 28 | .error { 29 | padding: 30px; 30 | } 31 | .loading{ 32 | padding: 18px 0px 0px 0px; 33 | .icon { 34 | justify-content: center; 35 | align-items: center; 36 | align-content: center; 37 | align-self: center; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/styles/components/_settings.scss: -------------------------------------------------------------------------------- 1 | .settings__button-box{ 2 | @extend .login__button-box 3 | } -------------------------------------------------------------------------------- /src/styles/components/_sidebar.scss: -------------------------------------------------------------------------------- 1 | .sidebar { 2 | padding-top: 64px; 3 | background-color: #fff; 4 | max-width: 210px; 5 | height: 100%; 6 | width: 200px; 7 | position: fixed!important; 8 | z-index: 1; 9 | overflow: hidden; 10 | } 11 | 12 | .sidebar__large { 13 | background-color: #eeeeee !important; 14 | z-index: 1000; 15 | } 16 | 17 | .sidebar__over { 18 | z-index: 1102; 19 | padding-top: 0; 20 | background-color: #ffffff; 21 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); 22 | z-index: 1111; 23 | } 24 | 25 | .sidebar__title { 26 | font-size: 20px; 27 | font-weight: 500; 28 | padding-right: 16px; 29 | font-family: Roboto, sans-serif; 30 | position: relative; 31 | text-overflow: ellipsis; 32 | white-space: nowrap; 33 | overflow: hidden; 34 | margin-left: 15px; 35 | } 36 | -------------------------------------------------------------------------------- /src/styles/components/_signup.scss: -------------------------------------------------------------------------------- 1 | .signup__button-box{ 2 | margin-top: 30px; 3 | @extend .login__button-box; 4 | } -------------------------------------------------------------------------------- /src/styles/components/_userBox.scss: -------------------------------------------------------------------------------- 1 | .user-box__add-circle { 2 | position: absolute; 3 | right: 16px; 4 | bottom: 69px; 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/app.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gold/react-social-network/04e0f4dcfb8fec1c1a4c18efb5ae02b5679f8451/src/tests/app.test.ts -------------------------------------------------------------------------------- /src/typings/react-day-picker.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-day-picker/DayPickerInput' 2 | declare module 'react-day-picker/moment' -------------------------------------------------------------------------------- /src/typings/react-linkif.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-linkify' -------------------------------------------------------------------------------- /src/typings/react-loadable.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-loadable' -------------------------------------------------------------------------------- /src/typings/react-parallax.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-parallax' 2 | -------------------------------------------------------------------------------- /src/typings/react-share.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-share' 2 | -------------------------------------------------------------------------------- /src/typings/react-string-replace.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-string-replace' -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "compilerOptions": { 4 | "types": ["reflect-metadata"], 5 | "allowSyntheticDefaultImports": true, // see below 6 | "baseUrl": "./src/", // enables you to import relative to this folder 7 | "paths": { 8 | "src/*": ["*"], 9 | "core/*": ["core/*"], 10 | "routes/*": ["routes/*"], 11 | "data/*": ["data/*"], 12 | "components/*": ["components/*"], 13 | "store/*": ["store/*"], 14 | "api/*": ["api/*"], 15 | "layouts/*": ["layouts/*"], 16 | "models/*": ["models/*"] 17 | }, 18 | "outDir": "build/dist", 19 | "module": "esnext", 20 | "target": "es5", 21 | "lib": ["es7", "dom"], 22 | "sourceMap": true, 23 | "allowJs": true, 24 | "jsx": "react", 25 | "moduleResolution": "node", 26 | "rootDir": "src", 27 | "forceConsistentCasingInFileNames": true, 28 | "noImplicitReturns": false, 29 | "noImplicitThis": true, 30 | "noImplicitAny": true, 31 | "strictNullChecks": true, 32 | "suppressImplicitAnyIndexErrors": true, 33 | "noUnusedLocals": false, 34 | "experimentalDecorators": true 35 | 36 | }, 37 | "include": [ 38 | "src/**/*", 39 | "index.d.ts" 40 | ], 41 | "exclude": [ 42 | "node_modules", 43 | "build", 44 | "scripts", 45 | "acceptance-tests", 46 | "webpack", 47 | "jest", 48 | "src/setupTests.ts" 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "compilerOptions": { 4 | "types": ["reflect-metadata"], 5 | "allowSyntheticDefaultImports": true, // see below 6 | "baseUrl": "./src/", // enables you to import relative to this folder 7 | "paths": { 8 | "src/*": ["*"], 9 | "core/*": ["core/*"], 10 | "routes/*": ["routes/*"], 11 | "data/*": ["data/*"], 12 | "components/*": ["components/*"], 13 | "store/*": ["store/*"], 14 | "api/*": ["api/*"], 15 | "layouts/*": ["layouts/*"], 16 | "models/*": ["models/*"] 17 | }, 18 | "outDir": "build/dist", 19 | "module": "esnext", 20 | "target": "es5", 21 | "lib": ["es7", "dom"], 22 | "sourceMap": true, 23 | "allowJs": true, 24 | "jsx": "react", 25 | "moduleResolution": "node", 26 | "rootDir": "src", 27 | "forceConsistentCasingInFileNames": true, 28 | "noImplicitReturns": false, 29 | "noImplicitThis": true, 30 | "noImplicitAny": true, 31 | "strictNullChecks": true, 32 | "suppressImplicitAnyIndexErrors": true, 33 | "noUnusedLocals": false, 34 | "experimentalDecorators": true 35 | 36 | }, 37 | "include": [ 38 | "src/**/*", 39 | "index.d.ts" 40 | ], 41 | "exclude": [ 42 | "node_modules", 43 | "build", 44 | "scripts", 45 | "acceptance-tests", 46 | "webpack", 47 | "jest", 48 | "src/setupTests.ts" 49 | ] 50 | } 51 | --------------------------------------------------------------------------------