This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch feat/1.2.1/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.2.1/ui by this push:
new ae95a95e fix: fix some ui bugs
ae95a95e is described below
commit ae95a95ea18c167bcbed356c8b53ae8577e3ea77
Author: shuai <[email protected]>
AuthorDate: Tue Nov 21 17:43:30 2023 +0800
fix: fix some ui bugs
---
i18n/en_US.yaml | 4 +++-
ui/src/components/Comment/index.scss | 1 +
ui/src/components/Comment/index.tsx | 2 +-
ui/src/components/Footer/index.tsx | 4 ++--
ui/src/components/Modal/Modal.tsx | 4 +++-
.../pages/Questions/Ask/components/SearchQuestion/index.tsx | 13 ++++++-------
ui/src/utils/common.ts | 8 ++++++--
ui/src/utils/request.ts | 1 +
8 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index 72a7fe56..d283b88e 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -748,6 +748,8 @@ ui:
x_hours_ago: "{{count}}h ago"
hour: hour
day: day
+ hours: hours
+ days: days
comment:
btn_add_comment: Add comment
reply_to: Reply to
@@ -854,7 +856,7 @@ ui:
placeholder: Search
footer:
build_on: >-
- Built on <1> Answer </1>- the open-source software that powers Q&A
+ Powered by <1> Apache Answer </1>- the open-source software that powers
Q&A
communities.<br />Made with love © {{cc}}.
upload_img:
name: Change
diff --git a/ui/src/components/Comment/index.scss
b/ui/src/components/Comment/index.scss
index 90b76439..47254f57 100644
--- a/ui/src/components/Comment/index.scss
+++ b/ui/src/components/Comment/index.scss
@@ -30,6 +30,7 @@
}
}
}
+ border-bottom: 1px solid var(--bs-colors-gray-200, #E9ECEF);
}
.fmt {
display: inline;
diff --git a/ui/src/components/Comment/index.tsx
b/ui/src/components/Comment/index.tsx
index f531ddce..9a2d4ab3 100644
--- a/ui/src/components/Comment/index.tsx
+++ b/ui/src/components/Comment/index.tsx
@@ -338,7 +338,7 @@ const Comment = ({ objectId, mode, commentId }) => {
<div
key={item.comment_id}
id={item.comment_id}
- className="border-bottom py-2 comment-item">
+ className="py-2 comment-item">
{item.showEdit ? (
<Form
className="mt-2"
diff --git a/ui/src/components/Footer/index.tsx
b/ui/src/components/Footer/index.tsx
index 6b832ba8..506e0cad 100644
--- a/ui/src/components/Footer/index.tsx
+++ b/ui/src/components/Footer/index.tsx
@@ -34,10 +34,10 @@ const Index = () => {
<Container className="py-3">
<p className="text-center mb-0 small text-secondary">
<Trans i18nKey="footer.build_on" values={{ cc }}>
- Built on
+ Powered by
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a href="https://answer.apache.org" target="_blank">
- Answer
+ Apache Answer
</a>
- the open-source software that powers Q&A communities.
<br />
diff --git a/ui/src/components/Modal/Modal.tsx
b/ui/src/components/Modal/Modal.tsx
index 8367f43f..4d66137a 100644
--- a/ui/src/components/Modal/Modal.tsx
+++ b/ui/src/components/Modal/Modal.tsx
@@ -79,7 +79,9 @@ const Index: FC<Props> = ({
<Modal.Footer>
{showCancel && (
<Button variant={cancelBtnVariant} onClick={onCancel}>
- {cancelText || t('btns.cancel')}
+ {cancelText === 'close'
+ ? t('btns.close')
+ : cancelText || t('btns.cancel')}
</Button>
)}
{showConfirm && (
diff --git a/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
b/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
index 15c1b344..bda9112a 100644
--- a/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
+++ b/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
@@ -46,16 +46,15 @@ const SearchQuestion = ({ similarQuestions }) => {
<ListGroup.Item
action
as="a"
- className="d-flex align-items-center link-dark"
+ className="link-dark text-wrap text-break"
key={item.id}
href={pathFactory.questionLanding(item.id, item.url_title)}
target="_blank">
- <span className="text-wrap text-break">
- {item.title}
- {item.status === 'closed'
- ? ` [${t('closed', { keyPrefix: 'question' })}]`
- : null}
- </span>
+ {item.title}
+ {item.status === 'closed'
+ ? ` [${t('closed', { keyPrefix: 'question' })}]`
+ : null}
+
{item.accepted_answer ? (
<span className="small ms-3 text-success">
<Icon type="bi" name="check-circle-fill" />
diff --git a/ui/src/utils/common.ts b/ui/src/utils/common.ts
index 9603ddbc..b6382a4e 100644
--- a/ui/src/utils/common.ts
+++ b/ui/src/utils/common.ts
@@ -113,10 +113,14 @@ function formatUptime(value) {
const second = parseInt(value, 10);
if (second > 60 * 60 && second < 60 * 60 * 24) {
- return `${Math.floor(second / 3600)} ${t('dates.hour')}`;
+ const hour = second / 3600;
+ return `${Math.floor(hour)} ${
+ hour > 1 ? t('dates.hours') : t('dates.hour')
+ }`;
}
if (second > 60 * 60 * 24) {
- return `${Math.floor(second / 3600 / 24)} ${t('dates.day')}`;
+ const day = second / 3600 / 24;
+ return `${Math.floor(day)} ${day > 1 ? t('dates.days') : t('dates.day')}`;
}
return `< 1 ${t('dates.hour')}`;
diff --git a/ui/src/utils/request.ts b/ui/src/utils/request.ts
index 31a22019..48f50e6e 100644
--- a/ui/src/utils/request.ts
+++ b/ui/src/utils/request.ts
@@ -137,6 +137,7 @@ class Request {
Modal.confirm({
content: msg,
showConfirm: false,
+ cancelText: 'close',
});
return Promise.reject(false);
}