Feed UI Improvements (#27356) (#27717)

Backport #27356 by @silverwind

Various improvements related to feeds:

- Fix markdown rendering
- Increase font size from 13px to default 14px via `flex-item`
- Add style to hashes
- Move the timestamp to title line. I realize it's not optimal for
translation, we may need to change all these translations

Before:
<img width="768" alt="Screenshot 2023-09-29 at 22 52 58"
src="https://github.com/go-gitea/gitea/assets/115237/edda8b84-23cf-4a43-90ad-a892798f4e6c">

After:
<img width="781" alt="Screenshot 2023-09-29 at 22 58 09"
src="https://github.com/go-gitea/gitea/assets/115237/7097474d-efcf-4f22-a2ab-834a4e25c4e8">

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Giteabot 2023-10-21 19:13:15 +08:00 committed by GitHub
parent a398089301
commit 1848858a1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View file

@ -78,20 +78,23 @@
{{$reviewer := index .GetIssueInfos 1}} {{$reviewer := index .GetIssueInfos 1}}
{{ctx.Locale.Tr "action.review_dismissed" ((printf "%s/pulls/%s" (.GetRepoLink ctx) $index) |Escape) $index ((.ShortRepoPath ctx)|Escape) $reviewer | Str2html}} {{ctx.Locale.Tr "action.review_dismissed" ((printf "%s/pulls/%s" (.GetRepoLink ctx) $index) |Escape) $index ((.ShortRepoPath ctx)|Escape) $reviewer | Str2html}}
{{end}} {{end}}
{{TimeSince .GetCreate ctx.Locale}}
</div> </div>
{{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}} {{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}}
{{$push := ActionContent2Commits .}} {{$push := ActionContent2Commits .}}
{{$repoLink := (.GetRepoLink ctx)}} {{$repoLink := (.GetRepoLink ctx)}}
{{range $push.Commits}} <div class="gt-df gt-fc gt-gap-2">
{{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}} {{range $push.Commits}}
<div class="flex-text-block"> {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16"> <div class="flex-text-block">
<a class="gt-mono" href="{{$commitLink}}">{{ShortSha .Sha1}}</a> <img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16">
<span class="text truncate light grey"> <a class="ui sha label" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
{{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}} <span class="text truncate">
</span> {{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}}
</div> </span>
{{end}} </div>
{{end}}
</div>
{{if and (gt $push.Len 1) $push.CompareURL}} {{if and (gt $push.Len 1) $push.CompareURL}}
<a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{ctx.Locale.Tr "action.compare_commits" $push.Len}} »</a> <a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{ctx.Locale.Tr "action.compare_commits" $push.Len}} »</a>
{{end}} {{end}}
@ -103,7 +106,7 @@
<a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | RenderEmoji $.Context | RenderCodeBlock}}</a> <a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | RenderEmoji $.Context | RenderCodeBlock}}</a>
{{$comment := index .GetIssueInfos 1}} {{$comment := index .GetIssueInfos 1}}
{{if gt (len $comment) 0}} {{if gt (len $comment) 0}}
<div class="flex-item-body">{{$comment | RenderEmoji $.Context | RenderCodeBlock}}</div> <div class="markup gt-font-14">{{RenderMarkdownToHtml ctx $comment}}</div>
{{end}} {{end}}
{{else if .GetOpType.InActions "merge_pull_request"}} {{else if .GetOpType.InActions "merge_pull_request"}}
<div class="flex-item-body text black">{{index .GetIssueInfos 1}}</div> <div class="flex-item-body text black">{{index .GetIssueInfos 1}}</div>
@ -113,7 +116,6 @@
<div class="flex-item-body text black">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</div> <div class="flex-item-body text black">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</div>
<div class="flex-item-body text black">{{index .GetIssueInfos 2 | RenderEmoji $.Context}}</div> <div class="flex-item-body text black">{{index .GetIssueInfos 2 | RenderEmoji $.Context}}</div>
{{end}} {{end}}
<div class="flex-item-body">{{TimeSince .GetCreate ctx.Locale}}</div>
</div> </div>
<div class="flex-item-trailing"> <div class="flex-item-trailing">
{{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32 "text grey gt-mr-2"}} {{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32 "text grey gt-mr-2"}}

View file

@ -69,7 +69,6 @@
} }
.flex-item .flex-item-body { .flex-item .flex-item-body {
font-size: 13px;
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;