diff --git a/app/actions/authorizeActions.ts b/app/actions/authorizeActions.ts index 4990af3..5005dce 100644 --- a/app/actions/authorizeActions.ts +++ b/app/actions/authorizeActions.ts @@ -1,148 +1,141 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; -import moment from 'moment'; -import { push } from 'react-router-redux'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' +import moment from 'moment' +import { push } from 'react-router-redux' // -Import domain -import { User } from 'domain/users'; -import { SocialError } from "domain/common"; - +import { User } from 'domain/users' +import { SocialError } from 'domain/common' // - Import action types -import { AuthorizeActionType } from 'constants/authorizeActionType'; +import { AuthorizeActionType } from 'constants/authorizeActionType' // - Import services -import { IAuthorizeService } from "services/authorize"; -import { IServiceProvider } from "factories"; -import { ServiceProvide } from "factories"; +import { IAuthorizeService } from 'services/authorize' +import { IServiceProvider } from 'factories' +import { ServiceProvide } from 'factories' -const serviceProvider: IServiceProvider = new ServiceProvide(); -const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService(); +const serviceProvider: IServiceProvider = new ServiceProvide() +const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService() // - Import actions -import * as globalActions from 'actions/globalActions'; - +import * as globalActions from 'actions/globalActions' /* _____________ CRUD DB _____________ */ - /** * Log in user in server - * @param {string} email - * @param {string} password + * @param {string} email + * @param {string} password */ - export const dbLogin = (email: string, password: string) => { - return (dispatch: any, getState: any) => { - dispatch(globalActions.showNotificationRequest()) - - return authorizeService.login(email, password).then((result) => { - dispatch(globalActions.showNotificationSuccess()) - dispatch(login(result.uid)) - dispatch(push('/')) - }, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))) - } +export const dbLogin = (email: string, password: string) => { + return (dispatch: any, getState: any) => { + dispatch(globalActions.showNotificationRequest()) + return authorizeService.login(email, password).then((result) => { + dispatch(globalActions.showNotificationSuccess()) + dispatch(login(result.uid)) + dispatch(push('/')) + }, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))) } +} /** * Log out user in server */ - export const dbLogout = () => { - return (dispatch: any, getState: any) => { - return authorizeService.logout().then((result) => { - dispatch(logout()); - dispatch(push('/login')); - - }, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))) - } +export const dbLogout = () => { + return (dispatch: any, getState: any) => { + return authorizeService.logout().then((result) => { + dispatch(logout()) + dispatch(push('/login')) + }, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))) } +} + /** - * + * * @param user for registering */ - export const dbSignup = (user: User) => { - return (dispatch: any, getState: any) => { - dispatch(globalActions.showNotificationRequest()) - return authorizeService.registerUser(user).then((result) => { - dispatch(signup({ - userId: result.uid, - ...user - })) - dispatch(push('/')) - }) - .catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))); - } - +export const dbSignup = (user: User) => { + return (dispatch: any, getState: any) => { + dispatch(globalActions.showNotificationRequest()) + return authorizeService.registerUser(user).then((result) => { + dispatch(signup({ + userId: result.uid, + ...user + })) + dispatch(push('/')) + }) + .catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code))) } +} /** * Change user's password - * @param {string} newPassword + * @param {string} newPassword */ - export const dbUpdatePassword = (newPassword: string) => { - return (dispatch: any, getState: any) => { - dispatch(globalActions.showNotificationRequest()) - - return authorizeService.updatePassword(newPassword).then(() => { - +export const dbUpdatePassword = (newPassword: string) => { + return (dispatch: any, getState: any) => { + dispatch(globalActions.showNotificationRequest()) + + return authorizeService.updatePassword(newPassword).then(() => { + // Update successful. - dispatch(globalActions.showNotificationSuccess()) - dispatch(updatePassword()) - dispatch(push('/')) - }) + dispatch(globalActions.showNotificationSuccess()) + dispatch(updatePassword()) + dispatch(push('/')) + }) .catch((error: SocialError) => { // An error happened. switch (error.code) { case 'auth/requires-recent-login': dispatch(globalActions.showErrorMessage(error.code)) dispatch(dbLogout()) - break; + break default: } }) - } - } - + } +} /* _____________ CRUD State _____________ */ /** * Loing user - * @param {string} uid + * @param {string} uids */ - export const login = (uid: string) => { - return { - type: AuthorizeActionType.LOGIN, - payload: { authed: true, uid } - } +export const login = (uid: string) => { + return { + type: AuthorizeActionType.LOGIN, + payload: { authed: true, uid } } +} /** * Logout user */ - export const logout = () => { - return { type: AuthorizeActionType.LOGOUT } - } +export const logout = () => { + return { type: AuthorizeActionType.LOGOUT } +} /** * User registeration call * @param user for registering */ - export const signup = (user: User) => { - return { - type: AuthorizeActionType.SIGNUP, - payload: { ...user } - } - +export const signup = (user: User) => { + return { + type: AuthorizeActionType.SIGNUP, + payload: { ...user } } +} + /** * Update user's password */ - export const updatePassword = () => { - return { type: AuthorizeActionType.UPDATE_PASSWORD } - } - +export const updatePassword = () => { + return { type: AuthorizeActionType.UPDATE_PASSWORD } +} diff --git a/app/actions/circleActions.ts b/app/actions/circleActions.ts index 5b5d57d..ffdfed4 100644 --- a/app/actions/circleActions.ts +++ b/app/actions/circleActions.ts @@ -2,8 +2,8 @@ import firebase, { firebaseRef } from 'app/firebase/' // - Import domain -import { User } from "domain/users"; -import { Circle, UserFollower } from "domain/circles"; +import { User } from 'domain/users' +import { Circle, UserFollower } from 'domain/circles' // - Import utility components import moment from 'moment' @@ -29,7 +29,7 @@ import * as notifyActions from 'actions/notifyActions' * Add a circle * @param {string} circleName */ -export var dbAddCircle = (circleName: string) => { +export let dbAddCircle = (circleName: string) => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid @@ -41,7 +41,7 @@ export var dbAddCircle = (circleName: string) => { let circleRef = firebaseRef.child(`userCircles/${uid}/circles`).push(circle) return circleRef.then(() => { - circle.id = circleRef.key; + circle.id = circleRef.key circle.ownerId = uid dispatch(addCircle(circle)) @@ -55,11 +55,11 @@ export var dbAddCircle = (circleName: string) => { * @param {string} cid is circle identifier * @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) => { - let uid: string = getState().authorize.uid; - let user: User = getState().user.info[uid]; + let uid: string = getState().authorize.uid + let user: User = getState().user.info[uid] let userCircle: User = { creationDate: moment().unix(), @@ -99,7 +99,7 @@ export var dbAddFollowingUser = (cid: string, userFollowing: User) => { * @param {string} cid is circle 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) => { let uid: string = getState().authorize.uid @@ -154,14 +154,14 @@ export const dbDeleteCircle = (id: string) => { let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - let updates: any = {}; - updates[`userCircles/${uid}/circles/${id}`] = null; + let updates: any = {} + updates[`userCircles/${uid}/circles/${id}`] = null return firebaseRef.update(updates).then((result) => { dispatch(deleteCircle(uid, id)) }, (error) => { dispatch(globalActions.showErrorMessage(error.message)) - }); + }) } } @@ -173,16 +173,16 @@ export const dbGetCircles = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.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) => { - var circles: any = snapshot.val() || {}; - var parsedCircles: { [circleId: string]: Circle } = {}; + let circles: any = snapshot.val() || {} + let parsedCircles: { [circleId: string]: Circle } = {} Object.keys(circles).forEach((circleId) => { if (circleId !== '-Followers' && circles[circleId].users) { Object.keys(circles[circleId].users).filter((v, i, a) => a.indexOf(v) === i).forEach((userId) => { dispatch(postActions.dbGetPostsByUserId(userId)) - dispatch(userActions.dbGetUserInfoByUserId(userId, "")) + dispatch(userActions.dbGetUserInfoByUserId(userId, '')) }) } 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) => { if (uid) { - let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`); + let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`) return circlesRef.once('value').then((snapshot) => { - var circles = snapshot.val() || {}; - var parsedCircles: { [circleId: string]: Circle } = {}; + let circles = snapshot.val() || {} + let parsedCircles: { [circleId: string]: Circle } = {} Object.keys(circles).forEach((circleId) => { parsedCircles[circleId] = { id: circleId, ...circles[circleId] } }) - dispatch(addCircles(uid, parsedCircles)); + dispatch(addCircles(uid, parsedCircles)) }) } diff --git a/app/actions/commentActions.ts b/app/actions/commentActions.ts index a00c7c0..1320150 100644 --- a/app/actions/commentActions.ts +++ b/app/actions/commentActions.ts @@ -3,17 +3,15 @@ import moment from 'moment' import { firebaseRef } from 'app/firebase/' // - Import domain -import { Comment } from "domain/comments"; +import { Comment } from 'domain/comments' // - Import action types -import {CommentActionType} from 'constants/commentActionType' +import { CommentActionType } from 'constants/commentActionType' // - Import actions import * as globalActions from 'actions/globalActions' import * as notifyActions from 'actions/notifyActions' - - /* _____________ CRUD DB _____________ */ /** @@ -38,20 +36,22 @@ export const dbAddComment = (ownerPostUserId: string,newComment: Comment, callBa postId: newComment.postId, text: newComment.text } - + let commentRef: any = firebaseRef.child(`postComments/${newComment.postId}`).push(comment) return commentRef.then(() => { dispatch(addComment(newComment)) callBack() dispatch(globalActions.hideTopLoading()) - if (ownerPostUserId && ownerPostUserId !== uid) + if (ownerPostUserId && ownerPostUserId !== uid) { dispatch(notifyActions.dbAddNotify( { description: 'Add comment on your post.', url: `/${ownerPostUserId}/posts/${newComment.postId}`, - notifyRecieverUserId: ownerPostUserId, notifierUserId: uid + notifyRecieverUserId: ownerPostUserId, notifierUserId: uid, + isSeen: false })) + } }, (error: any) => { dispatch(globalActions.showErrorMessage(error.message)) @@ -69,10 +69,10 @@ export const dbGetComments = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid if (uid) { - let commentsRef: any = firebaseRef.child(`postComments`); + let commentsRef: any = firebaseRef.child(`postComments`) 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)) }) @@ -92,12 +92,11 @@ export const dbUpdateComment = (id: string, postId: string, text: string) => { dispatch(globalActions.showTopLoading()) - // Get current user id let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - let updates: any = {}; + let updates: any = {} let comment: Comment = getState().comment.postComments[postId][id] updates[`postComments/${postId}/${id}`] = { postId: postId, @@ -131,13 +130,12 @@ export const dbDeleteComment = (id: string, postId: string) => { dispatch(globalActions.showTopLoading()) - // Get current user id let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - let updates: any = {}; - updates[`postComments/${postId}/${id}`] = null; + let updates: any = {} + updates[`postComments/${postId}/${id}`] = null return firebaseRef.update(updates).then((result) => { dispatch(deleteComment(id, postId)) @@ -154,12 +152,11 @@ export const dbDeleteComment = (id: string, postId: string) => { /* _____________ CRUD State _____________ */ - /** - * Add comment - * @param {Comment} data + * Add comment + * @param {Comment} data */ -export const addComment = (comment:Comment) => { +export const addComment = (comment: Comment) => { return { type: CommentActionType.ADD_COMMENT, @@ -168,7 +165,7 @@ export const addComment = (comment:Comment) => { } /** - * + * * @param id comment identifier * @param postId post identefier which comment belong to * @param text the new text for comment @@ -185,7 +182,7 @@ export const updateComment = ( id: string, postId: string, text: string) => { * Add comment list * @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 { type: CommentActionType.ADD_COMMENT_LIST, @@ -193,8 +190,6 @@ export const addCommentList = (postComments: {[postId: string]: {[commentId: str } } - - /** * Delete a comment * @param {string} id of comment @@ -229,4 +224,3 @@ export const closeCommentEditor = (comment: Comment) => { payload: comment } } - diff --git a/app/actions/globalActions.ts b/app/actions/globalActions.ts index 9f6d351..d22fa49 100644 --- a/app/actions/globalActions.ts +++ b/app/actions/globalActions.ts @@ -84,10 +84,10 @@ export const setHeaderTitleOpt = (callerKey: string,payload: any) => { case 'profile': const userName = getState().user.info && getState().user.info[payload] ? getState().user.info[payload].fullName : '' dispatch(setHeaderTitle(userName)) - break; + break default: - break; + break } } diff --git a/app/actions/imageGalleryActions.ts b/app/actions/imageGalleryActions.ts index 715aae6..83bef4f 100644 --- a/app/actions/imageGalleryActions.ts +++ b/app/actions/imageGalleryActions.ts @@ -3,10 +3,10 @@ import moment from 'moment' import { firebaseRef, firebaseAuth, storageRef } from 'app/firebase/' // - Import domain -import { Image } from "domain/imageGallery"; +import { Image } from 'domain/imageGallery' // - Import action types -import {ImageGalleryActionType} from 'constants/imageGalleryActionType' +import { ImageGalleryActionType } from 'constants/imageGalleryActionType' // - Import actions import * as globalActions from 'actions/globalActions' @@ -16,8 +16,6 @@ import FileAPI from 'api/FileAPI' /* _____________ UI Actions _____________ */ -declare const console: any; - /** * Download images for image gallery */ @@ -25,18 +23,18 @@ export const downloadForImageGallery = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.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) => { - var images = snapshot.val() || {}; - var parsedImages: Image[] = [] + let images = snapshot.val() || {} + let parsedImages: Image[] = [] Object.keys(images).forEach((imageId) => { parsedImages.push({ id: 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) => { let uid: string = getState().authorize.uid - var image: Image = { + let image: Image = { creationDate: moment().unix(), deleteDate: '', URL: imageURL, - fullPath:imageFullPath, + fullPath: imageFullPath, ownerUserId: uid, lastEditDate: 0, 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(() => { dispatch(addImage({ ...image, @@ -84,26 +82,26 @@ export const dbDeleteImage = (id: string) => { return (dispatch: any, getState: Function) => { // Get current user id - let uid: string = getState().authorize.uid; + let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - var updates: any = {}; - updates[`userFiles/${uid}/files/images/${id}`] = null; + let updates: any = {} + updates[`userFiles/${uid}/files/images/${id}`] = null return firebaseRef.update(updates).then((result) => { dispatch(deleteImage(id)) - console.log('image removed: ', id); + console.log('image removed: ', id) }, (error) => { - console.log(error); - }); + console.log(error) + }) } } /** * Upload image on the server - * @param {file} file - * @param {string} fileName + * @param {file} file + * @param {string} fileName */ export const dbUploadImage = (file: any, fileName: string) => { return (dispatch: any, getState: Function) => { @@ -116,48 +114,49 @@ export const dbUploadImage = (file: any, fileName: string) => { // Upload storage bar 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)) - }, (error: any) => { dispatch(globalActions.showErrorMessage(error.code)) dispatch(globalActions.hideTopLoading()) - }, (complete?: any ) => { + }, (complete?: any ) => { dispatch(globalActions.progressChange(100, false)) dispatch(dbSaveImage(fileName,'')) dispatch(globalActions.hideTopLoading()) - + }) } } /** * Download image from server - * @param {string} fileName + * @param {string} fileName */ export const dbDownloadImage = (fileName: string) => { return (dispatch: any, getState: Function) => { - if (fileName == 'noImage') + if (fileName === 'noImage') { return {} - if (getState().imageGallery.imageURLList[fileName] && fileName !== '') + } + if (getState().imageGallery.imageURLList[fileName] && fileName !== '') { return - - if (getState().imageGallery.imageRequests.indexOf(fileName) > -1) + } + if (getState().imageGallery.imageRequests.indexOf(fileName) > -1){ return + } dispatch(sendImageRequest(fileName)) - // Create a reference to the file we want to download - let starsRef: any = storageRef.child(`images/${fileName}`); + // Create a reference to the file we want to download + let starsRef: any = storageRef.child(`images/${fileName}`) // Get the download URL starsRef.getDownloadURL().then((url: string) => { - // Insert url into an tag to "download" + // Insert url into an tag to 'download' if (!getState().imageGallery.imageURLList[fileName] || fileName === '') dispatch(setImageURL(fileName, url)) - }).catch((error:any) => { + }).catch((error: any) => { // A full list of error codes is available at // https://firebase.google.com/docs/storage/web/handle-errors @@ -165,24 +164,24 @@ export const dbDownloadImage = (fileName: string) => { case 'storage/object_not_found': // File doesn't exist dispatch(globalActions.showErrorMessage('storage/object_not_found')) - break; + break case 'storage/unauthorized': // User doesn't have permission to access the object dispatch(globalActions.showErrorMessage('storage/unauthorized')) - break; + break case 'storage/canceled': // User canceled the upload dispatch(globalActions.showErrorMessage('storage/canceled')) - break; + break case 'storage/unknown': // Unknown error occurred, inspect the server response dispatch(globalActions.showErrorMessage('storage/unknown')) - break; + break } - }); + }) } } diff --git a/app/actions/notifyActions.ts b/app/actions/notifyActions.ts index dd047c5..5c0cf58 100644 --- a/app/actions/notifyActions.ts +++ b/app/actions/notifyActions.ts @@ -3,7 +3,7 @@ import moment from 'moment' import { firebaseRef } from 'app/firebase/' // - Import domain -import { Notification } from "domain/notifications"; +import { Notification } from 'domain/notifications' // - Import action types import {NotificationActionType} from 'constants/notificationActionType' @@ -47,10 +47,10 @@ export const dbGetNotifies = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid if (uid) { - let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`); + let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`) 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 => { if (!getState().user.info[notifies[key].notifierUserId]) { @@ -74,11 +74,11 @@ export const dbDeleteNotify = (id: string) => { return (dispatch: any, getState: Function) => { // Get current user id - var uid: string = getState().authorize.uid + let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - var updates: any = {}; - updates[`userNotifies/${uid}/${id}`] = null; + let updates: any = {} + updates[`userNotifies/${uid}/${id}`] = null return firebaseRef.update(updates).then((result) => { dispatch(deleteNotify(id)) @@ -101,7 +101,7 @@ export const dbSeenNotify = (id: string) => { let notify: Notification = getState().notify.userNotifies[id] - let updates: any = {}; + let updates: any = {} updates[`userNotifies/${uid}/${id}`] = { description: notify.description, url: notify.url, diff --git a/app/actions/postActions.ts b/app/actions/postActions.ts index e9aa1bb..3c36564 100644 --- a/app/actions/postActions.ts +++ b/app/actions/postActions.ts @@ -1,35 +1,29 @@ // - Import react components -import { Action } from "redux"; +import { Action } from 'redux' // - Import firebase component -import firebase, { firebaseRef } from '../firebase'; +import firebase, { firebaseRef } from '../firebase' // - Import domain -import { Post } from "domain/posts"; +import { Post } from 'domain/posts' // - Import utility components -import moment from 'moment'; +import moment from 'moment' // - Import action types -import { PostActionType } from 'constants/postActionType'; +import { PostActionType } from 'constants/postActionType' // - Import actions -import * as globalActions from 'actions/globalActions'; - -declare const console: any; - - - - +import * as globalActions from 'actions/globalActions' /* _____________ CRUD DB _____________ */ /** * Add a normal post - * @param {any} newPost - * @param {Function} callBack + * @param {any} newPost + * @param {Function} callBack */ -export var dbAddPost = (newPost: any, callBack: Function) => { +export let dbAddPost = (newPost: any, callBack: Function) => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid @@ -47,14 +41,13 @@ export var dbAddPost = (newPost: any, callBack: Function) => { tags: newPost.tags || [], commentCounter: 0, image: '', - imageFullPath:'', + imageFullPath: '', video: '', disableComments: newPost.disableComments, disableSharing: newPost.disableSharing, deleted: false } - let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post) return postRef.then(() => { dispatch(addPost(uid, { @@ -66,11 +59,10 @@ export var dbAddPost = (newPost: any, callBack: Function) => { } } - /** * Add a post with image - * @param {object} newPost - * @param {function} callBack + * @param {object} newPost + * @param {function} callBack */ export const dbAddImagePost = (newPost: any, callBack: Function) => { return (dispatch: any, getState: Function) => { @@ -99,8 +91,7 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => { 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(() => { dispatch(addPost(uid, { ...post, @@ -116,12 +107,12 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => { /** * Update a post from database - * @param {object} newPost + * @param {object} newPost * @param {func} callBack //TODO: anti pattern should change to parent state or move state to redux */ export const dbUpdatePost = (newPost: any, callBack: Function) => { console.log(newPost) - return (dispatch : any, getState: Function) => { + return (dispatch: any, getState: Function) => { dispatch(globalActions.showTopLoading()) @@ -129,7 +120,7 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => { let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - let updates: any = {}; + let updates: any = {} let post: Post = getState().post.userPosts[uid][newPost.id] let updatedPost: Post = { postTypeId: post.postTypeId, @@ -172,16 +163,16 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => { * @param {string} id is post identifier */ export const dbDeletePost = (id: string) => { - return (dispatch:any, getState:Function) => { + return (dispatch: any, getState: Function) => { dispatch(globalActions.showTopLoading()) // Get current user id - let uid : string = getState().authorize.uid + let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - let updates : any= {}; - updates[`userPosts/${uid}/posts/${id}`] = null; + let updates: any = {} + updates[`userPosts/${uid}/posts/${id}`] = null return firebaseRef.update(updates).then((result) => { dispatch(deletePost(uid, id)) @@ -190,7 +181,7 @@ export const dbDeletePost = (id: string) => { }, (error) => { dispatch(globalActions.showErrorMessage(error.message)) dispatch(globalActions.hideTopLoading()) - }); + }) } } @@ -199,23 +190,23 @@ export const dbDeletePost = (id: string) => { * Get all user posts from data base */ export const dbGetPosts = () => { - return (dispatch:any, getState:any) => { + return (dispatch: any, getState: any) => { let uid: string = getState().authorize.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) => { - var posts: any = snapshot.val() || {}; - var parsedPosts : {[postId: string]: Post} = {}; + let posts: any = snapshot.val() || {} + let parsedPosts: { [postId: string]: Post } = {} Object.keys(posts).forEach((postId) => { parsedPosts[postId] = { id: postId, ...posts[postId] - }; - }); + } + }) - dispatch(addPosts(uid, parsedPosts)); - }); + dispatch(addPosts(uid, parsedPosts)) + }) } } @@ -226,19 +217,19 @@ export const dbGetPosts = () => { * @param uid post owner identifier * @param postId post identifier */ -export const dbGetPostById = (uid:string, postId:string) => { +export const dbGetPostById = (uid: string, postId: string) => { return (dispatch: any, getState: Function) => { 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) => { - const newPost = snapshot.val() || {}; + const newPost = snapshot.val() || {} const post = { id: postId, ...newPost } - dispatch(addPost(uid, post)); - }); + dispatch(addPost(uid, post)) + }) } } @@ -253,30 +244,25 @@ export const dbGetPostsByUserId = (uid: string) => { return (dispatch: any, getState: Function) => { 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) => { - let posts: any = snapshot.val() || {}; - let parsedPosts: {[postId: string]: Post} = {}; + let posts: any = snapshot.val() || {} + let parsedPosts: { [postId: string]: Post } = {} Object.keys(posts).forEach((postId) => { parsedPosts[postId] = { id: postId, ...posts[postId] - }; - }); + } + }) - dispatch(addPosts(uid, parsedPosts)); - }); + dispatch(addPosts(uid, parsedPosts)) + }) } } } - - - - - /* _____________ CRUD State _____________ */ /** @@ -294,7 +280,7 @@ export const addPost = (uid: string, post: Post) => { /** * Update a post * @param {string} uid is user identifier - * @param {Post} post + * @param {Post} post */ export const updatePost = (uid: string, post: Post) => { return { @@ -315,13 +301,12 @@ export const deletePost = (uid: string, id: string) => { } } - /** * Add a list of post * @param {string} uid * @param {[object]} posts */ -export const addPosts = (uid: string, posts: {[postId: string]: Post}) => { +export const addPosts = (uid: string, posts: { [postId: string]: Post }) => { return { type: PostActionType.ADD_LIST_POST, payload: { uid, posts } @@ -339,7 +324,7 @@ export const clearAllData = () => { /** * Add a post with image - * @param {object} post + * @param {object} post */ export const addImagePost = (uid: string, post: any) => { return { @@ -348,4 +333,3 @@ export const addImagePost = (uid: string, post: any) => { } } - diff --git a/app/actions/userActions.ts b/app/actions/userActions.ts index 9f27cb6..b596cc9 100644 --- a/app/actions/userActions.ts +++ b/app/actions/userActions.ts @@ -2,7 +2,7 @@ import { firebaseRef } from 'app/firebase/' // - Import domain -import { Profile } from "domain/users"; +import { Profile } from 'domain/users' // - Import action types import {UserActionType} from 'constants/userActionType' @@ -11,7 +11,7 @@ import {UserActionType} from 'constants/userActionType' import * as globalActions from 'actions/globalActions' import * as userActions from 'actions/userActions' -declare const console: any; +declare const console: any /* _____________ CRUD DB _____________ */ @@ -23,10 +23,10 @@ export const dbGetUserInfo = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.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) => { - let userProfile: Profile = snapshot.val() || {}; + let userProfile: Profile = snapshot.val() || {} dispatch(addUserInfo(uid, { avatar: userProfile.avatar, @@ -35,7 +35,7 @@ export const dbGetUserInfo = () => { banner: userProfile.banner, 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) => { return (dispatch: any, getState: Function) => { 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) => { - let userProfile = snapshot.val() || {}; + let userProfile = snapshot.val() || {} dispatch(addUserInfo(uid, { avatar: userProfile.avatar, email: userProfile.email, @@ -64,12 +64,12 @@ export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => { case 'header': dispatch(globalActions.setHeaderTitle(userProfile.fullName)) - break; + break 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 // Write the new data simultaneously in the list - let updates: any = {}; + let updates: any = {} let profile = getState().user.info[uid] let updateProfie: Profile = { avatar: newProfile.avatar || profile.avatar || '', @@ -112,12 +112,12 @@ export const dbGetPeopleInfo = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid if (uid) { - let peopleRef: any = firebaseRef.child(`users`); + let peopleRef: any = firebaseRef.child(`users`) 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) => { if (userId !== uid) { let userInfo = people[userId].info @@ -132,7 +132,7 @@ export const dbGetPeopleInfo = () => { }) dispatch(addPeopleInfo(parsedPeople)) - }, (error: any) => console.log(error)); + }, (error: any) => console.log(error)) } } diff --git a/app/actions/voteActions.ts b/app/actions/voteActions.ts index 097c37e..d957e64 100644 --- a/app/actions/voteActions.ts +++ b/app/actions/voteActions.ts @@ -5,13 +5,13 @@ import { firebaseRef } from 'app/firebase/' import {VoteActionType} from 'constants/voteActionType' // - Import domain -import { Vote } from "domain/votes"; +import { Vote } from 'domain/votes' // - Import actions import * as globalActions from 'actions/globalActions' import * as notifyActions from 'actions/notifyActions' -declare const console: any; +declare const console: any /* _____________ CRUD DB _____________ */ /** @@ -22,8 +22,8 @@ declare const console: any; export const dbAddVote = (postId: string,ownerPostUserId: string) => { return (dispatch: any, getState: Function) => { - let uid: string = getState().authorize.uid; - var vote: Vote = { + let uid: string = getState().authorize.uid + let vote: Vote = { postId: postId, creationDate: moment().unix(), userDisplayName: getState().user.info[uid].fullName, @@ -31,7 +31,7 @@ export const dbAddVote = (postId: string,ownerPostUserId: string) => { userId: uid } - var voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote) + let voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote) return voteRef.then(() => { dispatch(addVote( { @@ -60,10 +60,10 @@ export const dbGetVotes = () => { return (dispatch: any, getState: Function) => { let uid: string = getState().authorize.uid if (uid) { - let votesRef: any = firebaseRef.child(`postVotes`); + let votesRef: any = firebaseRef.child(`postVotes`) 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)) }) @@ -81,15 +81,15 @@ export const dbDeleteVote = (postId: string) => { return (dispatch: any, getState: Function) => { // Get current user id - let uid: string = getState().authorize.uid; + let uid: string = getState().authorize.uid // Write the new data simultaneously in the list - var updates: any = {}; + let updates: any = {} let votes: {[voteId: string]: Vote} = getState().vote.postVotes[postId] 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) => { dispatch(deleteVote(id, postId)) diff --git a/app/api/AuthAPI.jsx b/app/api/AuthAPI.jsx index 4529aa9..ab7c2bf 100644 --- a/app/api/AuthAPI.jsx +++ b/app/api/AuthAPI.jsx @@ -1,16 +1,16 @@ // - Import firebase components -import {firebaseAuth, firebaseRef} from 'app/firebase/'; -import store from 'store/configureStore'; +import {firebaseAuth, firebaseRef} from 'app/firebase/' +import store from 'store/configureStore' // - Check user if is authorized -export var isAuthorized = () => { - var state = store.getState(); - return state.authorize.authed; +export let isAuthorized = () => { + let state = store.getState() + return state.authorize.authed -}; +} -export var isAdmin = () =>{ +export let isAdmin = () =>{ -return true; +return true -}; +} diff --git a/app/api/AuthRouterAPI.jsx b/app/api/AuthRouterAPI.jsx index 0121b68..1e82eac 100644 --- a/app/api/AuthRouterAPI.jsx +++ b/app/api/AuthRouterAPI.jsx @@ -6,8 +6,8 @@ import {Route, Redirect} from 'react-router-dom' import * as AuthAPI from 'AuthAPI' -export var PrivateRoute = ({component: Component, ...rest}) => { - console.log('is auth ; ', AuthAPI.isAuthorized()); +export let PrivateRoute = ({component: Component, ...rest}) => { + console.log('is auth ', AuthAPI.isAuthorized()) return ( { ) } -export var PublicRoute = ({component: Component,...rest}) => { +export let PublicRoute = ({component: Component,...rest}) => { return ( { - var re = /(?:\.([^.]+))?$/; - return re.exec(fileName)[1]; + let re = /(?:\.([^.]+))?$/ + return re.exec(fileName)[1] } -// Converts image to canvas; returns new canvas element +// Converts image to canvas returns new canvas element const convertImageToCanvas = (image) => { - var canvas = document.createElement("canvas"); - canvas.width = image.width; - canvas.height = image.height; - canvas.getContext("2d").drawImage(image, 0, 0); + let canvas = document.createElement('canvas') + canvas.width = image.width + canvas.height = image.height + 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) => { // Create a storage refrence - var storegeFile = storageRef.child(`images/${fileName}`) + let storegeFile = storageRef.child(`images/${fileName}`) // Upload file - var task = storegeFile.put(file) + let task = storegeFile.put(file) task.then((result) => { resolve(result) }).catch((error) => { @@ -40,7 +40,7 @@ const uploadImage = (file, fileName, progress) => { // Upload storage bar task.on('state_changed', (snapshot) => { - var percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100 + let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100 progress(percentage, true) }, (error) => { console.log('========== Upload Image ============') @@ -65,40 +65,40 @@ const constraintImage = (file,fileName, maxWidth, maxHeight) => { if(file.type.match(/image.*/)) { // Load the image - var reader = new FileReader(); + let reader = new FileReader() reader.onload = function (readerEvent) { - var image = new Image(); + let image = new Image() image.onload = function (imageEvent) { // Resize the image - var canvas = document.createElement('canvas'), + let canvas = document.createElement('canvas'), max_size = 986,// TODO : pull max size from a site config width = image.width, - height = image.height; + height = image.height if (width > height) { if (width > max_size) { - height *= max_size / width; - width = max_size; + height *= max_size / width + width = max_size } } else { if (height > max_size) { - width *= max_size / height; - height = max_size; + width *= max_size / height + height = max_size } } - canvas.width = width; - canvas.height = height; - canvas.getContext('2d').drawImage(image, 0, 0, width, height); - var dataUrl = canvas.toDataURL(); - var resizedImage = dataURLToBlob(dataUrl); - let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} }); - window.dispatchEvent(evt); + canvas.width = width + canvas.height = height + canvas.getContext('2d').drawImage(image, 0, 0, width, height) + let dataUrl = canvas.toDataURL() + let resizedImage = dataURLToBlob(dataUrl) + let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} }) + 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) => { - var BASE64_MARKER = ';base64,' + let BASE64_MARKER = 'base64,' if (dataURL.indexOf(BASE64_MARKER) == -1) { - var parts = dataURL.split(',') - var contentType = parts[0].split(':')[1] - var raw = parts[1] + let parts = dataURL.split(',') + let contentType = parts[0].split(':')[1] + let raw = parts[1] return new Blob([raw], {type: contentType}) } - var parts = dataURL.split(BASE64_MARKER) - var contentType = parts[0].split(':')[1] - var raw = window.atob(parts[1]) - var rawLength = raw.length + let parts = dataURL.split(BASE64_MARKER) + let contentType = parts[0].split(':')[1] + let raw = window.atob(parts[1]) + 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) } diff --git a/app/api/PostAPI.jsx b/app/api/PostAPI.jsx index c56b78f..853f1e9 100644 --- a/app/api/PostAPI.jsx +++ b/app/api/PostAPI.jsx @@ -8,8 +8,8 @@ export const detectTags = (content,character) => { } export const getContentTags = (content) => { - var newTags = [] - var tags = detectTags(content,'#') + let newTags = [] + let tags = detectTags(content,'#') tags.forEach((tag)=>{ newTags.push(tag.slice(1)) }) @@ -17,13 +17,13 @@ export const getContentTags = (content) => { } export const sortObjectsDate = (objects) => { - var sortedObjects = objects; + let sortedObjects = objects // Sort posts with creation date sortedObjects.sort((a, b) => { return parseInt(b.creationDate) - parseInt(a.creationDate) - }); + }) - return sortedObjects; + return sortedObjects } \ No newline at end of file diff --git a/app/api/StringAPI.jsx b/app/api/StringAPI.jsx index 1636e0c..a868b2b 100644 --- a/app/api/StringAPI.jsx +++ b/app/api/StringAPI.jsx @@ -4,7 +4,7 @@ import { storageRef } from 'app/firebase/' //- Import actions 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) } diff --git a/app/components/Blog.jsx b/app/components/Blog.jsx index 858a685..69218cd 100644 --- a/app/components/Blog.jsx +++ b/app/components/Blog.jsx @@ -1,6 +1,6 @@ // - Import react components import React, { Component } from 'react' -import { withRouter } from 'react-router-dom'; +import { withRouter } from 'react-router-dom' import { connect } from 'react-redux' import PropTypes from 'prop-types' import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card' @@ -120,8 +120,8 @@ export class Blog extends Component { } else { - var postBack = { oddPostList: [], evenPostList: [] } - var parsedPosts = [] + let postBack = { oddPostList: [], evenPostList: [] } + let parsedPosts = [] Object.keys(posts).forEach((postId) => { if(tag){ let regex = new RegExp("#" + tag,'g') @@ -142,7 +142,7 @@ export class Blog extends Component { } sortedPosts.forEach((post, index) => { - var newPost = ( + let newPost = (
{index > 1 || (!postBack.divided && index > 0) ?
: ''} diff --git a/app/components/CommentGroup.jsx b/app/components/CommentGroup.jsx index b4a8340..83d22e8 100644 --- a/app/components/CommentGroup.jsx +++ b/app/components/CommentGroup.jsx @@ -120,17 +120,17 @@ static propTypes = { * @return {DOM} list of comments' DOM */ commentList = () => { - var comments = this.props.comments + let comments = this.props.comments if (comments) { - var parsedComments = []; + let parsedComments = [] Object.keys(comments).slice(0, 3).forEach((commentId) => { parsedComments.push({ id: commentId, ...comments[commentId] - }); - }); + }) + }) if (parsedComments.length === 2) { parsedComments.push(parsedComments[0]) } @@ -230,7 +230,7 @@ static propTypes = {
): ''} - ); + ) } } diff --git a/app/components/CommentList.jsx b/app/components/CommentList.jsx index 597e90f..f715073 100644 --- a/app/components/CommentList.jsx +++ b/app/components/CommentList.jsx @@ -1,6 +1,6 @@ // - Import react components import React, { Component } from 'react' -import { connect } from 'react-redux'; +import { connect } from 'react-redux' import PropTypes from 'prop-types' import { List, ListItem } from 'material-ui/List' @@ -57,17 +57,17 @@ export class CommentList extends Component { * @return {DOM} list of comments' DOM */ commentList = () => { - var comments = this.props.comments + let comments = this.props.comments if (comments) { - var parsedComments = []; + let parsedComments = [] Object.keys(comments).forEach((commentId) => { parsedComments.push({ id: commentId, ...comments[commentId] - }); - }); + }) + }) let sortedComments = PostAPI.sortObjectsDate(parsedComments) return sortedComments.map((comment, index, array) => { diff --git a/app/components/CommentWrite.jsx b/app/components/CommentWrite.jsx index 2fc5855..60e1c6b 100644 --- a/app/components/CommentWrite.jsx +++ b/app/components/CommentWrite.jsx @@ -11,21 +11,21 @@ import * as commentActions from 'commentActions' // - Define variable const buttonStyle = { marginTop: '5px' -}; +} // - Create CommentWrite component class export class CommentWrite extends Component { constructor(props) { - super(props); + super(props) this.state = { inputValue:'' } // Binding functions to `this` - this.handleRef = this.handleRef.bind(this); - this.focus = this.focus.bind(this); - this.handleAddComment = this.handleAddComment.bind(this); + this.handleRef = this.handleRef.bind(this) + this.focus = this.focus.bind(this) + this.handleAddComment = this.handleAddComment.bind(this) this.handleOnChange = this.handleOnChange.bind(this) } @@ -56,7 +56,7 @@ export class CommentWrite extends Component { - ); + ) } } diff --git a/app/components/EditProfile.jsx b/app/components/EditProfile.jsx index d0e25cc..bf1a16a 100644 --- a/app/components/EditProfile.jsx +++ b/app/components/EditProfile.jsx @@ -153,9 +153,9 @@ export class EditProfile extends Component { * Set banner image url */ handleRequestSetBanner = (url) => { - console.log('==========Banner=================='); - console.log(url); - console.log('===================================='); + console.log('==========Banner==================') + console.log(url) + console.log('====================================') this.setState({ banner: url }) @@ -226,7 +226,7 @@ export class EditProfile extends Component { handleResize = (evt) => { // Set initial state - var width = window.innerWidth + let width = window.innerWidth if (width > 900) { this.setState({ diff --git a/app/components/HomeHeader.jsx b/app/components/HomeHeader.jsx index 99fdc25..d908758 100644 --- a/app/components/HomeHeader.jsx +++ b/app/components/HomeHeader.jsx @@ -90,12 +90,12 @@ export class HomeHeader extends Component { */ handleNotifyTouchTap = (event) => { // This prevents ghost click. - event.preventDefault(); + event.preventDefault() this.setState({ openNotifyMenu: true, anchorEl: event.currentTarget, - }); + }) } /** @@ -106,12 +106,12 @@ export class HomeHeader extends Component { */ handleAvatarTouchTap = (event) => { // This prevents ghost click. - event.preventDefault(); + event.preventDefault() this.setState({ openAvatarMenu: true, anchorEl: event.currentTarget, - }); + }) } /** @@ -133,8 +133,8 @@ export class HomeHeader extends Component { handleRequestClose = () => { this.setState({ openAvatarMenu: false, - }); - }; + }) + } /** @@ -144,7 +144,7 @@ export class HomeHeader extends Component { handleResize = (evt) => { // Set initial state - var width = window.innerWidth + let width = window.innerWidth if (width >= 600 && !this.state.showTitle) { this.setState({ @@ -171,7 +171,7 @@ export class HomeHeader extends Component { /** * Styles */ - var styles = { + let styles = { toolbarStyle: { backgroundColor: "", transition: "all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms", diff --git a/app/components/ImageGallery.jsx b/app/components/ImageGallery.jsx index 18a91b4..61584b6 100644 --- a/app/components/ImageGallery.jsx +++ b/app/components/ImageGallery.jsx @@ -6,7 +6,7 @@ import { GridList, GridTile } from 'material-ui/GridList' import IconButton from 'material-ui/IconButton' import Subheader from 'material-ui/Subheader' 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 SvgAddImage from 'material-ui/svg-icons/image/add-a-photo' 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 */ constructor(props) { - super(props); + super(props) // Binding function to `this` this.close = this.close.bind(this) @@ -106,7 +106,7 @@ export class ImageGallery extends Component { onFileChange = (evt) => { 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) } diff --git a/app/components/Login.jsx b/app/components/Login.jsx index 1cd4103..2b47192 100644 --- a/app/components/Login.jsx +++ b/app/components/Login.jsx @@ -20,7 +20,7 @@ export class Login extends Component { * @param {object} props is an object properties of component */ constructor(props) { - super(props); + super(props) this.state = { emailInput: '', @@ -40,12 +40,12 @@ export class Login extends Component { * @param {event} evt is an event of inputs of element on change */ handleInputChange = (evt) => { - const target = evt.target; - const value = target.type === 'checkbox' ? target.checked : target.value; - const name = target.name; + const target = evt.target + const value = target.type === 'checkbox' ? target.checked : target.value + const name = target.name this.setState({ [name]: value - }); + }) switch (name) { @@ -60,7 +60,7 @@ export class Login extends Component { passwordInputError: '' }) - break; + break default: } @@ -71,7 +71,7 @@ export class Login extends Component { */ handleForm = () => { - var error = false + let error = false if (this.state.emailInput === '') { this.setState({ emailInputError: 'This field is required' @@ -110,7 +110,7 @@ export class Login extends Component { textAlign: 'center', display: 'block', margin: "auto" - }; + } return (
diff --git a/app/components/Master/IMasterState.ts b/app/components/Master/IMasterState.ts index 6af412b..e5543c9 100644 --- a/app/components/Master/IMasterState.ts +++ b/app/components/Master/IMasterState.ts @@ -13,12 +13,12 @@ export interface IMasterState { * @type {Boolean} * @memberof IMasterState */ - authed:Boolean; + authed:Boolean /** * It's true if all default data loaded from database * * @type {Boolean} * @memberof IMasterState */ - dataLoaded:Boolean; + dataLoaded:Boolean } \ No newline at end of file diff --git a/app/components/Master/Master.tsx b/app/components/Master/Master.tsx index 9e8b3af..743ad56 100644 --- a/app/components/Master/Master.tsx +++ b/app/components/Master/Master.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux' import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom' import { firebaseAuth, firebaseRef } from 'app/firebase' import { push } from 'react-router-redux' -import Snackbar from 'material-ui/Snackbar'; +import Snackbar from 'material-ui/Snackbar' import LinearProgress from 'material-ui/LinearProgress' @@ -14,8 +14,8 @@ import Signup from 'components/Signup' import Login from 'components/Login' import Settings from 'components/Settings' import MasterLoading from 'components/MasterLoading' -import { IMasterProps } from "./IMasterProps"; -import { IMasterState } from "./IMasterState"; +import { IMasterProps } from "./IMasterProps" +import { IMasterState } from "./IMasterState" // - Import API @@ -45,12 +45,12 @@ export class Master extends Component{ static isPrivate = true // Constructor constructor(props : IMasterProps) { - super(props); + super(props) this.state = { loading: true, authed: false, dataLoaded: false - }; + } // Binding functions to `this` this.handleLoading = this.handleLoading.bind(this) @@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch : any, ownProps : any) => { * @param {object} state */ 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 { guest: authorize.guest, uid: authorize.uid, diff --git a/app/components/Master/index.ts b/app/components/Master/index.ts index 338b781..ff026aa 100644 --- a/app/components/Master/index.ts +++ b/app/components/Master/index.ts @@ -1,2 +1,2 @@ -import Master from './Master'; -export default Master; +import Master from './Master' +export default Master diff --git a/app/components/MasterLoading.jsx b/app/components/MasterLoading.jsx index 36fde96..621c8b8 100644 --- a/app/components/MasterLoading.jsx +++ b/app/components/MasterLoading.jsx @@ -12,7 +12,7 @@ export default class MasterLoading extends Component { // Constructor constructor(props) { - super(props); + super(props) // Binding functions to `this` @@ -49,7 +49,7 @@ export default class MasterLoading extends Component { - ); + ) } } diff --git a/app/components/People.jsx b/app/components/People.jsx index 4c51c99..1dbaefb 100644 --- a/app/components/People.jsx +++ b/app/components/People.jsx @@ -53,15 +53,15 @@ export class People extends Component { case undefined: case '': this.props.setHeaderTitle('People') - break; + break case 'circles': this.props.setHeaderTitle('Circles') - break; + break case 'followers': this.props.setHeaderTitle('Followers') - break; + break default: - break; + break } } @@ -98,15 +98,15 @@ export class People extends Component { case undefined: case '': tabIndex = 0 - break; + break case 'circles': tabIndex = 1 - break; + break case 'followers': tabIndex = 2 - break; + break default: - break; + break } return (
diff --git a/app/components/Post.jsx b/app/components/Post.jsx index b72bf2b..61f610c 100644 --- a/app/components/Post.jsx +++ b/app/components/Post.jsx @@ -297,7 +297,7 @@ static propTypes = { this.setState({ readMoreState: !this.state.readMoreState - }); + }) } componentDidMount() { diff --git a/app/components/PostWrite.jsx b/app/components/PostWrite.jsx index 4ea8062..ebf8967 100644 --- a/app/components/PostWrite.jsx +++ b/app/components/PostWrite.jsx @@ -4,9 +4,9 @@ import { connect } from 'react-redux' import PropTypes from 'prop-types' import { List, ListItem } from 'material-ui/List' import Paper from 'material-ui/Paper' -import Dialog from 'material-ui/Dialog'; -import FlatButton from 'material-ui/FlatButton'; -import RaisedButton from 'material-ui/RaisedButton'; +import Dialog from 'material-ui/Dialog' +import FlatButton from 'material-ui/FlatButton' +import RaisedButton from 'material-ui/RaisedButton' import { grey400, grey800, darkBlack, lightBlack } from 'material-ui/styles/colors' import IconButton from 'material-ui/IconButton' import TextField from 'material-ui/TextField' @@ -182,7 +182,7 @@ export class PostWrite extends Component { post, 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 if (!edit) { @@ -329,9 +329,9 @@ export class PostWrite extends Component { {!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'} ) - var postAvatar = + let postAvatar = - var author = ( + let author = (
{ // Set initial state - var width = window.innerWidth + let width = window.innerWidth if (width > 900) { this.setState({ diff --git a/app/components/Settings.jsx b/app/components/Settings.jsx index 99743ea..86ed824 100644 --- a/app/components/Settings.jsx +++ b/app/components/Settings.jsx @@ -26,7 +26,7 @@ export class Settings extends Component { * @param {object} props is an object properties of component */ constructor(props) { - super(props); + super(props) this.state = { passwordInput: '', @@ -46,12 +46,12 @@ export class Settings extends Component { * @param {event} evt is an event of inputs of element on change */ handleInputChange = (evt) => { - const target = evt.target; - const value = target.type === 'checkbox' ? target.checked : target.value; - const name = target.name; + const target = evt.target + const value = target.type === 'checkbox' ? target.checked : target.value + const name = target.name this.setState({ [name]: value - }); + }) switch (name) { @@ -66,7 +66,7 @@ export class Settings extends Component { passwordInputError: '' }) - break; + break default: } @@ -77,7 +77,7 @@ export class Settings extends Component { */ handleForm = () => { - var error = false + let error = false if (this.state.passwordInput === '') { this.setState({ passwordInputError: 'This field is required' @@ -122,7 +122,7 @@ export class Settings extends Component { textAlign: 'center', display: 'block', margin: "auto" - }; + } return (
diff --git a/app/components/Sidebar.jsx b/app/components/Sidebar.jsx index 597048e..415bafc 100644 --- a/app/components/Sidebar.jsx +++ b/app/components/Sidebar.jsx @@ -16,8 +16,8 @@ import * as authorizeActions from 'authorizeActions' import * as globalActions from 'globalActions' // - Feilds -const color = 'teal'; -const colorKey = 'blue'; +const color = 'teal' +const colorKey = 'blue' const sizeCondition = (width) => (width >= 750) @@ -124,12 +124,12 @@ export class Sidebar extends Component { this.setState({ auto: true }) - break; + break case 'overlay': this.setState({ shouldBeClosed: true }) - break; + break default: } @@ -159,7 +159,7 @@ export class Sidebar extends Component { handleResize = (evt) => { // Set initial state - var width = window.innerWidth + let width = window.innerWidth if (sizeCondition(width)) { @@ -202,7 +202,7 @@ export class Sidebar extends Component { * Handle logout user */ handleLogout = () => { - var { dispatch } = this.props + let { dispatch } = this.props dispatch(authorizeActions.dbLogout()) } @@ -215,7 +215,7 @@ export class Sidebar extends Component { handleKeyUp = (evt) => { if (this.state.overlayOpen) { if (this.state.open && keycode(event) === 'esc') { - this.open(false); + this.open(false) } } } diff --git a/app/components/Signup.jsx b/app/components/Signup.jsx index 6de7ee0..21a0c8a 100644 --- a/app/components/Signup.jsx +++ b/app/components/Signup.jsx @@ -24,7 +24,7 @@ export class Signup extends Component { * @param {object} props is an object properties of component */ constructor(props){ - super(props); + super(props) this.state = { fullNameInput: '', @@ -82,7 +82,7 @@ export class Signup extends Component { this.setState({ checkInputError: '' }) - break; + break default: @@ -97,7 +97,7 @@ export class Signup extends Component { const {fullNameInput, emailInput, passwordInput, confirmInput} = this.state const {register} = this.props - var error = false + let error = false // Validate full name let fullNameCheck = fullNameInput.trim().toLowerCase() @@ -165,7 +165,7 @@ export class Signup extends Component { textAlign: 'center', display: 'block', margin: "auto" -}; +} return ( diff --git a/app/components/UserBox.jsx b/app/components/UserBox.jsx index 8841e54..6948d01 100644 --- a/app/components/UserBox.jsx +++ b/app/components/UserBox.jsx @@ -5,9 +5,9 @@ import PropTypes from 'prop-types' import {push} from 'react-router-redux' import Paper from 'material-ui/Paper' import FlatButton from 'material-ui/FlatButton' -import RaisedButton from 'material-ui/RaisedButton'; -import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'; -import Menu from 'material-ui/Menu'; +import RaisedButton from 'material-ui/RaisedButton' +import Popover, { PopoverAnimationVertical } from 'material-ui/Popover' +import Menu from 'material-ui/Menu' import MenuItem from 'material-ui/MenuItem' import Checkbox from 'material-ui/Checkbox' import TextField from 'material-ui/TextField' @@ -118,7 +118,7 @@ export class UserBox extends Component { */ handleTouchTap = (evt) => { // This prevents ghost click. - event.preventDefault(); + event.preventDefault() this.setState({ open: true, diff --git a/app/constants/postActionType.ts b/app/constants/postActionType.ts index b882786..dbac02f 100644 --- a/app/constants/postActionType.ts +++ b/app/constants/postActionType.ts @@ -1,11 +1,11 @@ export enum PostActionType { - ADD_IMAGE_POST = "ADD_IMAGE_POST", - ADD_VIDEO_POST = "ADD_VIDEO_POST", - ADD_POST = "ADD_POST", - UPDATE_POST = "UPDATE_POST", - DELETE_POST = "DELETE_POST", - ADD_LIST_POST = "ADD_LIST_POST", - CLEAR_ALL_DATA_POST = "CLEAR_ALL_DATA_POST" + ADD_IMAGE_POST = 'ADD_IMAGE_POST', + ADD_VIDEO_POST = 'ADD_VIDEO_POST', + ADD_POST = 'ADD_POST', + UPDATE_POST = 'UPDATE_POST', + DELETE_POST = 'DELETE_POST', + ADD_LIST_POST = 'ADD_LIST_POST', + CLEAR_ALL_DATA_POST = 'CLEAR_ALL_DATA_POST' } diff --git a/app/domain/authorize/index.ts b/app/domain/authorize/index.ts index 374b4f8..4d7f14c 100644 --- a/app/domain/authorize/index.ts +++ b/app/domain/authorize/index.ts @@ -1,5 +1,5 @@ -import { LoginUser } from "./loginResult"; -import { RegisterUserResult } from "./registerUserResult"; +import { LoginUser } from './loginResult' +import { RegisterUserResult } from './registerUserResult' export { LoginUser, diff --git a/app/domain/authorize/loginResult.ts b/app/domain/authorize/loginResult.ts index ec81669..1bb6b1d 100644 --- a/app/domain/authorize/loginResult.ts +++ b/app/domain/authorize/loginResult.ts @@ -1,11 +1,11 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class LoginUser extends BaseDomain{ constructor(uid: string){ - super(); + super() - this._uid = uid; + this._uid = uid } /** @@ -15,9 +15,9 @@ export class LoginUser extends BaseDomain{ * @memberof LoginUser */ - private _uid : string; + private _uid : string public get uid() : string { - return this._uid; + return this._uid } diff --git a/app/domain/authorize/registerUserResult.ts b/app/domain/authorize/registerUserResult.ts index 72856ee..5540968 100644 --- a/app/domain/authorize/registerUserResult.ts +++ b/app/domain/authorize/registerUserResult.ts @@ -1,11 +1,11 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class RegisterUserResult extends BaseDomain{ constructor(uid: string){ - super(); + super() - this._uid = uid; + this._uid = uid } /** * User identifier @@ -14,9 +14,9 @@ export class RegisterUserResult extends BaseDomain{ * @memberof LoginUser */ - private _uid : string; - public get uid() : string { - return this._uid; + private _uid : string + public get uid (): string { + return this._uid } } diff --git a/app/domain/circles/circle.ts b/app/domain/circles/circle.ts index efe4206..9fa7aa7 100644 --- a/app/domain/circles/circle.ts +++ b/app/domain/circles/circle.ts @@ -1,5 +1,5 @@ -import { BaseDomain } from "domain/common"; -import { User } from "domain/users"; +import { BaseDomain } from 'domain/common' +import { User } from 'domain/users' export class Circle extends BaseDomain { @@ -9,7 +9,7 @@ export class Circle extends BaseDomain { * @type {string} * @memberof User */ - public id?: string | null; + public id?: string | null /** * Circle creation date time @@ -17,7 +17,7 @@ export class Circle extends BaseDomain { * @type {Date} * @memberof Circle */ - public creationDate?: number; + public creationDate?: number /** * Circle owner identifier @@ -25,7 +25,7 @@ export class Circle extends BaseDomain { * @type {string} * @memberof Circle */ - public ownerId?: string | null; + public ownerId?: string | null /** * Circle name @@ -33,7 +33,7 @@ export class Circle extends BaseDomain { * @type {string} * @memberof User */ - public name: string; + public name: string /** * The users in a circle @@ -41,7 +41,7 @@ export class Circle extends BaseDomain { * @type {string} * @memberof User */ - public users: {[userId:string]: User}; + public users: {[userId:string]: User} diff --git a/app/domain/circles/index.ts b/app/domain/circles/index.ts index 82d2991..77bf310 100644 --- a/app/domain/circles/index.ts +++ b/app/domain/circles/index.ts @@ -1,5 +1,5 @@ -import {Circle} from './circle'; -import {UserFollower} from './userFollower'; +import {Circle} from './circle' +import {UserFollower} from './userFollower' export { Circle, diff --git a/app/domain/circles/userFollower.ts b/app/domain/circles/userFollower.ts index eccd2f4..19711fd 100644 --- a/app/domain/circles/userFollower.ts +++ b/app/domain/circles/userFollower.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class UserFollower extends BaseDomain { @@ -9,7 +9,7 @@ export class UserFollower extends BaseDomain { * @type {Date} * @memberof Circle */ - public creationDate?: number; + public creationDate?: number /** * User full name @@ -17,7 +17,7 @@ export class UserFollower extends BaseDomain { * @type {string} * @memberof UserFollower */ - public fullName: string; + public fullName: string /** * Avatar URL address @@ -25,7 +25,7 @@ export class UserFollower extends BaseDomain { * @type {string} * @memberof UserFollower */ - public avatar: string; + public avatar: string /** * If following user approved {true} or not {false} @@ -33,7 +33,7 @@ export class UserFollower extends BaseDomain { * @type {Boolean} * @memberof UserFollower */ - public approved: Boolean; + public approved: Boolean diff --git a/app/domain/comments/comment.ts b/app/domain/comments/comment.ts index ba2accb..9909833 100644 --- a/app/domain/comments/comment.ts +++ b/app/domain/comments/comment.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Comment extends BaseDomain { @@ -8,7 +8,7 @@ export class Comment extends BaseDomain { * @type {string} * @memberof Comment */ - public postId: string; + public postId: string /** * Comment text @@ -16,7 +16,7 @@ export class Comment extends BaseDomain { * @type {string} * @memberof Comment */ - public text: string; + public text: string /** * Comment score @@ -24,7 +24,7 @@ export class Comment extends BaseDomain { * @type {number} * @memberof Comment */ - public score: number; + public score: number /** * Comment creation date @@ -32,7 +32,7 @@ export class Comment extends BaseDomain { * @type {number} * @memberof Comment */ - public creationDate:number; + public creationDate:number /** * Comment owner full name @@ -40,7 +40,7 @@ export class Comment extends BaseDomain { * @type {string} * @memberof Comment */ - public userDisplayName: string; + public userDisplayName: string /** * Comment owner avater address @@ -48,7 +48,7 @@ export class Comment extends BaseDomain { * @type {string} * @memberof Comment */ - public userAvatar: string; + public userAvatar: string /** * Comment owner identifier @@ -56,6 +56,6 @@ export class Comment extends BaseDomain { * @type {string} * @memberof Comment */ - public userId: string; + public userId: string } \ No newline at end of file diff --git a/app/domain/comments/index.ts b/app/domain/comments/index.ts index 19f79c5..38daa74 100644 --- a/app/domain/comments/index.ts +++ b/app/domain/comments/index.ts @@ -1,4 +1,4 @@ -import {Comment} from './comment'; +import {Comment} from './comment' export { Comment diff --git a/app/domain/common/index.ts b/app/domain/common/index.ts index 91d22e0..bfbbe3c 100644 --- a/app/domain/common/index.ts +++ b/app/domain/common/index.ts @@ -1,5 +1,5 @@ -import { SocialError } from "./socialError"; -import { BaseDomain } from "./baseDomain"; +import { SocialError } from './socialError' +import { BaseDomain } from './baseDomain' export { SocialError, diff --git a/app/domain/common/socialError.ts b/app/domain/common/socialError.ts index e0219ce..1544b98 100644 --- a/app/domain/common/socialError.ts +++ b/app/domain/common/socialError.ts @@ -1,9 +1,9 @@ export class SocialError{ constructor(code: string, description: string){ - this._code = code; - this._description = description; - this._isError = true; + this._code = code + this._description = description + this._isError = true } /** @@ -12,9 +12,9 @@ export class SocialError{ * @type {string} * @memberof SocialError */ - private _code : string; + private _code : string public get code() : string { - return this._code; + return this._code } /** @@ -24,9 +24,9 @@ export class SocialError{ * @memberof SocialError */ - private _description : string; + private _description : string public get description() : string { - return this._description; + return this._description } @@ -37,9 +37,9 @@ export class SocialError{ * @memberof SocialError */ - private _isError : Boolean; + private _isError : Boolean public get isError() : Boolean { - return this._isError; + return this._isError } } \ No newline at end of file diff --git a/app/domain/imageGallery/image.ts b/app/domain/imageGallery/image.ts index beb0cf3..cb60e17 100644 --- a/app/domain/imageGallery/image.ts +++ b/app/domain/imageGallery/image.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Image extends BaseDomain { @@ -8,7 +8,7 @@ export class Image extends BaseDomain { * @type {string} * @memberof Image */ - public id?: string | null; + public id?: string | null /** * Image creation date @@ -16,7 +16,7 @@ export class Image extends BaseDomain { * @type {number} * @memberof Image */ - public creationDate: number; + public creationDate: number /** * Image delete date @@ -24,7 +24,7 @@ export class Image extends BaseDomain { * @type {string} * @memberof Image */ - public deleteDate: string; + public deleteDate: string /** * Image URL address @@ -32,7 +32,7 @@ export class Image extends BaseDomain { * @type {string} * @memberof Image */ - public URL: string; + public URL: string /** * Image folder name with image name {folderName/imageName} @@ -40,7 +40,7 @@ export class Image extends BaseDomain { * @type {string} * @memberof Image */ - public fullPath: string; + public fullPath: string /** * Image owner identifier @@ -48,7 +48,7 @@ export class Image extends BaseDomain { * @type {string} * @memberof Image */ - public ownerUserId: string; + public ownerUserId: string /** * Last edit date @@ -56,7 +56,7 @@ export class Image extends BaseDomain { * @type {number} * @memberof Image */ - public lastEditDate: number; + public lastEditDate: number /** * If the image was deleted {true} or not {false} @@ -64,6 +64,6 @@ export class Image extends BaseDomain { * @type {Boolean} * @memberof Image */ - public deleted: Boolean; + public deleted: Boolean } \ No newline at end of file diff --git a/app/domain/imageGallery/index.ts b/app/domain/imageGallery/index.ts index 2b06bd1..138671c 100644 --- a/app/domain/imageGallery/index.ts +++ b/app/domain/imageGallery/index.ts @@ -1,4 +1,4 @@ -import { Image } from "./image"; +import { Image } from './image' export { Image diff --git a/app/domain/notifications/index.ts b/app/domain/notifications/index.ts index dbc6a18..d73e47c 100644 --- a/app/domain/notifications/index.ts +++ b/app/domain/notifications/index.ts @@ -1,4 +1,4 @@ -import {Notification} from './notification'; +import {Notification} from './notification' export { Notification diff --git a/app/domain/notifications/notification.ts b/app/domain/notifications/notification.ts index 7a98ae0..e8e2d42 100644 --- a/app/domain/notifications/notification.ts +++ b/app/domain/notifications/notification.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Notification extends BaseDomain { @@ -8,7 +8,7 @@ export class Notification extends BaseDomain { * @type {string} * @memberof Notification */ - public description: string; + public description: string /** * The URL which notification refer to @@ -16,7 +16,7 @@ export class Notification extends BaseDomain { * @type {string} * @memberof Notification */ - public url: string; + public url: string /** * The identifier of the user who makes the notification @@ -24,7 +24,7 @@ export class Notification extends BaseDomain { * @type {string} * @memberof Notification */ - public notifierUserId: string; + public notifierUserId: string /** * The identifier of the user who receive the notification @@ -32,7 +32,7 @@ export class Notification extends BaseDomain { * @type {string} * @memberof Notification */ - public notifyRecieverUserId: string; + public notifyRecieverUserId: string /** * If the notification is seen {true} or not {false} @@ -40,6 +40,6 @@ export class Notification extends BaseDomain { * @type {Boolean} * @memberof Notification */ - public isSeen: Boolean; + public isSeen: Boolean } \ No newline at end of file diff --git a/app/domain/posts/index.ts b/app/domain/posts/index.ts index 436061e..fdb7141 100644 --- a/app/domain/posts/index.ts +++ b/app/domain/posts/index.ts @@ -1,4 +1,4 @@ -import {Post} from './post'; +import {Post} from './post' export { Post diff --git a/app/domain/posts/post.ts b/app/domain/posts/post.ts index 065d698..937dc9e 100644 --- a/app/domain/posts/post.ts +++ b/app/domain/posts/post.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Post extends BaseDomain { @@ -8,7 +8,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public id?: string | null; + public id?: string | null /** * The identifier of post type @@ -16,7 +16,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public postTypeId: number; + public postTypeId: number /** * The post creation date @@ -24,7 +24,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public creationDate:number; + public creationDate:number /** * The post delete date @@ -32,7 +32,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public deleteDate: number; + public deleteDate: number /** * The score of post @@ -40,7 +40,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public score: number; + public score: number /** * Post view count @@ -48,7 +48,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public viewCount: number; + public viewCount: number /** * The text of post @@ -56,7 +56,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public body: string; + public body: string /** * The identifier of post owner @@ -64,7 +64,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public ownerUserId: string; + public ownerUserId: string /** * Full name of post owner @@ -72,7 +72,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public ownerDisplayName: string; + public ownerDisplayName: string /** * Avatar address of post owner @@ -80,7 +80,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public ownerAvatar: string; + public ownerAvatar: string /** * Last post edit date @@ -88,7 +88,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public lastEditDate: number; + public lastEditDate: number /** * Post tags @@ -96,7 +96,7 @@ export class Post extends BaseDomain { * @type {string[]} * @memberof Post */ - public tags: string[]; + public tags: string[] /** * Numeber of comment on the post @@ -104,7 +104,7 @@ export class Post extends BaseDomain { * @type {number} * @memberof Post */ - public commentCounter: number; + public commentCounter: number /** * The address of image on the post @@ -112,7 +112,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public image: string; + public image: string /** * Post image full path @@ -120,7 +120,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public imageFullPath: string; + public imageFullPath: string /** * The adress of video on the post @@ -128,7 +128,7 @@ export class Post extends BaseDomain { * @type {string} * @memberof Post */ - public video: string; + public video: string /** * If writing comment is disabled {true} or not {false} @@ -136,7 +136,7 @@ export class Post extends BaseDomain { * @type {Boolean} * @memberof Post */ - public disableComments: Boolean; + public disableComments: Boolean /** * If sharing post is disabled {true} or not {false} @@ -144,7 +144,7 @@ export class Post extends BaseDomain { * @type {Boolean} * @memberof Post */ - public disableSharing: Boolean; + public disableSharing: Boolean /** * If the post is deleted {true} or not false @@ -152,7 +152,7 @@ export class Post extends BaseDomain { * @type {Boolean} * @memberof Post */ - public deleted: Boolean; + public deleted: Boolean } \ No newline at end of file diff --git a/app/domain/users/index.ts b/app/domain/users/index.ts index c6d5d29..87b24b7 100644 --- a/app/domain/users/index.ts +++ b/app/domain/users/index.ts @@ -1,5 +1,5 @@ -import {User} from './user'; -import {Profile} from './profile'; +import {User} from './user' +import {Profile} from './profile' export { User, diff --git a/app/domain/users/profile.ts b/app/domain/users/profile.ts index 48ff32a..440ad1e 100644 --- a/app/domain/users/profile.ts +++ b/app/domain/users/profile.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Profile extends BaseDomain { @@ -8,7 +8,7 @@ export class Profile extends BaseDomain { * @type {string} * @memberof Profile */ - public avatar: string; + public avatar: string /** * User email @@ -16,7 +16,7 @@ export class Profile extends BaseDomain { * @type {string} * @memberof Profile */ - public email: string; + public email: string /** * User full name @@ -24,7 +24,7 @@ export class Profile extends BaseDomain { * @type {string} * @memberof Profile */ - public fullName: string; + public fullName: string /** * The banner address of user profile @@ -32,7 +32,7 @@ export class Profile extends BaseDomain { * @type {string} * @memberof Profile */ - public banner: string; + public banner: string /** * User tag line @@ -40,6 +40,6 @@ export class Profile extends BaseDomain { * @type {string} * @memberof Profile */ - public tagLine: string; + public tagLine: string } \ No newline at end of file diff --git a/app/domain/users/user.ts b/app/domain/users/user.ts index 2821c69..39f1e12 100644 --- a/app/domain/users/user.ts +++ b/app/domain/users/user.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class User extends BaseDomain { @@ -8,7 +8,7 @@ export class User extends BaseDomain { * @type {string} * @memberof User */ - public fullName: string; + public fullName: string /** * User avatar address @@ -16,7 +16,7 @@ export class User extends BaseDomain { * @type {string} * @memberof User */ - public avatar: string; + public avatar: string /** * Email of the user @@ -24,7 +24,7 @@ export class User extends BaseDomain { * @type {string} * @memberof User */ - public email?: string | null; + public email?: string | null /** * Password of the user @@ -32,7 +32,7 @@ export class User extends BaseDomain { * @type {string} * @memberof User */ - public password?: string | null; + public password?: string | null /** * User identifier @@ -40,7 +40,7 @@ export class User extends BaseDomain { * @type {string} * @memberof User */ - public userId?: string | null; + public userId?: string | null /** * User creation date @@ -48,6 +48,6 @@ export class User extends BaseDomain { * @type {number} * @memberof User */ - public creationDate: number; + public creationDate: number } \ No newline at end of file diff --git a/app/domain/votes/index.ts b/app/domain/votes/index.ts index cd8c5cc..d2ca1e7 100644 --- a/app/domain/votes/index.ts +++ b/app/domain/votes/index.ts @@ -1,4 +1,4 @@ -import {Vote} from './vote'; +import {Vote} from './vote' export { Vote diff --git a/app/domain/votes/vote.ts b/app/domain/votes/vote.ts index 16e5ce9..4daa0c7 100644 --- a/app/domain/votes/vote.ts +++ b/app/domain/votes/vote.ts @@ -1,4 +1,4 @@ -import { BaseDomain } from "domain/common"; +import { BaseDomain } from 'domain/common' export class Vote extends BaseDomain { @@ -8,7 +8,7 @@ export class Vote extends BaseDomain { * @type {string} * @memberof Vote */ - public id?: string | null; + public id?: string | null /** * Post identifire which vote on @@ -16,7 +16,7 @@ export class Vote extends BaseDomain { * @type {string} * @memberof Vote */ - public postId: string; + public postId: string /** * Vote date @@ -24,7 +24,7 @@ export class Vote extends BaseDomain { * @type {number} * @memberof Vote */ - public creationDate: number; + public creationDate: number /** * Voter full name @@ -32,7 +32,7 @@ export class Vote extends BaseDomain { * @type {string} * @memberof Vote */ - public userDisplayName: string; + public userDisplayName: string /** * Avatar of voter @@ -40,7 +40,7 @@ export class Vote extends BaseDomain { * @type {string} * @memberof Vote */ - public userAvatar: string; + public userAvatar: string /** * Voter identifier @@ -48,6 +48,6 @@ export class Vote extends BaseDomain { * @type {string} * @memberof Vote */ - public userId: string; + public userId: string } \ No newline at end of file diff --git a/app/factories/IServiceProvider.ts b/app/factories/IServiceProvider.ts index f88dc51..340f3d5 100644 --- a/app/factories/IServiceProvider.ts +++ b/app/factories/IServiceProvider.ts @@ -5,6 +5,6 @@ export interface IServiceProvider{ * * @memberof IServiceProvider */ - createAuthorizeService : () => IAuthorizeService; + createAuthorizeService : () => IAuthorizeService } \ No newline at end of file diff --git a/app/factories/index.ts b/app/factories/index.ts index 8deabc1..a880dae 100644 --- a/app/factories/index.ts +++ b/app/factories/index.ts @@ -1,5 +1,5 @@ -import { IServiceProvider } from "./IServiceProvider"; -import { ServiceProvide } from "./serviceProvide"; +import { IServiceProvider } from './IServiceProvider' +import { ServiceProvide } from './serviceProvide' export { IServiceProvider, diff --git a/app/factories/serviceProvide.ts b/app/factories/serviceProvide.ts index eb8e592..8ef910e 100644 --- a/app/factories/serviceProvide.ts +++ b/app/factories/serviceProvide.ts @@ -1,14 +1,14 @@ //#region Interfaces -import { IServiceProvider } from "factories"; -import { IAuthorizeService } from "services/authorize"; +import { IServiceProvider } from 'factories' +import { IAuthorizeService } from 'services/authorize' //#endregion //#region Service implemented classes // - Firebase services - import { AuthorizeService } from "firebaseServices/authorize"; + import { AuthorizeService } from 'firebaseServices/authorize' //#endregion @@ -20,7 +20,7 @@ export class ServiceProvide implements IServiceProvider { * @memberof ServiceProvide */ createAuthorizeService: () => IAuthorizeService = () => { - return new AuthorizeService(); + return new AuthorizeService() } } \ No newline at end of file diff --git a/app/firebase/index.js b/app/firebase/index.js index 0762333..e9fda77 100644 --- a/app/firebase/index.js +++ b/app/firebase/index.js @@ -1,7 +1,7 @@ -import firebase from 'firebase'; +import firebase from 'firebase' try { - var config = { + let config = { apiKey: process.env.API_KEY, authDomain: process.env.AUTH_DOMAIN, databaseURL: process.env.DATABASE_URL, @@ -10,17 +10,17 @@ try { messagingSenderId: process.env.MESSAGING_SENDER_ID } - firebase.initializeApp(config); + firebase.initializeApp(config) } catch (e) { } // - Storage reference -export var storageRef = firebase.storage().ref() +export let storageRef = firebase.storage().ref() // - Database authorize -export var firebaseAuth = firebase.auth -export var firebaseRef = firebase.database().ref() +export let firebaseAuth = firebase.auth +export let firebaseRef = firebase.database().ref() // - Firebase default -export default firebase; +export default firebase diff --git a/app/firebaseServices/authorize/AuthorizeService.ts b/app/firebaseServices/authorize/AuthorizeService.ts index 3629571..bab3ad7 100644 --- a/app/firebaseServices/authorize/AuthorizeService.ts +++ b/app/firebaseServices/authorize/AuthorizeService.ts @@ -1,14 +1,14 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { IAuthorizeService } from "services/authorize"; -import { User } from "Domain/users"; -import { LoginUser, RegisterUserResult } from "domain/authorize"; -import { SocialError } from "domain/common"; +import { IAuthorizeService } from 'services/authorize' +import { User } from 'Domain/users' +import { LoginUser, RegisterUserResult } from 'domain/authorize' +import { SocialError } from 'domain/common' /** * Firbase authorize service - * + * * @export * @class AuthorizeService * @implements {IAuthorizeService} @@ -17,45 +17,45 @@ export class AuthorizeService implements IAuthorizeService { /** * Login the user - * + * * @returns {Promise} * @memberof IAuthorizeService */ - public login: (email: string, password: string) => Promise = (email, password) => { + public login: (email: string, password: string) => Promise = (email, password) => { - return new Promise((resolve, reject) => { - firebaseAuth() + return new Promise((resolve, reject) => { + firebaseAuth() .signInWithEmailAndPassword(email, password) .then((result) => { - resolve(new LoginUser(result.uid)); + resolve(new LoginUser(result.uid)) }) .catch((error: any) => { - reject(new SocialError(error.code, error.message)); + reject(new SocialError(error.code, error.message)) }) - }); - }; + }) + } /** - * Logs out the user - * - * @returns {Promise} - * @memberof IAuthorizeService - */ + * Logs out the user + * + * @returns {Promise} + * @memberof IAuthorizeService + */ public logout: () => Promise = () => { return new Promise((resolve, reject) => { firebaseAuth() .signOut() .then((result) => { - resolve(); + resolve() }) .catch((error: any) => { - reject(new SocialError(error.code, error.message)); + reject(new SocialError(error.code, error.message)) }) - }); + }) } - /** + /** * Register a user * * @returns {Promise} @@ -64,49 +64,48 @@ export class AuthorizeService implements IAuthorizeService { public registerUser: (user: User) => Promise = (user) => { return new Promise((resolve, reject) => { firebaseAuth() - .createUserWithEmailAndPassword(user.email, user.password) + .createUserWithEmailAndPassword(user.email as string, user.password as string) .then((signupResult) => { firebaseRef.child(`users/${signupResult.uid}/info`) .set({ ...user, - avatar: 'noImage' + avatar: 'noImage' }) .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 * * @returns {Promise} * @memberof IAuthorizeService */ - public updatePassword: (newPassword: string) => Promise = (newPassword) => { - console.log('===================================='); - console.log("update password"); - console.log('===================================='); - return new Promise((resolve, reject) => { - var user = firebaseAuth().currentUser; - console.log('===================================='); - console.log(user); - console.log('===================================='); - if (user) { - user.updatePassword(newPassword).then(() => { - // Update successful. - resolve(); - }).catch((error: any) => { - // An error happened. - reject(new SocialError(error.code, error.message)); - }); - } + public updatePassword: (newPassword: string) => Promise = (newPassword) => { + console.log('====================================') + console.log('update password') + console.log('====================================') + return new Promise((resolve, reject) => { + let user = firebaseAuth().currentUser + console.log('====================================') + console.log(user) + console.log('====================================') + if (user) { + user.updatePassword(newPassword).then(() => { + // Update successful. + resolve() + }).catch((error: any) => { + // An error happened. + reject(new SocialError(error.code, error.message)) + }) + } - }); - } + }) + } - -} \ No newline at end of file +} diff --git a/app/firebaseServices/authorize/index.ts b/app/firebaseServices/authorize/index.ts index 7e35377..32dad68 100644 --- a/app/firebaseServices/authorize/index.ts +++ b/app/firebaseServices/authorize/index.ts @@ -1,4 +1,4 @@ -import { AuthorizeService } from "./AuthorizeService"; +import { AuthorizeService } from './AuthorizeService' export { AuthorizeService diff --git a/app/firebaseServices/circles/CircleService.ts b/app/firebaseServices/circles/CircleService.ts index 427ef8c..ac6a7fe 100644 --- a/app/firebaseServices/circles/CircleService.ts +++ b/app/firebaseServices/circles/CircleService.ts @@ -1,11 +1,11 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { ICircleService } from 'services/circles'; -import { Circle, UserFollower } from 'domain/circles'; -import { User } from 'domain/users'; +import { SocialError } from 'domain/common' +import { ICircleService } from 'services/circles' +import { Circle, UserFollower } from 'domain/circles' +import { User } from 'domain/users' /** * Firbase circle service @@ -16,12 +16,12 @@ import { User } from 'domain/users'; */ export class CircleService implements ICircleService { - addCircle: (userId: string, circle: Circle) => Promise; - addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise; - deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise; - updateCircle: (userId: string, circle: Circle, circleId: string) => Promise; - deleteCircle: (circleId: string, userId: string) => Promise; - getCircles: () => Promise<{ [circleId: string]: Circle; }>; - getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle; }>; + addCircle: (userId: string, circle: Circle) => Promise + addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise + deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise + updateCircle: (userId: string, circle: Circle, circleId: string) => Promise + deleteCircle: (circleId: string, userId: string) => Promise + getCircles: () => Promise<{ [circleId: string]: Circle }> + getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle }> } \ No newline at end of file diff --git a/app/firebaseServices/circles/index.ts b/app/firebaseServices/circles/index.ts index f7fb770..54ccd4d 100644 --- a/app/firebaseServices/circles/index.ts +++ b/app/firebaseServices/circles/index.ts @@ -1,4 +1,4 @@ -import { AuthorizeService } from "./CircleService"; +import { AuthorizeService } from './CircleService' export { AuthorizeService diff --git a/app/firebaseServices/comments/CommentService.ts b/app/firebaseServices/comments/CommentService.ts index 6853214..a921a7c 100644 --- a/app/firebaseServices/comments/CommentService.ts +++ b/app/firebaseServices/comments/CommentService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { ICommentService } from 'services/comments'; +import { SocialError } from 'domain/common' +import { ICommentService } from 'services/comments' /** * Firbase comment service diff --git a/app/firebaseServices/comments/index.ts b/app/firebaseServices/comments/index.ts index 8c005fd..e4f9a1e 100644 --- a/app/firebaseServices/comments/index.ts +++ b/app/firebaseServices/comments/index.ts @@ -1,4 +1,4 @@ -import { CommentService } from "./CommentService"; +import { CommentService } from './CommentService' export { CommentService diff --git a/app/firebaseServices/common/CommonService.ts b/app/firebaseServices/common/CommonService.ts index 159b823..ebe4cee 100644 --- a/app/firebaseServices/common/CommonService.ts +++ b/app/firebaseServices/common/CommonService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { ICommonService } from 'services/common'; +import { SocialError } from 'domain/common' +import { ICommonService } from 'services/common' /** * Firbase common service diff --git a/app/firebaseServices/common/index.ts b/app/firebaseServices/common/index.ts index fe2af39..7470140 100644 --- a/app/firebaseServices/common/index.ts +++ b/app/firebaseServices/common/index.ts @@ -1,4 +1,4 @@ -import { CommonService } from "./CommonService"; +import { CommonService } from './CommonService' export { CommonService diff --git a/app/firebaseServices/imageGallery/ImageGalleryService.ts b/app/firebaseServices/imageGallery/ImageGalleryService.ts index f55a281..85af5f7 100644 --- a/app/firebaseServices/imageGallery/ImageGalleryService.ts +++ b/app/firebaseServices/imageGallery/ImageGalleryService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { IImageGalleryService } from 'services/imageGallery'; +import { SocialError } from 'domain/common' +import { IImageGalleryService } from 'services/imageGallery' /** * Firbase image gallery service diff --git a/app/firebaseServices/imageGallery/index.ts b/app/firebaseServices/imageGallery/index.ts index 1d781d9..787b63d 100644 --- a/app/firebaseServices/imageGallery/index.ts +++ b/app/firebaseServices/imageGallery/index.ts @@ -1,4 +1,4 @@ -import { ImageGalleryService } from "./ImageGalleryService"; +import { ImageGalleryService } from './ImageGalleryService' export { ImageGalleryService diff --git a/app/firebaseServices/notifications/index.ts b/app/firebaseServices/notifications/index.ts index 620eb53..943f9ef 100644 --- a/app/firebaseServices/notifications/index.ts +++ b/app/firebaseServices/notifications/index.ts @@ -1,4 +1,4 @@ -import { NotificationService } from "./NotificationService"; +import { NotificationService } from './NotificationService' export { NotificationService diff --git a/app/firebaseServices/notifications/notificationService.ts b/app/firebaseServices/notifications/notificationService.ts index 9333d3c..dcc27cf 100644 --- a/app/firebaseServices/notifications/notificationService.ts +++ b/app/firebaseServices/notifications/notificationService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { INotificationService } from 'services/notifications'; +import { SocialError } from 'domain/common' +import { INotificationService } from 'services/notifications' /** * Firbase notification service diff --git a/app/firebaseServices/posts/PostService.ts b/app/firebaseServices/posts/PostService.ts index debe49d..2b51a7c 100644 --- a/app/firebaseServices/posts/PostService.ts +++ b/app/firebaseServices/posts/PostService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { IPostService } from 'services/posts'; +import { SocialError } from 'domain/common' +import { IPostService } from 'services/posts' /** * Firbase post service diff --git a/app/firebaseServices/posts/index.ts b/app/firebaseServices/posts/index.ts index 159f7e3..e9c7fd6 100644 --- a/app/firebaseServices/posts/index.ts +++ b/app/firebaseServices/posts/index.ts @@ -1,4 +1,4 @@ -import { PostService } from "./PostService"; +import { PostService } from './PostService' export { PostService diff --git a/app/firebaseServices/users/UserService.ts b/app/firebaseServices/users/UserService.ts index f94d545..084a6fb 100644 --- a/app/firebaseServices/users/UserService.ts +++ b/app/firebaseServices/users/UserService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { IUserService } from 'services/users'; +import { SocialError } from 'domain/common' +import { IUserService } from 'services/users' /** * Firbase user service diff --git a/app/firebaseServices/users/index.ts b/app/firebaseServices/users/index.ts index ac86cf7..d883994 100644 --- a/app/firebaseServices/users/index.ts +++ b/app/firebaseServices/users/index.ts @@ -1,4 +1,4 @@ -import { UserService } from "./UserService"; +import { UserService } from './UserService' export { UserService diff --git a/app/firebaseServices/votes/VoteService.ts b/app/firebaseServices/votes/VoteService.ts index e13a584..a216acc 100644 --- a/app/firebaseServices/votes/VoteService.ts +++ b/app/firebaseServices/votes/VoteService.ts @@ -1,8 +1,8 @@ // - Import react components -import { firebaseRef, firebaseAuth } from 'app/firebase/'; +import { firebaseRef, firebaseAuth } from 'app/firebase/' -import { SocialError } from "domain/common"; -import { IVoteService } from 'services/votes'; +import { SocialError } from 'domain/common' +import { IVoteService } from 'services/votes' /** * Firbase vote service diff --git a/app/firebaseServices/votes/index.ts b/app/firebaseServices/votes/index.ts index 6b882f3..fb59f65 100644 --- a/app/firebaseServices/votes/index.ts +++ b/app/firebaseServices/votes/index.ts @@ -1,4 +1,4 @@ -import { VoteService } from "./VoteService"; +import { VoteService } from './VoteService' export { VoteService diff --git a/app/layouts/DialogTitle.jsx b/app/layouts/DialogTitle.jsx index 58fa2ee..c3044ca 100644 --- a/app/layouts/DialogTitle.jsx +++ b/app/layouts/DialogTitle.jsx @@ -63,7 +63,7 @@ export default class DialogTitle extends Component { contain: { display: 'flex', flexDirection: 'row', - justifyContent: "space-between" + justifyContent: 'space-between' }, title: { color: 'rgba(0,0,0,0.87)', diff --git a/app/reducers/authorize/AuthorizeState.ts b/app/reducers/authorize/AuthorizeState.ts index 4526e9b..3509c5c 100644 --- a/app/reducers/authorize/AuthorizeState.ts +++ b/app/reducers/authorize/AuthorizeState.ts @@ -12,7 +12,7 @@ export class AuthorizeState { * @type {number} * @memberof AuthorizeState */ - uid: number = 0; + uid: number = 0 /** * If user is authed {true} or not {false} @@ -20,7 +20,7 @@ export class AuthorizeState { * @type {Boolean} * @memberof AuthorizeState */ - authed: Boolean = false; + authed: Boolean = false /** * If user password is updated {true} or not {false} @@ -28,7 +28,7 @@ export class AuthorizeState { * @type {Boolean} * @memberof AuthorizeState */ - updatePassword: Boolean = false; + updatePassword: Boolean = false /** * If the user is guest {true} or not {false} @@ -36,5 +36,5 @@ export class AuthorizeState { * @type {Boolean} * @memberof AuthorizeState */ - guest: Boolean = false; + guest: Boolean = false } \ No newline at end of file diff --git a/app/reducers/authorize/IAuthorizeAction.ts b/app/reducers/authorize/IAuthorizeAction.ts index bc1b31e..3690554 100644 --- a/app/reducers/authorize/IAuthorizeAction.ts +++ b/app/reducers/authorize/IAuthorizeAction.ts @@ -9,7 +9,7 @@ import {AuthorizeActionType} from 'constants/authorizeActionType' * @interface IAuthorizeAction */ export interface IAuthorizeAction { - payload: any; - type: AuthorizeActionType; + payload: any + type: AuthorizeActionType } \ No newline at end of file diff --git a/app/reducers/authorize/authorizeReducer.ts b/app/reducers/authorize/authorizeReducer.ts index cdf4e88..e9dea8d 100644 --- a/app/reducers/authorize/authorizeReducer.ts +++ b/app/reducers/authorize/authorizeReducer.ts @@ -1,11 +1,11 @@ // - Import react components -import {Reducer, Action} from "redux"; +import {Reducer, Action} from 'redux' // - Import action types import {AuthorizeActionType} from 'constants/authorizeActionType' -import { IAuthorizeAction } from "./IAuthorizeAction"; -import { AuthorizeState } from "./AuthorizeState"; +import { IAuthorizeAction } from './IAuthorizeAction' +import { AuthorizeState } from './AuthorizeState' @@ -14,8 +14,8 @@ import { AuthorizeState } from "./AuthorizeState"; * @param {object} state * @param {object} action */ -export var authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{ - const { payload } = action; +export let authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{ + const { payload } = action switch (action.type) { case AuthorizeActionType.LOGIN: return{ diff --git a/app/reducers/authorize/index.ts b/app/reducers/authorize/index.ts index 3835c8e..36633e5 100644 --- a/app/reducers/authorize/index.ts +++ b/app/reducers/authorize/index.ts @@ -1,3 +1,3 @@ -import { authorizeReducer } from "./authorizeReducer"; +import { authorizeReducer } from './authorizeReducer' -export {authorizeReducer}; \ No newline at end of file +export {authorizeReducer} \ No newline at end of file diff --git a/app/reducers/circles/CircleState.ts b/app/reducers/circles/CircleState.ts index 407d8f0..deaf7fb 100644 --- a/app/reducers/circles/CircleState.ts +++ b/app/reducers/circles/CircleState.ts @@ -1,4 +1,4 @@ -import { Circle } from "domain/circles"; +import { Circle } from 'domain/circles' /** * Circle state @@ -14,7 +14,7 @@ export class CircleState { * @type {({[userId: string]: {[circleId: string]: Circle}} | null)} * @memberof CircleState */ - userCircles: {[userId: string]: {[circleId: string]: Circle}} = {}; + userCircles: {[userId: string]: {[circleId: string]: Circle}} = {} /** * If user circles are loaded {true} or not {false} @@ -22,5 +22,5 @@ export class CircleState { * @type {Boolean} * @memberof CircleState */ - loaded: Boolean = false; + loaded: Boolean = false } \ No newline at end of file diff --git a/app/reducers/circles/circleReducer.ts b/app/reducers/circles/circleReducer.ts index 0ae6ad4..b9165df 100644 --- a/app/reducers/circles/circleReducer.ts +++ b/app/reducers/circles/circleReducer.ts @@ -3,14 +3,14 @@ import moment from 'moment' import _ from 'lodash' // - Import domain -import { User } from "domain/users"; -import { Circle } from "domain/circles"; +import { User } from 'domain/users' +import { Circle } from 'domain/circles' // - Import action types import {CircleActionType} from 'constants/circleActionType' -import { CircleState } from "./CircleState"; -import { ICircleAction } from "./ICircleAction"; +import { CircleState } from './CircleState' +import { ICircleAction } from './ICircleAction' @@ -19,11 +19,11 @@ import { ICircleAction } from "./ICircleAction"; * @param state * @param action */ -export var circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => { +export let circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => { const { payload } = action switch (action.type) { case CircleActionType.CLEAR_ALL_CIRCLES: - return new CircleState(); + return new CircleState() case CircleActionType.ADD_CIRCLE: return { @@ -156,7 +156,7 @@ export var circleReducer = (state: CircleState = new CircleState(), action: ICir } default: - return state; + return state } } diff --git a/app/reducers/circles/index.ts b/app/reducers/circles/index.ts index e026aba..d98c85c 100644 --- a/app/reducers/circles/index.ts +++ b/app/reducers/circles/index.ts @@ -1,3 +1,3 @@ -import { circleReducer } from "./circleReducer"; +import { circleReducer } from './circleReducer' -export {circleReducer}; \ No newline at end of file +export {circleReducer} \ No newline at end of file diff --git a/app/reducers/comments/CommentState.ts b/app/reducers/comments/CommentState.ts index 4e7cd90..db631e9 100644 --- a/app/reducers/comments/CommentState.ts +++ b/app/reducers/comments/CommentState.ts @@ -1,5 +1,5 @@ -import { Comment } from "domain/comments"; +import { Comment } from 'domain/comments' /** * Comment state @@ -15,7 +15,7 @@ export class CommentState { * @type {({[postId: string]: {[commentId: string]: Comment}} | null)} * @memberof CommentState */ - postComments: {[postId: string]: {[commentId: string]: Comment}} = {}; + postComments: {[postId: string]: {[commentId: string]: Comment}} = {} /** * If the comments are loaded {true} or not {false} @@ -23,5 +23,5 @@ export class CommentState { * @type {Boolean} * @memberof CommentState */ - loaded: Boolean = false; + loaded: Boolean = false } \ No newline at end of file diff --git a/app/reducers/comments/ICommentAction.ts b/app/reducers/comments/ICommentAction.ts index cd18d84..cb85da0 100644 --- a/app/reducers/comments/ICommentAction.ts +++ b/app/reducers/comments/ICommentAction.ts @@ -8,7 +8,7 @@ import {CommentActionType} from 'constants/commentActionType' * @interface ICommentAction */ export interface ICommentAction { - payload: any; - type: CommentActionType; + payload: any + type: CommentActionType } \ No newline at end of file diff --git a/app/reducers/comments/commentReducer.ts b/app/reducers/comments/commentReducer.ts index ab8f920..694d319 100644 --- a/app/reducers/comments/commentReducer.ts +++ b/app/reducers/comments/commentReducer.ts @@ -3,23 +3,23 @@ import moment from 'moment' import _ from 'lodash' // - Import domain -import { User } from "domain/users"; -import { Comment } from "domain/comments"; +import { User } from 'domain/users' +import { Comment } from 'domain/comments' // - Import action types import {CommentActionType} from 'constants/commentActionType' -import { CommentState } from "./CommentState"; -import { ICommentAction } from "./ICommentAction"; +import { CommentState } from './CommentState' +import { ICommentAction } from './ICommentAction' /** * Comment reducer * @param state * @param action */ -export var commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => { - var { payload } = action +export let commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => { + let { payload } = action switch (action.type) { /* _____________ CRUD _____________ */ @@ -62,7 +62,7 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I } } case CommentActionType.DELETE_COMMENT: - var parsedComments = {} + let parsedComments = {} if (!state.postComments![payload.postId]) { return state } @@ -111,11 +111,11 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I } case CommentActionType.CLEAR_ALL_DATA_COMMENT: - return new CommentState(); + return new CommentState() default: - return state; + return state } diff --git a/app/reducers/comments/index.ts b/app/reducers/comments/index.ts index 38c38ff..f89adc9 100644 --- a/app/reducers/comments/index.ts +++ b/app/reducers/comments/index.ts @@ -1,3 +1,3 @@ -import { commentReducer } from "./commentReducer"; +import { commentReducer } from './commentReducer' -export {commentReducer}; \ No newline at end of file +export {commentReducer} \ No newline at end of file diff --git a/app/reducers/global/GlobalState.ts b/app/reducers/global/GlobalState.ts index c0d8190..36afc28 100644 --- a/app/reducers/global/GlobalState.ts +++ b/app/reducers/global/GlobalState.ts @@ -17,8 +17,8 @@ export class GlobalState { * @memberof IGlobalState */ progress: { - percent: number; - visible: Boolean; + percent: number + visible: Boolean } = { percent : 0, visible : false @@ -30,7 +30,7 @@ export class GlobalState { * @type {Boolean} * @memberof IGlobalState */ - loadingStatus: Boolean = true; + loadingStatus: Boolean = true /** * If user date is loaded {true} or not {false} @@ -38,7 +38,7 @@ export class GlobalState { * @type {Boolean} * @memberof IGlobalState */ - defaultLoadDataStatus: Boolean = false; + defaultLoadDataStatus: Boolean = false /** * If message popup is open {true} or not {false} @@ -46,7 +46,7 @@ export class GlobalState { * @type {Boolean} * @memberof IGlobalState */ - messageOpen: Boolean = false; + messageOpen: Boolean = false /** * The text of popup global message @@ -54,7 +54,7 @@ export class GlobalState { * @type {string} * @memberof IGlobalState */ - message: string = ''; + message: string = '' /** * Window size @@ -62,7 +62,7 @@ export class GlobalState { * @type {number} * @memberof IGlobalState */ - windowWidth: number = 0; + windowWidth: number = 0 /** * Window height @@ -70,7 +70,7 @@ export class GlobalState { * @type {number} * @memberof IGlobalState */ - windowHeight: number = 0; + windowHeight: number = 0 /** * The text of website header @@ -78,7 +78,7 @@ export class GlobalState { * @type {string} * @memberof IGlobalState */ - headerTitle: string = ''; + headerTitle: string = '' /** * Top loading is visible {true} or not {false} @@ -86,7 +86,7 @@ export class GlobalState { * @type {Boolean} * @memberof IGlobalState */ - showTopLoading: Boolean = false; + showTopLoading: Boolean = false /** * Top loading message queue @@ -94,7 +94,7 @@ export class GlobalState { * @type {number} * @memberof IGlobalState */ - topLoadingQueue: number = 0; + topLoadingQueue: number = 0 /** * Temp date storage @@ -102,6 +102,6 @@ export class GlobalState { * @type {*} * @memberof IGlobalState */ - temp: any = {}; + temp: any = {} } \ No newline at end of file diff --git a/app/reducers/global/IGlobalAction.ts b/app/reducers/global/IGlobalAction.ts index eabb29c..512523a 100644 --- a/app/reducers/global/IGlobalAction.ts +++ b/app/reducers/global/IGlobalAction.ts @@ -1,4 +1,4 @@ -import { GlobalActionType } from 'constants/globalActionType'; +import { GlobalActionType } from 'constants/globalActionType' /** * Global action interface diff --git a/app/reducers/global/globalReducer.ts b/app/reducers/global/globalReducer.ts index 4a02c7c..b814686 100644 --- a/app/reducers/global/globalReducer.ts +++ b/app/reducers/global/globalReducer.ts @@ -1,9 +1,9 @@ // - Import action types -import { GlobalActionType } from 'constants/globalActionType'; +import { GlobalActionType } from 'constants/globalActionType' -import { GlobalState } from "./GlobalState"; -import { IGlobalAction } from "./IGlobalAction"; +import { GlobalState } from './GlobalState' +import { IGlobalAction } from './IGlobalAction' /** @@ -48,13 +48,13 @@ export const globalReducer = (state: GlobalState = new GlobalState(), action: IG case GlobalActionType.SHOW_SEND_REQUEST_MESSAGE_GLOBAL: return { ...state, - message: "Request has been sent", + message: 'Request has been sent', messageOpen: true } case GlobalActionType.SHOW_REQUEST_SUCCESS_MESSAGE_GLOBAL: return { ...state, - message: "Your request has processed successfuly", + message: 'Your request has processed successfuly', messageOpen: true } case GlobalActionType.HIDE_MESSAGE_GLOBAL: diff --git a/app/reducers/global/index.ts b/app/reducers/global/index.ts index e8f0157..686e41a 100644 --- a/app/reducers/global/index.ts +++ b/app/reducers/global/index.ts @@ -1,3 +1,3 @@ -import { globalReducer } from "./globalReducer"; +import { globalReducer } from './globalReducer' -export {globalReducer}; \ No newline at end of file +export {globalReducer} \ No newline at end of file diff --git a/app/reducers/imageGallery/ImageGalleryState.ts b/app/reducers/imageGallery/ImageGalleryState.ts index e7c6b00..0e15508 100644 --- a/app/reducers/imageGallery/ImageGalleryState.ts +++ b/app/reducers/imageGallery/ImageGalleryState.ts @@ -1,4 +1,4 @@ -import { Image } from "domain/imageGallery"; +import { Image } from 'domain/imageGallery' /** * ImageGallery state @@ -14,7 +14,7 @@ export class ImageGalleryState { * @type {Boolean} * @memberof ImageGalleryState */ - status: Boolean = false; + status: Boolean = false /** * The list of image @@ -22,7 +22,7 @@ export class ImageGalleryState { * @type {(Image[] | null)} * @memberof ImageGalleryState */ - images: Image[] = []; + images: Image[] = [] /** * Selected image name @@ -30,7 +30,7 @@ export class ImageGalleryState { * @type {string} * @memberof ImageGalleryState */ - selectImage: string = ''; + selectImage: string = '' /** * Selected image address @@ -38,7 +38,7 @@ export class ImageGalleryState { * @type {string} * @memberof ImageGalleryState */ - selectURL: string = ''; + selectURL: string = '' /** * If image gallery is loaded {true} or not false @@ -46,7 +46,7 @@ export class ImageGalleryState { * @type {Boolean} * @memberof ImageGalleryState */ - loaded: Boolean = false; + loaded: Boolean = false /** * Images address list @@ -54,7 +54,7 @@ export class ImageGalleryState { * @type {*} * @memberof ImageGalleryState */ - imageURLList: any = {}; + imageURLList: any = {} /** * Store image requested @@ -62,6 +62,6 @@ export class ImageGalleryState { * @type {*} * @memberof ImageGalleryState */ - imageRequests: any = {}; + imageRequests: any = {} } \ No newline at end of file diff --git a/app/reducers/imageGallery/imageGalleryReducer.ts b/app/reducers/imageGallery/imageGalleryReducer.ts index 28e72a3..b6ad757 100644 --- a/app/reducers/imageGallery/imageGalleryReducer.ts +++ b/app/reducers/imageGallery/imageGalleryReducer.ts @@ -2,21 +2,21 @@ import _ from 'lodash' // - Import domain -import { User } from "domain/users"; -import { Image } from "domain/imageGallery"; +import { User } from 'domain/users' +import { Image } from 'domain/imageGallery' // - Import image gallery action types import {ImageGalleryActionType} from 'constants/imageGalleryActionType' -import { IImageGalleryAction } from "./IImageGalleryAction"; -import { ImageGalleryState } from "./ImageGalleryState"; +import { IImageGalleryAction } from './IImageGalleryAction' +import { ImageGalleryState } from './ImageGalleryState' /** * Image gallery reducer */ -export var imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => { +export let imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => { const { payload } = action switch (action.type) { @@ -66,6 +66,6 @@ export var imageGalleryReducer = (state: ImageGalleryState = new ImageGallerySta default: - return state; + return state } } diff --git a/app/reducers/imageGallery/index.ts b/app/reducers/imageGallery/index.ts index 74ac80b..64265d1 100644 --- a/app/reducers/imageGallery/index.ts +++ b/app/reducers/imageGallery/index.ts @@ -1,3 +1,3 @@ -import { imageGalleryReducer } from "./imageGalleryReducer"; +import { imageGalleryReducer } from './imageGalleryReducer' -export {imageGalleryReducer}; \ No newline at end of file +export {imageGalleryReducer} \ No newline at end of file diff --git a/app/reducers/index.ts b/app/reducers/index.ts index e74e02d..7f204fd 100644 --- a/app/reducers/index.ts +++ b/app/reducers/index.ts @@ -1,12 +1,12 @@ -import { authorizeReducer } from "./authorize"; -import { circleReducer } from "./circles"; -import { commentReducer } from "./comments"; -import { globalReducer } from "./global"; -import { imageGalleryReducer } from "./imageGallery"; -import { notificationReducer } from "./notifications"; -import { postReducer } from "./posts"; -import { userReducer } from "./users"; -import { voteReducer } from "./votes"; +import { authorizeReducer } from './authorize' +import { circleReducer } from './circles' +import { commentReducer } from './comments' +import { globalReducer } from './global' +import { imageGalleryReducer } from './imageGallery' +import { notificationReducer } from './notifications' +import { postReducer } from './posts' +import { userReducer } from './users' +import { voteReducer } from './votes' export{ authorizeReducer, diff --git a/app/reducers/notifications/NotificationState.ts b/app/reducers/notifications/NotificationState.ts index 1ed2944..59bdabb 100644 --- a/app/reducers/notifications/NotificationState.ts +++ b/app/reducers/notifications/NotificationState.ts @@ -1,4 +1,4 @@ -import { Notification } from "domain/notifications"; +import { Notification } from 'domain/notifications' /** * Notification state @@ -14,7 +14,7 @@ export class NotificationState { * @type {({[userId: string]: {[notificationId: string]: Notification}} | null)} * @memberof NotificationState */ - userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {}; + userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {} /** * If user notifications are loaded {true} or not {false} @@ -22,5 +22,5 @@ export class NotificationState { * @type {Boolean} * @memberof NotificationState */ - loaded: Boolean = false; + loaded: Boolean = false } \ No newline at end of file diff --git a/app/reducers/notifications/index.ts b/app/reducers/notifications/index.ts index 48196e7..2dbb38b 100644 --- a/app/reducers/notifications/index.ts +++ b/app/reducers/notifications/index.ts @@ -1,3 +1,3 @@ -import { notificationReducer } from "./notificationReducer"; +import { notificationReducer } from './notificationReducer' -export {notificationReducer}; \ No newline at end of file +export {notificationReducer} \ No newline at end of file diff --git a/app/reducers/notifications/notificationReducer.ts b/app/reducers/notifications/notificationReducer.ts index a0b2f19..96b8f41 100644 --- a/app/reducers/notifications/notificationReducer.ts +++ b/app/reducers/notifications/notificationReducer.ts @@ -3,13 +3,13 @@ import moment from 'moment' import _ from 'lodash' // - Import domain -import { Notification } from "domain/notifications"; +import { Notification } from 'domain/notifications' // - Import action types import {NotificationActionType} from 'constants/notificationActionType' -import { NotificationState } from "./NotificationState"; -import { INotificationAction } from "./INotificationAction"; +import { NotificationState } from './NotificationState' +import { INotificationAction } from './INotificationAction' /** @@ -17,8 +17,8 @@ import { INotificationAction } from "./INotificationAction"; * @param {object} state * @param {object} action */ -export var notificationReducer = (state: NotificationState = new NotificationState(), action: INotificationAction) => { - var { payload } = action +export let notificationReducer = (state: NotificationState = new NotificationState(), action: INotificationAction) => { + let { payload } = action switch (action.type) { /* _____________ CRUD _____________ */ @@ -48,7 +48,7 @@ export var notificationReducer = (state: NotificationState = new NotificationSta } case NotificationActionType.DELETE_NOTIFY: - var parsedNotifies = {} + let parsedNotifies = {} Object.keys(state.userNotifies!).map((id) => { if (id !== payload) { _.merge(parsedNotifies, { [id]: { ...state.userNotifies![id] } }) @@ -68,7 +68,7 @@ export var notificationReducer = (state: NotificationState = new NotificationSta default: - return state; + return state } diff --git a/app/reducers/posts/IPostAction.ts b/app/reducers/posts/IPostAction.ts index 6871fc2..402e18a 100644 --- a/app/reducers/posts/IPostAction.ts +++ b/app/reducers/posts/IPostAction.ts @@ -1,4 +1,4 @@ -import { PostActionType } from "constants/postActionType"; +import { PostActionType } from 'constants/postActionType' /** * Post action interface diff --git a/app/reducers/posts/PostState.ts b/app/reducers/posts/PostState.ts index 7b1c5fb..78993f3 100644 --- a/app/reducers/posts/PostState.ts +++ b/app/reducers/posts/PostState.ts @@ -13,7 +13,7 @@ export class PostState { * @type {*} * @memberof PostState */ - userPosts: any = {}; + userPosts: any = {} /** * If user posts are loaded {true} or not {false} @@ -21,5 +21,5 @@ export class PostState { * @type {Boolean} * @memberof PostState */ - loaded: Boolean = false; + loaded: Boolean = false } \ No newline at end of file diff --git a/app/reducers/posts/index.ts b/app/reducers/posts/index.ts index d76e268..ee6527e 100644 --- a/app/reducers/posts/index.ts +++ b/app/reducers/posts/index.ts @@ -1,3 +1,3 @@ -import { postReducer } from "./postReducer"; +import { postReducer } from './postReducer' -export {postReducer}; \ No newline at end of file +export {postReducer} \ No newline at end of file diff --git a/app/reducers/posts/postReducer.ts b/app/reducers/posts/postReducer.ts index b683abc..467f967 100644 --- a/app/reducers/posts/postReducer.ts +++ b/app/reducers/posts/postReducer.ts @@ -1,15 +1,15 @@ // - Import react components import moment from 'moment' import _ from 'lodash' -import {Reducer, Action} from "redux"; +import {Reducer, Action} from 'redux' // - Import action types -import { PostActionType } from "constants/postActionType"; +import { PostActionType } from 'constants/postActionType' -import { PostState } from "./PostState"; -import { IPostAction } from "./IPostAction"; +import { PostState } from './PostState' +import { IPostAction } from './IPostAction' /** @@ -17,8 +17,8 @@ import { IPostAction } from "./IPostAction"; * @param {object} state * @param {object} action */ -export var postReducer = (state : PostState = new PostState(), action : IPostAction) => { - const { payload } = action; +export let postReducer = (state : PostState = new PostState(), action : IPostAction) => { + const { payload } = action switch (action.type) { case PostActionType.CLEAR_ALL_DATA_POST: return new PostState() @@ -93,7 +93,7 @@ export var postReducer = (state : PostState = new PostState(), action : IPostAct } default: - return state; + return state } } \ No newline at end of file diff --git a/app/reducers/users/UserState.ts b/app/reducers/users/UserState.ts index bf2c364..a63d5fc 100644 --- a/app/reducers/users/UserState.ts +++ b/app/reducers/users/UserState.ts @@ -1,4 +1,4 @@ -import { User,Profile } from "domain/users"; +import { User,Profile } from 'domain/users' /** * User state @@ -13,7 +13,7 @@ export class UserState { * @type {({[userId: string]: Profile} | null)} * @memberof UserState */ - info: {[userId: string]: Profile} = {}; + info: {[userId: string]: Profile} = {} /** * If users profile are loaded @@ -21,7 +21,7 @@ export class UserState { * @type {Boolean} * @memberof UserState */ - loaded: Boolean = false; + loaded: Boolean = false /** * If edit profile is open {true} or not {false} @@ -29,5 +29,5 @@ export class UserState { * @type {Boolean} * @memberof UserState */ - openEditProfile: Boolean = false; + openEditProfile: Boolean = false } \ No newline at end of file diff --git a/app/reducers/users/index.ts b/app/reducers/users/index.ts index b1cc0c5..a727944 100644 --- a/app/reducers/users/index.ts +++ b/app/reducers/users/index.ts @@ -1,3 +1,3 @@ -import { userReducer } from "./userReducer"; +import { userReducer } from './userReducer' -export {userReducer}; \ No newline at end of file +export {userReducer} \ No newline at end of file diff --git a/app/reducers/users/userReducer.ts b/app/reducers/users/userReducer.ts index a4f0c38..12fb7d3 100644 --- a/app/reducers/users/userReducer.ts +++ b/app/reducers/users/userReducer.ts @@ -2,15 +2,15 @@ import {UserActionType} from 'constants/userActionType' // - Import domain -import { User,Profile } from "domain/users"; +import { User,Profile } from 'domain/users' -import { UserState } from "./UserState"; -import { IUserAction } from "./IUserAction"; +import { UserState } from './UserState' +import { IUserAction } from './IUserAction' /** * User reducer */ -export var userReducer = (state: UserState = new UserState(), action: IUserAction) => { +export let userReducer = (state: UserState = new UserState(), action: IUserAction) => { const { payload } = action switch (action.type) { case UserActionType.USER_INFO: @@ -57,7 +57,7 @@ export var userReducer = (state: UserState = new UserState(), action: IUserActio case UserActionType.CLEAR_ALL_DATA_USER: - return new UserState(); + return new UserState() case UserActionType.CLOSE_EDIT_PROFILE: return { @@ -73,6 +73,6 @@ export var userReducer = (state: UserState = new UserState(), action: IUserActio default: - return state; + return state } } diff --git a/app/reducers/votes/VoteState.ts b/app/reducers/votes/VoteState.ts index 67efd47..ffee2df 100644 --- a/app/reducers/votes/VoteState.ts +++ b/app/reducers/votes/VoteState.ts @@ -1,4 +1,4 @@ -import { Vote } from "domain/votes"; +import { Vote } from 'domain/votes' /** * Vote state @@ -14,7 +14,7 @@ export class VoteState { * @type {({[postId: string]: {[voteId: string]: Vote}} | null)} * @memberof VoteState */ - postVotes: {[postId: string]: {[voteId: string]: Vote}} | null = null; + postVotes: {[postId: string]: {[voteId: string]: Vote}} | null = null /** * If posts vote are loaded {true} or not {false} @@ -22,5 +22,5 @@ export class VoteState { * @type {Boolean} * @memberof VoteState */ - loaded: Boolean = false; + loaded: Boolean = false } \ No newline at end of file diff --git a/app/reducers/votes/index.ts b/app/reducers/votes/index.ts index 6c1154b..41594a8 100644 --- a/app/reducers/votes/index.ts +++ b/app/reducers/votes/index.ts @@ -1,3 +1,3 @@ -import { voteReducer } from "./voteReducer"; +import { voteReducer } from './voteReducer' -export {voteReducer}; \ No newline at end of file +export {voteReducer} \ No newline at end of file diff --git a/app/reducers/votes/voteReducer.ts b/app/reducers/votes/voteReducer.ts index 909c744..3fe5e72 100644 --- a/app/reducers/votes/voteReducer.ts +++ b/app/reducers/votes/voteReducer.ts @@ -6,11 +6,11 @@ import _ from 'lodash' import {VoteActionType} from 'constants/voteActionType' // Import domain -import { Vote } from "domain/votes"; +import { Vote } from 'domain/votes' -import { VoteState } from "./VoteState"; -import { IVoteAction } from "./IVoteAction"; +import { VoteState } from './VoteState' +import { IVoteAction } from './IVoteAction' /** @@ -18,8 +18,8 @@ import { IVoteAction } from "./IVoteAction"; * @param {object} state * @param {object} action */ -export var voteReducer = (state: VoteState = new VoteState(), action: IVoteAction) => { - var { payload } = action +export let voteReducer = (state: VoteState = new VoteState(), action: IVoteAction) => { + let { payload } = action switch (action.type) { /* _____________ CRUD _____________ */ @@ -47,7 +47,7 @@ export var voteReducer = (state: VoteState = new VoteState(), action: IVoteActio } case VoteActionType.DELETE_VOTE: - var parsedVotes = {} + let parsedVotes = {} if (state.postVotes![payload.postId]) Object.keys(state.postVotes![payload.postId]).map((id) => { if (id !== payload.id) { @@ -67,11 +67,11 @@ export var voteReducer = (state: VoteState = new VoteState(), action: IVoteActio case VoteActionType.CLEAR_ALL_DATA_VOTE: - return new VoteState(); + return new VoteState() default: - return state; + return state } diff --git a/app/services/authorize/IAuthorizeService.ts b/app/services/authorize/IAuthorizeService.ts index d32c74e..ef4980a 100644 --- a/app/services/authorize/IAuthorizeService.ts +++ b/app/services/authorize/IAuthorizeService.ts @@ -1,5 +1,5 @@ -import { User } from "domain/users"; -import { LoginUser, RegisterUserResult } from "domain/authorize"; +import { User } from 'domain/users' +import { LoginUser, RegisterUserResult } from 'domain/authorize' @@ -18,7 +18,7 @@ export interface IAuthorizeService { * @returns {Promise} * @memberof IAuthorizeService */ - login: (email: string, password: string) => Promise; + login: (email: string, password: string) => Promise /** * Logs out the user @@ -26,16 +26,16 @@ export interface IAuthorizeService { * @returns {Promise} * @memberof IAuthorizeService */ - logout: () => Promise; + logout: () => Promise /** * @returns {Promise} */ - updatePassword: (newPassword: string) => Promise; + updatePassword: (newPassword: string) => Promise /** * @returns {Promise} */ - registerUser: (user: User) => Promise; + registerUser: (user: User) => Promise } \ No newline at end of file diff --git a/app/services/authorize/index.ts b/app/services/authorize/index.ts index 3b65030..c215306 100644 --- a/app/services/authorize/index.ts +++ b/app/services/authorize/index.ts @@ -1,4 +1,4 @@ -import { IAuthorizeService } from "./IAuthorizeService"; +import { IAuthorizeService } from './IAuthorizeService' export { IAuthorizeService diff --git a/app/services/circles/ICircleService.ts b/app/services/circles/ICircleService.ts index 21e4431..d467237 100644 --- a/app/services/circles/ICircleService.ts +++ b/app/services/circles/ICircleService.ts @@ -1,5 +1,5 @@ -import { User } from "domain/users"; -import { Circle, UserFollower } from "domain/circles"; +import { User } from 'domain/users' +import { Circle, UserFollower } from 'domain/circles' /** * Circle service interface @@ -9,11 +9,11 @@ import { Circle, UserFollower } from "domain/circles"; */ export interface ICircleService { - addCircle: (userId: string, circle: Circle) => Promise; - addFollowingUser: (userId: string, circleId:string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise; - deleteFollowingUser: (userId: string, circleId: string,userFollowingId: string) => Promise; - updateCircle: (userId: string, circle: Circle, circleId: string) => Promise; - deleteCircle: (circleId: string, userId: string) => Promise; - getCircles: () => Promise<{ [circleId: string]: Circle }>; - getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle }>; + addCircle: (userId: string, circle: Circle) => Promise + addFollowingUser: (userId: string, circleId:string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise + deleteFollowingUser: (userId: string, circleId: string,userFollowingId: string) => Promise + updateCircle: (userId: string, circle: Circle, circleId: string) => Promise + deleteCircle: (circleId: string, userId: string) => Promise + getCircles: () => Promise<{ [circleId: string]: Circle }> + getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle }> } \ No newline at end of file diff --git a/app/services/circles/index.ts b/app/services/circles/index.ts index 0e94f6c..f155cb7 100644 --- a/app/services/circles/index.ts +++ b/app/services/circles/index.ts @@ -1,4 +1,4 @@ -import { ICircleService } from "./ICircleService"; +import { ICircleService } from './ICircleService' export { ICircleService diff --git a/app/services/comments/ICommentService.ts b/app/services/comments/ICommentService.ts index 9668d3a..a33fb6a 100644 --- a/app/services/comments/ICommentService.ts +++ b/app/services/comments/ICommentService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/comments/index.ts b/app/services/comments/index.ts index a3a4170..6987679 100644 --- a/app/services/comments/index.ts +++ b/app/services/comments/index.ts @@ -1,4 +1,4 @@ -import { ICommentService } from "./ICommentService"; +import { ICommentService } from './ICommentService' export { ICommentService diff --git a/app/services/common/ICommonService.ts b/app/services/common/ICommonService.ts index 81c2d48..b0a6547 100644 --- a/app/services/common/ICommonService.ts +++ b/app/services/common/ICommonService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/common/index.ts b/app/services/common/index.ts index 0902003..3bf3106 100644 --- a/app/services/common/index.ts +++ b/app/services/common/index.ts @@ -1,4 +1,4 @@ -import { ICommonService } from "./ICommonService"; +import { ICommonService } from './ICommonService' export { ICommonService diff --git a/app/services/imageGallery/IImageGalleryService.ts b/app/services/imageGallery/IImageGalleryService.ts index f80d272..5ca7e66 100644 --- a/app/services/imageGallery/IImageGalleryService.ts +++ b/app/services/imageGallery/IImageGalleryService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/imageGallery/index.ts b/app/services/imageGallery/index.ts index e0837b2..d1b0701 100644 --- a/app/services/imageGallery/index.ts +++ b/app/services/imageGallery/index.ts @@ -1,4 +1,4 @@ -import { IImageGalleryService } from "./IImageGalleryService"; +import { IImageGalleryService } from './IImageGalleryService' export { IImageGalleryService diff --git a/app/services/notifications/INotificationService.ts b/app/services/notifications/INotificationService.ts index 07374bd..94962f6 100644 --- a/app/services/notifications/INotificationService.ts +++ b/app/services/notifications/INotificationService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/notifications/index.ts b/app/services/notifications/index.ts index 9b5746f..0fab123 100644 --- a/app/services/notifications/index.ts +++ b/app/services/notifications/index.ts @@ -1,4 +1,4 @@ -import { INotificationService } from "./INotificationService"; +import { INotificationService } from './INotificationService' export { INotificationService diff --git a/app/services/posts/IPostService.ts b/app/services/posts/IPostService.ts index e8acfe0..01544bd 100644 --- a/app/services/posts/IPostService.ts +++ b/app/services/posts/IPostService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/posts/index.ts b/app/services/posts/index.ts index 128a8c2..6e1fc3c 100644 --- a/app/services/posts/index.ts +++ b/app/services/posts/index.ts @@ -1,4 +1,4 @@ -import { IPostService } from "./IPostService"; +import { IPostService } from './IPostService' export { IPostService diff --git a/app/services/users/IUserService.ts b/app/services/users/IUserService.ts index 0df8a22..3607067 100644 --- a/app/services/users/IUserService.ts +++ b/app/services/users/IUserService.ts @@ -1,4 +1,4 @@ -import { User } from "domain/users"; +import { User } from 'domain/users' diff --git a/app/services/users/index.ts b/app/services/users/index.ts index 28be5fc..d4d7ea2 100644 --- a/app/services/users/index.ts +++ b/app/services/users/index.ts @@ -1,4 +1,4 @@ -import { IUserService } from "./IUserService"; +import { IUserService } from './IUserService' export { IUserService diff --git a/app/services/votes/IVoteService.ts b/app/services/votes/IVoteService.ts index b0e62ec..e87a621 100644 --- a/app/services/votes/IVoteService.ts +++ b/app/services/votes/IVoteService.ts @@ -1,15 +1,11 @@ -import { User } from "domain/users"; - - - +import { User } from 'domain/users' /** * Vote service interface - * + * * @export * @interface IVoteService */ export interface IVoteService { - -} \ No newline at end of file +} diff --git a/app/services/votes/index.ts b/app/services/votes/index.ts index 1b6f2c3..e7dbe5a 100644 --- a/app/services/votes/index.ts +++ b/app/services/votes/index.ts @@ -1,4 +1,4 @@ -import { IVoteService } from "./IVoteService"; +import { IVoteService } from './IVoteService' export { IVoteService diff --git a/app/store/configureStore.ts b/app/store/configureStore.ts index 7045ed8..4bde072 100644 --- a/app/store/configureStore.ts +++ b/app/store/configureStore.ts @@ -3,7 +3,7 @@ import * as redux from 'redux' import thunk from 'redux-thunk' import {routerReducer, routerMiddleware } from 'react-router-redux' import createHistory from 'history/createBrowserHistory' -import {createLogger} from 'redux-logger'; +import {createLogger} from 'redux-logger' // - Import reducers import { @@ -16,9 +16,9 @@ import { userReducer, circleReducer, notificationReducer -} from 'reducers'; +} from 'reducers' -declare const window: any; +declare const window: any // Create a history of your choosing (we're using a browser history in this case) export const history = createHistory() @@ -42,13 +42,13 @@ let reducer = redux.combineReducers({ }) // - initial state -var initialState = { +let initialState = { } // - Config and create store of redux -var store : redux.Store<{}> = redux.createStore(reducer, initialState, redux.compose( +let store : redux.Store<{}> = redux.createStore(reducer, initialState, redux.compose( redux.applyMiddleware(logger,thunk,middleware), (window as any).devToolsExtension ? (window as any).devToolsExtension() : (f:any) => f )) diff --git a/app/tests/actions/authorizeActions.test.jsx b/app/tests/actions/authorizeActions.test.jsx index b8b61aa..44d392a 100644 --- a/app/tests/actions/authorizeActions.test.jsx +++ b/app/tests/actions/authorizeActions.test.jsx @@ -1,32 +1,32 @@ // - Import react components import configureMockStore from 'redux-mock-store' import thunk from 'redux-thunk' -var expect = require('expect') +let expect = require('expect') import firebase, {firebaseRef} from 'app/firebase' -var authorizeActions = require('authorizeActions') +let authorizeActions = require('authorizeActions') import * as types from 'actionTypes' -var createMockStore = configureMockStore([thunk]) +let createMockStore = configureMockStore([thunk]) describe('AuthorizeActions', () => { it('should generate login action', () => { const uid = 'UID123456' - var action = { + let action = { type: types.LOGIN, authed: true, uid } - var res = authorizeActions.login(action.uid) + let res = authorizeActions.login(action.uid) - expect(res).toEqual(action); + expect(res).toEqual(action) }) it('should generate logout action', () => { - var action = { + let action = { type: types.LOGOUT } - var res = authorizeActions.logout() + let res = authorizeActions.logout() expect(res).toEqual(action) }) diff --git a/app/tests/app.test.jsx b/app/tests/app.test.jsx index c5bf504..fb3e2f1 100644 --- a/app/tests/app.test.jsx +++ b/app/tests/app.test.jsx @@ -1,7 +1,7 @@ -var expect = require('expect'); +let expect = require('expect') describe('App', () => { it('should properly run tests', () => { - expect(1).toBe(1); - }); -}); + expect(1).toBe(1) + }) +}) diff --git a/app/tests/components/Blog.test.jsx b/app/tests/components/Blog.test.jsx index 7cb2bdc..9237523 100644 --- a/app/tests/components/Blog.test.jsx +++ b/app/tests/components/Blog.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Blog} = require('Blog'); +let {Blog} = require('Blog') describe('Blog', () => { it('should exist', () => { - expect(Blog).toExist(); + expect(Blog).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Circle.test.jsx b/app/tests/components/Circle.test.jsx index 9ada7a5..ffa6872 100644 --- a/app/tests/components/Circle.test.jsx +++ b/app/tests/components/Circle.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Circle} = require('Circle'); +let {Circle} = require('Circle') describe('Circle', () => { it('should exist', () => { - expect(Circle).toExist(); + expect(Circle).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Comment.test.jsx b/app/tests/components/Comment.test.jsx index bac2a5a..2746bf5 100644 --- a/app/tests/components/Comment.test.jsx +++ b/app/tests/components/Comment.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Comment} = require('Comment'); +let {Comment} = require('Comment') describe('Comment', () => { it('should exist', () => { - expect(Comment).toExist(); + expect(Comment).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/CommentWrite.test.jsx b/app/tests/components/CommentWrite.test.jsx index 0cca6ba..50a77c2 100644 --- a/app/tests/components/CommentWrite.test.jsx +++ b/app/tests/components/CommentWrite.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {CommentWrite} = require('CommentWrite'); +let {CommentWrite} = require('CommentWrite') describe('CommentWrite', () => { it('should exist', () => { - expect(CommentWrite).toExist(); + expect(CommentWrite).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/CommnetGroup.test.jsx b/app/tests/components/CommnetGroup.test.jsx index 51c592c..7d90808 100644 --- a/app/tests/components/CommnetGroup.test.jsx +++ b/app/tests/components/CommnetGroup.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {CommentGroup} = require('CommentGroup'); +let {CommentGroup} = require('CommentGroup') describe('CommentGroup', () => { it('should exist', () => { - expect(CommentGroup).toExist(); + expect(CommentGroup).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/CommnetList.jsx b/app/tests/components/CommnetList.jsx index ed8f1cb..a8cc30a 100644 --- a/app/tests/components/CommnetList.jsx +++ b/app/tests/components/CommnetList.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {CommentList} = require('CommentList'); +let {CommentList} = require('CommentList') describe('CommentList', () => { it('should exist', () => { - expect(CommentList).toExist(); + expect(CommentList).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/EditProfile.test.jsx b/app/tests/components/EditProfile.test.jsx index dde9481..8f4898d 100644 --- a/app/tests/components/EditProfile.test.jsx +++ b/app/tests/components/EditProfile.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {EditProfile} = require('EditProfile'); +let {EditProfile} = require('EditProfile') describe('EditProfile', () => { it('should exist', () => { - expect(EditProfile).toExist(); + expect(EditProfile).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/FindPeople.test.jsx b/app/tests/components/FindPeople.test.jsx index c1a9efd..5373f0b 100644 --- a/app/tests/components/FindPeople.test.jsx +++ b/app/tests/components/FindPeople.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {FindPeople} = require('FindPeople'); +let {FindPeople} = require('FindPeople') describe('FindPeople', () => { it('should exist', () => { - expect(FindPeople).toExist(); + expect(FindPeople).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Followers.test.jsx b/app/tests/components/Followers.test.jsx index 7592e45..98a06f0 100644 --- a/app/tests/components/Followers.test.jsx +++ b/app/tests/components/Followers.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Followers} = require('Followers'); +let {Followers} = require('Followers') describe('Followers', () => { it('should exist', () => { - expect(Followers).toExist(); + expect(Followers).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Following.test.jsx b/app/tests/components/Following.test.jsx index 0acc0e1..43920f5 100644 --- a/app/tests/components/Following.test.jsx +++ b/app/tests/components/Following.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Following} = require('Following'); +let {Following} = require('Following') describe('Following', () => { it('should exist', () => { - expect(Following).toExist(); + expect(Following).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Home.test.jsx b/app/tests/components/Home.test.jsx index b81e0fd..8314b80 100644 --- a/app/tests/components/Home.test.jsx +++ b/app/tests/components/Home.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Home} = require('Home'); +let {Home} = require('Home') describe('Home', () => { it('should exist', () => { - expect(Home).toExist(); + expect(Home).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/HomeHeader.test.jsx b/app/tests/components/HomeHeader.test.jsx index ad79f69..5b8621e 100644 --- a/app/tests/components/HomeHeader.test.jsx +++ b/app/tests/components/HomeHeader.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {HomeHeader} = require('HomeHeader'); +let {HomeHeader} = require('HomeHeader') describe('HomeHeader', () => { it('should exist', () => { - expect(HomeHeader).toExist(); + expect(HomeHeader).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/ImageGallery.test.jsx b/app/tests/components/ImageGallery.test.jsx index d406b45..f07eb15 100644 --- a/app/tests/components/ImageGallery.test.jsx +++ b/app/tests/components/ImageGallery.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {ImageGallery} = require('ImageGallery'); +let {ImageGallery} = require('ImageGallery') describe('ImageGallery', () => { it('should exist', () => { - expect(ImageGallery).toExist(); + expect(ImageGallery).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Img.test.jsx b/app/tests/components/Img.test.jsx index dfda0d7..6023ba7 100644 --- a/app/tests/components/Img.test.jsx +++ b/app/tests/components/Img.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Img} = require('Img'); +let {Img} = require('Img') describe('Img', () => { it('should exist', () => { - expect(Img).toExist(); + expect(Img).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/ImgCover.test.jsx b/app/tests/components/ImgCover.test.jsx index fbec77c..2988b85 100644 --- a/app/tests/components/ImgCover.test.jsx +++ b/app/tests/components/ImgCover.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {ImgCover} = require('ImgCover'); +let {ImgCover} = require('ImgCover') describe('ImgCover', () => { it('should exist', () => { - expect(ImgCover).toExist(); + expect(ImgCover).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Login.test.jsx b/app/tests/components/Login.test.jsx index 74fd227..27b1bf7 100644 --- a/app/tests/components/Login.test.jsx +++ b/app/tests/components/Login.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Login} = require('Login'); +let {Login} = require('Login') describe('Login', () => { it('should exist', () => { - expect(Login).toExist(); + expect(Login).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Master.test.jsx b/app/tests/components/Master.test.jsx index 1b57689..70c5714 100644 --- a/app/tests/components/Master.test.jsx +++ b/app/tests/components/Master.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Master} = require('Master'); +let {Master} = require('Master') describe('Master', () => { it('should exist', () => { - expect(Master).toExist(); + expect(Master).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/NotifyItem.test.jsx b/app/tests/components/NotifyItem.test.jsx index cca338b..f00970a 100644 --- a/app/tests/components/NotifyItem.test.jsx +++ b/app/tests/components/NotifyItem.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {NotifyItem} = require('NotifyItem'); +let {NotifyItem} = require('NotifyItem') describe('NotifyItem', () => { it('should exist', () => { - expect(NotifyItem).toExist(); + expect(NotifyItem).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Post.test.jsx b/app/tests/components/Post.test.jsx index 54693df..26c93f7 100644 --- a/app/tests/components/Post.test.jsx +++ b/app/tests/components/Post.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Post} = require('Post'); +let {Post} = require('Post') describe('Post', () => { it('should exist', () => { - expect(Post).toExist(); + expect(Post).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/PostWrite.test.jsx b/app/tests/components/PostWrite.test.jsx index aa9e13a..81f6de3 100644 --- a/app/tests/components/PostWrite.test.jsx +++ b/app/tests/components/PostWrite.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {PostWrite} = require('PostWrite'); +let {PostWrite} = require('PostWrite') describe('PostWrite', () => { it('should exist', () => { - expect(PostWrite).toExist(); + expect(PostWrite).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Settings.test.jsx b/app/tests/components/Settings.test.jsx index f9120c1..5bb4e4d 100644 --- a/app/tests/components/Settings.test.jsx +++ b/app/tests/components/Settings.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Settings} = require('Settings'); +let {Settings} = require('Settings') describe('Settings', () => { it('should exist', () => { - expect(Settings).toExist(); + expect(Settings).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Sidebar.test.jsx b/app/tests/components/Sidebar.test.jsx index 2f28c7f..b14bcfb 100644 --- a/app/tests/components/Sidebar.test.jsx +++ b/app/tests/components/Sidebar.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Sidebar} = require('Sidebar'); +let {Sidebar} = require('Sidebar') describe('Sidebar', () => { it('should exist', () => { - expect(Sidebar).toExist(); + expect(Sidebar).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/Signup.test.jsx b/app/tests/components/Signup.test.jsx index 48e4cc3..2eaa8e9 100644 --- a/app/tests/components/Signup.test.jsx +++ b/app/tests/components/Signup.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {Signup} = require('Signup'); +let {Signup} = require('Signup') describe('Signup', () => { it('should exist', () => { - expect(Signup).toExist(); + expect(Signup).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/UserBox.test.jsx b/app/tests/components/UserBox.test.jsx index 906cb24..5fd20d4 100644 --- a/app/tests/components/UserBox.test.jsx +++ b/app/tests/components/UserBox.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {UserBox} = require('UserBox'); +let {UserBox} = require('UserBox') describe('UserBox', () => { it('should exist', () => { - expect(UserBox).toExist(); + expect(UserBox).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/UserBoxList.test.jsx b/app/tests/components/UserBoxList.test.jsx index 3b7aaeb..ac815f9 100644 --- a/app/tests/components/UserBoxList.test.jsx +++ b/app/tests/components/UserBoxList.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {UserBoxList} = require('UserBoxList'); +let {UserBoxList} = require('UserBoxList') describe('UserBoxList', () => { it('should exist', () => { - expect(UserBoxList).toExist(); + expect(UserBoxList).toExist() }) }) \ No newline at end of file diff --git a/app/tests/components/YourCircles.test.jsx b/app/tests/components/YourCircles.test.jsx index 0dc868d..b1ca2ee 100644 --- a/app/tests/components/YourCircles.test.jsx +++ b/app/tests/components/YourCircles.test.jsx @@ -1,14 +1,14 @@ -var React = require('react'); -var ReactDOM = require('react-dom'); -var TestUtils = require('react-dom/test-utils'); -var expect = require('expect'); -var $ = require('jquery'); +let React = require('react') +let ReactDOM = require('react-dom') +let TestUtils = require('react-dom/test-utils') +let expect = require('expect') +let $ = require('jquery') -var {YourCircles} = require('YourCircles'); +let {YourCircles} = require('YourCircles') describe('YourCircles', () => { it('should exist', () => { - expect(YourCircles).toExist(); + expect(YourCircles).toExist() }) }) \ No newline at end of file diff --git a/app/tests/reducers/authorizeReducer.test.jsx b/app/tests/reducers/authorizeReducer.test.jsx index 6a84311..9c7dd22 100644 --- a/app/tests/reducers/authorizeReducer.test.jsx +++ b/app/tests/reducers/authorizeReducer.test.jsx @@ -1,6 +1,6 @@ // - Import react components -var expect = require('expect') -var df = require('deep-freeze-strict') +let expect = require('expect') +let df = require('deep-freeze-strict') import { authorizeReducer } from 'authorizeReducer' // - Import action types @@ -10,7 +10,7 @@ import * as types from 'actionTypes' /** * Default state */ -var defaultState = { +let defaultState = { uid: 0, authed: false, updatePassword: false, @@ -19,11 +19,11 @@ var defaultState = { describe('authorizeReducer', () => { it('should set user in login state', () => { - var action = { + let action = { type: types.LOGIN, uid: 'user12345' - }; - var res = authorizeReducer(df(defaultState), df(action)); + } + let res = authorizeReducer(df(defaultState), df(action)) expect(res.uid).toEqual(action.uid) expect(res.authed).toEqual(true) @@ -31,10 +31,10 @@ describe('authorizeReducer', () => { }) it('should set user in logout state', () => { - var action = { + let action = { type: types.LOGOUT - }; - var res = authorizeReducer(df(defaultState), df(action)); + } + let res = authorizeReducer(df(defaultState), df(action)) expect(res.uid).toEqual(0) expect(res.authed).toEqual(false) @@ -42,21 +42,21 @@ describe('authorizeReducer', () => { }) it('should set uid in signup', () => { - var action = { + let action = { type: types.SIGNUP, uid: 'user12345' - }; - var res = authorizeReducer(df(defaultState), df(action)); + } + let res = authorizeReducer(df(defaultState), df(action)) expect(res.uid).toEqual(action.uid) }) it('should update password', () => { - var action = { + let action = { type: types.UPDATE_PASSWORD, updatePassword: 'p@55w0rd' - }; - var res = authorizeReducer(df(defaultState), df(action)); + } + let res = authorizeReducer(df(defaultState), df(action)) expect(res.updatePassword).toEqual(action.updatePassword) }) diff --git a/tsconfig.json b/tsconfig.json index 539494c..906f776 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "module": "es6", "target": "es6", - "lib": ["es6"], + "lib": ["es6","dom"], "types": ["reflect-metadata"], "allowSyntheticDefaultImports": true, // see below "baseUrl": "./app/", // enables you to import relative to this folder