From 14c13ced9cd6f4c86718305f09c3b0250b4e407f Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Fri, 8 Mar 2024 10:00:15 +0800 Subject: [PATCH 1/7] modify variables --- .github/workflows/release-nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 80e6683919fc7..b697e52072771 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -83,8 +83,8 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME}} + password: ${{ secrets.DOCKER_PASSWORD }} - name: fetch go modules run: make vendor - name: build rootful docker image From 3b749d8df8ff207bb6573ac902ec32c0da07b22c Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Fri, 8 Mar 2024 10:03:22 +0800 Subject: [PATCH 2/7] modify variables --- .github/workflows/release-nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index b697e52072771..53d6ce6509ff6 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -120,8 +120,8 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME}} + password: ${{ secrets.DOCKER_PASSWORD }} - name: fetch go modules run: make vendor - name: build rootless docker image From 81f9a84f9fa73229b5c288f56fa6c641b94f90dd Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 8 Mar 2024 08:57:52 +0100 Subject: [PATCH 3/7] Set user's 24h preference from their current OS locale (#29651) @silverwind Can you update the issue content? Looks like we need to merge issue content and https://github.com/go-gitea/gitea/pull/29651#issuecomment-1984600844 as the commit message. --- web_src/js/components/RepoActionView.vue | 4 ++-- web_src/js/modules/tippy.js | 10 +++++++++- web_src/js/utils/time.js | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 97cd05b45bcc4..de9625b143bab 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -3,7 +3,7 @@ import {SvgIcon} from '../svg.js'; import ActionRunStatus from './ActionRunStatus.vue'; import {createApp} from 'vue'; import {toggleElem} from '../utils/dom.js'; -import {getCurrentLocale} from '../utils.js'; +import {formatDatetime} from '../utils/time.js'; import {renderAnsi} from '../render/ansi.js'; import {POST, DELETE} from '../modules/fetch.js'; @@ -167,7 +167,7 @@ const sfc = { const logTimeStamp = document.createElement('span'); logTimeStamp.className = 'log-time-stamp'; const date = new Date(parseFloat(line.timestamp * 1000)); - const timeStamp = date.toLocaleString(getCurrentLocale(), {timeZoneName: 'short'}); + const timeStamp = formatDatetime(date); logTimeStamp.textContent = timeStamp; toggleElem(logTimeStamp, this.timeVisible['log-time-stamp']); // for "Show seconds" diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index 27f371fd88659..489afc0ae1cfa 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -1,5 +1,6 @@ import tippy, {followCursor} from 'tippy.js'; import {isDocumentFragmentOrElementNode} from '../utils/dom.js'; +import {formatDatetime} from '../utils/time.js'; const visibleInstances = new Set(); @@ -93,8 +94,15 @@ function attachTooltip(target, content = null) { } function switchTitleToTooltip(target) { - const title = target.getAttribute('title'); + let title = target.getAttribute('title'); if (title) { + // apply custom formatting to relative-time's tooltips + if (target.tagName.toLowerCase() === 'relative-time') { + const datetime = target.getAttribute('datetime'); + if (datetime) { + title = formatDatetime(new Date(datetime)); + } + } target.setAttribute('data-tooltip-content', title); target.setAttribute('aria-label', title); // keep the attribute, in case there are some other "[title]" selectors diff --git a/web_src/js/utils/time.js b/web_src/js/utils/time.js index 3284e893e1377..1848792c984c9 100644 --- a/web_src/js/utils/time.js +++ b/web_src/js/utils/time.js @@ -1,4 +1,5 @@ import dayjs from 'dayjs'; +import {getCurrentLocale} from '../utils.js'; // Returns an array of millisecond-timestamps of start-of-week days (Sundays) export function startDaysBetween(startDate, endDate) { @@ -44,3 +45,23 @@ export function fillEmptyStartDaysWithZeroes(startDays, data) { return Object.values(result); } + +let dateFormat; + +// format a Date object to document's locale, but with 24h format from user's current locale because this +// option is a personal preference of the user, not something that the document's locale should dictate. +export function formatDatetime(date) { + if (!dateFormat) { + // TODO: replace `hour12` with `Intl.Locale.prototype.getHourCycles` once there is broad browser support + dateFormat = new Intl.DateTimeFormat(getCurrentLocale(), { + day: 'numeric', + month: 'short', + year: 'numeric', + hour: 'numeric', + hour12: !Number.isInteger(Number(new Intl.DateTimeFormat([], {hour: 'numeric'}).format())), + minute: '2-digit', + timeZoneName: 'short', + }); + } + return dateFormat.format(date); +} From fa27104bc008f96602a068ce88564a67d48df9d5 Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Fri, 8 Mar 2024 16:07:09 +0800 Subject: [PATCH 4/7] revert --- .github/workflows/release-nightly.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 53d6ce6509ff6..80e6683919fc7 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -83,8 +83,8 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME}} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: fetch go modules run: make vendor - name: build rootful docker image @@ -120,8 +120,8 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME}} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: fetch go modules run: make vendor - name: build rootless docker image From 8d55eaff851f397d4f5356a7a303b0b251f366c7 Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Mon, 11 Mar 2024 12:28:11 +0800 Subject: [PATCH 5/7] Fix:Circular loading spinner is oval in safari browser --- web_src/css/modules/animations.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/modules/animations.css b/web_src/css/modules/animations.css index 87eb6a75cf071..d15642055b65a 100644 --- a/web_src/css/modules/animations.css +++ b/web_src/css/modules/animations.css @@ -19,7 +19,7 @@ display: block; left: 50%; top: 50%; - height: min(4em, 66.6%); + width: min(4em, 66.6%); aspect-ratio: 1; transform: translate(-50%, -50%); animation: isloadingspin 1000ms infinite linear; From 3102bd9fb23d9f59892ab608aa93feab1bd8d974 Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Tue, 12 Mar 2024 10:09:53 +0800 Subject: [PATCH 6/7] fix --- web_src/css/base.css | 1 + web_src/css/modules/animations.css | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index e53e0619c80e6..1a469e407c488 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -21,6 +21,7 @@ --border-radius-circle: 50%; --opacity-disabled: 0.55; --height-loading: 16rem; + --width-loading: 16rem; --min-height-textarea: 132px; /* padding + 6 lines + border = calc(1.57142em + 6lh + 2px), but lh is not fully supported */ --tab-size: 4; } diff --git a/web_src/css/modules/animations.css b/web_src/css/modules/animations.css index d15642055b65a..cf1d8bbadf72e 100644 --- a/web_src/css/modules/animations.css +++ b/web_src/css/modules/animations.css @@ -1,11 +1,13 @@ @keyframes isloadingspin { - 0% { transform: translate(-50%, -50%) rotate(0deg); } - 100% { transform: translate(-50%, -50%) rotate(360deg); } + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } } .is-loading { + display: flex; + justify-content: center; + align-items: center; pointer-events: none !important; - position: relative !important; overflow: hidden !important; } @@ -15,13 +17,8 @@ .is-loading::after { content: ""; - position: absolute; - display: block; - left: 50%; - top: 50%; width: min(4em, 66.6%); aspect-ratio: 1; - transform: translate(-50%, -50%); animation: isloadingspin 1000ms infinite linear; border-width: 4px; border-style: solid; @@ -45,7 +42,7 @@ form.single-button-form.is-loading .button { .markup pre.is-loading, .editor-loading.is-loading, .pdf-content.is-loading { - height: var(--height-loading); + width: var(--width-loading); } .markup .is-loading > * { @@ -62,7 +59,6 @@ code.language-math.is-loading::after { padding: 0; border-width: 2px; width: 1.25rem; - height: 1.25rem; } @keyframes fadein { From c64a2c35b19ba2f5c0f50074fc0bcf14f39cf2cc Mon Sep 17 00:00:00 2001 From: HEREYUA <1240335630@qq.com> Date: Wed, 13 Mar 2024 18:24:40 +0800 Subject: [PATCH 7/7] fix --- web_src/css/base.css | 1 - web_src/css/modules/animations.css | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 1a469e407c488..e53e0619c80e6 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -21,7 +21,6 @@ --border-radius-circle: 50%; --opacity-disabled: 0.55; --height-loading: 16rem; - --width-loading: 16rem; --min-height-textarea: 132px; /* padding + 6 lines + border = calc(1.57142em + 6lh + 2px), but lh is not fully supported */ --tab-size: 4; } diff --git a/web_src/css/modules/animations.css b/web_src/css/modules/animations.css index cf1d8bbadf72e..b112a40c2777e 100644 --- a/web_src/css/modules/animations.css +++ b/web_src/css/modules/animations.css @@ -14,10 +14,10 @@ .is-loading > * { opacity: 0.3; } - +/* Using `height` and `aspect-ratio` together in Safari can cause issues. The same problem can be seen in the WebKit bug:https://bugs.webkit.org/show_bug.cgi?id=267625, but it can be avoided by not using absolute positioning on `::after`. */ .is-loading::after { content: ""; - width: min(4em, 66.6%); + height: min(4em, 66.6%); aspect-ratio: 1; animation: isloadingspin 1000ms infinite linear; border-width: 4px; @@ -42,7 +42,7 @@ form.single-button-form.is-loading .button { .markup pre.is-loading, .editor-loading.is-loading, .pdf-content.is-loading { - width: var(--width-loading); + height: var(--height-loading); } .markup .is-loading > * { @@ -58,7 +58,7 @@ form.single-button-form.is-loading .button { code.language-math.is-loading::after { padding: 0; border-width: 2px; - width: 1.25rem; + height: 1.25rem; } @keyframes fadein {