Commit 6139050e authored by Phil Hughes's avatar Phil Hughes

Add active class to active file in IDE commit panel

Closes #46051
parent 1c28b624
...@@ -43,6 +43,10 @@ export default { ...@@ -43,6 +43,10 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
activeFileKey: {
type: String,
required: true,
},
}, },
data() { data() {
return { return {
...@@ -115,6 +119,7 @@ export default { ...@@ -115,6 +119,7 @@ export default {
:action-component="itemActionComponent" :action-component="itemActionComponent"
:key-prefix="title" :key-prefix="title"
:staged-list="stagedList" :staged-list="stagedList"
:active-file-key="activeFileKey"
/> />
</li> </li>
</ul> </ul>
......
...@@ -30,6 +30,10 @@ export default { ...@@ -30,6 +30,10 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
activeFileKey: {
type: String,
required: true,
},
}, },
computed: { computed: {
iconName() { iconName() {
...@@ -39,6 +43,12 @@ export default { ...@@ -39,6 +43,12 @@ export default {
iconClass() { iconClass() {
return `multi-file-${this.file.tempFile ? 'addition' : 'modified'} append-right-8`; return `multi-file-${this.file.tempFile ? 'addition' : 'modified'} append-right-8`;
}, },
fullKey() {
return `${this.keyPrefix.toLowerCase()}-${this.file.key}`;
},
isActive() {
return this.activeFileKey === this.fullKey;
},
}, },
methods: { methods: {
...mapActions([ ...mapActions([
...@@ -70,7 +80,12 @@ export default { ...@@ -70,7 +80,12 @@ export default {
</script> </script>
<template> <template>
<div class="multi-file-commit-list-item"> <div
class="multi-file-commit-list-item"
:class="{
'is-active': isActive
}"
>
<button <button
type="button" type="button"
class="multi-file-commit-list-path" class="multi-file-commit-list-path"
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
'unusedSeal', 'unusedSeal',
]), ]),
...mapState('commit', ['commitMessage', 'submitCommitLoading']), ...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommitedChanges']), ...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommitedChanges', 'activeFile']),
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled']), ...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled']),
showStageUnstageArea() { showStageUnstageArea() {
return !!(this.someUncommitedChanges || this.lastCommitMsg || !this.unusedSeal); return !!(this.someUncommitedChanges || this.lastCommitMsg || !this.unusedSeal);
...@@ -44,6 +44,7 @@ export default { ...@@ -44,6 +44,7 @@ export default {
if (this.lastOpenedFile) { if (this.lastOpenedFile) {
this.openPendingTab({ this.openPendingTab({
file: this.lastOpenedFile, file: this.lastOpenedFile,
keyPrefix: this.lastOpenedFile.changed ? 'unstaged' : 'staged',
}) })
.then(changeViewer => { .then(changeViewer => {
if (changeViewer) { if (changeViewer) {
...@@ -92,6 +93,7 @@ export default { ...@@ -92,6 +93,7 @@ export default {
action="stageAllChanges" action="stageAllChanges"
:action-btn-text="__('Stage all')" :action-btn-text="__('Stage all')"
item-action-component="stage-button" item-action-component="stage-button"
:active-file-key="activeFile.key"
/> />
<commit-files-list <commit-files-list
icon-name="staged" icon-name="staged"
...@@ -101,6 +103,7 @@ export default { ...@@ -101,6 +103,7 @@ export default {
:action-btn-text="__('Unstage all')" :action-btn-text="__('Unstage all')"
item-action-component="unstage-button" item-action-component="unstage-button"
:staged-list="true" :staged-list="true"
:active-file-key="activeFile.key"
/> />
</template> </template>
<empty-state <empty-state
......
...@@ -612,6 +612,10 @@ ...@@ -612,6 +612,10 @@
} }
} }
.multi-file-commit-list-item.is-active {
background-color: $white-normal;
}
.multi-file-commit-list-path { .multi-file-commit-list-path {
padding: 0; padding: 0;
background: none; background: none;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment