Skip to content

Commit 02e49a0

Browse files
Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (#34137)
In the file tree, the icons are not vertically centered, which affects the overall visual consistency. Currently, the icons of submodules and symlinks do not adopt the value of entryIcon, resulting in inconsistent icon display. before: ![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test gitea_src_branch_main_README md (3)](https://github.com/user-attachments/assets/d521b89f-909a-43f9-8f39-787b0243b159) after: ![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test gitea_src_branch_main_README md (2)](https://github.com/user-attachments/assets/4866807f-c890-4709-b595-7086011e5231) --------- Co-authored-by: silverwind <[email protected]>
1 parent fac6b87 commit 02e49a0

File tree

10 files changed

+36
-34
lines changed

10 files changed

+36
-34
lines changed

Diff for: templates/repo/actions/status.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{else if eq .status "blocked"}}
1717
{{svg "octicon-blocked" $size (printf "text yellow %s" $className)}}
1818
{{else if eq .status "running"}}
19-
{{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}}
19+
{{svg "octicon-meter" $size (printf "text yellow circular-spin %s" $className)}}
2020
{{else}}{{/*failure, unknown*/}}
2121
{{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}}
2222
{{end}}

Diff for: web_src/css/base.css

+12
Original file line numberDiff line numberDiff line change
@@ -1181,3 +1181,15 @@ the "!important" is necessary to override Fomantic UI menu item styles, meanwhil
11811181
flex-grow: 1;
11821182
justify-content: space-between;
11831183
}
1184+
1185+
.svg.octicon-file-directory-fill,
1186+
.svg.octicon-file-directory-open-fill,
1187+
.svg.octicon-file-submodule {
1188+
color: var(--color-primary);
1189+
}
1190+
1191+
.svg.octicon-file,
1192+
.svg.octicon-file-symlink-file,
1193+
.svg.octicon-file-directory-symlink {
1194+
color: var(--color-secondary-dark-7);
1195+
}

Diff for: web_src/css/modules/animations.css

+10
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,13 @@ code.language-math.is-loading::after {
116116
animation-duration: 100ms;
117117
animation-timing-function: ease-in-out;
118118
}
119+
120+
.circular-spin {
121+
animation: circular-spin-keyframes 1s linear infinite;
122+
}
123+
124+
@keyframes circular-spin-keyframes {
125+
100% {
126+
transform: rotate(-360deg);
127+
}
128+
}

Diff for: web_src/css/repo/home-file-list.css

-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414
}
1515
}
1616

17-
#repo-files-table .svg.octicon-file-directory-fill,
18-
#repo-files-table .svg.octicon-file-submodule {
19-
color: var(--color-primary);
20-
}
21-
22-
#repo-files-table .svg.octicon-file,
23-
#repo-files-table .svg.octicon-file-symlink-file,
24-
#repo-files-table .svg.octicon-file-directory-symlink {
25-
color: var(--color-secondary-dark-7);
26-
}
27-
2817
#repo-files-table .repo-file-item {
2918
display: contents;
3019
}

