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 {
required: false,
default: false,
},
activeFileKey: {
type: String,
required: true,
},
},
data() {
return {
......@@ -115,6 +119,7 @@ export default {
:action-component="itemActionComponent"
:key-prefix="title"
:staged-list="stagedList"
:active-file-key="activeFileKey"
/>
</li>
</ul>
......
......@@ -30,6 +30,10 @@ export default {
required: false,
default: false,
},
activeFileKey: {
type: String,
required: true,
},
},
computed: {
iconName() {
......@@ -39,6 +43,12 @@ export default {
iconClass() {
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: {
...mapActions([
......@@ -70,7 +80,12 @@ export default {
</script>
<template>
<div class="multi-file-commit-list-item">
<div
class="multi-file-commit-list-item"
:class="{
'is-active': isActive
}"
>
<button
type="button"
class="multi-file-commit-list-path"
......
......@@ -27,7 +27,7 @@ export default {
'unusedSeal',
]),
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommitedChanges']),
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommitedChanges', 'activeFile']),
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled']),
showStageUnstageArea() {
return !!(this.someUncommitedChanges || this.lastCommitMsg || !this.unusedSeal);
......@@ -44,6 +44,7 @@ export default {
if (this.lastOpenedFile) {
this.openPendingTab({
file: this.lastOpenedFile,
keyPrefix: this.lastOpenedFile.changed ? 'unstaged' : 'staged',
})
.then(changeViewer => {
if (changeViewer) {
......@@ -92,6 +93,7 @@ export default {
action="stageAllChanges"
:action-btn-text="__('Stage all')"
item-action-component="stage-button"
:active-file-key="activeFile.key"
/>
<commit-files-list
icon-name="staged"
......@@ -101,6 +103,7 @@ export default {
:action-btn-text="__('Unstage all')"
item-action-component="unstage-button"
:staged-list="true"
:active-file-key="activeFile.key"
/>
</template>
<empty-state
......
......@@ -612,6 +612,10 @@
}
}
.multi-file-commit-list-item.is-active {
background-color: $white-normal;
}
.multi-file-commit-list-path {
padding: 0;
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