improved success message after commit with new sidebar

This commit is contained in:
Phil Hughes 2018-05-03 14:21:45 +01:00
parent 93f0eb07c9
commit 2a7bfacfb7
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F
9 changed files with 54 additions and 38 deletions

View file

@ -51,7 +51,7 @@ export default {
/>
</button>
</li>
<li v-show="hasChanges">
<li>
<button
type="button"
class="ide-sidebar-link js-ide-review-mode"
@ -65,7 +65,7 @@ export default {
/>
</button>
</li>
<li>
<li v-show="hasChanges">
<button
type="button"
class="ide-sidebar-link js-ide-commit-mode"

View file

@ -1,5 +1,5 @@
<script>
import { mapGetters, mapState } from 'vuex';
import { mapState } from 'vuex';
import { sprintf, __ } from '~/locale';
import * as consts from '../../stores/modules/commit/constants';
import RadioGroup from './radio_group.vue';

View file

@ -21,13 +21,10 @@ export default {
};
},
computed: {
...mapState(['lastCommitMsg', 'changedFiles', 'stagedFiles', 'currentActivityView']),
...mapState(['changedFiles', 'stagedFiles', 'currentActivityView', 'lastCommitMsg']),
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['hasChanges']),
...mapGetters(['hasChanges', 'someUncommitedChanges']),
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled']),
someUncommitedChanges() {
return !!(this.changedFiles.length || this.stagedFiles.length);
},
overviewText() {
return sprintf(
__(
@ -126,8 +123,7 @@ export default {
ref="formEl"
>
<success-message
v-if="lastCommitMsg && !someUncommitedChanges"
:committed-state-svg-path="committedStateSvgPath"
v-show="(lastCommitMsg && someUncommitedChanges)"
/>
<commit-message-field
:text="commitMessage"

View file

@ -2,14 +2,8 @@
import { mapState } from 'vuex';
export default {
props: {
committedStateSvgPath: {
type: String,
required: true,
},
},
computed: {
...mapState(['lastCommitMsg']),
...mapState(['lastCommitMsg', 'committedStateSvgPath']),
},
};
</script>

View file

@ -11,6 +11,8 @@ import ActivityBar from './activity_bar.vue';
import CommitSection from './repo_commit_section.vue';
import CommitForm from './commit_sidebar/form.vue';
import IdeReview from './ide_review.vue';
import SuccessMessage from './commit_sidebar/success_message.vue';
import { activityBarViews } from '../constants';
export default {
components: {
@ -25,10 +27,24 @@ export default {
IdeTree,
CommitForm,
IdeReview,
SuccessMessage,
},
computed: {
...mapState(['loading', 'currentBranchId', 'currentActivityView']),
...mapGetters(['currentProject']),
...mapState([
'loading',
'currentBranchId',
'currentActivityView',
'changedFiles',
'stagedFiles',
'lastCommitMsg',
]),
...mapGetters(['currentProject', 'someUncommitedChanges']),
showSuccessMessage() {
return (
this.currentActivityView === activityBarViews.edit &&
(this.lastCommitMsg && !this.someUncommitedChanges)
);
},
},
};
</script>
@ -96,6 +112,9 @@ export default {
/>
</div>
<commit-form />
<success-message
v-show="showSuccessMessage"
/>
</template>
</div>
</resizable-panel>

View file

@ -27,14 +27,11 @@ export default {
'unusedSeal',
]),
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['lastOpenedFile', 'hasChanges']),
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommitedChanges']),
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled']),
showStageUnstageArea() {
return !!(this.someUncommitedChanges || this.lastCommitMsg || !this.unusedSeal);
},
someUncommitedChanges() {
return !!(this.changedFiles.length || this.stagedFiles.length);
},
},
watch: {
hasChanges() {

View file

@ -26,6 +26,7 @@ export default {
'getStagedFile',
'isEditModeActive',
'isCommitModeActive',
'isReviewModeActive',
]),
shouldHideEditor() {
return this.file && this.file.binary && !this.file.content;

View file

@ -59,6 +59,10 @@ export const lastOpenedFile = state =>
export const isEditModeActive = state => state.currentActivityView === activityBarViews.edit;
export const isCommitModeActive = state => state.currentActivityView === activityBarViews.commit;
export const isReviewModeActive = state => state.currentActivityView === activityBarViews.review;
export const someUncommitedChanges = state =>
!!(state.changedFiles.length || state.stagedFiles.length);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};

View file

@ -443,6 +443,7 @@
}
.multi-file-commit-panel-inner {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
@ -485,7 +486,6 @@
margin-bottom: 0;
border-bottom: 1px solid $white-dark;
padding: $gl-btn-padding $gl-padding;
min-height: 56px;
}
.multi-file-commit-panel-header-title {
@ -612,24 +612,14 @@
.btn {
font-size: $gl-font-size;
}
.multi-file-commit-panel-success-message {
top: 0;
}
}
.multi-file-commit-panel-bottom {
position: relative;
.multi-file-commit-panel-success-message {
position: absolute;
top: 1px;
left: 3px;
bottom: 0;
right: 0;
z-index: 10;
background: $gray-light;
overflow: auto;
display: flex;
flex-direction: column;
justify-content: center;
}
}
.dirty-diff {
@ -870,6 +860,7 @@
.ide-activity-bar {
position: relative;
flex: 0 0 60px;
z-index: 1;
}
.ide-file-finder-overlay {
@ -1032,3 +1023,17 @@
.ide-new-modal-label {
line-height: 34px;
}
.multi-file-commit-panel-success-message {
position: absolute;
top: 61px;
left: 1px;
bottom: 0;
right: 0;
z-index: 10;
background: $white-light;
overflow: auto;
display: flex;
flex-direction: column;
justify-content: center;
}