Diff for: web_src/js/components/ActionRunStatus.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ withDefaults(defineProps<{
2424
<SvgIcon name="octicon-stop" class="text yellow" :size="size" :class="className" v-else-if="status === 'cancelled'"/>
2525
<SvgIcon name="octicon-clock" class="text yellow" :size="size" :class="className" v-else-if="status === 'waiting'"/>
2626
<SvgIcon name="octicon-blocked" class="text yellow" :size="size" :class="className" v-else-if="status === 'blocked'"/>
27-
<SvgIcon name="octicon-meter" class="text yellow" :size="size" :class="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
27+
<SvgIcon name="octicon-meter" class="text yellow" :size="size" :class="'circular-spin ' + className" v-else-if="status === 'running'"/>
2828
<SvgIcon name="octicon-x-circle-fill" class="text red" :size="size" v-else/><!-- failure, unknown -->
2929
</span>
3030
</template>

Diff for: web_src/js/components/RepoActionView.vue

+1-11
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ export default defineComponent({
574574
<!-- If the job is done and the job step log is loaded for the first time, show the loading icon
575575
currentJobStepsStates[i].cursor === null means the log is loaded for the first time
576576
-->
577-
<SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="tw-mr-2 job-status-rotate"/>
577+
<SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="tw-mr-2 circular-spin"/>
578578
<SvgIcon v-else :name="currentJobStepsStates[i].expanded ? 'octicon-chevron-down': 'octicon-chevron-right'" :class="['tw-mr-2', !isExpandable(jobStep.status) && 'tw-invisible']"/>
579579
<ActionRunStatus :status="jobStep.status" class="tw-mr-2"/>
580580

@@ -896,16 +896,6 @@ export default defineComponent({
896896

897897
<style> /* eslint-disable-line vue-scoped-css/enforce-style-type */
898898
/* some elements are not managed by vue, so we need to use global style */
899-
.job-status-rotate {
900-
animation: job-status-rotate-keyframes 1s linear infinite;
901-
}
902-
903-
@keyframes job-status-rotate-keyframes {
904-
100% {
905-
transform: rotate(-360deg);
906-
}
907-
}
908-
909899
.job-step-section {
910900
margin: 10px;
911901
}

Diff for: web_src/js/components/RepoCodeFrequency.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const options: ChartOptions<'line'> = {
150150
<div class="tw-flex ui segment main-graph">
151151
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
152152
<div v-if="isLoading">
153-
<SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/>
153+
<SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/>
154154
{{ locale.loadingInfo }}
155155
</div>
156156
<div v-else class="text red">

Diff for: web_src/js/components/RepoContributors.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export default defineComponent({
375375
<div class="tw-flex ui segment main-graph">
376376
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
377377
<div v-if="isLoading">
378-
<SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/>
378+
<SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/>
379379
{{ locale.loadingInfo }}
380380
</div>
381381
<div v-else class="text red">

Diff for: web_src/js/components/RepoRecentCommits.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const options: ChartOptions<'bar'> = {
128128
<div class="tw-flex ui segment main-graph">
129129
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
130130
<div v-if="isLoading">
131-
<SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/>
131+
<SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/>
132132
{{ locale.loadingInfo }}
133133
</div>
134134
<div v-else class="text red">

Diff for: web_src/js/components/ViewFileTreeItem.vue

+8-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const doGotoSubModule = () => {
5858
>
5959
<!-- submodule -->
6060
<div class="item-content">
61-
<SvgIcon class="text primary" name="octicon-file-submodule"/>
61+
<!-- eslint-disable-next-line vue/no-v-html -->
62+
<span class="tw-contents" v-html="item.entryIcon"/>
6263
<span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span>
6364
</div>
6465
</div>
@@ -70,7 +71,8 @@ const doGotoSubModule = () => {
7071
>
7172
<!-- symlink -->
7273
<div class="item-content">
73-
<SvgIcon name="octicon-file-symlink-file"/>
74+
<!-- eslint-disable-next-line vue/no-v-html -->
75+
<span class="tw-contents" v-html="item.entryIcon"/>
7476
<span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span>
7577
</div>
7678
</div>
@@ -83,7 +85,7 @@ const doGotoSubModule = () => {
8385
<!-- file -->
8486
<div class="item-content">
8587
<!-- eslint-disable-next-line vue/no-v-html -->
86-
<span v-html="item.entryIcon"/>
88+
<span class="tw-contents" v-html="item.entryIcon"/>
8789
<span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span>
8890
</div>
8991
</div>
@@ -95,13 +97,12 @@ const doGotoSubModule = () => {
9597
>
9698
<!-- directory -->
9799
<div class="item-toggle">
98-
<!-- FIXME: use a general and global class for this animation -->
99-
<SvgIcon v-if="isLoading" name="octicon-sync" class="job-status-rotate"/>
100+
<SvgIcon v-if="isLoading" name="octicon-sync" class="circular-spin"/>
100101
<SvgIcon v-else :name="collapsed ? 'octicon-chevron-right' : 'octicon-chevron-down'" @click.stop="doLoadChildren"/>
101102
</div>
102103
<div class="item-content">
103104
<!-- eslint-disable-next-line vue/no-v-html -->
104-
<span class="text primary" v-html="(!collapsed && item.entryIconOpen) ? item.entryIconOpen : item.entryIcon"/>
105+
<span class="tw-contents" v-html="(!collapsed && item.entryIconOpen) ? item.entryIconOpen : item.entryIcon"/>
105106
<span class="gt-ellipsis">{{ item.entryName }}</span>
106107
</div>
107108
</div>
@@ -154,7 +155,7 @@ const doGotoSubModule = () => {
154155
grid-area: content;
155156
display: flex;
156157
align-items: center;
157-
gap: 0.25em;
158+
gap: 0.5em;
158159
text-overflow: ellipsis;
159160
min-width: 0;
160161
}

0 commit comments

Comments
 (0)