Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#510 Not saved indicator improvement (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Mar 8, 2017
1 parent 130d833 commit 922745e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
12 changes: 7 additions & 5 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ export function initLayoutSuccess(layout, scope) {
}
}

export function initDataSuccess(data, scope, docId, saveStatus) {
export function initDataSuccess(data, scope, docId, saveStatus, validStatus) {
return {
type: types.INIT_DATA_SUCCESS,
data,
scope,
docId,
saveStatus
saveStatus,
validStatus
}
}

Expand All @@ -74,11 +75,12 @@ export function updateRowStatus(scope, tabid, rowid, saveStatus) {
}
}

export function updateDataSuccess(item, scope, saveStatus) {
export function updateDataSuccess(item, scope, saveStatus, validStatus) {
return {
type: types.UPDATE_DATA_SUCCESS,
item,
saveStatus,
validStatus,
scope
}
}
Expand Down Expand Up @@ -233,7 +235,7 @@ export function createWindow(

dispatch(initDataSuccess(
preparedData, getScope(isModal), docId,
response.data[0].saveStatus
response.data[0].saveStatus, response.data[0].validStatus
));

if (isModal) {
Expand Down Expand Up @@ -385,7 +387,7 @@ function mapDataToState(data, isModal, rowId, id, windowType) {
dispatch(updateRowSuccess(field, item.tabid, item.rowId, getScope(false)));
}

dispatch(updateDataSuccess(field, getScope(isModal), data[0].saveStatus));
dispatch(updateDataSuccess(field, getScope(isModal), data[0].saveStatus, data[0].validStatus));
}
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/assets/css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
width: 100%;
position: fixed;
z-index: 201;
margin-top:-1px;
background-color: $brand-bright-color;
}

Expand All @@ -181,7 +182,7 @@
overflow: hidden;
}
.subheader-column:focus {
border-color: #e1e7ec;;
border-color: #e1e7ec;
}

@media (max-width: $breakpoint) {
Expand Down Expand Up @@ -268,6 +269,7 @@

.btn-square {
min-width: 55px;

}


Expand Down Expand Up @@ -296,6 +298,8 @@
}

.btn-header {
position: relative;
top:-1px;
border-color: $brand-border-color;
}

Expand Down
8 changes: 6 additions & 2 deletions src/assets/css/indicator.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
height: 100%;
}



@media screen and (max-width: 991px) {
.indicator {
width: 50%;
Expand Down Expand Up @@ -67,6 +69,8 @@
.indicator-error {
animation-name: indicator-error;
animation-duration: 1s;
width: 100%;
background-color: $brand-font-color-danger;
}

@keyframes indicator-pending {
Expand Down Expand Up @@ -111,7 +115,7 @@
background-color: $brand-font-color-danger;
}
100% {
width: 0%;
background-color: transparent;
width: 100%;
background-color: $brand-font-color-danger;
}
}
2 changes: 1 addition & 1 deletion src/assets/css/inputs.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ button {


.btn-square {
height: 55px;
height: 54px;
width: 55px;
display: flex;
flex-direction: column;
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/Indicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class Indicator extends Component {
return (
<div>
<div className={
'indicator-bar indicator-' + indicator +
(isDocumentNotSaved ? ' indicator-error ' : ' ')
'indicator-bar ' +
(isDocumentNotSaved ? 'indicator-error ' : 'indicator-' + indicator)
} />
</div>
)
Expand Down
5 changes: 4 additions & 1 deletion src/containers/MasterWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class MasterWindow extends Component {
attachments={attachments}
showSidelist={true}
showIndicator={!modal.visible}
isDocumentNotSaved={!master.saveStatus.saved}
isDocumentNotSaved={
!master.saveStatus.saved &&
!master.validStatus.initialValue
}
>
{modal.visible &&
<Modal
Expand Down
6 changes: 4 additions & 2 deletions src/reducers/windowHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const initialState = {
layout: {},
data: [],
rowData: {},
saveStatus: {}
saveStatus: {},
validStatus: {}
},
indicator: 'saved',
latestNewDocument: null,
Expand Down Expand Up @@ -99,7 +100,8 @@ export default function windowHandler(state = initialState, action) {
docId: action.docId,
layout: {},
rowData: {},
saveStatus: action.saveStatus
saveStatus: action.saveStatus,
validStatus: action.validStatus
})
})

Expand Down

0 comments on commit 922745e

Please sign in to comment.