feat(ui): show repo size on mobile (#6344)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6344
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
0ko 2024-12-22 17:05:27 +00:00
parent 54255688f5
commit 4e820ff795
2 changed files with 16 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{{if and (not .HideRepoInfo) (not .IsBlame)}} {{if and (not .HideRepoInfo) (not .IsBlame)}}
<div class="ui segments repository-summary tw-mt-1 tw-mb-0"> <div class="ui segments repository-summary tw-mt-1 tw-mb-0">
<div class="ui segment sub-menu repository-menu"> <div class="ui segment repository-menu">
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}} {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}}
<a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}"> <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}">
{{svg "octicon-history"}} {{ctx.Locale.TrN .CommitsCount "repo.n_commit_one" "repo.n_commit_few" (printf "<b>%d</b>" .CommitsCount | SafeHTML)}} {{svg "octicon-history"}} {{ctx.Locale.TrN .CommitsCount "repo.n_commit_one" "repo.n_commit_few" (printf "<b>%d</b>" .CommitsCount | SafeHTML)}}
@ -13,7 +13,7 @@
{{svg "octicon-tag"}} {{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (printf "<b>%d</b>" .NumTags | SafeHTML)}} {{svg "octicon-tag"}} {{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (printf "<b>%d</b>" .NumTags | SafeHTML)}}
</a> </a>
{{end}} {{end}}
<span class="item not-mobile" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}> <span class="item" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}>
{{$fileSizeFields := ctx.Locale.TrSize .Repository.Size}} {{$fileSizeFields := ctx.Locale.TrSize .Repository.Size}}
{{svg "octicon-database"}} <b>{{$fileSizeFields.PrettyNumber}}</b> {{$fileSizeFields.TranslatedUnit}} {{svg "octicon-database"}} <b>{{$fileSizeFields.PrettyNumber}}</b> {{$fileSizeFields.TranslatedUnit}}
</span> </span>

View file

@ -2013,15 +2013,27 @@ details.repo-search-result summary::marker {
box-shadow: none; box-shadow: none;
} }
.repository .repository-summary .repository-menu {
display: grid;
grid-template-columns: repeat(4, 1fr);
padding: 0 0.5em;
}
@media (max-width: 767.98px) {
.repository .repository-summary .repository-menu {
grid-template-rows: repeat(2, 1fr);
grid-template-columns: repeat(2, 1fr);
}
}
.repository .repository-summary .segment.sub-menu { .repository .repository-summary .segment.sub-menu {
border: none; border: none;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0; padding: 0;
overflow: hidden;
} }
.repository .repository-summary .sub-menu .item { .repository .repository-summary .item {
flex: 1; flex: 1;
height: 30px; height: 30px;
line-height: var(--line-height-default); line-height: var(--line-height-default);
@ -2029,7 +2041,6 @@ details.repo-search-result summary::marker {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 0.25em; gap: 0.25em;
padding: 0 0.5em; /* make the UI look better for narrow (mobile) view */
text-decoration: none; text-decoration: none;
} }