Merge branch 'ui' of git.backyard.segmentfault.com:opensource/answer into ui

This commit is contained in:
shuai 2022-10-14 17:22:29 +08:00
commit 6382c10e31
13 changed files with 24 additions and 21 deletions

View File

@ -73,7 +73,7 @@ const Mentions: FC<IProps> = ({ children, pageUsers, onSelected }) => {
return;
}
const text = `@${item?.displayName}[${item?.userName}] `;
const text = `@${item?.userName}`;
onSelected(
`${value.substring(
0,

View File

@ -118,8 +118,8 @@ const Flags: FC = () => {
className="fs-14 text-secondary"
/>
<BaseUserCard data={li.report_user} className="mt-2 mb-2" />
{li.flaged_reason ? (
<small>{li.flaged_content}</small>
{li.flagged_reason ? (
<small>{li.flagged_content}</small>
) : (
<small>
{li.reason?.name}

View File

@ -412,7 +412,7 @@ const Ask = () => {
)}
</Form>
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<Card className="mb-4">
<Card.Header>
{t('title', { keyPrefix: 'how_to_format' })}

View File

@ -166,7 +166,7 @@ const Index = () => {
/>
)}
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<RelatedQuestions id={question?.id || ''} />
</Col>
</Row>

View File

@ -217,7 +217,7 @@ const Ask = () => {
</div>
</Form>
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<Card>
<Card.Header>
{t('title', { keyPrefix: 'how_to_format' })}

View File

@ -29,7 +29,7 @@ const Questions: FC = () => {
<Col xxl={7} lg={8} sm={12}>
<QuestionList source="questions" />
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<FollowingTags />
<HotQuestions />
</Col>

View File

@ -53,7 +53,7 @@ const Index = () => {
/>
</div>
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<Tips />
</Col>
</Row>

View File

@ -90,7 +90,7 @@ const Questions: FC = () => {
</div>
<QuestionList source="tag" />
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<FollowingTags />
<HotQuestions />
</Col>

View File

@ -249,7 +249,7 @@ const Ask = () => {
</div>
</Form>
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<Card>
<Card.Header>
{t('title', { keyPrefix: 'how_to_format' })}

View File

@ -93,7 +93,7 @@ const TagIntroduction = () => {
<PageTitle title={pageTitle} />
<Container className="pt-4 mt-2 mb-5">
<Row className="justify-content-center">
<Col xs={7}>
<Col xxl={7} lg={8} sm={12}>
<h3 className="mb-3">
<Link
to={`/tags/${tagInfo?.slug_name}`}
@ -133,7 +133,7 @@ const TagIntroduction = () => {
})}
</div>
</Col>
<Col xs={3}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<Card>
<Card.Header className="d-flex justify-content-between">
<span>{t('synonyms.title')}</span>

View File

@ -120,7 +120,7 @@ const Notifications = () => {
</div>
)}
</Col>
<Col xxl={3} lg={4} sm={12} />
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0" />
</Row>
</Container>
</>

View File

@ -60,7 +60,11 @@ const Personal: FC = () => {
<Col xxl={7} lg={8} sm={12}>
<UserInfo data={userInfo?.info} />
</Col>
<Col xxl={3} lg={4} sm={12} className="d-flex justify-content-end">
<Col
xxl={3}
lg={4}
sm={12}
className="d-flex justify-content-end mt-5 mt-lg-0">
{isSelf && (
<div>
<Button
@ -111,7 +115,7 @@ const Personal: FC = () => {
</div>
)}
</Col>
<Col xxl={3} lg={4} sm={12}>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
<h5 className="mb-3">Stats</h5>
{userInfo?.info && (
<>

View File

@ -78,8 +78,8 @@ function scrollTop(element) {
* @returns Array<{displayName: string, userName: string}>
*/
function matchedUsers(markdown) {
const globalReg = /@(.*?)\[(.*?)\]/gm;
const reg = /@(.*?)\[(.*?)\]/;
const globalReg = /\B@([\w|]+)/g;
const reg = /\B@([\w\\_\\.]+)/;
const users = markdown.match(globalReg);
if (!users) {
@ -88,8 +88,7 @@ function matchedUsers(markdown) {
return users.map((user) => {
const matched = user.match(reg);
return {
displayName: matched[2],
userName: matched[2],
userName: matched[1],
};
});
}
@ -100,8 +99,8 @@ function matchedUsers(markdown) {
* @returns string
*/
function parseUserInfo(markdown) {
const globalReg = /@(.*?)\[(.*?)\]/gm;
return markdown.replace(globalReg, '[@$1](/u/$2)');
const globalReg = /\B@([\w\\_\\.\\-]+)/g;
return markdown.replace(globalReg, '[@$1](/u/$1)');
}
export {