Skip to content

Commit a4f6830

Browse files
committed
fix: some bug
1 parent 641cae7 commit a4f6830

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

public/locales/en/repository.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"url": {
2424
"home": "Website",
25-
"document": "Documentation",
25+
"document": "Doc",
2626
"download": "Download",
2727
"online": "Demo",
2828
"source": "Source"

src/components/respository/Info.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,19 +457,19 @@ const Info = ({ repo, t, i18n_lang }: RepositoryProps) => {
457457
<span>{t('info.opensource')}</span>
458458
<span className='mx-0.5 md:mx-1.5'></span>
459459
<NoPrefetchLink href={`/license/${repo.license_lid}`}>
460-
<span className='cursor-pointer text-blue-500'>
460+
<span className='inline-flex max-w-[60px] cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-blue-500 md:max-w-full'>
461461
{repo.license}
462462
</span>
463463
</NoPrefetchLink>
464464
</div>
465465
)}
466466
</div>
467467
</div>
468-
<div className='flex flex-row gap-x-4 text-sm'>
468+
<div className='flex flex-row gap-x-1 text-sm md:gap-x-4'>
469469
{!repo.is_claimed && (
470470
<NoPrefetchLink href={`/repository/${repo.rid}/embed`}>
471471
<div className='flex cursor-pointer items-center justify-center text-blue-500 hover:text-current active:text-gray-400 md:hover:text-blue-600'>
472-
<BsPersonCheck className='mr-2' size={16} />
472+
<BsPersonCheck className='mr-1' size={16} />
473473
{t('info.unclaim')}
474474
</div>
475475
</NoPrefetchLink>
@@ -479,23 +479,23 @@ const Info = ({ repo, t, i18n_lang }: RepositoryProps) => {
479479
onClick={jumpComment}
480480
className='hidden cursor-pointer items-center justify-center hover:text-blue-500 active:text-gray-400 md:flex'
481481
>
482-
<GoComment className='mr-2' size={16} />
482+
<GoComment className='mr-1' size={16} />
483483
{t('info.discuss')}
484484
</div>
485485
<div
486486
className={isCollected ? 'text-blue-500' : ''}
487487
onClick={handleCollect}
488488
>
489489
<div className='flex cursor-pointer items-center justify-center hover:text-blue-500 active:text-gray-400 md:hover:text-blue-500'>
490-
<BsBookmark className='mr-2' size={16} />
490+
<BsBookmark className='mr-1' size={16} />
491491
{isCollected ? numFormat(collectTotal, 1) : t('info.collect')}
492492
</div>
493493
</div>
494494
<div
495495
className='flex cursor-pointer items-center justify-center hover:text-current active:text-gray-400 md:hover:text-blue-500'
496496
onClick={handleCopy}
497497
>
498-
<GoLinkExternal className='mr-2' size={16} />
498+
<GoLinkExternal className='mr-1' size={16} />
499499
{t('info.share')}
500500
</div>
501501
</div>

src/pages/repository/[rid]/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ interface Props {
2020
const RepositoryPage: NextPage<Props> = ({ repo }) => {
2121
const { t, i18n } = useTranslation('repository');
2222

23+
const getLocalizedField = (field: any, fallback: any) =>
24+
i18n.language === 'en' ? field ?? fallback : fallback;
25+
2326
return (
2427
<>
2528
<Seo
26-
title={`${repo.full_name}: ${repo.title}`}
27-
description={repo.summary}
29+
title={`${repo.full_name}: ${getLocalizedField(
30+
repo.title_en,
31+
repo.title
32+
)}`}
33+
description={getLocalizedField(repo.summary_en, repo.summary)}
2834
/>
2935
<RepoDetailNavbar
3036
avatar={repo.share_user.avatar}

0 commit comments

Comments
 (0)