Merge branch 'feat/1.2.5/ui' into test

This commit is contained in:
shuai
2024-01-23 12:06:20 +08:00
21 changed files with 392 additions and 328 deletions
+2
View File
@@ -1,2 +1,4 @@
TSC_COMPILE_ON_ERROR=true
ESLINT_NO_DEV_ERRORS=true
PUBLIC_URL = /
REACT_APP_API_URL = /
+2 -2
View File
@@ -16,7 +16,7 @@
},
"dependencies": {
"axios": "^0.27.2",
"bootstrap": "^5.3.0",
"bootstrap": "^5.3.2",
"bootstrap-icons": "^1.10.5",
"classnames": "^2.3.1",
"codemirror": "5.65.0",
@@ -32,7 +32,7 @@
"qrcode": "^1.5.1",
"qs": "^6.11.0",
"react": "^18.2.0",
"react-bootstrap": "^2.7.4",
"react-bootstrap": "^2.10.0",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-i18next": "^11.18.3",
+304 -289
View File
File diff suppressed because it is too large Load Diff
+39 -2
View File
@@ -12,6 +12,9 @@
--an-white: #fff;
--an-inbox-warning:#fff3cd80;
--an-f5: #f5f5f5;
--an-answer-item-border-top: rgba(0, 0, 0, .125);
--an-answer-inbox-nav-border-top: var(--bs-border-color);
--an-comment-item-border-bottom: var(--bs-colors-gray-200);
}
@@ -27,6 +30,9 @@
--an-white: #000;
--an-inbox-warning:#38363180;
--an-f5: var(--bs-body-bg);
--an-answer-item-border-top: var(--bs-border-color);
--an-answer-inbox-nav-border-top: var(--bs-border-color);
--an-comment-item-border-bottom: var(--bs-border-color);
}
[data-bs-theme="dark"] {
@@ -54,8 +60,39 @@
background-color: RGBA(255, 255, 255, var(--bs-bg-opacity, 1)) !important;
}
#sideNav {
.side-nav-right-line {
background-color: var(--bs-border-color);
.nav-link:hover, .nav-link.active {
color: var(--bs-body-color) !important;
background-color: #2b3035 !important;
}
}
.badge-tag {
background: rgba($blue-900, 0.5);
color: $blue-300;
&:hover {
color: $blue-300;
background: $blue-900;
}
}
.badge-tag-required {
background: $gray-800;
color:$gray-300;
border: 1px solid $gray-600;
&:hover {
color: $gray-300;
background: $gray-700;
}
}
.badge-tag-reserved {
color: $orange-300;
background: rgba($orange-900, 0.5);
border: 1px solid $orange-900;
&:hover {
color: $orange-300;
background: rgba($orange-900, 1);
}
}
}
@@ -41,20 +41,27 @@ const ActionBar = ({
const { t } = useTranslation('translation', { keyPrefix: 'comment' });
return (
<div className="d-flex justify-content-between small">
<div className="d-flex align-items-center link-secondary">
<div className="d-flex justify-content-between flex-wrap small">
<div className="d-flex align-items-center flex-wrap link-secondary">
{userStatus !== 'deleted' ? (
<Link to={`/users/${username}`}>{nickName}</Link>
<Link
to={`/users/${username}`}
className="name-ellipsis"
style={{ maxWidth: '200px' }}>
{nickName}
</Link>
) : (
<span>{nickName}</span>
)}
<span className="mx-1"></span>
<FormatTime time={createdAt} className="me-3" />
<FormatTime time={createdAt} className="me-3 flex-shrink-0" />
<Button
title={t('tip_vote')}
variant="link"
size="sm"
className={`me-3 btn-no-border p-0 ${isVote ? '' : 'link-secondary'}`}
className={`flex-shrink-0 me-3 btn-no-border p-0 ${
isVote ? '' : 'link-secondary'
}`}
onClick={onVote}>
<Icon name="hand-thumbs-up-fill" />
{voteCount > 0 && <span className="ms-2">{voteCount}</span>}
@@ -96,11 +103,7 @@ const ActionBar = ({
<Dropdown.Menu align="end">
{memberActions.map((action) => {
return (
<Dropdown.Item
key={action.name}
variant="link"
size="sm"
onClick={() => onAction(action)}>
<Dropdown.Item key={action.name} onClick={() => onAction(action)}>
{action.name}
</Dropdown.Item>
);
+1 -1
View File
@@ -30,7 +30,7 @@
}
}
}
border-bottom: 1px solid var(--bs-colors-gray-200, #E9ECEF);
border-bottom: 1px solid var(--an-comment-item-border-bottom);
}
.fmt {
display: inline;
-2
View File
@@ -74,10 +74,8 @@ const Comment = ({ objectId, mode, commentId }) => {
useEffect(() => {
if (pageIndex === 0 && commentId) {
console.log('scrollCallback');
setTimeout(() => {
const el = document.getElementById(commentId);
console.log(el);
scrollToElementTop(el);
bgFadeOut(el);
}, 100);
@@ -58,6 +58,12 @@ const Index: FC = () => {
.round()
.array()}
}
:root[data-bs-theme='dark'] {
--bs-link-hover-color: ${shiftColor(primaryColor, -0.8).hex()};
--bs-link-hover-color-rgb: ${shiftColor(primaryColor, -0.8)
.round()
.array()};
}
.nav-pills {
--bs-nav-pills-link-active-bg: ${primaryColor.hex()};
}
@@ -128,6 +134,20 @@ const Index: FC = () => {
.badge-tag:not(.badge-tag-reserved, .badge-tag-required):hover {
background-color: ${tintColor(primaryColor, 0.2).hex()};
}
[data-bs-theme="dark"] .badge-tag:not(.badge-tag-reserved):not(.badge-tag-required) {
background-color: rgba(${shadeColor(primaryColor, 0.2)
.rgb()
.array()
.join(',')}, .5);
color: ${tintColor(primaryColor, 0.4).hex()};
}
[data-bs-theme="dark"] .badge-tag:not(.badge-tag-reserved, .badge-tag-required):hover {
background-color: rgba(${tintColor(
primaryColor,
0.4,
).hex()}, 0.8);
color: ${tintColor(primaryColor, 0.6).hex()};
}
`}
</style>
)}
+1 -1
View File
@@ -117,7 +117,7 @@ const Image = ({ editorInstance }) => {
editor.replaceSelection(loadingText);
const urls = await upload(fileList).catch((ex) => {
console.log('ex: ', ex);
console.error('upload file error: ', ex);
});
const text: string[] = [];
+1 -1
View File
@@ -47,7 +47,7 @@
right: 12px;
width: 1px;
height: 100%;
background-color: var(--bs-gray-300);
background-color: var(--bs-border-color);
min-height: calc(100vh - 62px - 74px);
}
}
-4
View File
@@ -128,13 +128,11 @@ const TagSelector: FC<IProps> = ({
};
const handleTagSelectorFocus = () => {
console.log('foucsed 555');
setFocusState(true);
inputRef.current?.focus();
};
const handleTagSelectorBlur = () => {
console.log('tab key pressed666');
setFocusState(false);
setCurrentIndex(0);
handleMenuShow(false);
@@ -221,7 +219,6 @@ const TagSelector: FC<IProps> = ({
e.stopPropagation();
const { keyCode } = e;
if (keyCode === 9) {
console.log('tab key pressed');
handleTagSelectorBlur();
return;
}
@@ -334,7 +331,6 @@ const TagSelector: FC<IProps> = ({
}
}, [focusState, tags, hiddenCreateBtn, searchValue, maxTagLength]);
console.log('focusState===', focusState);
return (
<div ref={containerRef} className="position-relative">
<div
@@ -259,7 +259,6 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
label={t('login_required.switch')}
checked={data.login_required.value}
onChange={(e) => {
console.log(e.target.checked);
changeCallback({
login_required: {
value: e.target.checked,
@@ -93,7 +93,7 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
if (ex.isError) {
iaCaptcha.handleCaptchaError(ex.list);
}
console.log('ex: ', ex);
console.error('putInviteUser error: ', ex);
});
});
};
+1 -1
View File
@@ -18,7 +18,7 @@
*/
.answer-item {
border-top: 1px solid rgba(33, 37, 41, 0.25);
border-top: 1px solid var(--an-answer-item-border-top);
}
@media screen and (max-width: 768px) {
+3 -3
View File
@@ -68,7 +68,7 @@ const Index: FC = () => {
resolveNextOne(resp, pageNumber);
})
.catch((ex) => {
console.log('ex: ', ex);
console.error('review next error: ', ex);
});
};
const reviewInfo = unreviewed_info?.content;
@@ -85,7 +85,7 @@ const Index: FC = () => {
queryNextOne(page);
})
.catch((ex) => {
console.log('ex: ', ex);
console.error('revisionAudit approve error: ', ex);
})
.finally(() => {
setIsLoading(false);
@@ -101,7 +101,7 @@ const Index: FC = () => {
queryNextOne(page);
})
.catch((ex) => {
console.log('ex: ', ex);
console.error('revisionAudit reject error: ', ex);
})
.finally(() => {
setIsLoading(false);
-2
View File
@@ -98,8 +98,6 @@ const Index: FC = () => {
usePageTags({
title: pageTitle,
});
console.log('timelineData', linkUrl);
return (
<div className="py-4 mb-5">
<h5 className="mb-4">
+1 -1
View File
@@ -18,6 +18,6 @@
*/
.inbox-nav {
border-top: 1px solid rgba(0, 0, 0, .125);
border-top: 1px solid var(--an-answer-item-border-top);
padding: .5rem 0;
}
@@ -92,8 +92,6 @@ const Index = () => {
setLangs(res);
};
console.log(formData.color_scheme, '3333');
const handleOnChange = (d) => {
setFormData(d);
};
+1 -1
View File
@@ -58,5 +58,5 @@ export const shiftColor = (color, weight) => {
if (weight > 0) {
return shadeColor(color, weight);
}
return tintColor(color, weight);
return tintColor(color, -weight);
};
+1 -3
View File
@@ -144,10 +144,9 @@ export const pullLoggedUser = async (isInitPull = false) => {
pluTimestamp = Date.now();
const loggedUserInfo = await getLoggedUserInfo({
passingError: true,
}).catch((ex) => {
}).catch(() => {
pluTimestamp = 0;
loggedUserInfoStore.getState().clear(false);
console.error(ex);
});
if (loggedUserInfo) {
loggedUserInfoStore.getState().update(loggedUserInfo);
@@ -424,7 +423,6 @@ export const googleSnapshotRedirect = () => {
if (searchStr.indexOf('cache:') === 0 && searchStr.includes(':http')) {
const redirectUrl = `http${searchStr.split(':http')[1]}`;
const pathname = redirectUrl.replace(new URL(redirectUrl).origin, '');
console.log('googleSnapshotUrl', window.location.href);
gr.ok = false;
gr.redirect = pathname || '/';
+1 -1
View File
@@ -76,7 +76,7 @@ const addI18nResource = async (langName) => {
const { default: resConf } = await import(`@i18n/${langName}.yaml`);
res.resources = resConf.ui;
} catch (ex) {
console.log('ex: ', ex);
console.error('addI18nResource error: ', ex);
}
} else if (storageResource && storageResource.lng === res.lng) {
res.resources = storageResource.resources;