Skip to content

Commit

Permalink
feat: format all js and jsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme-NL committed Nov 6, 2023
1 parent f3cafdc commit 34bc9f1
Show file tree
Hide file tree
Showing 199 changed files with 3,758 additions and 3,319 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/actions/actionTypes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import keyMirror from "keymirror";
import keyMirror from 'keymirror';

export default keyMirror({
REQUEST_PROJECT_BOARD: null,
Expand Down
17 changes: 8 additions & 9 deletions app/assets/javascripts/actions/labels.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import actionTypes from './actionTypes';

export const addLabelToProject = (label) => ({
export const addLabelToProject = label => ({
type: actionTypes.ADD_LABEL_TO_PROJECT,
label
label,
});

export const addLabelSuccess = (storyId, label) => ({
type: actionTypes.ADD_LABEL,
storyId,
label
label,
});

export const removeLabel = (storyId, labelName) => ({
type: actionTypes.DELETE_LABEL,
storyId,
labelName
labelName,
});

export const addLabel = (storyId, label) =>
(dispatch) => {
dispatch(addLabelSuccess(storyId, label));
dispatch(addLabelToProject(label));
}
export const addLabel = (storyId, label) => dispatch => {
dispatch(addLabelSuccess(storyId, label));
dispatch(addLabelToProject(label));
};
20 changes: 10 additions & 10 deletions app/assets/javascripts/actions/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ import { setLoadingStory, storyFailure } from './story';
export const deleteNoteSuccess = (storyId, noteId) => ({
type: actionTypes.DELETE_NOTE,
storyId,
noteId
noteId,
});

export const createNoteSuccess = (storyId, note) => ({
type: actionTypes.ADD_NOTE,
storyId,
note
note,
});

export const deleteNote = (projectId, storyId, noteId) =>
export const deleteNote =
(projectId, storyId, noteId) =>
async (dispatch, getState, { Note }) => {
dispatch(setLoadingStory(storyId));

try {
await Note.destroy(projectId, storyId, noteId);
return dispatch(deleteNoteSuccess(storyId, noteId));
}
catch (error) {
} catch (error) {
return dispatch(storyFailure(storyId, error));
}
}
};

export const createNote = (projectId, storyId, note) =>
export const createNote =
(projectId, storyId, note) =>
async (dispatch, getState, { Note }) => {
dispatch(setLoadingStory(storyId));

try {
const newNote = await Note.post(projectId, storyId, note);
return dispatch(createNoteSuccess(storyId, newNote));
}
catch (error) {
} catch (error) {
return dispatch(storyFailure(storyId, error));
}
}
};
55 changes: 29 additions & 26 deletions app/assets/javascripts/actions/notifications.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
import actionTypes from './actionTypes';
import status from 'http-status';

export const addNotification = (notification) => ({
export const addNotification = notification => ({
type: actionTypes.ADD_NOTIFICATION,
notification
notification,
});

export const removeNotification = (id) => ({
export const removeNotification = id => ({
type: actionTypes.REMOVE_NOTIFICATION,
id
id,
});

export const sendSuccessNotification = (message) =>
export const sendSuccessNotification =
message =>
(dispatch, getState, { Notification }) => {
const newNotification = Notification.createNotification({
type: Notification.types.SUCCESS,
message
message,
});

dispatch(addNotification(newNotification));

setTimeout(() => {
dispatch(removeNotification(newNotification.id));
}, 4000);
}
};

export const sendErrorNotification = (error, { custom = false } = {}) => {
if (error.response) return sendServerErrorNotification(error);
if (custom) return sendCustomErrorNotification(error);
return sendDefaultErrorNotification();
}
};

export const sendCustomErrorNotification = code =>
export const sendCustomErrorNotification =
code =>
(dispatch, _, { Notification }) =>
dispatch(
addNotification(
Notification.createNotification({
type: Notification.types.ERROR,
message: I18n.t(code)
message: I18n.t(code),
})
)
);

const sendServerErrorNotification = (error) =>
const sendServerErrorNotification =
error =>
(dispatch, getState, { Notification }) => {
const type = Notification.types.ERROR;

Expand All @@ -56,7 +59,9 @@ const sendServerErrorNotification = (error) =>
addNotification(
Notification.createNotification({
type,
message: I18n.t('users.You are not authorized to perform this action')
message: I18n.t(
'users.You are not authorized to perform this action'
),
})
)
);
Expand All @@ -65,39 +70,37 @@ const sendServerErrorNotification = (error) =>
addNotification(
Notification.createNotification({
type,
message: I18n.t('not_found')
message: I18n.t('not_found'),
})
)
);
default:
return dispatch(
addDefaultErrorNotification(Notification)
);
return dispatch(addDefaultErrorNotification(Notification));
}
}
};

export const sendDefaultErrorNotification = () =>
export const sendDefaultErrorNotification =
() =>
(dispatch, getState, { Notification }) =>
dispatch(
addDefaultErrorNotification(Notification)
);
dispatch(addDefaultErrorNotification(Notification));

const addDefaultErrorNotification = Notification =>
addNotification(
Notification.createNotification({
type: Notification.types.ERROR,
message: I18n.t('messages.operations.error.default_error')
message: I18n.t('messages.operations.error.default_error'),
})
)
);

export const addValidationNotifications = (errors) =>
export const addValidationNotifications =
errors =>
(dispatch, getState, { Notification }) => {
const notifications = Object.keys(errors).map(error =>
Notification.createNotification({
type: Notification.types.ERROR,
message: `Error. ${error}: ${errors[error]}`
message: `Error. ${error}: ${errors[error]}`,
})
);

dispatch(addNotification(notifications));
}
};
15 changes: 8 additions & 7 deletions app/assets/javascripts/actions/pastIterations.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import actionTypes from './actionTypes';

