Improvment in tslint standard (#16)

This commit is contained in:
Qolzam
2017-10-10 16:39:02 +07:00
parent 181d2b8abd
commit 1937742f04
160 changed files with 984 additions and 1019 deletions

View File

@@ -1,148 +1,141 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import moment from 'moment'; import moment from 'moment'
import { push } from 'react-router-redux'; import { push } from 'react-router-redux'
// -Import domain // -Import domain
import { User } from 'domain/users'; import { User } from 'domain/users'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
// - Import action types // - Import action types
import { AuthorizeActionType } from 'constants/authorizeActionType'; import { AuthorizeActionType } from 'constants/authorizeActionType'
// - Import services // - Import services
import { IAuthorizeService } from "services/authorize"; import { IAuthorizeService } from 'services/authorize'
import { IServiceProvider } from "factories"; import { IServiceProvider } from 'factories'
import { ServiceProvide } from "factories"; import { ServiceProvide } from 'factories'
const serviceProvider: IServiceProvider = new ServiceProvide(); const serviceProvider: IServiceProvider = new ServiceProvide()
const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService(); const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService()
// - Import actions // - Import actions
import * as globalActions from 'actions/globalActions'; import * as globalActions from 'actions/globalActions'
/* _____________ CRUD DB _____________ */ /* _____________ CRUD DB _____________ */
/** /**
* Log in user in server * Log in user in server
* @param {string} email * @param {string} email
* @param {string} password * @param {string} password
*/ */
export const dbLogin = (email: string, password: string) => { export const dbLogin = (email: string, password: string) => {
return (dispatch: any, getState: any) => { return (dispatch: any, getState: any) => {
dispatch(globalActions.showNotificationRequest()) dispatch(globalActions.showNotificationRequest())
return authorizeService.login(email, password).then((result) => {
return authorizeService.login(email, password).then((result) => { dispatch(globalActions.showNotificationSuccess())
dispatch(globalActions.showNotificationSuccess()) dispatch(login(result.uid))
dispatch(login(result.uid)) dispatch(push('/'))
dispatch(push('/')) }, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
}
} }
}
/** /**
* Log out user in server * Log out user in server
*/ */
export const dbLogout = () => { export const dbLogout = () => {
return (dispatch: any, getState: any) => { return (dispatch: any, getState: any) => {
return authorizeService.logout().then((result) => { return authorizeService.logout().then((result) => {
dispatch(logout()); dispatch(logout())
dispatch(push('/login')); dispatch(push('/login'))
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
}
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
} }
}
/** /**
* *
* @param user for registering * @param user for registering
*/ */
export const dbSignup = (user: User) => { export const dbSignup = (user: User) => {
return (dispatch: any, getState: any) => { return (dispatch: any, getState: any) => {
dispatch(globalActions.showNotificationRequest()) dispatch(globalActions.showNotificationRequest())
return authorizeService.registerUser(user).then((result) => { return authorizeService.registerUser(user).then((result) => {
dispatch(signup({ dispatch(signup({
userId: result.uid, userId: result.uid,
...user ...user
})) }))
dispatch(push('/')) dispatch(push('/'))
}) })
.catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))); .catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
}
} }
}
/** /**
* Change user's password * Change user's password
* @param {string} newPassword * @param {string} newPassword
*/ */
export const dbUpdatePassword = (newPassword: string) => { export const dbUpdatePassword = (newPassword: string) => {
return (dispatch: any, getState: any) => { return (dispatch: any, getState: any) => {
dispatch(globalActions.showNotificationRequest()) dispatch(globalActions.showNotificationRequest())
return authorizeService.updatePassword(newPassword).then(() => { return authorizeService.updatePassword(newPassword).then(() => {
// Update successful. // Update successful.
dispatch(globalActions.showNotificationSuccess()) dispatch(globalActions.showNotificationSuccess())
dispatch(updatePassword()) dispatch(updatePassword())
dispatch(push('/')) dispatch(push('/'))
}) })
.catch((error: SocialError) => { .catch((error: SocialError) => {
// An error happened. // An error happened.
switch (error.code) { switch (error.code) {
case 'auth/requires-recent-login': case 'auth/requires-recent-login':
dispatch(globalActions.showErrorMessage(error.code)) dispatch(globalActions.showErrorMessage(error.code))
dispatch(dbLogout()) dispatch(dbLogout())
break; break
default: default:
} }
}) })
} }
} }
/* _____________ CRUD State _____________ */ /* _____________ CRUD State _____________ */
/** /**
* Loing user * Loing user
* @param {string} uid * @param {string} uids
*/ */
export const login = (uid: string) => { export const login = (uid: string) => {
return { return {
type: AuthorizeActionType.LOGIN, type: AuthorizeActionType.LOGIN,
payload: { authed: true, uid } payload: { authed: true, uid }
}
} }
}
/** /**
* Logout user * Logout user
*/ */
export const logout = () => { export const logout = () => {
return { type: AuthorizeActionType.LOGOUT } return { type: AuthorizeActionType.LOGOUT }
} }
/** /**
* User registeration call * User registeration call
* @param user for registering * @param user for registering
*/ */
export const signup = (user: User) => { export const signup = (user: User) => {
return { return {
type: AuthorizeActionType.SIGNUP, type: AuthorizeActionType.SIGNUP,
payload: { ...user } payload: { ...user }
}
} }
}
/** /**
* Update user's password * Update user's password
*/ */
export const updatePassword = () => { export const updatePassword = () => {
return { type: AuthorizeActionType.UPDATE_PASSWORD } return { type: AuthorizeActionType.UPDATE_PASSWORD }
} }

View File

@@ -2,8 +2,8 @@
import firebase, { firebaseRef } from 'app/firebase/' import firebase, { firebaseRef } from 'app/firebase/'
// - Import domain // - Import domain
import { User } from "domain/users"; import { User } from 'domain/users'
import { Circle, UserFollower } from "domain/circles"; import { Circle, UserFollower } from 'domain/circles'
// - Import utility components // - Import utility components
import moment from 'moment' import moment from 'moment'
@@ -29,7 +29,7 @@ import * as notifyActions from 'actions/notifyActions'
* Add a circle * Add a circle
* @param {string} circleName * @param {string} circleName
*/ */
export var dbAddCircle = (circleName: string) => { export let dbAddCircle = (circleName: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
@@ -41,7 +41,7 @@ export var dbAddCircle = (circleName: string) => {
let circleRef = firebaseRef.child(`userCircles/${uid}/circles`).push(circle) let circleRef = firebaseRef.child(`userCircles/${uid}/circles`).push(circle)
return circleRef.then(() => { return circleRef.then(() => {
circle.id = circleRef.key; circle.id = circleRef.key
circle.ownerId = uid circle.ownerId = uid
dispatch(addCircle(circle)) dispatch(addCircle(circle))
@@ -55,11 +55,11 @@ export var dbAddCircle = (circleName: string) => {
* @param {string} cid is circle identifier * @param {string} cid is circle identifier
* @param {User} userFollowing is the user for following * @param {User} userFollowing is the user for following
*/ */
export var dbAddFollowingUser = (cid: string, userFollowing: User) => { export let dbAddFollowingUser = (cid: string, userFollowing: User) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid; let uid: string = getState().authorize.uid
let user: User = getState().user.info[uid]; let user: User = getState().user.info[uid]
let userCircle: User = { let userCircle: User = {
creationDate: moment().unix(), creationDate: moment().unix(),
@@ -99,7 +99,7 @@ export var dbAddFollowingUser = (cid: string, userFollowing: User) => {
* @param {string} cid is circle identifier * @param {string} cid is circle identifier
* @param {string} followingId following user identifier * @param {string} followingId following user identifier
*/ */
export var dbDeleteFollowingUser = (cid: string, followingId: string) => { export let dbDeleteFollowingUser = (cid: string, followingId: string) => {
return (dispatch: any, getState:Function) => { return (dispatch: any, getState:Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
@@ -154,14 +154,14 @@ export const dbDeleteCircle = (id: string) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates: any = {}; let updates: any = {}
updates[`userCircles/${uid}/circles/${id}`] = null; updates[`userCircles/${uid}/circles/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deleteCircle(uid, id)) dispatch(deleteCircle(uid, id))
}, (error) => { }, (error) => {
dispatch(globalActions.showErrorMessage(error.message)) dispatch(globalActions.showErrorMessage(error.message))
}); })
} }
} }
@@ -173,16 +173,16 @@ export const dbGetCircles = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let circlesRef: any = firebaseRef.child(`userCircles/${uid}/circles`); let circlesRef: any = firebaseRef.child(`userCircles/${uid}/circles`)
return circlesRef.once('value').then((snapshot: any) => { return circlesRef.once('value').then((snapshot: any) => {
var circles: any = snapshot.val() || {}; let circles: any = snapshot.val() || {}
var parsedCircles: { [circleId: string]: Circle } = {}; let parsedCircles: { [circleId: string]: Circle } = {}
Object.keys(circles).forEach((circleId) => { Object.keys(circles).forEach((circleId) => {
if (circleId !== '-Followers' && circles[circleId].users) { if (circleId !== '-Followers' && circles[circleId].users) {
Object.keys(circles[circleId].users).filter((v, i, a) => a.indexOf(v) === i).forEach((userId) => { Object.keys(circles[circleId].users).filter((v, i, a) => a.indexOf(v) === i).forEach((userId) => {
dispatch(postActions.dbGetPostsByUserId(userId)) dispatch(postActions.dbGetPostsByUserId(userId))
dispatch(userActions.dbGetUserInfoByUserId(userId, "")) dispatch(userActions.dbGetUserInfoByUserId(userId, ''))
}) })
} }
parsedCircles[circleId] = { parsedCircles[circleId] = {
@@ -191,8 +191,8 @@ export const dbGetCircles = () => {
} }
}) })
dispatch(addCircles(uid, parsedCircles)); dispatch(addCircles(uid, parsedCircles))
}); })
} }
} }
@@ -207,18 +207,18 @@ export const dbGetCirclesByUserId = (uid: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
if (uid) { if (uid) {
let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`); let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`)
return circlesRef.once('value').then((snapshot) => { return circlesRef.once('value').then((snapshot) => {
var circles = snapshot.val() || {}; let circles = snapshot.val() || {}
var parsedCircles: { [circleId: string]: Circle } = {}; let parsedCircles: { [circleId: string]: Circle } = {}
Object.keys(circles).forEach((circleId) => { Object.keys(circles).forEach((circleId) => {
parsedCircles[circleId] = { parsedCircles[circleId] = {
id: circleId, id: circleId,
...circles[circleId] ...circles[circleId]
} }
}) })
dispatch(addCircles(uid, parsedCircles)); dispatch(addCircles(uid, parsedCircles))
}) })
} }

View File

@@ -3,17 +3,15 @@ import moment from 'moment'
import { firebaseRef } from 'app/firebase/' import { firebaseRef } from 'app/firebase/'
// - Import domain // - Import domain
import { Comment } from "domain/comments"; import { Comment } from 'domain/comments'
// - Import action types // - Import action types
import {CommentActionType} from 'constants/commentActionType' import { CommentActionType } from 'constants/commentActionType'
// - Import actions // - Import actions
import * as globalActions from 'actions/globalActions' import * as globalActions from 'actions/globalActions'
import * as notifyActions from 'actions/notifyActions' import * as notifyActions from 'actions/notifyActions'
/* _____________ CRUD DB _____________ */ /* _____________ CRUD DB _____________ */
/** /**
@@ -45,13 +43,15 @@ export const dbAddComment = (ownerPostUserId: string,newComment: Comment, callBa
callBack() callBack()
dispatch(globalActions.hideTopLoading()) dispatch(globalActions.hideTopLoading())
if (ownerPostUserId && ownerPostUserId !== uid) if (ownerPostUserId && ownerPostUserId !== uid) {
dispatch(notifyActions.dbAddNotify( dispatch(notifyActions.dbAddNotify(
{ {
description: 'Add comment on your post.', description: 'Add comment on your post.',
url: `/${ownerPostUserId}/posts/${newComment.postId}`, url: `/${ownerPostUserId}/posts/${newComment.postId}`,
notifyRecieverUserId: ownerPostUserId, notifierUserId: uid notifyRecieverUserId: ownerPostUserId, notifierUserId: uid,
isSeen: false
})) }))
}
}, (error: any) => { }, (error: any) => {
dispatch(globalActions.showErrorMessage(error.message)) dispatch(globalActions.showErrorMessage(error.message))
@@ -69,10 +69,10 @@ export const dbGetComments = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let commentsRef: any = firebaseRef.child(`postComments`); let commentsRef: any = firebaseRef.child(`postComments`)
return commentsRef.on('value', (snapshot: any) => { return commentsRef.on('value', (snapshot: any) => {
let comments: {[postId: string]: {[commentId: string] : Comment}} = snapshot!.val() || {}; let comments: {[postId: string]: {[commentId: string]: Comment}} = snapshot!.val() || {}
dispatch(addCommentList(comments)) dispatch(addCommentList(comments))
}) })
@@ -92,12 +92,11 @@ export const dbUpdateComment = (id: string, postId: string, text: string) => {
dispatch(globalActions.showTopLoading()) dispatch(globalActions.showTopLoading())
// Get current user id // Get current user id
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates: any = {}; let updates: any = {}
let comment: Comment = getState().comment.postComments[postId][id] let comment: Comment = getState().comment.postComments[postId][id]
updates[`postComments/${postId}/${id}`] = { updates[`postComments/${postId}/${id}`] = {
postId: postId, postId: postId,
@@ -131,13 +130,12 @@ export const dbDeleteComment = (id: string, postId: string) => {
dispatch(globalActions.showTopLoading()) dispatch(globalActions.showTopLoading())
// Get current user id // Get current user id
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates: any = {}; let updates: any = {}
updates[`postComments/${postId}/${id}`] = null; updates[`postComments/${postId}/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deleteComment(id, postId)) dispatch(deleteComment(id, postId))
@@ -154,12 +152,11 @@ export const dbDeleteComment = (id: string, postId: string) => {
/* _____________ CRUD State _____________ */ /* _____________ CRUD State _____________ */
/** /**
* Add comment * Add comment
* @param {Comment} data * @param {Comment} data
*/ */
export const addComment = (comment:Comment) => { export const addComment = (comment: Comment) => {
return { return {
type: CommentActionType.ADD_COMMENT, type: CommentActionType.ADD_COMMENT,
@@ -185,7 +182,7 @@ export const updateComment = ( id: string, postId: string, text: string) => {
* Add comment list * Add comment list
* @param {[postId: string]: {[commentId: string] : Comment}} postComments an array of comments * @param {[postId: string]: {[commentId: string] : Comment}} postComments an array of comments
*/ */
export const addCommentList = (postComments: {[postId: string]: {[commentId: string] : Comment}}) => { export const addCommentList = (postComments: {[postId: string]: {[commentId: string]: Comment}}) => {
return { return {
type: CommentActionType.ADD_COMMENT_LIST, type: CommentActionType.ADD_COMMENT_LIST,
@@ -193,8 +190,6 @@ export const addCommentList = (postComments: {[postId: string]: {[commentId: str
} }
} }
/** /**
* Delete a comment * Delete a comment
* @param {string} id of comment * @param {string} id of comment
@@ -229,4 +224,3 @@ export const closeCommentEditor = (comment: Comment) => {
payload: comment payload: comment
} }
} }

View File

@@ -84,10 +84,10 @@ export const setHeaderTitleOpt = (callerKey: string,payload: any) => {
case 'profile': case 'profile':
const userName = getState().user.info && getState().user.info[payload] ? getState().user.info[payload].fullName : '' const userName = getState().user.info && getState().user.info[payload] ? getState().user.info[payload].fullName : ''
dispatch(setHeaderTitle(userName)) dispatch(setHeaderTitle(userName))
break; break
default: default:
break; break
} }
} }

View File

@@ -3,10 +3,10 @@ import moment from 'moment'
import { firebaseRef, firebaseAuth, storageRef } from 'app/firebase/' import { firebaseRef, firebaseAuth, storageRef } from 'app/firebase/'
// - Import domain // - Import domain
import { Image } from "domain/imageGallery"; import { Image } from 'domain/imageGallery'
// - Import action types // - Import action types
import {ImageGalleryActionType} from 'constants/imageGalleryActionType' import { ImageGalleryActionType } from 'constants/imageGalleryActionType'
// - Import actions // - Import actions
import * as globalActions from 'actions/globalActions' import * as globalActions from 'actions/globalActions'
@@ -16,8 +16,6 @@ import FileAPI from 'api/FileAPI'
/* _____________ UI Actions _____________ */ /* _____________ UI Actions _____________ */
declare const console: any;
/** /**
* Download images for image gallery * Download images for image gallery
*/ */
@@ -25,18 +23,18 @@ export const downloadForImageGallery = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let imagesRef: any = firebaseRef.child(`userFiles/${uid}/files/images`); let imagesRef: any = firebaseRef.child(`userFiles/${uid}/files/images`)
return imagesRef.once('value').then((snapshot: any) => { return imagesRef.once('value').then((snapshot: any) => {
var images = snapshot.val() || {}; let images = snapshot.val() || {}
var parsedImages: Image[] = [] let parsedImages: Image[] = []
Object.keys(images).forEach((imageId) => { Object.keys(images).forEach((imageId) => {
parsedImages.push({ parsedImages.push({
id: imageId, id: imageId,
...images[imageId] ...images[imageId]
}) })
}) })
dispatch(addImageList(parsedImages)); dispatch(addImageList(parsedImages))
}) })
} }
@@ -55,17 +53,17 @@ export const dbSaveImage = (imageURL: string,imageFullPath: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
var image: Image = { let image: Image = {
creationDate: moment().unix(), creationDate: moment().unix(),
deleteDate: '', deleteDate: '',
URL: imageURL, URL: imageURL,
fullPath:imageFullPath, fullPath: imageFullPath,
ownerUserId: uid, ownerUserId: uid,
lastEditDate: 0, lastEditDate: 0,
deleted: false deleted: false
} }
var imageRef = firebaseRef.child(`userFiles/${uid}/files/images`).push(image) let imageRef = firebaseRef.child(`userFiles/${uid}/files/images`).push(image)
return imageRef.then(() => { return imageRef.then(() => {
dispatch(addImage({ dispatch(addImage({
...image, ...image,
@@ -84,18 +82,18 @@ export const dbDeleteImage = (id: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
// Get current user id // Get current user id
let uid: string = getState().authorize.uid; let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
var updates: any = {}; let updates: any = {}
updates[`userFiles/${uid}/files/images/${id}`] = null; updates[`userFiles/${uid}/files/images/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deleteImage(id)) dispatch(deleteImage(id))
console.log('image removed: ', id); console.log('image removed: ', id)
}, (error) => { }, (error) => {
console.log(error); console.log(error)
}); })
} }
} }
@@ -116,15 +114,14 @@ export const dbUploadImage = (file: any, fileName: string) => {
// Upload storage bar // Upload storage bar
task.on('state_changed', (snapshot: any) => { task.on('state_changed', (snapshot: any) => {
var percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100 let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
dispatch(globalActions.progressChange(percentage, true)) dispatch(globalActions.progressChange(percentage, true))
}, (error: any) => { }, (error: any) => {
dispatch(globalActions.showErrorMessage(error.code)) dispatch(globalActions.showErrorMessage(error.code))
dispatch(globalActions.hideTopLoading()) dispatch(globalActions.hideTopLoading())
}, (complete?: any ) => { }, (complete?: any ) => {
dispatch(globalActions.progressChange(100, false)) dispatch(globalActions.progressChange(100, false))
dispatch(dbSaveImage(fileName,'')) dispatch(dbSaveImage(fileName,''))
dispatch(globalActions.hideTopLoading()) dispatch(globalActions.hideTopLoading())
@@ -140,24 +137,26 @@ export const dbUploadImage = (file: any, fileName: string) => {
export const dbDownloadImage = (fileName: string) => { export const dbDownloadImage = (fileName: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
if (fileName == 'noImage') if (fileName === 'noImage') {
return {} return {}
if (getState().imageGallery.imageURLList[fileName] && fileName !== '') }
if (getState().imageGallery.imageURLList[fileName] && fileName !== '') {
return return
}
if (getState().imageGallery.imageRequests.indexOf(fileName) > -1) if (getState().imageGallery.imageRequests.indexOf(fileName) > -1){
return return
}
dispatch(sendImageRequest(fileName)) dispatch(sendImageRequest(fileName))
// Create a reference to the file we want to download // Create a reference to the file we want to download
let starsRef: any = storageRef.child(`images/${fileName}`); let starsRef: any = storageRef.child(`images/${fileName}`)
// Get the download URL // Get the download URL
starsRef.getDownloadURL().then((url: string) => { starsRef.getDownloadURL().then((url: string) => {
// Insert url into an <img> tag to "download" // Insert url into an <img> tag to 'download'
if (!getState().imageGallery.imageURLList[fileName] || fileName === '') if (!getState().imageGallery.imageURLList[fileName] || fileName === '')
dispatch(setImageURL(fileName, url)) dispatch(setImageURL(fileName, url))
}).catch((error:any) => { }).catch((error: any) => {
// A full list of error codes is available at // A full list of error codes is available at
// https://firebase.google.com/docs/storage/web/handle-errors // https://firebase.google.com/docs/storage/web/handle-errors
@@ -165,24 +164,24 @@ export const dbDownloadImage = (fileName: string) => {
case 'storage/object_not_found': case 'storage/object_not_found':
// File doesn't exist // File doesn't exist
dispatch(globalActions.showErrorMessage('storage/object_not_found')) dispatch(globalActions.showErrorMessage('storage/object_not_found'))
break; break
case 'storage/unauthorized': case 'storage/unauthorized':
// User doesn't have permission to access the object // User doesn't have permission to access the object
dispatch(globalActions.showErrorMessage('storage/unauthorized')) dispatch(globalActions.showErrorMessage('storage/unauthorized'))
break; break
case 'storage/canceled': case 'storage/canceled':
// User canceled the upload // User canceled the upload
dispatch(globalActions.showErrorMessage('storage/canceled')) dispatch(globalActions.showErrorMessage('storage/canceled'))
break; break
case 'storage/unknown': case 'storage/unknown':
// Unknown error occurred, inspect the server response // Unknown error occurred, inspect the server response
dispatch(globalActions.showErrorMessage('storage/unknown')) dispatch(globalActions.showErrorMessage('storage/unknown'))
break; break
} }
}); })
} }
} }

View File

@@ -3,7 +3,7 @@ import moment from 'moment'
import { firebaseRef } from 'app/firebase/' import { firebaseRef } from 'app/firebase/'
// - Import domain // - Import domain
import { Notification } from "domain/notifications"; import { Notification } from 'domain/notifications'
// - Import action types // - Import action types
import {NotificationActionType} from 'constants/notificationActionType' import {NotificationActionType} from 'constants/notificationActionType'
@@ -47,10 +47,10 @@ export const dbGetNotifies = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`); let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`)
return notifiesRef.on('value', (snapshot: any) => { return notifiesRef.on('value', (snapshot: any) => {
let notifies: {[notifyId: string]: Notification} = snapshot.val() || {}; let notifies: {[notifyId: string]: Notification} = snapshot.val() || {}
Object.keys(notifies).forEach((key => { Object.keys(notifies).forEach((key => {
if (!getState().user.info[notifies[key].notifierUserId]) { if (!getState().user.info[notifies[key].notifierUserId]) {
@@ -74,11 +74,11 @@ export const dbDeleteNotify = (id: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
// Get current user id // Get current user id
var uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
var updates: any = {}; let updates: any = {}
updates[`userNotifies/${uid}/${id}`] = null; updates[`userNotifies/${uid}/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deleteNotify(id)) dispatch(deleteNotify(id))
@@ -101,7 +101,7 @@ export const dbSeenNotify = (id: string) => {
let notify: Notification = getState().notify.userNotifies[id] let notify: Notification = getState().notify.userNotifies[id]
let updates: any = {}; let updates: any = {}
updates[`userNotifies/${uid}/${id}`] = { updates[`userNotifies/${uid}/${id}`] = {
description: notify.description, description: notify.description,
url: notify.url, url: notify.url,

View File

@@ -1,26 +1,20 @@
// - Import react components // - Import react components
import { Action } from "redux"; import { Action } from 'redux'
// - Import firebase component // - Import firebase component
import firebase, { firebaseRef } from '../firebase'; import firebase, { firebaseRef } from '../firebase'
// - Import domain // - Import domain
import { Post } from "domain/posts"; import { Post } from 'domain/posts'
// - Import utility components // - Import utility components
import moment from 'moment'; import moment from 'moment'
// - Import action types // - Import action types
import { PostActionType } from 'constants/postActionType'; import { PostActionType } from 'constants/postActionType'
// - Import actions // - Import actions
import * as globalActions from 'actions/globalActions'; import * as globalActions from 'actions/globalActions'
declare const console: any;
/* _____________ CRUD DB _____________ */ /* _____________ CRUD DB _____________ */
@@ -29,7 +23,7 @@ declare const console: any;
* @param {any} newPost * @param {any} newPost
* @param {Function} callBack * @param {Function} callBack
*/ */
export var dbAddPost = (newPost: any, callBack: Function) => { export let dbAddPost = (newPost: any, callBack: Function) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
@@ -47,14 +41,13 @@ export var dbAddPost = (newPost: any, callBack: Function) => {
tags: newPost.tags || [], tags: newPost.tags || [],
commentCounter: 0, commentCounter: 0,
image: '', image: '',
imageFullPath:'', imageFullPath: '',
video: '', video: '',
disableComments: newPost.disableComments, disableComments: newPost.disableComments,
disableSharing: newPost.disableSharing, disableSharing: newPost.disableSharing,
deleted: false deleted: false
} }
let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post) let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
return postRef.then(() => { return postRef.then(() => {
dispatch(addPost(uid, { dispatch(addPost(uid, {
@@ -66,7 +59,6 @@ export var dbAddPost = (newPost: any, callBack: Function) => {
} }
} }
/** /**
* Add a post with image * Add a post with image
* @param {object} newPost * @param {object} newPost
@@ -99,8 +91,7 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => {
deleted: false deleted: false
} }
let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
let postRef : any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
return postRef.then(() => { return postRef.then(() => {
dispatch(addPost(uid, { dispatch(addPost(uid, {
...post, ...post,
@@ -121,7 +112,7 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => {
*/ */
export const dbUpdatePost = (newPost: any, callBack: Function) => { export const dbUpdatePost = (newPost: any, callBack: Function) => {
console.log(newPost) console.log(newPost)
return (dispatch : any, getState: Function) => { return (dispatch: any, getState: Function) => {
dispatch(globalActions.showTopLoading()) dispatch(globalActions.showTopLoading())
@@ -129,7 +120,7 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates: any = {}; let updates: any = {}
let post: Post = getState().post.userPosts[uid][newPost.id] let post: Post = getState().post.userPosts[uid][newPost.id]
let updatedPost: Post = { let updatedPost: Post = {
postTypeId: post.postTypeId, postTypeId: post.postTypeId,
@@ -172,16 +163,16 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => {
* @param {string} id is post identifier * @param {string} id is post identifier
*/ */
export const dbDeletePost = (id: string) => { export const dbDeletePost = (id: string) => {
return (dispatch:any, getState:Function) => { return (dispatch: any, getState: Function) => {
dispatch(globalActions.showTopLoading()) dispatch(globalActions.showTopLoading())
// Get current user id // Get current user id
let uid : string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates : any= {}; let updates: any = {}
updates[`userPosts/${uid}/posts/${id}`] = null; updates[`userPosts/${uid}/posts/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deletePost(uid, id)) dispatch(deletePost(uid, id))
@@ -190,7 +181,7 @@ export const dbDeletePost = (id: string) => {
}, (error) => { }, (error) => {
dispatch(globalActions.showErrorMessage(error.message)) dispatch(globalActions.showErrorMessage(error.message))
dispatch(globalActions.hideTopLoading()) dispatch(globalActions.hideTopLoading())
}); })
} }
} }
@@ -199,23 +190,23 @@ export const dbDeletePost = (id: string) => {
* Get all user posts from data base * Get all user posts from data base
*/ */
export const dbGetPosts = () => { export const dbGetPosts = () => {
return (dispatch:any, getState:any) => { return (dispatch: any, getState: any) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`); let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`)
return postsRef.once('value').then((snapshot: any) => { return postsRef.once('value').then((snapshot: any) => {
var posts: any = snapshot.val() || {}; let posts: any = snapshot.val() || {}
var parsedPosts : {[postId: string]: Post} = {}; let parsedPosts: { [postId: string]: Post } = {}
Object.keys(posts).forEach((postId) => { Object.keys(posts).forEach((postId) => {
parsedPosts[postId] = { parsedPosts[postId] = {
id: postId, id: postId,
...posts[postId] ...posts[postId]
}; }
}); })
dispatch(addPosts(uid, parsedPosts)); dispatch(addPosts(uid, parsedPosts))
}); })
} }
} }
@@ -226,19 +217,19 @@ export const dbGetPosts = () => {
* @param uid post owner identifier * @param uid post owner identifier
* @param postId post identifier * @param postId post identifier
*/ */
export const dbGetPostById = (uid:string, postId:string) => { export const dbGetPostById = (uid: string, postId: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
if (uid) { if (uid) {
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts/${postId}`); let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts/${postId}`)
return postsRef.once('value').then((snapshot: any) => { return postsRef.once('value').then((snapshot: any) => {
const newPost = snapshot.val() || {}; const newPost = snapshot.val() || {}
const post = { const post = {
id: postId, id: postId,
...newPost ...newPost
} }
dispatch(addPost(uid, post)); dispatch(addPost(uid, post))
}); })
} }
} }
@@ -253,30 +244,25 @@ export const dbGetPostsByUserId = (uid: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
if (uid) { if (uid) {
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`); let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`)
return postsRef.once('value').then((snapshot: any) => { return postsRef.once('value').then((snapshot: any) => {
let posts: any = snapshot.val() || {}; let posts: any = snapshot.val() || {}
let parsedPosts: {[postId: string]: Post} = {}; let parsedPosts: { [postId: string]: Post } = {}
Object.keys(posts).forEach((postId) => { Object.keys(posts).forEach((postId) => {
parsedPosts[postId] = { parsedPosts[postId] = {
id: postId, id: postId,
...posts[postId] ...posts[postId]
}; }
}); })
dispatch(addPosts(uid, parsedPosts)); dispatch(addPosts(uid, parsedPosts))
}); })
} }
} }
} }
/* _____________ CRUD State _____________ */ /* _____________ CRUD State _____________ */
/** /**
@@ -315,13 +301,12 @@ export const deletePost = (uid: string, id: string) => {
} }
} }
/** /**
* Add a list of post * Add a list of post
* @param {string} uid * @param {string} uid
* @param {[object]} posts * @param {[object]} posts
*/ */
export const addPosts = (uid: string, posts: {[postId: string]: Post}) => { export const addPosts = (uid: string, posts: { [postId: string]: Post }) => {
return { return {
type: PostActionType.ADD_LIST_POST, type: PostActionType.ADD_LIST_POST,
payload: { uid, posts } payload: { uid, posts }
@@ -348,4 +333,3 @@ export const addImagePost = (uid: string, post: any) => {
} }
} }

View File

@@ -2,7 +2,7 @@
import { firebaseRef } from 'app/firebase/' import { firebaseRef } from 'app/firebase/'
// - Import domain // - Import domain
import { Profile } from "domain/users"; import { Profile } from 'domain/users'
// - Import action types // - Import action types
import {UserActionType} from 'constants/userActionType' import {UserActionType} from 'constants/userActionType'
@@ -11,7 +11,7 @@ import {UserActionType} from 'constants/userActionType'
import * as globalActions from 'actions/globalActions' import * as globalActions from 'actions/globalActions'
import * as userActions from 'actions/userActions' import * as userActions from 'actions/userActions'
declare const console: any; declare const console: any
/* _____________ CRUD DB _____________ */ /* _____________ CRUD DB _____________ */
@@ -23,10 +23,10 @@ export const dbGetUserInfo = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`); let userProfileRef: any = firebaseRef.child(`users/${uid}/info`)
return userProfileRef.once('value').then((snapshot: any) => { return userProfileRef.once('value').then((snapshot: any) => {
let userProfile: Profile = snapshot.val() || {}; let userProfile: Profile = snapshot.val() || {}
dispatch(addUserInfo(uid, { dispatch(addUserInfo(uid, {
avatar: userProfile.avatar, avatar: userProfile.avatar,
@@ -35,7 +35,7 @@ export const dbGetUserInfo = () => {
banner: userProfile.banner, banner: userProfile.banner,
tagLine: userProfile.tagLine tagLine: userProfile.tagLine
})) }))
}, (error: any) => console.log(error)); }, (error: any) => console.log(error))
} }
} }
@@ -49,10 +49,10 @@ export const dbGetUserInfo = () => {
export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => { export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
if (uid) { if (uid) {
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`); let userProfileRef: any = firebaseRef.child(`users/${uid}/info`)
return userProfileRef.once('value').then((snapshot: any) => { return userProfileRef.once('value').then((snapshot: any) => {
let userProfile = snapshot.val() || {}; let userProfile = snapshot.val() || {}
dispatch(addUserInfo(uid, { dispatch(addUserInfo(uid, {
avatar: userProfile.avatar, avatar: userProfile.avatar,
email: userProfile.email, email: userProfile.email,
@@ -64,12 +64,12 @@ export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => {
case 'header': case 'header':
dispatch(globalActions.setHeaderTitle(userProfile.fullName)) dispatch(globalActions.setHeaderTitle(userProfile.fullName))
break; break
default: default:
break; break
} }
}, (error: any) => console.log(error)); }, (error: any) => console.log(error))
} }
} }
@@ -86,7 +86,7 @@ export const dbUpdateUserInfo = (newProfile: Profile) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
let updates: any = {}; let updates: any = {}
let profile = getState().user.info[uid] let profile = getState().user.info[uid]
let updateProfie: Profile = { let updateProfie: Profile = {
avatar: newProfile.avatar || profile.avatar || '', avatar: newProfile.avatar || profile.avatar || '',
@@ -112,12 +112,12 @@ export const dbGetPeopleInfo = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let peopleRef: any = firebaseRef.child(`users`); let peopleRef: any = firebaseRef.child(`users`)
return peopleRef.once('value').then((snapshot: any) => { return peopleRef.once('value').then((snapshot: any) => {
let people = snapshot.val() || {}; let people = snapshot.val() || {}
let parsedPeople: {[userId: string]: Profile} = {}; let parsedPeople: {[userId: string]: Profile} = {}
Object.keys(people).forEach((userId) => { Object.keys(people).forEach((userId) => {
if (userId !== uid) { if (userId !== uid) {
let userInfo = people[userId].info let userInfo = people[userId].info
@@ -132,7 +132,7 @@ export const dbGetPeopleInfo = () => {
}) })
dispatch(addPeopleInfo(parsedPeople)) dispatch(addPeopleInfo(parsedPeople))
}, (error: any) => console.log(error)); }, (error: any) => console.log(error))
} }
} }

View File

@@ -5,13 +5,13 @@ import { firebaseRef } from 'app/firebase/'
import {VoteActionType} from 'constants/voteActionType' import {VoteActionType} from 'constants/voteActionType'
// - Import domain // - Import domain
import { Vote } from "domain/votes"; import { Vote } from 'domain/votes'
// - Import actions // - Import actions
import * as globalActions from 'actions/globalActions' import * as globalActions from 'actions/globalActions'
import * as notifyActions from 'actions/notifyActions' import * as notifyActions from 'actions/notifyActions'
declare const console: any; declare const console: any
/* _____________ CRUD DB _____________ */ /* _____________ CRUD DB _____________ */
/** /**
@@ -22,8 +22,8 @@ declare const console: any;
export const dbAddVote = (postId: string,ownerPostUserId: string) => { export const dbAddVote = (postId: string,ownerPostUserId: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid; let uid: string = getState().authorize.uid
var vote: Vote = { let vote: Vote = {
postId: postId, postId: postId,
creationDate: moment().unix(), creationDate: moment().unix(),
userDisplayName: getState().user.info[uid].fullName, userDisplayName: getState().user.info[uid].fullName,
@@ -31,7 +31,7 @@ export const dbAddVote = (postId: string,ownerPostUserId: string) => {
userId: uid userId: uid
} }
var voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote) let voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote)
return voteRef.then(() => { return voteRef.then(() => {
dispatch(addVote( dispatch(addVote(
{ {
@@ -60,10 +60,10 @@ export const dbGetVotes = () => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
let uid: string = getState().authorize.uid let uid: string = getState().authorize.uid
if (uid) { if (uid) {
let votesRef: any = firebaseRef.child(`postVotes`); let votesRef: any = firebaseRef.child(`postVotes`)
return votesRef.on('value',(snapshot: any) => { return votesRef.on('value',(snapshot: any) => {
let postVotes: {[postId:string]: {[voteId: string]: Vote}} = snapshot.val() || {}; let postVotes: {[postId:string]: {[voteId: string]: Vote}} = snapshot.val() || {}
dispatch(addVoteList(postVotes)) dispatch(addVoteList(postVotes))
}) })
@@ -81,15 +81,15 @@ export const dbDeleteVote = (postId: string) => {
return (dispatch: any, getState: Function) => { return (dispatch: any, getState: Function) => {
// Get current user id // Get current user id
let uid: string = getState().authorize.uid; let uid: string = getState().authorize.uid
// Write the new data simultaneously in the list // Write the new data simultaneously in the list
var updates: any = {}; let updates: any = {}
let votes: {[voteId: string]: Vote} = getState().vote.postVotes[postId] let votes: {[voteId: string]: Vote} = getState().vote.postVotes[postId]
let id: string = Object.keys(votes).filter((key)=> votes[key].userId === uid)[0] let id: string = Object.keys(votes).filter((key)=> votes[key].userId === uid)[0]
updates[`postVotes/${postId}/${id}`] = null; updates[`postVotes/${postId}/${id}`] = null
return firebaseRef.update(updates).then((result) => { return firebaseRef.update(updates).then((result) => {
dispatch(deleteVote(id, postId)) dispatch(deleteVote(id, postId))

View File

@@ -1,16 +1,16 @@
// - Import firebase components // - Import firebase components
import {firebaseAuth, firebaseRef} from 'app/firebase/'; import {firebaseAuth, firebaseRef} from 'app/firebase/'
import store from 'store/configureStore'; import store from 'store/configureStore'
// - Check user if is authorized // - Check user if is authorized
export var isAuthorized = () => { export let isAuthorized = () => {
var state = store.getState(); let state = store.getState()
return state.authorize.authed; return state.authorize.authed
}; }
export var isAdmin = () =>{ export let isAdmin = () =>{
return true; return true
}; }

View File

@@ -6,8 +6,8 @@ import {Route, Redirect} from 'react-router-dom'
import * as AuthAPI from 'AuthAPI' import * as AuthAPI from 'AuthAPI'
export var PrivateRoute = ({component: Component, ...rest}) => { export let PrivateRoute = ({component: Component, ...rest}) => {
console.log('is auth ; ', AuthAPI.isAuthorized()); console.log('is auth ', AuthAPI.isAuthorized())
return ( return (
<Route <Route
{...rest} {...rest}
@@ -18,7 +18,7 @@ export var PrivateRoute = ({component: Component, ...rest}) => {
) )
} }
export var PublicRoute = ({component: Component,...rest}) => { export let PublicRoute = ({component: Component,...rest}) => {
return ( return (
<Route <Route
{...rest} {...rest}

View File

@@ -5,18 +5,18 @@ import { storageRef } from 'app/firebase/'
// - Get file Extension // - Get file Extension
const getExtension = (fileName) => { const getExtension = (fileName) => {
var re = /(?:\.([^.]+))?$/; let re = /(?:\.([^.]+))?$/
return re.exec(fileName)[1]; return re.exec(fileName)[1]
} }
// Converts image to canvas; returns new canvas element // Converts image to canvas returns new canvas element
const convertImageToCanvas = (image) => { const convertImageToCanvas = (image) => {
var canvas = document.createElement("canvas"); let canvas = document.createElement('canvas')
canvas.width = image.width; canvas.width = image.width
canvas.height = image.height; canvas.height = image.height
canvas.getContext("2d").drawImage(image, 0, 0); canvas.getContext('2d').drawImage(image, 0, 0)
return canvas; return canvas
} }
/** /**
@@ -28,10 +28,10 @@ const uploadImage = (file, fileName, progress) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Create a storage refrence // Create a storage refrence
var storegeFile = storageRef.child(`images/${fileName}`) let storegeFile = storageRef.child(`images/${fileName}`)
// Upload file // Upload file
var task = storegeFile.put(file) let task = storegeFile.put(file)
task.then((result) => { task.then((result) => {
resolve(result) resolve(result)
}).catch((error) => { }).catch((error) => {
@@ -40,7 +40,7 @@ const uploadImage = (file, fileName, progress) => {
// Upload storage bar // Upload storage bar
task.on('state_changed', (snapshot) => { task.on('state_changed', (snapshot) => {
var percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100 let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
progress(percentage, true) progress(percentage, true)
}, (error) => { }, (error) => {
console.log('========== Upload Image ============') console.log('========== Upload Image ============')
@@ -65,40 +65,40 @@ const constraintImage = (file,fileName, maxWidth, maxHeight) => {
if(file.type.match(/image.*/)) { if(file.type.match(/image.*/)) {
// Load the image // Load the image
var reader = new FileReader(); let reader = new FileReader()
reader.onload = function (readerEvent) { reader.onload = function (readerEvent) {
var image = new Image(); let image = new Image()
image.onload = function (imageEvent) { image.onload = function (imageEvent) {
// Resize the image // Resize the image
var canvas = document.createElement('canvas'), let canvas = document.createElement('canvas'),
max_size = 986,// TODO : pull max size from a site config max_size = 986,// TODO : pull max size from a site config
width = image.width, width = image.width,
height = image.height; height = image.height
if (width > height) { if (width > height) {
if (width > max_size) { if (width > max_size) {
height *= max_size / width; height *= max_size / width
width = max_size; width = max_size
} }
} else { } else {
if (height > max_size) { if (height > max_size) {
width *= max_size / height; width *= max_size / height
height = max_size; height = max_size
} }
} }
canvas.width = width; canvas.width = width
canvas.height = height; canvas.height = height
canvas.getContext('2d').drawImage(image, 0, 0, width, height); canvas.getContext('2d').drawImage(image, 0, 0, width, height)
var dataUrl = canvas.toDataURL(); let dataUrl = canvas.toDataURL()
var resizedImage = dataURLToBlob(dataUrl); let resizedImage = dataURLToBlob(dataUrl)
let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} }); let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} })
window.dispatchEvent(evt); window.dispatchEvent(evt)
} }
image.src = readerEvent.target.result; image.src = readerEvent.target.result
} }
reader.readAsDataURL(file); reader.readAsDataURL(file)
} }
} }
@@ -109,23 +109,23 @@ const constraintImage = (file,fileName, maxWidth, maxHeight) => {
*/ */
const dataURLToBlob = (dataURL) => { const dataURLToBlob = (dataURL) => {
var BASE64_MARKER = ';base64,' let BASE64_MARKER = 'base64,'
if (dataURL.indexOf(BASE64_MARKER) == -1) { if (dataURL.indexOf(BASE64_MARKER) == -1) {
var parts = dataURL.split(',') let parts = dataURL.split(',')
var contentType = parts[0].split(':')[1] let contentType = parts[0].split(':')[1]
var raw = parts[1] let raw = parts[1]
return new Blob([raw], {type: contentType}) return new Blob([raw], {type: contentType})
} }
var parts = dataURL.split(BASE64_MARKER) let parts = dataURL.split(BASE64_MARKER)
var contentType = parts[0].split(':')[1] let contentType = parts[0].split(':')[1]
var raw = window.atob(parts[1]) let raw = window.atob(parts[1])
var rawLength = raw.length let rawLength = raw.length
var uInt8Array = new Uint8Array(rawLength) let uInt8Array = new Uint8Array(rawLength)
for (var i = 0; i < rawLength; ++i) { for (let i = 0 i < rawLength ++i) {
uInt8Array[i] = raw.charCodeAt(i) uInt8Array[i] = raw.charCodeAt(i)
} }

View File

@@ -8,8 +8,8 @@ export const detectTags = (content,character) => {
} }
export const getContentTags = (content) => { export const getContentTags = (content) => {
var newTags = [] let newTags = []
var tags = detectTags(content,'#') let tags = detectTags(content,'#')
tags.forEach((tag)=>{ tags.forEach((tag)=>{
newTags.push(tag.slice(1)) newTags.push(tag.slice(1))
}) })
@@ -17,13 +17,13 @@ export const getContentTags = (content) => {
} }
export const sortObjectsDate = (objects) => { export const sortObjectsDate = (objects) => {
var sortedObjects = objects; let sortedObjects = objects
// Sort posts with creation date // Sort posts with creation date
sortedObjects.sort((a, b) => { sortedObjects.sort((a, b) => {
return parseInt(b.creationDate) - parseInt(a.creationDate) return parseInt(b.creationDate) - parseInt(a.creationDate)
}); })
return sortedObjects; return sortedObjects
} }

View File

@@ -4,7 +4,7 @@ import { storageRef } from 'app/firebase/'
//- Import actions //- Import actions
const isValidEmail = (email) => { const isValidEmail = (email) => {
var 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,}))$/; 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,}))$/
return re.test(email) return re.test(email)
} }

View File

@@ -1,6 +1,6 @@
// - Import react components // - Import react components
import React, { Component } from 'react' import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card' import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card'
@@ -120,8 +120,8 @@ export class Blog extends Component {
} }
else { else {
var postBack = { oddPostList: [], evenPostList: [] } let postBack = { oddPostList: [], evenPostList: [] }
var parsedPosts = [] let parsedPosts = []
Object.keys(posts).forEach((postId) => { Object.keys(posts).forEach((postId) => {
if(tag){ if(tag){
let regex = new RegExp("#" + tag,'g') let regex = new RegExp("#" + tag,'g')
@@ -142,7 +142,7 @@ export class Blog extends Component {
} }
sortedPosts.forEach((post, index) => { sortedPosts.forEach((post, index) => {
var newPost = ( let newPost = (
<div key={post.id}> <div key={post.id}>
{index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: "16px" }}></div> : ''} {index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: "16px" }}></div> : ''}

View File

@@ -120,17 +120,17 @@ static propTypes = {
* @return {DOM} list of comments' DOM * @return {DOM} list of comments' DOM
*/ */
commentList = () => { commentList = () => {
var comments = this.props.comments let comments = this.props.comments
if (comments) { if (comments) {
var parsedComments = []; let parsedComments = []
Object.keys(comments).slice(0, 3).forEach((commentId) => { Object.keys(comments).slice(0, 3).forEach((commentId) => {
parsedComments.push({ parsedComments.push({
id: commentId, id: commentId,
...comments[commentId] ...comments[commentId]
}); })
}); })
if (parsedComments.length === 2) { if (parsedComments.length === 2) {
parsedComments.push(parsedComments[0]) parsedComments.push(parsedComments[0])
} }
@@ -230,7 +230,7 @@ static propTypes = {
</Paper> </Paper>
</div>): ''} </div>): ''}
</div> </div>
); )
} }
} }

View File

@@ -1,6 +1,6 @@
// - Import react components // - Import react components
import React, { Component } from 'react' import React, { Component } from 'react'
import { connect } from 'react-redux'; import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { List, ListItem } from 'material-ui/List' import { List, ListItem } from 'material-ui/List'
@@ -57,17 +57,17 @@ export class CommentList extends Component {
* @return {DOM} list of comments' DOM * @return {DOM} list of comments' DOM
*/ */
commentList = () => { commentList = () => {
var comments = this.props.comments let comments = this.props.comments
if (comments) { if (comments) {
var parsedComments = []; let parsedComments = []
Object.keys(comments).forEach((commentId) => { Object.keys(comments).forEach((commentId) => {
parsedComments.push({ parsedComments.push({
id: commentId, id: commentId,
...comments[commentId] ...comments[commentId]
}); })
}); })
let sortedComments = PostAPI.sortObjectsDate(parsedComments) let sortedComments = PostAPI.sortObjectsDate(parsedComments)
return sortedComments.map((comment, index, array) => { return sortedComments.map((comment, index, array) => {

View File

@@ -11,21 +11,21 @@ import * as commentActions from 'commentActions'
// - Define variable // - Define variable
const buttonStyle = { const buttonStyle = {
marginTop: '5px' marginTop: '5px'
}; }
// - Create CommentWrite component class // - Create CommentWrite component class
export class CommentWrite extends Component { export class CommentWrite extends Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
inputValue:'' inputValue:''
} }
// Binding functions to `this` // Binding functions to `this`
this.handleRef = this.handleRef.bind(this); this.handleRef = this.handleRef.bind(this)
this.focus = this.focus.bind(this); this.focus = this.focus.bind(this)
this.handleAddComment = this.handleAddComment.bind(this); this.handleAddComment = this.handleAddComment.bind(this)
this.handleOnChange = this.handleOnChange.bind(this) this.handleOnChange = this.handleOnChange.bind(this)
} }
@@ -56,7 +56,7 @@ export class CommentWrite extends Component {
<Button basic style={buttonStyle} onClick={this.handleAddComment} color='teal'>Add Comment</Button> <Button basic style={buttonStyle} onClick={this.handleAddComment} color='teal'>Add Comment</Button>
</div> </div>
); )
} }
} }

View File

@@ -153,9 +153,9 @@ export class EditProfile extends Component {
* Set banner image url * Set banner image url
*/ */
handleRequestSetBanner = (url) => { handleRequestSetBanner = (url) => {
console.log('==========Banner=================='); console.log('==========Banner==================')
console.log(url); console.log(url)
console.log('===================================='); console.log('====================================')
this.setState({ this.setState({
banner: url banner: url
}) })
@@ -226,7 +226,7 @@ export class EditProfile extends Component {
handleResize = (evt) => { handleResize = (evt) => {
// Set initial state // Set initial state
var width = window.innerWidth let width = window.innerWidth
if (width > 900) { if (width > 900) {
this.setState({ this.setState({

View File

@@ -90,12 +90,12 @@ export class HomeHeader extends Component {
*/ */
handleNotifyTouchTap = (event) => { handleNotifyTouchTap = (event) => {
// This prevents ghost click. // This prevents ghost click.
event.preventDefault(); event.preventDefault()
this.setState({ this.setState({
openNotifyMenu: true, openNotifyMenu: true,
anchorEl: event.currentTarget, anchorEl: event.currentTarget,
}); })
} }
/** /**
@@ -106,12 +106,12 @@ export class HomeHeader extends Component {
*/ */
handleAvatarTouchTap = (event) => { handleAvatarTouchTap = (event) => {
// This prevents ghost click. // This prevents ghost click.
event.preventDefault(); event.preventDefault()
this.setState({ this.setState({
openAvatarMenu: true, openAvatarMenu: true,
anchorEl: event.currentTarget, anchorEl: event.currentTarget,
}); })
} }
/** /**
@@ -133,8 +133,8 @@ export class HomeHeader extends Component {
handleRequestClose = () => { handleRequestClose = () => {
this.setState({ this.setState({
openAvatarMenu: false, openAvatarMenu: false,
}); })
}; }
/** /**
@@ -144,7 +144,7 @@ export class HomeHeader extends Component {
handleResize = (evt) => { handleResize = (evt) => {
// Set initial state // Set initial state
var width = window.innerWidth let width = window.innerWidth
if (width >= 600 && !this.state.showTitle) { if (width >= 600 && !this.state.showTitle) {
this.setState({ this.setState({
@@ -171,7 +171,7 @@ export class HomeHeader extends Component {
/** /**
* Styles * Styles
*/ */
var styles = { let styles = {
toolbarStyle: { toolbarStyle: {
backgroundColor: "", backgroundColor: "",
transition: "all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms", transition: "all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",

View File

@@ -6,7 +6,7 @@ import { GridList, GridTile } from 'material-ui/GridList'
import IconButton from 'material-ui/IconButton' import IconButton from 'material-ui/IconButton'
import Subheader from 'material-ui/Subheader' import Subheader from 'material-ui/Subheader'
import StarBorder from 'material-ui/svg-icons/toggle/star-border' import StarBorder from 'material-ui/svg-icons/toggle/star-border'
import FloatingActionButton from 'material-ui/FloatingActionButton'; import FloatingActionButton from 'material-ui/FloatingActionButton'
import SvgUpload from 'material-ui/svg-icons/file/cloud-upload' import SvgUpload from 'material-ui/svg-icons/file/cloud-upload'
import SvgAddImage from 'material-ui/svg-icons/image/add-a-photo' import SvgAddImage from 'material-ui/svg-icons/image/add-a-photo'
import SvgDelete from 'material-ui/svg-icons/action/delete' import SvgDelete from 'material-ui/svg-icons/action/delete'
@@ -43,7 +43,7 @@ export class ImageGallery extends Component {
* @param {object} props is an object properties of component * @param {object} props is an object properties of component
*/ */
constructor(props) { constructor(props) {
super(props); super(props)
// Binding function to `this` // Binding function to `this`
this.close = this.close.bind(this) this.close = this.close.bind(this)
@@ -106,7 +106,7 @@ export class ImageGallery extends Component {
onFileChange = (evt) => { onFileChange = (evt) => {
const extension = FileAPI.getExtension(evt.target.files[0].name) const extension = FileAPI.getExtension(evt.target.files[0].name)
var fileName = (`${uuid()}.${extension}`) let fileName = (`${uuid()}.${extension}`)
let image = FileAPI.constraintImage(evt.target.files[0], fileName) let image = FileAPI.constraintImage(evt.target.files[0], fileName)
} }

View File

@@ -20,7 +20,7 @@ export class Login extends Component {
* @param {object} props is an object properties of component * @param {object} props is an object properties of component
*/ */
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
emailInput: '', emailInput: '',
@@ -40,12 +40,12 @@ export class Login extends Component {
* @param {event} evt is an event of inputs of element on change * @param {event} evt is an event of inputs of element on change
*/ */
handleInputChange = (evt) => { handleInputChange = (evt) => {
const target = evt.target; const target = evt.target
const value = target.type === 'checkbox' ? target.checked : target.value; const value = target.type === 'checkbox' ? target.checked : target.value
const name = target.name; const name = target.name
this.setState({ this.setState({
[name]: value [name]: value
}); })
switch (name) { switch (name) {
@@ -60,7 +60,7 @@ export class Login extends Component {
passwordInputError: '' passwordInputError: ''
}) })
break; break
default: default:
} }
@@ -71,7 +71,7 @@ export class Login extends Component {
*/ */
handleForm = () => { handleForm = () => {
var error = false let error = false
if (this.state.emailInput === '') { if (this.state.emailInput === '') {
this.setState({ this.setState({
emailInputError: 'This field is required' emailInputError: 'This field is required'
@@ -110,7 +110,7 @@ export class Login extends Component {
textAlign: 'center', textAlign: 'center',
display: 'block', display: 'block',
margin: "auto" margin: "auto"
}; }
return ( return (
<form> <form>

View File

@@ -13,12 +13,12 @@ export interface IMasterState {
* @type {Boolean} * @type {Boolean}
* @memberof IMasterState * @memberof IMasterState
*/ */
authed:Boolean; authed:Boolean
/** /**
* It's true if all default data loaded from database * It's true if all default data loaded from database
* *
* @type {Boolean} * @type {Boolean}
* @memberof IMasterState * @memberof IMasterState
*/ */
dataLoaded:Boolean; dataLoaded:Boolean
} }

View File

@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom' import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom'
import { firebaseAuth, firebaseRef } from 'app/firebase' import { firebaseAuth, firebaseRef } from 'app/firebase'
import { push } from 'react-router-redux' import { push } from 'react-router-redux'
import Snackbar from 'material-ui/Snackbar'; import Snackbar from 'material-ui/Snackbar'
import LinearProgress from 'material-ui/LinearProgress' import LinearProgress from 'material-ui/LinearProgress'
@@ -14,8 +14,8 @@ import Signup from 'components/Signup'
import Login from 'components/Login' import Login from 'components/Login'
import Settings from 'components/Settings' import Settings from 'components/Settings'
import MasterLoading from 'components/MasterLoading' import MasterLoading from 'components/MasterLoading'
import { IMasterProps } from "./IMasterProps"; import { IMasterProps } from "./IMasterProps"
import { IMasterState } from "./IMasterState"; import { IMasterState } from "./IMasterState"
// - Import API // - Import API
@@ -45,12 +45,12 @@ export class Master extends Component<IMasterProps,IMasterState>{
static isPrivate = true static isPrivate = true
// Constructor // Constructor
constructor(props : IMasterProps) { constructor(props : IMasterProps) {
super(props); super(props)
this.state = { this.state = {
loading: true, loading: true,
authed: false, authed: false,
dataLoaded: false dataLoaded: false
}; }
// Binding functions to `this` // Binding functions to `this`
this.handleLoading = this.handleLoading.bind(this) this.handleLoading = this.handleLoading.bind(this)
@@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch : any, ownProps : any) => {
* @param {object} state * @param {object} state
*/ */
const mapStateToProps = (state : any) => { const mapStateToProps = (state : any) => {
const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state; const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state
return { return {
guest: authorize.guest, guest: authorize.guest,
uid: authorize.uid, uid: authorize.uid,

View File

@@ -1,2 +1,2 @@
import Master from './Master'; import Master from './Master'
export default Master; export default Master

View File

@@ -12,7 +12,7 @@ export default class MasterLoading extends Component {
// Constructor // Constructor
constructor(props) { constructor(props) {
super(props); super(props)
// Binding functions to `this` // Binding functions to `this`
@@ -49,7 +49,7 @@ export default class MasterLoading extends Component {
); )
} }
} }

View File

@@ -53,15 +53,15 @@ export class People extends Component {
case undefined: case undefined:
case '': case '':
this.props.setHeaderTitle('People') this.props.setHeaderTitle('People')
break; break
case 'circles': case 'circles':
this.props.setHeaderTitle('Circles') this.props.setHeaderTitle('Circles')
break; break
case 'followers': case 'followers':
this.props.setHeaderTitle('Followers') this.props.setHeaderTitle('Followers')
break; break
default: default:
break; break
} }
} }
@@ -98,15 +98,15 @@ export class People extends Component {
case undefined: case undefined:
case '': case '':
tabIndex = 0 tabIndex = 0
break; break
case 'circles': case 'circles':
tabIndex = 1 tabIndex = 1
break; break
case 'followers': case 'followers':
tabIndex = 2 tabIndex = 2
break; break
default: default:
break; break
} }
return ( return (
<div style={styles.people}> <div style={styles.people}>

View File

@@ -297,7 +297,7 @@ static propTypes = {
this.setState({ this.setState({
readMoreState: !this.state.readMoreState readMoreState: !this.state.readMoreState
}); })
} }
componentDidMount() { componentDidMount() {

View File

@@ -4,9 +4,9 @@ import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { List, ListItem } from 'material-ui/List' import { List, ListItem } from 'material-ui/List'
import Paper from 'material-ui/Paper' import Paper from 'material-ui/Paper'
import Dialog from 'material-ui/Dialog'; import Dialog from 'material-ui/Dialog'
import FlatButton from 'material-ui/FlatButton'; import FlatButton from 'material-ui/FlatButton'
import RaisedButton from 'material-ui/RaisedButton'; import RaisedButton from 'material-ui/RaisedButton'
import { grey400, grey800, darkBlack, lightBlack } from 'material-ui/styles/colors' import { grey400, grey800, darkBlack, lightBlack } from 'material-ui/styles/colors'
import IconButton from 'material-ui/IconButton' import IconButton from 'material-ui/IconButton'
import TextField from 'material-ui/TextField' import TextField from 'material-ui/TextField'
@@ -182,7 +182,7 @@ export class PostWrite extends Component {
post, post,
update } = this.props update } = this.props
var tags = PostAPI.getContentTags(postText) let tags = PostAPI.getContentTags(postText)
// In edit status we should fire update if not we should fire post function // In edit status we should fire update if not we should fire post function
if (!edit) { if (!edit) {
@@ -329,9 +329,9 @@ export class PostWrite extends Component {
<MenuItem onClick={this.handleToggleSharing} style={{ fontSize: "14px" }}>{!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'}</MenuItem> <MenuItem onClick={this.handleToggleSharing} style={{ fontSize: "14px" }}>{!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'}</MenuItem>
</IconMenu> </IconMenu>
) )
var postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} /> let postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} />
var author = ( let author = (
<div> <div>
<span style={{ <span style={{
fontSize: "14px", fontSize: "14px",

View File

@@ -91,7 +91,7 @@ export class ProfileHead extends Component {
handleResize = (evt) => { handleResize = (evt) => {
// Set initial state // Set initial state
var width = window.innerWidth let width = window.innerWidth
if (width > 900) { if (width > 900) {
this.setState({ this.setState({

View File

@@ -26,7 +26,7 @@ export class Settings extends Component {
* @param {object} props is an object properties of component * @param {object} props is an object properties of component
*/ */
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
passwordInput: '', passwordInput: '',
@@ -46,12 +46,12 @@ export class Settings extends Component {
* @param {event} evt is an event of inputs of element on change * @param {event} evt is an event of inputs of element on change
*/ */
handleInputChange = (evt) => { handleInputChange = (evt) => {
const target = evt.target; const target = evt.target
const value = target.type === 'checkbox' ? target.checked : target.value; const value = target.type === 'checkbox' ? target.checked : target.value
const name = target.name; const name = target.name
this.setState({ this.setState({
[name]: value [name]: value
}); })
switch (name) { switch (name) {
@@ -66,7 +66,7 @@ export class Settings extends Component {
passwordInputError: '' passwordInputError: ''
}) })
break; break
default: default:
} }
@@ -77,7 +77,7 @@ export class Settings extends Component {
*/ */
handleForm = () => { handleForm = () => {
var error = false let error = false
if (this.state.passwordInput === '') { if (this.state.passwordInput === '') {
this.setState({ this.setState({
passwordInputError: 'This field is required' passwordInputError: 'This field is required'
@@ -122,7 +122,7 @@ export class Settings extends Component {
textAlign: 'center', textAlign: 'center',
display: 'block', display: 'block',
margin: "auto" margin: "auto"
}; }
return ( return (
<div> <div>

View File

@@ -16,8 +16,8 @@ import * as authorizeActions from 'authorizeActions'
import * as globalActions from 'globalActions' import * as globalActions from 'globalActions'
// - Feilds // - Feilds
const color = 'teal'; const color = 'teal'
const colorKey = 'blue'; const colorKey = 'blue'
const sizeCondition = (width) => (width >= 750) const sizeCondition = (width) => (width >= 750)
@@ -124,12 +124,12 @@ export class Sidebar extends Component {
this.setState({ this.setState({
auto: true auto: true
}) })
break; break
case 'overlay': case 'overlay':
this.setState({ this.setState({
shouldBeClosed: true shouldBeClosed: true
}) })
break; break
default: default:
} }
@@ -159,7 +159,7 @@ export class Sidebar extends Component {
handleResize = (evt) => { handleResize = (evt) => {
// Set initial state // Set initial state
var width = window.innerWidth let width = window.innerWidth
if (sizeCondition(width)) { if (sizeCondition(width)) {
@@ -202,7 +202,7 @@ export class Sidebar extends Component {
* Handle logout user * Handle logout user
*/ */
handleLogout = () => { handleLogout = () => {
var { dispatch } = this.props let { dispatch } = this.props
dispatch(authorizeActions.dbLogout()) dispatch(authorizeActions.dbLogout())
} }
@@ -215,7 +215,7 @@ export class Sidebar extends Component {
handleKeyUp = (evt) => { handleKeyUp = (evt) => {
if (this.state.overlayOpen) { if (this.state.overlayOpen) {
if (this.state.open && keycode(event) === 'esc') { if (this.state.open && keycode(event) === 'esc') {
this.open(false); this.open(false)
} }
} }
} }

View File

@@ -24,7 +24,7 @@ export class Signup extends Component {
* @param {object} props is an object properties of component * @param {object} props is an object properties of component
*/ */
constructor(props){ constructor(props){
super(props); super(props)
this.state = { this.state = {
fullNameInput: '', fullNameInput: '',
@@ -82,7 +82,7 @@ export class Signup extends Component {
this.setState({ this.setState({
checkInputError: '' checkInputError: ''
}) })
break; break
default: default:
@@ -97,7 +97,7 @@ export class Signup extends Component {
const {fullNameInput, emailInput, passwordInput, confirmInput} = this.state const {fullNameInput, emailInput, passwordInput, confirmInput} = this.state
const {register} = this.props const {register} = this.props
var error = false let error = false
// Validate full name // Validate full name
let fullNameCheck = fullNameInput.trim().toLowerCase() let fullNameCheck = fullNameInput.trim().toLowerCase()
@@ -165,7 +165,7 @@ export class Signup extends Component {
textAlign: 'center', textAlign: 'center',
display: 'block', display: 'block',
margin: "auto" margin: "auto"
}; }
return ( return (

View File

@@ -5,9 +5,9 @@ import PropTypes from 'prop-types'
import {push} from 'react-router-redux' import {push} from 'react-router-redux'
import Paper from 'material-ui/Paper' import Paper from 'material-ui/Paper'
import FlatButton from 'material-ui/FlatButton' import FlatButton from 'material-ui/FlatButton'
import RaisedButton from 'material-ui/RaisedButton'; import RaisedButton from 'material-ui/RaisedButton'
import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'; import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'
import Menu from 'material-ui/Menu'; import Menu from 'material-ui/Menu'
import MenuItem from 'material-ui/MenuItem' import MenuItem from 'material-ui/MenuItem'
import Checkbox from 'material-ui/Checkbox' import Checkbox from 'material-ui/Checkbox'
import TextField from 'material-ui/TextField' import TextField from 'material-ui/TextField'
@@ -118,7 +118,7 @@ export class UserBox extends Component {
*/ */
handleTouchTap = (evt) => { handleTouchTap = (evt) => {
// This prevents ghost click. // This prevents ghost click.
event.preventDefault(); event.preventDefault()
this.setState({ this.setState({
open: true, open: true,

View File

@@ -1,11 +1,11 @@
export enum PostActionType { export enum PostActionType {
ADD_IMAGE_POST = "ADD_IMAGE_POST", ADD_IMAGE_POST = 'ADD_IMAGE_POST',
ADD_VIDEO_POST = "ADD_VIDEO_POST", ADD_VIDEO_POST = 'ADD_VIDEO_POST',
ADD_POST = "ADD_POST", ADD_POST = 'ADD_POST',
UPDATE_POST = "UPDATE_POST", UPDATE_POST = 'UPDATE_POST',
DELETE_POST = "DELETE_POST", DELETE_POST = 'DELETE_POST',
ADD_LIST_POST = "ADD_LIST_POST", ADD_LIST_POST = 'ADD_LIST_POST',
CLEAR_ALL_DATA_POST = "CLEAR_ALL_DATA_POST" CLEAR_ALL_DATA_POST = 'CLEAR_ALL_DATA_POST'
} }

View File

@@ -1,5 +1,5 @@
import { LoginUser } from "./loginResult"; import { LoginUser } from './loginResult'
import { RegisterUserResult } from "./registerUserResult"; import { RegisterUserResult } from './registerUserResult'
export { export {
LoginUser, LoginUser,

View File

@@ -1,11 +1,11 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class LoginUser extends BaseDomain{ export class LoginUser extends BaseDomain{
constructor(uid: string){ constructor(uid: string){
super(); super()
this._uid = uid; this._uid = uid
} }
/** /**
@@ -15,9 +15,9 @@ export class LoginUser extends BaseDomain{
* @memberof LoginUser * @memberof LoginUser
*/ */
private _uid : string; private _uid : string
public get uid() : string { public get uid() : string {
return this._uid; return this._uid
} }

View File

@@ -1,11 +1,11 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class RegisterUserResult extends BaseDomain{ export class RegisterUserResult extends BaseDomain{
constructor(uid: string){ constructor(uid: string){
super(); super()
this._uid = uid; this._uid = uid
} }
/** /**
* User identifier * User identifier
@@ -14,9 +14,9 @@ export class RegisterUserResult extends BaseDomain{
* @memberof LoginUser * @memberof LoginUser
*/ */
private _uid : string; private _uid : string
public get uid() : string { public get uid (): string {
return this._uid; return this._uid
} }
} }

View File

@@ -1,5 +1,5 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
import { User } from "domain/users"; import { User } from 'domain/users'
export class Circle extends BaseDomain { export class Circle extends BaseDomain {
@@ -9,7 +9,7 @@ export class Circle extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public id?: string | null; public id?: string | null
/** /**
* Circle creation date time * Circle creation date time
@@ -17,7 +17,7 @@ export class Circle extends BaseDomain {
* @type {Date} * @type {Date}
* @memberof Circle * @memberof Circle
*/ */
public creationDate?: number; public creationDate?: number
/** /**
* Circle owner identifier * Circle owner identifier
@@ -25,7 +25,7 @@ export class Circle extends BaseDomain {
* @type {string} * @type {string}
* @memberof Circle * @memberof Circle
*/ */
public ownerId?: string | null; public ownerId?: string | null
/** /**
* Circle name * Circle name
@@ -33,7 +33,7 @@ export class Circle extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public name: string; public name: string
/** /**
* The users in a circle * The users in a circle
@@ -41,7 +41,7 @@ export class Circle extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public users: {[userId:string]: User}; public users: {[userId:string]: User}

View File

@@ -1,5 +1,5 @@
import {Circle} from './circle'; import {Circle} from './circle'
import {UserFollower} from './userFollower'; import {UserFollower} from './userFollower'
export { export {
Circle, Circle,

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class UserFollower extends BaseDomain { export class UserFollower extends BaseDomain {
@@ -9,7 +9,7 @@ export class UserFollower extends BaseDomain {
* @type {Date} * @type {Date}
* @memberof Circle * @memberof Circle
*/ */
public creationDate?: number; public creationDate?: number
/** /**
* User full name * User full name
@@ -17,7 +17,7 @@ export class UserFollower extends BaseDomain {
* @type {string} * @type {string}
* @memberof UserFollower * @memberof UserFollower
*/ */
public fullName: string; public fullName: string
/** /**
* Avatar URL address * Avatar URL address
@@ -25,7 +25,7 @@ export class UserFollower extends BaseDomain {
* @type {string} * @type {string}
* @memberof UserFollower * @memberof UserFollower
*/ */
public avatar: string; public avatar: string
/** /**
* If following user approved {true} or not {false} * If following user approved {true} or not {false}
@@ -33,7 +33,7 @@ export class UserFollower extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof UserFollower * @memberof UserFollower
*/ */
public approved: Boolean; public approved: Boolean

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Comment extends BaseDomain { export class Comment extends BaseDomain {
@@ -8,7 +8,7 @@ export class Comment extends BaseDomain {
* @type {string} * @type {string}
* @memberof Comment * @memberof Comment
*/ */
public postId: string; public postId: string
/** /**
* Comment text * Comment text
@@ -16,7 +16,7 @@ export class Comment extends BaseDomain {
* @type {string} * @type {string}
* @memberof Comment * @memberof Comment
*/ */
public text: string; public text: string
/** /**
* Comment score * Comment score
@@ -24,7 +24,7 @@ export class Comment extends BaseDomain {
* @type {number} * @type {number}
* @memberof Comment * @memberof Comment
*/ */
public score: number; public score: number
/** /**
* Comment creation date * Comment creation date
@@ -32,7 +32,7 @@ export class Comment extends BaseDomain {
* @type {number} * @type {number}
* @memberof Comment * @memberof Comment
*/ */
public creationDate:number; public creationDate:number
/** /**
* Comment owner full name * Comment owner full name
@@ -40,7 +40,7 @@ export class Comment extends BaseDomain {
* @type {string} * @type {string}
* @memberof Comment * @memberof Comment
*/ */
public userDisplayName: string; public userDisplayName: string
/** /**
* Comment owner avater address * Comment owner avater address
@@ -48,7 +48,7 @@ export class Comment extends BaseDomain {
* @type {string} * @type {string}
* @memberof Comment * @memberof Comment
*/ */
public userAvatar: string; public userAvatar: string
/** /**
* Comment owner identifier * Comment owner identifier
@@ -56,6 +56,6 @@ export class Comment extends BaseDomain {
* @type {string} * @type {string}
* @memberof Comment * @memberof Comment
*/ */
public userId: string; public userId: string
} }

View File

@@ -1,4 +1,4 @@
import {Comment} from './comment'; import {Comment} from './comment'
export { export {
Comment Comment

View File

@@ -1,5 +1,5 @@
import { SocialError } from "./socialError"; import { SocialError } from './socialError'
import { BaseDomain } from "./baseDomain"; import { BaseDomain } from './baseDomain'
export { export {
SocialError, SocialError,

View File

@@ -1,9 +1,9 @@
export class SocialError{ export class SocialError{
constructor(code: string, description: string){ constructor(code: string, description: string){
this._code = code; this._code = code
this._description = description; this._description = description
this._isError = true; this._isError = true
} }
/** /**
@@ -12,9 +12,9 @@ export class SocialError{
* @type {string} * @type {string}
* @memberof SocialError * @memberof SocialError
*/ */
private _code : string; private _code : string
public get code() : string { public get code() : string {
return this._code; return this._code
} }
/** /**
@@ -24,9 +24,9 @@ export class SocialError{
* @memberof SocialError * @memberof SocialError
*/ */
private _description : string; private _description : string
public get description() : string { public get description() : string {
return this._description; return this._description
} }
@@ -37,9 +37,9 @@ export class SocialError{
* @memberof SocialError * @memberof SocialError
*/ */
private _isError : Boolean; private _isError : Boolean
public get isError() : Boolean { public get isError() : Boolean {
return this._isError; return this._isError
} }
} }

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Image extends BaseDomain { export class Image extends BaseDomain {
@@ -8,7 +8,7 @@ export class Image extends BaseDomain {
* @type {string} * @type {string}
* @memberof Image * @memberof Image
*/ */
public id?: string | null; public id?: string | null
/** /**
* Image creation date * Image creation date
@@ -16,7 +16,7 @@ export class Image extends BaseDomain {
* @type {number} * @type {number}
* @memberof Image * @memberof Image
*/ */
public creationDate: number; public creationDate: number
/** /**
* Image delete date * Image delete date
@@ -24,7 +24,7 @@ export class Image extends BaseDomain {
* @type {string} * @type {string}
* @memberof Image * @memberof Image
*/ */
public deleteDate: string; public deleteDate: string
/** /**
* Image URL address * Image URL address
@@ -32,7 +32,7 @@ export class Image extends BaseDomain {
* @type {string} * @type {string}
* @memberof Image * @memberof Image
*/ */
public URL: string; public URL: string
/** /**
* Image folder name with image name {folderName/imageName} * Image folder name with image name {folderName/imageName}
@@ -40,7 +40,7 @@ export class Image extends BaseDomain {
* @type {string} * @type {string}
* @memberof Image * @memberof Image
*/ */
public fullPath: string; public fullPath: string
/** /**
* Image owner identifier * Image owner identifier
@@ -48,7 +48,7 @@ export class Image extends BaseDomain {
* @type {string} * @type {string}
* @memberof Image * @memberof Image
*/ */
public ownerUserId: string; public ownerUserId: string
/** /**
* Last edit date * Last edit date
@@ -56,7 +56,7 @@ export class Image extends BaseDomain {
* @type {number} * @type {number}
* @memberof Image * @memberof Image
*/ */
public lastEditDate: number; public lastEditDate: number
/** /**
* If the image was deleted {true} or not {false} * If the image was deleted {true} or not {false}
@@ -64,6 +64,6 @@ export class Image extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof Image * @memberof Image
*/ */
public deleted: Boolean; public deleted: Boolean
} }

View File

@@ -1,4 +1,4 @@
import { Image } from "./image"; import { Image } from './image'
export { export {
Image Image

View File

@@ -1,4 +1,4 @@
import {Notification} from './notification'; import {Notification} from './notification'
export { export {
Notification Notification

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Notification extends BaseDomain { export class Notification extends BaseDomain {
@@ -8,7 +8,7 @@ export class Notification extends BaseDomain {
* @type {string} * @type {string}
* @memberof Notification * @memberof Notification
*/ */
public description: string; public description: string
/** /**
* The URL which notification refer to * The URL which notification refer to
@@ -16,7 +16,7 @@ export class Notification extends BaseDomain {
* @type {string} * @type {string}
* @memberof Notification * @memberof Notification
*/ */
public url: string; public url: string
/** /**
* The identifier of the user who makes the notification * The identifier of the user who makes the notification
@@ -24,7 +24,7 @@ export class Notification extends BaseDomain {
* @type {string} * @type {string}
* @memberof Notification * @memberof Notification
*/ */
public notifierUserId: string; public notifierUserId: string
/** /**
* The identifier of the user who receive the notification * The identifier of the user who receive the notification
@@ -32,7 +32,7 @@ export class Notification extends BaseDomain {
* @type {string} * @type {string}
* @memberof Notification * @memberof Notification
*/ */
public notifyRecieverUserId: string; public notifyRecieverUserId: string
/** /**
* If the notification is seen {true} or not {false} * If the notification is seen {true} or not {false}
@@ -40,6 +40,6 @@ export class Notification extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof Notification * @memberof Notification
*/ */
public isSeen: Boolean; public isSeen: Boolean
} }

View File

@@ -1,4 +1,4 @@
import {Post} from './post'; import {Post} from './post'
export { export {
Post Post

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Post extends BaseDomain { export class Post extends BaseDomain {
@@ -8,7 +8,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public id?: string | null; public id?: string | null
/** /**
* The identifier of post type * The identifier of post type
@@ -16,7 +16,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public postTypeId: number; public postTypeId: number
/** /**
* The post creation date * The post creation date
@@ -24,7 +24,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public creationDate:number; public creationDate:number
/** /**
* The post delete date * The post delete date
@@ -32,7 +32,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public deleteDate: number; public deleteDate: number
/** /**
* The score of post * The score of post
@@ -40,7 +40,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public score: number; public score: number
/** /**
* Post view count * Post view count
@@ -48,7 +48,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public viewCount: number; public viewCount: number
/** /**
* The text of post * The text of post
@@ -56,7 +56,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public body: string; public body: string
/** /**
* The identifier of post owner * The identifier of post owner
@@ -64,7 +64,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public ownerUserId: string; public ownerUserId: string
/** /**
* Full name of post owner * Full name of post owner
@@ -72,7 +72,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public ownerDisplayName: string; public ownerDisplayName: string
/** /**
* Avatar address of post owner * Avatar address of post owner
@@ -80,7 +80,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public ownerAvatar: string; public ownerAvatar: string
/** /**
* Last post edit date * Last post edit date
@@ -88,7 +88,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public lastEditDate: number; public lastEditDate: number
/** /**
* Post tags * Post tags
@@ -96,7 +96,7 @@ export class Post extends BaseDomain {
* @type {string[]} * @type {string[]}
* @memberof Post * @memberof Post
*/ */
public tags: string[]; public tags: string[]
/** /**
* Numeber of comment on the post * Numeber of comment on the post
@@ -104,7 +104,7 @@ export class Post extends BaseDomain {
* @type {number} * @type {number}
* @memberof Post * @memberof Post
*/ */
public commentCounter: number; public commentCounter: number
/** /**
* The address of image on the post * The address of image on the post
@@ -112,7 +112,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public image: string; public image: string
/** /**
* Post image full path * Post image full path
@@ -120,7 +120,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public imageFullPath: string; public imageFullPath: string
/** /**
* The adress of video on the post * The adress of video on the post
@@ -128,7 +128,7 @@ export class Post extends BaseDomain {
* @type {string} * @type {string}
* @memberof Post * @memberof Post
*/ */
public video: string; public video: string
/** /**
* If writing comment is disabled {true} or not {false} * If writing comment is disabled {true} or not {false}
@@ -136,7 +136,7 @@ export class Post extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof Post * @memberof Post
*/ */
public disableComments: Boolean; public disableComments: Boolean
/** /**
* If sharing post is disabled {true} or not {false} * If sharing post is disabled {true} or not {false}
@@ -144,7 +144,7 @@ export class Post extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof Post * @memberof Post
*/ */
public disableSharing: Boolean; public disableSharing: Boolean
/** /**
* If the post is deleted {true} or not false * If the post is deleted {true} or not false
@@ -152,7 +152,7 @@ export class Post extends BaseDomain {
* @type {Boolean} * @type {Boolean}
* @memberof Post * @memberof Post
*/ */
public deleted: Boolean; public deleted: Boolean
} }

View File

@@ -1,5 +1,5 @@
import {User} from './user'; import {User} from './user'
import {Profile} from './profile'; import {Profile} from './profile'
export { export {
User, User,

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Profile extends BaseDomain { export class Profile extends BaseDomain {
@@ -8,7 +8,7 @@ export class Profile extends BaseDomain {
* @type {string} * @type {string}
* @memberof Profile * @memberof Profile
*/ */
public avatar: string; public avatar: string
/** /**
* User email * User email
@@ -16,7 +16,7 @@ export class Profile extends BaseDomain {
* @type {string} * @type {string}
* @memberof Profile * @memberof Profile
*/ */
public email: string; public email: string
/** /**
* User full name * User full name
@@ -24,7 +24,7 @@ export class Profile extends BaseDomain {
* @type {string} * @type {string}
* @memberof Profile * @memberof Profile
*/ */
public fullName: string; public fullName: string
/** /**
* The banner address of user profile * The banner address of user profile
@@ -32,7 +32,7 @@ export class Profile extends BaseDomain {
* @type {string} * @type {string}
* @memberof Profile * @memberof Profile
*/ */
public banner: string; public banner: string
/** /**
* User tag line * User tag line
@@ -40,6 +40,6 @@ export class Profile extends BaseDomain {
* @type {string} * @type {string}
* @memberof Profile * @memberof Profile
*/ */
public tagLine: string; public tagLine: string
} }

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class User extends BaseDomain { export class User extends BaseDomain {
@@ -8,7 +8,7 @@ export class User extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public fullName: string; public fullName: string
/** /**
* User avatar address * User avatar address
@@ -16,7 +16,7 @@ export class User extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public avatar: string; public avatar: string
/** /**
* Email of the user * Email of the user
@@ -24,7 +24,7 @@ export class User extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public email?: string | null; public email?: string | null
/** /**
* Password of the user * Password of the user
@@ -32,7 +32,7 @@ export class User extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public password?: string | null; public password?: string | null
/** /**
* User identifier * User identifier
@@ -40,7 +40,7 @@ export class User extends BaseDomain {
* @type {string} * @type {string}
* @memberof User * @memberof User
*/ */
public userId?: string | null; public userId?: string | null
/** /**
* User creation date * User creation date
@@ -48,6 +48,6 @@ export class User extends BaseDomain {
* @type {number} * @type {number}
* @memberof User * @memberof User
*/ */
public creationDate: number; public creationDate: number
} }

View File

@@ -1,4 +1,4 @@
import {Vote} from './vote'; import {Vote} from './vote'
export { export {
Vote Vote

View File

@@ -1,4 +1,4 @@
import { BaseDomain } from "domain/common"; import { BaseDomain } from 'domain/common'
export class Vote extends BaseDomain { export class Vote extends BaseDomain {
@@ -8,7 +8,7 @@ export class Vote extends BaseDomain {
* @type {string} * @type {string}
* @memberof Vote * @memberof Vote
*/ */
public id?: string | null; public id?: string | null
/** /**
* Post identifire which vote on * Post identifire which vote on
@@ -16,7 +16,7 @@ export class Vote extends BaseDomain {
* @type {string} * @type {string}
* @memberof Vote * @memberof Vote
*/ */
public postId: string; public postId: string
/** /**
* Vote date * Vote date
@@ -24,7 +24,7 @@ export class Vote extends BaseDomain {
* @type {number} * @type {number}
* @memberof Vote * @memberof Vote
*/ */
public creationDate: number; public creationDate: number
/** /**
* Voter full name * Voter full name
@@ -32,7 +32,7 @@ export class Vote extends BaseDomain {
* @type {string} * @type {string}
* @memberof Vote * @memberof Vote
*/ */
public userDisplayName: string; public userDisplayName: string
/** /**
* Avatar of voter * Avatar of voter
@@ -40,7 +40,7 @@ export class Vote extends BaseDomain {
* @type {string} * @type {string}
* @memberof Vote * @memberof Vote
*/ */
public userAvatar: string; public userAvatar: string
/** /**
* Voter identifier * Voter identifier
@@ -48,6 +48,6 @@ export class Vote extends BaseDomain {
* @type {string} * @type {string}
* @memberof Vote * @memberof Vote
*/ */
public userId: string; public userId: string
} }

View File

@@ -5,6 +5,6 @@ export interface IServiceProvider{
* *
* @memberof IServiceProvider * @memberof IServiceProvider
*/ */
createAuthorizeService : () => IAuthorizeService; createAuthorizeService : () => IAuthorizeService
} }

View File

@@ -1,5 +1,5 @@
import { IServiceProvider } from "./IServiceProvider"; import { IServiceProvider } from './IServiceProvider'
import { ServiceProvide } from "./serviceProvide"; import { ServiceProvide } from './serviceProvide'
export { export {
IServiceProvider, IServiceProvider,

View File

@@ -1,14 +1,14 @@
//#region Interfaces //#region Interfaces
import { IServiceProvider } from "factories"; import { IServiceProvider } from 'factories'
import { IAuthorizeService } from "services/authorize"; import { IAuthorizeService } from 'services/authorize'
//#endregion //#endregion
//#region Service implemented classes //#region Service implemented classes
// - Firebase services // - Firebase services
import { AuthorizeService } from "firebaseServices/authorize"; import { AuthorizeService } from 'firebaseServices/authorize'
//#endregion //#endregion
@@ -20,7 +20,7 @@ export class ServiceProvide implements IServiceProvider {
* @memberof ServiceProvide * @memberof ServiceProvide
*/ */
createAuthorizeService: () => IAuthorizeService = () => { createAuthorizeService: () => IAuthorizeService = () => {
return new AuthorizeService(); return new AuthorizeService()
} }
} }

View File

@@ -1,7 +1,7 @@
import firebase from 'firebase'; import firebase from 'firebase'
try { try {
var config = { let config = {
apiKey: process.env.API_KEY, apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN, authDomain: process.env.AUTH_DOMAIN,
databaseURL: process.env.DATABASE_URL, databaseURL: process.env.DATABASE_URL,
@@ -10,17 +10,17 @@ try {
messagingSenderId: process.env.MESSAGING_SENDER_ID messagingSenderId: process.env.MESSAGING_SENDER_ID
} }
firebase.initializeApp(config); firebase.initializeApp(config)
} catch (e) { } catch (e) {
} }
// - Storage reference // - Storage reference
export var storageRef = firebase.storage().ref() export let storageRef = firebase.storage().ref()
// - Database authorize // - Database authorize
export var firebaseAuth = firebase.auth export let firebaseAuth = firebase.auth
export var firebaseRef = firebase.database().ref() export let firebaseRef = firebase.database().ref()
// - Firebase default // - Firebase default
export default firebase; export default firebase

View File

@@ -1,10 +1,10 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { IAuthorizeService } from "services/authorize"; import { IAuthorizeService } from 'services/authorize'
import { User } from "Domain/users"; import { User } from 'Domain/users'
import { LoginUser, RegisterUserResult } from "domain/authorize"; import { LoginUser, RegisterUserResult } from 'domain/authorize'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
/** /**
* Firbase authorize service * Firbase authorize service
@@ -21,41 +21,41 @@ export class AuthorizeService implements IAuthorizeService {
* @returns {Promise<LoginUser>} * @returns {Promise<LoginUser>}
* @memberof IAuthorizeService * @memberof IAuthorizeService
*/ */
public login: (email: string, password: string) => Promise<LoginUser> = (email, password) => { public login: (email: string, password: string) => Promise<LoginUser> = (email, password) => {
return new Promise<LoginUser>((resolve, reject) => { return new Promise<LoginUser>((resolve, reject) => {
firebaseAuth() firebaseAuth()
.signInWithEmailAndPassword(email, password) .signInWithEmailAndPassword(email, password)
.then((result) => { .then((result) => {
resolve(new LoginUser(result.uid)); resolve(new LoginUser(result.uid))
}) })
.catch((error: any) => { .catch((error: any) => {
reject(new SocialError(error.code, error.message)); reject(new SocialError(error.code, error.message))
}) })
}); })
}; }
/** /**
* Logs out the user * Logs out the user
* *
* @returns {Promise<void>} * @returns {Promise<void>}
* @memberof IAuthorizeService * @memberof IAuthorizeService
*/ */
public logout: () => Promise<void> = () => { public logout: () => Promise<void> = () => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
firebaseAuth() firebaseAuth()
.signOut() .signOut()
.then((result) => { .then((result) => {
resolve(); resolve()
}) })
.catch((error: any) => { .catch((error: any) => {
reject(new SocialError(error.code, error.message)); reject(new SocialError(error.code, error.message))
}) })
}); })
} }
/** /**
* Register a user * Register a user
* *
* @returns {Promise<void>} * @returns {Promise<void>}
@@ -64,49 +64,48 @@ export class AuthorizeService implements IAuthorizeService {
public registerUser: (user: User) => Promise<RegisterUserResult> = (user) => { public registerUser: (user: User) => Promise<RegisterUserResult> = (user) => {
return new Promise<RegisterUserResult>((resolve, reject) => { return new Promise<RegisterUserResult>((resolve, reject) => {
firebaseAuth() firebaseAuth()
.createUserWithEmailAndPassword(user.email, user.password) .createUserWithEmailAndPassword(user.email as string, user.password as string)
.then((signupResult) => { .then((signupResult) => {
firebaseRef.child(`users/${signupResult.uid}/info`) firebaseRef.child(`users/${signupResult.uid}/info`)
.set({ .set({
...user, ...user,
avatar: 'noImage' avatar: 'noImage'
}) })
.then((result) => { .then((result) => {
resolve(new RegisterUserResult(signupResult.uid)); resolve(new RegisterUserResult(signupResult.uid))
}) })
.catch((error: any) => reject(new SocialError(error.name, error.message))); .catch((error: any) => reject(new SocialError(error.name, error.message)))
}) })
.catch((error: any) => reject(new SocialError(error.code, error.message))); .catch((error: any) => reject(new SocialError(error.code, error.message)))
}); })
} }
/** /**
* Update user password * Update user password
* *
* @returns {Promise<void>} * @returns {Promise<void>}
* @memberof IAuthorizeService * @memberof IAuthorizeService
*/ */
public updatePassword: (newPassword: string) => Promise<void> = (newPassword) => { public updatePassword: (newPassword: string) => Promise<void> = (newPassword) => {
console.log('===================================='); console.log('====================================')
console.log("update password"); console.log('update password')
console.log('===================================='); console.log('====================================')
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
var user = firebaseAuth().currentUser; let user = firebaseAuth().currentUser
console.log('===================================='); console.log('====================================')
console.log(user); console.log(user)
console.log('===================================='); console.log('====================================')
if (user) { if (user) {
user.updatePassword(newPassword).then(() => { user.updatePassword(newPassword).then(() => {
// Update successful. // Update successful.
resolve(); resolve()
}).catch((error: any) => { }).catch((error: any) => {
// An error happened. // An error happened.
reject(new SocialError(error.code, error.message)); reject(new SocialError(error.code, error.message))
}); })
} }
});
}
})
}
} }

View File

@@ -1,4 +1,4 @@
import { AuthorizeService } from "./AuthorizeService"; import { AuthorizeService } from './AuthorizeService'
export { export {
AuthorizeService AuthorizeService

View File

@@ -1,11 +1,11 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { ICircleService } from 'services/circles'; import { ICircleService } from 'services/circles'
import { Circle, UserFollower } from 'domain/circles'; import { Circle, UserFollower } from 'domain/circles'
import { User } from 'domain/users'; import { User } from 'domain/users'
/** /**
* Firbase circle service * Firbase circle service
@@ -16,12 +16,12 @@ import { User } from 'domain/users';
*/ */
export class CircleService implements ICircleService { export class CircleService implements ICircleService {
addCircle: (userId: string, circle: Circle) => Promise<string>; addCircle: (userId: string, circle: Circle) => Promise<string>
addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise<void>; addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise<void>
deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise<void>; deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise<void>
updateCircle: (userId: string, circle: Circle, circleId: string) => Promise<void>; updateCircle: (userId: string, circle: Circle, circleId: string) => Promise<void>
deleteCircle: (circleId: string, userId: string) => Promise<void>; deleteCircle: (circleId: string, userId: string) => Promise<void>
getCircles: () => Promise<{ [circleId: string]: Circle; }>; getCircles: () => Promise<{ [circleId: string]: Circle }>
getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle; }>; getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle }>
} }

View File

@@ -1,4 +1,4 @@
import { AuthorizeService } from "./CircleService"; import { AuthorizeService } from './CircleService'
export { export {
AuthorizeService AuthorizeService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { ICommentService } from 'services/comments'; import { ICommentService } from 'services/comments'
/** /**
* Firbase comment service * Firbase comment service

View File

@@ -1,4 +1,4 @@
import { CommentService } from "./CommentService"; import { CommentService } from './CommentService'
export { export {
CommentService CommentService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { ICommonService } from 'services/common'; import { ICommonService } from 'services/common'
/** /**
* Firbase common service * Firbase common service

View File

@@ -1,4 +1,4 @@
import { CommonService } from "./CommonService"; import { CommonService } from './CommonService'
export { export {
CommonService CommonService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { IImageGalleryService } from 'services/imageGallery'; import { IImageGalleryService } from 'services/imageGallery'
/** /**
* Firbase image gallery service * Firbase image gallery service

View File

@@ -1,4 +1,4 @@
import { ImageGalleryService } from "./ImageGalleryService"; import { ImageGalleryService } from './ImageGalleryService'
export { export {
ImageGalleryService ImageGalleryService

View File

@@ -1,4 +1,4 @@
import { NotificationService } from "./NotificationService"; import { NotificationService } from './NotificationService'
export { export {
NotificationService NotificationService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { INotificationService } from 'services/notifications'; import { INotificationService } from 'services/notifications'
/** /**
* Firbase notification service * Firbase notification service

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { IPostService } from 'services/posts'; import { IPostService } from 'services/posts'
/** /**
* Firbase post service * Firbase post service

View File

@@ -1,4 +1,4 @@
import { PostService } from "./PostService"; import { PostService } from './PostService'
export { export {
PostService PostService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { IUserService } from 'services/users'; import { IUserService } from 'services/users'
/** /**
* Firbase user service * Firbase user service

View File

@@ -1,4 +1,4 @@
import { UserService } from "./UserService"; import { UserService } from './UserService'
export { export {
UserService UserService

View File

@@ -1,8 +1,8 @@
// - Import react components // - Import react components
import { firebaseRef, firebaseAuth } from 'app/firebase/'; import { firebaseRef, firebaseAuth } from 'app/firebase/'
import { SocialError } from "domain/common"; import { SocialError } from 'domain/common'
import { IVoteService } from 'services/votes'; import { IVoteService } from 'services/votes'
/** /**
* Firbase vote service * Firbase vote service

View File

@@ -1,4 +1,4 @@
import { VoteService } from "./VoteService"; import { VoteService } from './VoteService'
export { export {
VoteService VoteService

View File

@@ -63,7 +63,7 @@ export default class DialogTitle extends Component {
contain: { contain: {
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
justifyContent: "space-between" justifyContent: 'space-between'
}, },
title: { title: {
color: 'rgba(0,0,0,0.87)', color: 'rgba(0,0,0,0.87)',

View File

@@ -12,7 +12,7 @@ export class AuthorizeState {
* @type {number} * @type {number}
* @memberof AuthorizeState * @memberof AuthorizeState
*/ */
uid: number = 0; uid: number = 0
/** /**
* If user is authed {true} or not {false} * If user is authed {true} or not {false}
@@ -20,7 +20,7 @@ export class AuthorizeState {
* @type {Boolean} * @type {Boolean}
* @memberof AuthorizeState * @memberof AuthorizeState
*/ */
authed: Boolean = false; authed: Boolean = false
/** /**
* If user password is updated {true} or not {false} * If user password is updated {true} or not {false}
@@ -28,7 +28,7 @@ export class AuthorizeState {
* @type {Boolean} * @type {Boolean}
* @memberof AuthorizeState * @memberof AuthorizeState
*/ */
updatePassword: Boolean = false; updatePassword: Boolean = false
/** /**
* If the user is guest {true} or not {false} * If the user is guest {true} or not {false}
@@ -36,5 +36,5 @@ export class AuthorizeState {
* @type {Boolean} * @type {Boolean}
* @memberof AuthorizeState * @memberof AuthorizeState
*/ */
guest: Boolean = false; guest: Boolean = false
} }

View File

@@ -9,7 +9,7 @@ import {AuthorizeActionType} from 'constants/authorizeActionType'
* @interface IAuthorizeAction * @interface IAuthorizeAction
*/ */
export interface IAuthorizeAction { export interface IAuthorizeAction {
payload: any; payload: any
type: AuthorizeActionType; type: AuthorizeActionType
} }

View File

@@ -1,11 +1,11 @@
// - Import react components // - Import react components
import {Reducer, Action} from "redux"; import {Reducer, Action} from 'redux'
// - Import action types // - Import action types
import {AuthorizeActionType} from 'constants/authorizeActionType' import {AuthorizeActionType} from 'constants/authorizeActionType'
import { IAuthorizeAction } from "./IAuthorizeAction"; import { IAuthorizeAction } from './IAuthorizeAction'
import { AuthorizeState } from "./AuthorizeState"; import { AuthorizeState } from './AuthorizeState'
@@ -14,8 +14,8 @@ import { AuthorizeState } from "./AuthorizeState";
* @param {object} state * @param {object} state
* @param {object} action * @param {object} action
*/ */
export var authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{ export let authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{
const { payload } = action; const { payload } = action
switch (action.type) { switch (action.type) {
case AuthorizeActionType.LOGIN: case AuthorizeActionType.LOGIN:
return{ return{

View File

@@ -1,3 +1,3 @@
import { authorizeReducer } from "./authorizeReducer"; import { authorizeReducer } from './authorizeReducer'
export {authorizeReducer}; export {authorizeReducer}

View File

@@ -1,4 +1,4 @@
import { Circle } from "domain/circles"; import { Circle } from 'domain/circles'
/** /**
* Circle state * Circle state
@@ -14,7 +14,7 @@ export class CircleState {
* @type {({[userId: string]: {[circleId: string]: Circle}} | null)} * @type {({[userId: string]: {[circleId: string]: Circle}} | null)}
* @memberof CircleState * @memberof CircleState
*/ */
userCircles: {[userId: string]: {[circleId: string]: Circle}} = {}; userCircles: {[userId: string]: {[circleId: string]: Circle}} = {}
/** /**
* If user circles are loaded {true} or not {false} * If user circles are loaded {true} or not {false}
@@ -22,5 +22,5 @@ export class CircleState {
* @type {Boolean} * @type {Boolean}
* @memberof CircleState * @memberof CircleState
*/ */
loaded: Boolean = false; loaded: Boolean = false
} }

View File

@@ -3,14 +3,14 @@ import moment from 'moment'
import _ from 'lodash' import _ from 'lodash'
// - Import domain // - Import domain
import { User } from "domain/users"; import { User } from 'domain/users'
import { Circle } from "domain/circles"; import { Circle } from 'domain/circles'
// - Import action types // - Import action types
import {CircleActionType} from 'constants/circleActionType' import {CircleActionType} from 'constants/circleActionType'
import { CircleState } from "./CircleState"; import { CircleState } from './CircleState'
import { ICircleAction } from "./ICircleAction"; import { ICircleAction } from './ICircleAction'
@@ -19,11 +19,11 @@ import { ICircleAction } from "./ICircleAction";
* @param state * @param state
* @param action * @param action
*/ */
export var circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => { export let circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => {
const { payload } = action const { payload } = action
switch (action.type) { switch (action.type) {
case CircleActionType.CLEAR_ALL_CIRCLES: case CircleActionType.CLEAR_ALL_CIRCLES:
return new CircleState(); return new CircleState()
case CircleActionType.ADD_CIRCLE: case CircleActionType.ADD_CIRCLE:
return { return {
@@ -156,7 +156,7 @@ export var circleReducer = (state: CircleState = new CircleState(), action: ICir
} }
default: default:
return state; return state
} }
} }

View File

@@ -1,3 +1,3 @@
import { circleReducer } from "./circleReducer"; import { circleReducer } from './circleReducer'
export {circleReducer}; export {circleReducer}

View File

@@ -1,5 +1,5 @@
import { Comment } from "domain/comments"; import { Comment } from 'domain/comments'
/** /**
* Comment state * Comment state
@@ -15,7 +15,7 @@ export class CommentState {
* @type {({[postId: string]: {[commentId: string]: Comment}} | null)} * @type {({[postId: string]: {[commentId: string]: Comment}} | null)}
* @memberof CommentState * @memberof CommentState
*/ */
postComments: {[postId: string]: {[commentId: string]: Comment}} = {}; postComments: {[postId: string]: {[commentId: string]: Comment}} = {}
/** /**
* If the comments are loaded {true} or not {false} * If the comments are loaded {true} or not {false}
@@ -23,5 +23,5 @@ export class CommentState {
* @type {Boolean} * @type {Boolean}
* @memberof CommentState * @memberof CommentState
*/ */
loaded: Boolean = false; loaded: Boolean = false
} }

View File

@@ -8,7 +8,7 @@ import {CommentActionType} from 'constants/commentActionType'
* @interface ICommentAction * @interface ICommentAction
*/ */
export interface ICommentAction { export interface ICommentAction {
payload: any; payload: any
type: CommentActionType; type: CommentActionType
} }

View File

@@ -3,23 +3,23 @@ import moment from 'moment'
import _ from 'lodash' import _ from 'lodash'
// - Import domain // - Import domain
import { User } from "domain/users"; import { User } from 'domain/users'
import { Comment } from "domain/comments"; import { Comment } from 'domain/comments'
// - Import action types // - Import action types
import {CommentActionType} from 'constants/commentActionType' import {CommentActionType} from 'constants/commentActionType'
import { CommentState } from "./CommentState"; import { CommentState } from './CommentState'
import { ICommentAction } from "./ICommentAction"; import { ICommentAction } from './ICommentAction'
/** /**
* Comment reducer * Comment reducer
* @param state * @param state
* @param action * @param action
*/ */
export var commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => { export let commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => {
var { payload } = action let { payload } = action
switch (action.type) { switch (action.type) {
/* _____________ CRUD _____________ */ /* _____________ CRUD _____________ */
@@ -62,7 +62,7 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I
} }
} }
case CommentActionType.DELETE_COMMENT: case CommentActionType.DELETE_COMMENT:
var parsedComments = {} let parsedComments = {}
if (!state.postComments![payload.postId]) { if (!state.postComments![payload.postId]) {
return state return state
} }
@@ -111,11 +111,11 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I
} }
case CommentActionType.CLEAR_ALL_DATA_COMMENT: case CommentActionType.CLEAR_ALL_DATA_COMMENT:
return new CommentState(); return new CommentState()
default: default:
return state; return state
} }

View File

@@ -1,3 +1,3 @@
import { commentReducer } from "./commentReducer"; import { commentReducer } from './commentReducer'
export {commentReducer}; export {commentReducer}

View File

@@ -17,8 +17,8 @@ export class GlobalState {
* @memberof IGlobalState * @memberof IGlobalState
*/ */
progress: { progress: {
percent: number; percent: number
visible: Boolean; visible: Boolean
} = { } = {
percent : 0, percent : 0,
visible : false visible : false
@@ -30,7 +30,7 @@ export class GlobalState {
* @type {Boolean} * @type {Boolean}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
loadingStatus: Boolean = true; loadingStatus: Boolean = true
/** /**
* If user date is loaded {true} or not {false} * If user date is loaded {true} or not {false}
@@ -38,7 +38,7 @@ export class GlobalState {
* @type {Boolean} * @type {Boolean}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
defaultLoadDataStatus: Boolean = false; defaultLoadDataStatus: Boolean = false
/** /**
* If message popup is open {true} or not {false} * If message popup is open {true} or not {false}
@@ -46,7 +46,7 @@ export class GlobalState {
* @type {Boolean} * @type {Boolean}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
messageOpen: Boolean = false; messageOpen: Boolean = false
/** /**
* The text of popup global message * The text of popup global message
@@ -54,7 +54,7 @@ export class GlobalState {
* @type {string} * @type {string}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
message: string = ''; message: string = ''
/** /**
* Window size * Window size
@@ -62,7 +62,7 @@ export class GlobalState {
* @type {number} * @type {number}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
windowWidth: number = 0; windowWidth: number = 0
/** /**
* Window height * Window height
@@ -70,7 +70,7 @@ export class GlobalState {
* @type {number} * @type {number}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
windowHeight: number = 0; windowHeight: number = 0
/** /**
* The text of website header * The text of website header
@@ -78,7 +78,7 @@ export class GlobalState {
* @type {string} * @type {string}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
headerTitle: string = ''; headerTitle: string = ''
/** /**
* Top loading is visible {true} or not {false} * Top loading is visible {true} or not {false}
@@ -86,7 +86,7 @@ export class GlobalState {
* @type {Boolean} * @type {Boolean}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
showTopLoading: Boolean = false; showTopLoading: Boolean = false
/** /**
* Top loading message queue * Top loading message queue
@@ -94,7 +94,7 @@ export class GlobalState {
* @type {number} * @type {number}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
topLoadingQueue: number = 0; topLoadingQueue: number = 0
/** /**
* Temp date storage * Temp date storage
@@ -102,6 +102,6 @@ export class GlobalState {
* @type {*} * @type {*}
* @memberof IGlobalState * @memberof IGlobalState
*/ */
temp: any = {}; temp: any = {}
} }

View File

@@ -1,4 +1,4 @@
import { GlobalActionType } from 'constants/globalActionType'; import { GlobalActionType } from 'constants/globalActionType'
/** /**
* Global action interface * Global action interface

View File

@@ -1,9 +1,9 @@
// - Import action types // - Import action types
import { GlobalActionType } from 'constants/globalActionType'; import { GlobalActionType } from 'constants/globalActionType'
import { GlobalState } from "./GlobalState"; import { GlobalState } from './GlobalState'
import { IGlobalAction } from "./IGlobalAction"; import { IGlobalAction } from './IGlobalAction'
/** /**
@@ -48,13 +48,13 @@ export const globalReducer = (state: GlobalState = new GlobalState(), action: IG
case GlobalActionType.SHOW_SEND_REQUEST_MESSAGE_GLOBAL: case GlobalActionType.SHOW_SEND_REQUEST_MESSAGE_GLOBAL:
return { return {
...state, ...state,
message: "Request has been sent", message: 'Request has been sent',
messageOpen: true messageOpen: true
} }
case GlobalActionType.SHOW_REQUEST_SUCCESS_MESSAGE_GLOBAL: case GlobalActionType.SHOW_REQUEST_SUCCESS_MESSAGE_GLOBAL:
return { return {
...state, ...state,
message: "Your request has processed successfuly", message: 'Your request has processed successfuly',
messageOpen: true messageOpen: true
} }
case GlobalActionType.HIDE_MESSAGE_GLOBAL: case GlobalActionType.HIDE_MESSAGE_GLOBAL:

View File

@@ -1,3 +1,3 @@
import { globalReducer } from "./globalReducer"; import { globalReducer } from './globalReducer'
export {globalReducer}; export {globalReducer}

View File

@@ -1,4 +1,4 @@
import { Image } from "domain/imageGallery"; import { Image } from 'domain/imageGallery'
/** /**
* ImageGallery state * ImageGallery state
@@ -14,7 +14,7 @@ export class ImageGalleryState {
* @type {Boolean} * @type {Boolean}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
status: Boolean = false; status: Boolean = false
/** /**
* The list of image * The list of image
@@ -22,7 +22,7 @@ export class ImageGalleryState {
* @type {(Image[] | null)} * @type {(Image[] | null)}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
images: Image[] = []; images: Image[] = []
/** /**
* Selected image name * Selected image name
@@ -30,7 +30,7 @@ export class ImageGalleryState {
* @type {string} * @type {string}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
selectImage: string = ''; selectImage: string = ''
/** /**
* Selected image address * Selected image address
@@ -38,7 +38,7 @@ export class ImageGalleryState {
* @type {string} * @type {string}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
selectURL: string = ''; selectURL: string = ''
/** /**
* If image gallery is loaded {true} or not false * If image gallery is loaded {true} or not false
@@ -46,7 +46,7 @@ export class ImageGalleryState {
* @type {Boolean} * @type {Boolean}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
loaded: Boolean = false; loaded: Boolean = false
/** /**
* Images address list * Images address list
@@ -54,7 +54,7 @@ export class ImageGalleryState {
* @type {*} * @type {*}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
imageURLList: any = {}; imageURLList: any = {}
/** /**
* Store image requested * Store image requested
@@ -62,6 +62,6 @@ export class ImageGalleryState {
* @type {*} * @type {*}
* @memberof ImageGalleryState * @memberof ImageGalleryState
*/ */
imageRequests: any = {}; imageRequests: any = {}
} }

View File

@@ -2,21 +2,21 @@
import _ from 'lodash' import _ from 'lodash'
// - Import domain // - Import domain
import { User } from "domain/users"; import { User } from 'domain/users'
import { Image } from "domain/imageGallery"; import { Image } from 'domain/imageGallery'
// - Import image gallery action types // - Import image gallery action types
import {ImageGalleryActionType} from 'constants/imageGalleryActionType' import {ImageGalleryActionType} from 'constants/imageGalleryActionType'
import { IImageGalleryAction } from "./IImageGalleryAction"; import { IImageGalleryAction } from './IImageGalleryAction'
import { ImageGalleryState } from "./ImageGalleryState"; import { ImageGalleryState } from './ImageGalleryState'
/** /**
* Image gallery reducer * Image gallery reducer
*/ */
export var imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => { export let imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => {
const { payload } = action const { payload } = action
switch (action.type) { switch (action.type) {
@@ -66,6 +66,6 @@ export var imageGalleryReducer = (state: ImageGalleryState = new ImageGallerySta
default: default:
return state; return state
} }
} }

View File

@@ -1,3 +1,3 @@
import { imageGalleryReducer } from "./imageGalleryReducer"; import { imageGalleryReducer } from './imageGalleryReducer'
export {imageGalleryReducer}; export {imageGalleryReducer}

View File

@@ -1,12 +1,12 @@
import { authorizeReducer } from "./authorize"; import { authorizeReducer } from './authorize'
import { circleReducer } from "./circles"; import { circleReducer } from './circles'
import { commentReducer } from "./comments"; import { commentReducer } from './comments'
import { globalReducer } from "./global"; import { globalReducer } from './global'
import { imageGalleryReducer } from "./imageGallery"; import { imageGalleryReducer } from './imageGallery'
import { notificationReducer } from "./notifications"; import { notificationReducer } from './notifications'
import { postReducer } from "./posts"; import { postReducer } from './posts'
import { userReducer } from "./users"; import { userReducer } from './users'
import { voteReducer } from "./votes"; import { voteReducer } from './votes'
export{ export{
authorizeReducer, authorizeReducer,

View File

@@ -1,4 +1,4 @@
import { Notification } from "domain/notifications"; import { Notification } from 'domain/notifications'
/** /**
* Notification state * Notification state
@@ -14,7 +14,7 @@ export class NotificationState {
* @type {({[userId: string]: {[notificationId: string]: Notification}} | null)} * @type {({[userId: string]: {[notificationId: string]: Notification}} | null)}
* @memberof NotificationState * @memberof NotificationState
*/ */
userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {}; userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {}
/** /**
* If user notifications are loaded {true} or not {false} * If user notifications are loaded {true} or not {false}
@@ -22,5 +22,5 @@ export class NotificationState {
* @type {Boolean} * @type {Boolean}
* @memberof NotificationState * @memberof NotificationState
*/ */
loaded: Boolean = false; loaded: Boolean = false
} }

View File

@@ -1,3 +1,3 @@
import { notificationReducer } from "./notificationReducer"; import { notificationReducer } from './notificationReducer'
export {notificationReducer}; export {notificationReducer}

Some files were not shown because too many files have changed in this diff Show More