Skip to content

Commit

Permalink
Polished CSS, refactored useApi Query hook
Browse files Browse the repository at this point in the history
  • Loading branch information
oldboyxx committed Jan 6, 2020
1 parent 64b237e commit a35b831
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 407 deletions.
6 changes: 2 additions & 4 deletions client/cypress/integration/issueDetails.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ describe('Issue details', () => {

cy.get(testid`modal:tracking`).within(() => {
cy.contains('No time logged').should('exist');
getNumberInputAtIndex(0).debounced('type', 1);

getNumberInputAtIndex(0).debounced('type', 1);
cy.get('div[width="10"]').should('exist'); // tracking bar

getNumberInputAtIndex(1).debounced('type', 2);

cy.contains('button', 'Done')
Expand Down Expand Up @@ -124,7 +125,6 @@ describe('Issue details', () => {
it('edits a comment successfully', () => {
getIssueDetailsModal().within(() => {
cy.get(testid`issue-comment`)
.first()
.contains('Edit')
.click()
.should('not.exist');
Expand All @@ -139,7 +139,6 @@ describe('Issue details', () => {
.should('not.exist');

cy.get(testid`issue-comment`)
.first()
.should('contain', 'Edit')
.and('contain', 'TEST_COMMENT_EDITED');
});
Expand All @@ -148,7 +147,6 @@ describe('Issue details', () => {
it('deletes a comment successfully', () => {
getIssueDetailsModal()
.find(testid`issue-comment`)
.first()
.contains('Delete')
.click();

Expand Down
6 changes: 3 additions & 3 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"axios": "^0.19.0",
"color": "^3.1.2",
"core-js": "^3.4.7",
"formik": "^2.0.8",
"formik": "^2.1.1",
"history": "^4.10.1",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.15",
Expand Down
6 changes: 6 additions & 0 deletions client/src/Project/Board/Lists/List/Issue/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const Issue = styled.div`
box-shadow: 0px 1px 2px 0px rgba(9, 30, 66, 0.25);
transition: background 0.1s;
${mixin.clickable}
@media (max-width: 1100px) {
padding: 10px 8px;
}
&:hover {
background: ${color.backgroundLight};
}
Expand All @@ -30,6 +33,9 @@ export const Issue = styled.div`
export const Title = styled.p`
padding-bottom: 11px;
${font.size(15)}
@media (max-width: 1100px) {
${font.size(14.5)}
}
`;

export const Bottom = styled.div`
Expand Down
3 changes: 2 additions & 1 deletion client/src/Project/Board/Lists/List/Styles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components';

import { color, font } from 'shared/utils/styles';
import { color, font, mixin } from 'shared/utils/styles';

export const List = styled.div`
display: flex;
Expand All @@ -17,6 +17,7 @@ export const Title = styled.div`
text-transform: uppercase;
color: ${color.textMedium};
${font.size(12.5)};
${mixin.truncateText}
`;

export const IssuesCount = styled.span`
Expand Down
9 changes: 6 additions & 3 deletions client/src/Project/Board/Lists/List/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import moment from 'moment';
import { Droppable } from 'react-beautiful-dnd';
import { intersection } from 'lodash';

import useCurrentUser from 'shared/hooks/currentUser';
import { IssueStatusCopy } from 'shared/constants/issues';

import Issue from './Issue';
Expand All @@ -14,11 +13,14 @@ const propTypes = {
status: PropTypes.string.isRequired,
project: PropTypes.object.isRequired,
filters: PropTypes.object.isRequired,
currentUserId: PropTypes.number,
};

const ProjectBoardList = ({ status, project, filters }) => {
const { currentUserId } = useCurrentUser();
const defaultProps = {
currentUserId: null,
};

const ProjectBoardList = ({ status, project, filters, currentUserId }) => {
const filteredIssues = filterIssues(project.issues, filters, currentUserId);
const filteredListIssues = getSortedListIssues(filteredIssues, status);
const allListIssues = getSortedListIssues(project.issues, status);
Expand Down Expand Up @@ -77,5 +79,6 @@ const formatIssuesCount = (allListIssues, filteredListIssues) => {
};

ProjectBoardList.propTypes = propTypes;
ProjectBoardList.defaultProps = defaultProps;

export default ProjectBoardList;
11 changes: 10 additions & 1 deletion client/src/Project/Board/Lists/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { DragDropContext } from 'react-beautiful-dnd';

import useCurrentUser from 'shared/hooks/currentUser';
import api from 'shared/utils/api';
import { moveItemWithinArray, insertItemIntoArray } from 'shared/utils/javascript';
import { IssueStatus } from 'shared/constants/issues';
Expand All @@ -16,6 +17,8 @@ const propTypes = {
};

const ProjectBoardLists = ({ project, filters, updateLocalProjectIssues }) => {
const { currentUserId } = useCurrentUser();

const handleIssueDrop = ({ draggableId, destination, source }) => {
if (!isPositionChanged(source, destination)) return;

Expand All @@ -35,7 +38,13 @@ const ProjectBoardLists = ({ project, filters, updateLocalProjectIssues }) => {
<DragDropContext onDragEnd={handleIssueDrop}>
<Lists>
{Object.values(IssueStatus).map(status => (
<List key={status} status={status} project={project} filters={filters} />
<List
key={status}
status={status}
project={project}
filters={filters}
currentUserId={currentUserId}
/>
))}
</Lists>
</DragDropContext>
Expand Down
2 changes: 1 addition & 1 deletion client/src/Project/IssueSearch/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { color, font, mixin } from 'shared/utils/styles';
import { InputDebounced, Spinner, Icon } from 'shared/components';

export const IssueSearch = styled.div`
padding: 25px 35px;
padding: 25px 35px 60px;
`;

export const SearchInputCont = styled.div`
Expand Down
33 changes: 20 additions & 13 deletions client/src/Project/Sidebar/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ import styled from 'styled-components';
import { color, sizes, font, mixin, zIndexValues } from 'shared/utils/styles';

export const Sidebar = styled.div`
position: absolute;
position: fixed;
z-index: ${zIndexValues.navLeft - 1};
top: 0;
left: ${sizes.appNavBarLeftWidth}px;
height: 100vh;
width: 240px;
padding: 0 16px;
width: ${sizes.secondarySideBarWidth}px;
padding: 0 16px 24px;
background: ${color.backgroundLightest};
border-right: 1px solid ${color.borderLightest};
${mixin.scrollableY}
${mixin.customScrollbar()}
@media (max-width: 1100px) {
width: ${sizes.secondarySideBarWidth - 10}px;
}
`;

export const ProjectInfo = styled.div`
Expand Down Expand Up @@ -67,18 +72,20 @@ export const LinkText = styled.div`
`;

export const NotImplemented = styled.div`
display: none;
display: inline-block;
position: absolute;
top: 9px;
left: 101%;
width: 120px;
padding: 3px 0 3px 8px;
top: 7px;
left: 40px;
width: 140px;
padding: 5px 0 5px 8px;
border-radius: 3px;
color: #fff;
background: #000;
${font.size(12.5)};
${font.medium}
text-transform: uppercase;
color: ${color.textDark};
background: ${color.backgroundMedium};
opacity: 0;
${font.size(11.5)};
${font.bold}
${LinkItem}:hover & {
display: inline-block;
opacity: 1;
}
`;
8 changes: 7 additions & 1 deletion client/src/Project/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import styled from 'styled-components';

import { sizes } from 'shared/utils/styles';

const paddingLeft = sizes.appNavBarLeftWidth + sizes.secondarySideBarWidth + 40;

export const ProjectPage = styled.div`
padding: 25px 32px 0 ${sizes.appNavBarLeftWidth + sizes.secondarySideBarWidth + 40}px;
padding: 25px 32px 50px ${paddingLeft}px;
@media (max-width: 1100px) {
padding: 25px 20px 50px ${paddingLeft - 20}px;
}
`;
7 changes: 0 additions & 7 deletions client/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@ import ReactDOM from 'react-dom';
import App from 'App';

ReactDOM.render(<App />, document.getElementById('root'));

// QUERY component cache-only doesn't work until first req finishes, look at currentUser on page load
// APP IS NOT RESPONSIVE - REDUCE BROWSER HEIGHT, ISSUES DONT SCROLL
// TODO: UPDATE FORMIK TO FIX SETFIELDVALUE TO EMPTY ARRAY ISSUE https://github.com/jaredpalmer/formik/pull/2144
// REFACTOR HTML TO USE SEMANTIC ELEMENTS
// MOVE SOME UTILS LIKE API TO SERVICES FOLDER
// RENAME ISSUE DETAILS "USERS" TO ASSIGNEESREPORTER
15 changes: 8 additions & 7 deletions client/src/shared/components/Modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ const Modal = ({

useOnOutsideClick($modalRef, isOpen, closeModal, $clickableOverlayRef);
useOnEscapeKeyDown(isOpen, closeModal);
useEffect(setBodyScrollLock, [isOpen]);

useEffect(() => {
document.body.style.overflow = 'hidden';

return () => {
document.body.style.overflow = 'visible';
};
}, [isOpen]);

return (
<>
Expand All @@ -72,7 +79,6 @@ const Modal = ({
className={className}
variant={variant}
width={width}
data-jira-modal="true"
data-testid={testid}
ref={$modalRef}
>
Expand All @@ -89,11 +95,6 @@ const Modal = ({

const $root = document.getElementById('root');

const setBodyScrollLock = () => {
const areAnyModalsOpen = !!document.querySelector('[data-jira-modal]');
document.body.style.overflow = areAnyModalsOpen ? 'hidden' : 'visible';
};

Modal.propTypes = propTypes;
Modal.defaultProps = defaultProps;

Expand Down
8 changes: 7 additions & 1 deletion client/src/shared/hooks/api/mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ const useMutation = (method, url) => {
[method, url, mergeState],
);

return [{ ...state, [isWorkingAlias[method]]: state.isWorking }, makeRequest];
return [
{
...state,
[isWorkingAlias[method]]: state.isWorking,
},
makeRequest,
];
};

const isWorkingAlias = {
Expand Down
Loading

0 comments on commit a35b831

Please sign in to comment.