export const receivePastIterations = (pastIterations) => ({
export const receivePastIterations = pastIterations => ({
type: actionTypes.RECEIVE_PAST_ITERATIONS,
data: pastIterations
data: pastIterations,
});

export const requestPastStories = iterationNumber => ({
type: actionTypes.REQUEST_PAST_STORIES,
iterationNumber
iterationNumber,
});

export const receivePastStories = (stories, iterationNumber, from) => ({
type: actionTypes.RECEIVE_PAST_STORIES,
iterationNumber,
stories,
from
from,
});

export const errorRequestPastStories = (error, iterationNumber) => ({
type: actionTypes.ERROR_REQUEST_PAST_STORIES,
iterationNumber,
error
});
error,
});

export const fetchPastStories = (iterationNumber, startDate, endDate) =>
export const fetchPastStories =
(iterationNumber, startDate, endDate) =>
async (dispatch, getState, { PastIteration }) => {
const { project } = getState();

Expand Down
44 changes: 22 additions & 22 deletions app/assets/javascripts/actions/projectBoard.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import actionTypes from "./actionTypes";
import { receiveUsers } from "./user";
import { receiveStories, toggleStory } from "./story";
import { receivePastIterations } from "./pastIterations";
import { storyScopes } from "../libs/beta/constants";
import { sendErrorNotification } from "./notifications";
import actionTypes from './actionTypes';
import { receiveUsers } from './user';
import { receiveStories, toggleStory } from './story';
import { receivePastIterations } from './pastIterations';
import { storyScopes } from '../libs/beta/constants';
import { sendErrorNotification } from './notifications';

const requestProjectBoard = () => ({
type: actionTypes.REQUEST_PROJECT_BOARD,
});

const receiveProjectBoard = (projectId) => ({
const receiveProjectBoard = projectId => ({
type: actionTypes.RECEIVE_PROJECT_BOARD,
data: projectId,
});
Expand All @@ -18,12 +18,12 @@ export const closeSearchSuccess = () => ({
type: actionTypes.CLOSE_SEARCH,
});

const errorRequestProjectBoard = (error) => ({
const errorRequestProjectBoard = error => ({
type: actionTypes.ERROR_REQUEST_PROJECT_BOARD,
error: error,
});

const receiveProject = (data) => ({
const receiveProject = data => ({
type: actionTypes.RECEIVE_PROJECT,
data,
});
Expand All @@ -38,27 +38,27 @@ export const updateStorySuccess = (story, from) => ({
from,
});

export const searchStoriesSuccess = (keyWord) => ({
export const searchStoriesSuccess = keyWord => ({
type: actionTypes.SEARCH_STORIES_SUCCESS,
keyWord,
});

export const updateLoadingSearch = (loading) => ({
export const updateLoadingSearch = loading => ({
type: actionTypes.LOADING_SEARCH,
loading,
});

export const toggleColumnVisibility = (column) => ({
export const toggleColumnVisibility = column => ({
type: actionTypes.TOGGLE_COLUMN_VISIBILITY,
column,
});

export const expandStoryIfNeeded = (dispatch, getHash) => {
const storyId = getHash("#story-");
const storyId = getHash('#story-');

if (storyId) {
dispatch(toggleStory(parseInt(storyId)));
window.history.pushState("", "/", window.location.pathname);
window.history.pushState('', '/', window.location.pathname);
}
};

Expand All @@ -67,7 +67,7 @@ export const sendErrorNotificationIfNeeded = (dispatch, code, condition) => {
};

export const toggleColumn =
(column) =>
column =>
(dispatch, getState, { ProjectBoard }) => {
const { projectBoard } = getState();

Expand All @@ -77,7 +77,7 @@ export const toggleColumn =
};

export const fetchProjectBoard =
(projectId) =>
projectId =>
async (dispatch, getState, { ProjectBoard, UrlService }) => {
dispatch(requestProjectBoard());

Expand All @@ -97,7 +97,7 @@ export const fetchProjectBoard =
}
};

export const closeSearch = () => (dispatch) => {
export const closeSearch = () => dispatch => {
dispatch(closeSearchSuccess());
dispatch(receiveStories([], storyScopes.SEARCH));
};
Expand All @@ -107,19 +107,19 @@ export const search =
(dispatch, _, { Search }) => {
Search.searchStories(keyWord, projectId, {
onStart: () => dispatch(updateLoadingSearch(true)),
onSuccess: (result) => {
onSuccess: result => {
dispatch(updateLoadingSearch(false));
dispatch(searchStoriesSuccess(keyWord));
dispatch(receiveStories(result, "search"));
dispatch(receiveStories(result, 'search'));
sendErrorNotificationIfNeeded(
dispatch,
"projects.stories_not_found",
'projects.stories_not_found',
!result.length
);
},
onError: (error) => {
onError: error => {
dispatch(
sendErrorNotification("messages.operations.error.default_error", {
sendErrorNotification('messages.operations.error.default_error', {
custom: true,
})
);
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/actions/sprint.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import actionTypes from './actionTypes';

export const simulateSprintVelocity = (simulatedSprintVelocity) => ({
export const simulateSprintVelocity = simulatedSprintVelocity => ({
type: actionTypes.SIMULATE_SPRINT_VELOCITY,
simulatedSprintVelocity
})
simulatedSprintVelocity,
});

export const revertSprintVelocity = () => ({
type: actionTypes.REVERT_TO_CALCULATED_VELOCITY
})
type: actionTypes.REVERT_TO_CALCULATED_VELOCITY,
});
Loading

0 comments on commit 34bc9f1

Please sign in to comment.