Skip to content

Commit 656d5a1

Browse files
yardenshohamgempirzeripathlunny
authored
Fix PR file tree folders no longer collapsing (#22864) (#22872)
Backport #22864 Collapsing folders currently just throws a console error ``` index.js?v=1.19.0~dev-403-gb6b8feb3d:10 TypeError: this.$set is not a function at Proxy.handleClick (index.js?v=1.19.0~dev-403-gb6b8feb3d:58:7159) at index.js?v=1.19.0~dev-403-gb6b8feb3d:58:6466 at index.js?v=1.19.0~dev-403-gb6b8feb3d:10:93922 at ce (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1472) at Q (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1567) at HTMLDivElement.$e (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:79198) ``` This PR fixes this and allows folders to be collapsed again. Also: - better cursor interaction with folders - added some color to the diff detail stats - remove green link color from all the file names Screenshots: ![image](https://user-images.githubusercontent.com/9765622/218269712-2f3dda55-6d70-407f-8d34-2a5d9c8df548.png) ![image](https://user-images.githubusercontent.com/9765622/218269714-6ce8a954-daea-4ed6-9eea-8b2323db4d8f.png) Co-authored-by: gempir <[email protected]> Co-authored-by: zeripath <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 43d1183 commit 656d5a1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

web_src/js/components/DiffFileTreeItem.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/>
1111
<a
1212
v-if="item.isFile"
13-
class="file ellipsis"
13+
class="file ellipsis muted"
1414
:href="item.isFile ? '#diff-' + item.file.NameHash : ''"
1515
>{{ item.name }}</a>
1616
<SvgIcon
@@ -68,7 +68,7 @@ export default {
6868
if (itemIsFile) {
6969
return;
7070
}
71-
this.$set(this, 'collapsed', !this.collapsed);
71+
this.collapsed = !this.collapsed;
7272
},
7373
getIconForDiffType(pType) {
7474
const diffTypes = {
@@ -88,6 +88,7 @@ export default {
8888
span.svg-icon.status {
8989
float: right;
9090
}
91+
9192
span.svg-icon.file {
9293
color: var(--color-secondary-dark-7);
9394
}
@@ -127,6 +128,8 @@ span.svg-icon.octicon-diff-renamed {
127128
div.directory {
128129
display: grid;
129130
grid-template-columns: 18px 20px auto;
131+
user-select: none;
132+
cursor: pointer;
130133
}
131134
132135
div.directory:hover {

web_src/less/_repository.less

+14
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,20 @@
16081608
margin-right: .25rem;
16091609
}
16101610

1611+
// Because the translations contain the <strong> we need to style with nth-of-type
1612+
1613+
.diff-detail-stats strong:nth-of-type(1) {
1614+
color: var(--color-yellow);
1615+
}
1616+
1617+
.diff-detail-stats strong:nth-of-type(2) {
1618+
color: var(--color-green);
1619+
}
1620+
1621+
.diff-detail-stats strong:nth-of-type(3) {
1622+
color: var(--color-red);
1623+
}
1624+
16111625
.diff-detail-stats {
16121626
@media (max-width: 480px) {
16131627
font-size: 0;

0 commit comments

Comments
 (0)