Skip to content

Commit

Permalink
fix: some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
521xueweihan committed Aug 12, 2024
1 parent 641cae7 commit a4f6830
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion public/locales/en/repository.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"url": {
"home": "Website",
"document": "Documentation",
"document": "Doc",
"download": "Download",
"online": "Demo",
"source": "Source"
Expand Down
12 changes: 6 additions & 6 deletions src/components/respository/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,19 @@ const Info = ({ repo, t, i18n_lang }: RepositoryProps) => {
<span>{t('info.opensource')}</span>
<span className='mx-0.5 md:mx-1.5'></span>
<NoPrefetchLink href={`/license/${repo.license_lid}`}>
<span className='cursor-pointer text-blue-500'>
<span className='inline-flex max-w-[60px] cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-blue-500 md:max-w-full'>
{repo.license}
</span>
</NoPrefetchLink>
</div>
)}
</div>
</div>
<div className='flex flex-row gap-x-4 text-sm'>
<div className='flex flex-row gap-x-1 text-sm md:gap-x-4'>
{!repo.is_claimed && (
<NoPrefetchLink href={`/repository/${repo.rid}/embed`}>
<div className='flex cursor-pointer items-center justify-center text-blue-500 hover:text-current active:text-gray-400 md:hover:text-blue-600'>
<BsPersonCheck className='mr-2' size={16} />
<BsPersonCheck className='mr-1' size={16} />
{t('info.unclaim')}
</div>
</NoPrefetchLink>
Expand All @@ -479,23 +479,23 @@ const Info = ({ repo, t, i18n_lang }: RepositoryProps) => {
onClick={jumpComment}
className='hidden cursor-pointer items-center justify-center hover:text-blue-500 active:text-gray-400 md:flex'
>
<GoComment className='mr-2' size={16} />
<GoComment className='mr-1' size={16} />
{t('info.discuss')}
</div>
<div
className={isCollected ? 'text-blue-500' : ''}
onClick={handleCollect}
>
<div className='flex cursor-pointer items-center justify-center hover:text-blue-500 active:text-gray-400 md:hover:text-blue-500'>
<BsBookmark className='mr-2' size={16} />
<BsBookmark className='mr-1' size={16} />
{isCollected ? numFormat(collectTotal, 1) : t('info.collect')}
</div>
</div>
<div
className='flex cursor-pointer items-center justify-center hover:text-current active:text-gray-400 md:hover:text-blue-500'
onClick={handleCopy}
>
<GoLinkExternal className='mr-2' size={16} />
<GoLinkExternal className='mr-1' size={16} />
{t('info.share')}
</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/repository/[rid]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ interface Props {
const RepositoryPage: NextPage<Props> = ({ repo }) => {
const { t, i18n } = useTranslation('repository');

const getLocalizedField = (field: any, fallback: any) =>
i18n.language === 'en' ? field ?? fallback : fallback;

return (
<>
<Seo
title={`${repo.full_name}: ${repo.title}`}
description={repo.summary}
title={`${repo.full_name}: ${getLocalizedField(
repo.title_en,
repo.title
)}`}
description={getLocalizedField(repo.summary_en, repo.summary)}
/>
<RepoDetailNavbar
avatar={repo.share_user.avatar}
Expand Down

0 comments on commit a4f6830

Please sign in to comment.