Skip to content

Commit

Permalink
fix: tarns bug
Browse files Browse the repository at this point in the history
  • Loading branch information
521xueweihan committed Aug 4, 2024
1 parent db6e3ff commit af363e2
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 69 deletions.
2 changes: 1 addition & 1 deletion public/locales/en/article.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Articles",
"description": "Here you'll find original and high-quality articles focused on open source projects.",
"bottom_text_login": "You've reached the end.",
"bottom_text_nologin": "End of content! Log in to see more.",
"bottom_text_nologin": "End of content! Login to see more.",
"nav": {
"title": "Articles",
"hot": "Popular",
Expand Down
18 changes: 9 additions & 9 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"login": {
"text": "Login",
"title": "Choose a login method",
"tips": "By logging in, you agree to the",
"agreement": "User Agreement",
"title": "Choose login method",
"tips": "Login agree to the",
"agreement": "Agreement",
"oauth": "Login via {{platform}}",
"redirect": "Waiting for redirection...",
"redirect_bar_text": "Logging in, waiting for redirection..."
Expand All @@ -41,7 +41,7 @@
"desc": "HelloGitHub is a platform for discovering and sharing beginner-friendly open source projects.\nWe help users find joy in programming, solve technical challenges, and explore amazing tools to start their open-source journey."
},
"recommend": {
"title": "Recommended",
"title": "Recommend",
"desc": "Content is collected from spdx and GitHub, following the",
"desc2": "protocol.",
"change": "Refresh"
Expand All @@ -60,7 +60,7 @@
},
"submit_repo": {
"text": "Submit",
"title": "Recommend or Submit an Open Source Project",
"title": "Recommend or Submit an Project",
"description": "Only approved projects will be displayed on the homepage",
"url_placeholder": "Project URL",
"url_tip": "👆 Only projects on GitHub are accepted",
Expand All @@ -80,16 +80,16 @@
},
"collect": {
"title": "New",
"edit_success": "Successfully Edited",
"edit_fail": "Edit Failed",
"create_success": "Successfully Created",
"create_fail": "Creation Failed",
"edit_success": "Successfully Edited",
"edit_fail": "Edit Failed",
"name": "Name",
"name_placeholder": "Enter folder name",
"desc": "Description",
"desc": "Desc",
"desc_placeholder": "Enter folder description (up to 100 characters, optional)",
"pravite": "Private",
"pravite_desc": "",
"pravite_desc": "Visible only to you",
"public": "Public",
"public_desc": "Visible to everyone",
"button": {
Expand Down
6 changes: 1 addition & 5 deletions public/locales/en/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"save": "Save",
"save_success_msg": "Save successful!",
"save_fail_msg": "Save failed!",
"max_tag_msg": "You can only select up to {{maxTotal}} tags!",
"编程语言": "Programming",
"技术栈": "Technology",
"应用类型": "Application",
"其它": "Other"
"max_tag_msg": "You can only select up to {{maxTotal}} tags!"
}
}
4 changes: 2 additions & 2 deletions public/locales/en/notification.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Message Center",
"empty": "No messages",
"repository": {
"desc": "You {{content}} open source project "
"desc": "You {{content}} project "
},
"reply": {
"desc": "replied to you on",
Expand All @@ -11,6 +11,6 @@
"comment": {
"desc": "commented on your",
"desc2": "commented on the project you shared",
"desc3": "open source project:"
"desc3": "project:"
}
}
24 changes: 14 additions & 10 deletions public/locales/en/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"page_next": "Next",
"read_button": "View",
"tabs": {
"dynamic": "Activity",
"dynamic": "Dynamic",
"favorite": "Favorites",
"comment": "Comments",
"vote": "Likes",
"repo": "Projects"
"comment": "Comment",
"vote": "Vote",
"repo": "Project"
},
"user_info": {
"desc": "User #{{rank}} of HelloGitHub community, joined on {{date}}",
"desc2": "Shared {{share_repo}} open source projects, posted {{comment_repo}} project reviews, and earned {{contribute}} contribution points.",
"desc2": "Shared {{share_repo}} projects, posted {{comment_repo}} project reviews, and earned {{contribute}} contribution points.",
"desc3": "User #{{rank}} of HelloGitHub community",
"desc4": "Joined on {{date}}, earned {{contribute}} contribution points",
"desc5": "Shared {{share_repo}} open source projects, posted {{comment_repo}} project reviews"
"desc5": "Shared {{share_repo}} projects, posted {{comment_repo}} project reviews"
},
"dynamic": {
"time_desc": "Activity",
"desc": "No activity",
"value_text": ", earned {{value}} contribution points.",
"comment": "Commented on open source project",
"comment": "Commented on project",
"comment_hot": "Hot comment on",
"comment_hot2": "project",
"comment_bad": "Posted meaningless/spam comment, deducted 2 contribution points.",
Expand All @@ -47,8 +47,8 @@
"share": "Share"
},
"dialog": {
"del_title": "Are you sure to delete the favorites folder?",
"del_desc": "Deleting the folder will remove all projects in it",
"del_title": "Delete the favorites folder?",
"del_desc": "Deleting folder removes all projects within",
"edit_title": "Edit Favorites Folder"
},
"status": {
Expand All @@ -72,10 +72,14 @@
"button": {
"appeal": "Appeal",
"vote": "Likes {{total}}"
},
"item": {
"expand": "Expand",
"collapse": "Collapse"
}
},
"vote": {
"empty": "No likes"
"empty": "No Votes"
},
"repo": {
"empty": "No projects",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/en/search.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Open Source Project Search Results",
"description": "Find interesting and beginner-friendly open source projects on HelloGitHub",
"bottom_text_nologin": "That's all! Log in to see more content",
"bottom_text_nologin": "That's all! Login to see more content",
"navbar": "Search Results"
}
6 changes: 3 additions & 3 deletions public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@
},
"collect": {
"title": "新建收藏夹",
"edit_success": "修改成功",
"edit_fail": "修改失败",
"create_success": "新建成功",
"create_fail": "新建失败",
"edit_success": "修改成功",
"edit_fail": "修改失败",
"name": "名称",
"name_placeholder": "请输入收藏夹名称",
"desc": "描述",
"desc_placeholder": "请输入收藏描述(限100字,选填)",
"pravite": "私有",
"pravite_desc": "",
"pravite_desc": "仅个人可见",
"public": "公开",
"public_desc": "所有人可见",
"button": {
Expand Down
6 changes: 1 addition & 5 deletions public/locales/zh/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"save": "保存",
"save_success_msg": "保存成功!",
"save_fail_msg": "保存失败!",
"max_tag_msg": "最多只能选择 {{maxTotal}} 个标签!",
"编程语言": "编程语言",
"技术栈": "技术栈",
"应用类型": "应用类型",
"其它": "其它"
"max_tag_msg": "最多只能选择 {{maxTotal}} 个标签!"
}
}
4 changes: 4 additions & 0 deletions public/locales/zh/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
"button": {
"appeal": "申诉",
"vote": "点赞 {{total}}"
},
"item": {
"expand": "展开",
"collapse": "收起"
}
},
"vote": {
Expand Down
10 changes: 5 additions & 5 deletions src/components/collection/AddCollection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ type EditCollectionProps = {
type: 'add' | 'edit';
title: string;
visible: boolean;
t: (key: string) => string;
initValue?: EditCollectionFormData;
onFinish?: () => void;
onClose: () => void;
};

export const EditCollectionMoal = (props: EditCollectionProps) => {
const { t, visible, title = t('collect.title') } = props;
const { t } = useTranslation('common');

const { visible, title } = props;
const initFormData = React.useMemo(
() => ({
name: '',
Expand Down Expand Up @@ -170,7 +171,7 @@ export const EditCollectionMoal = (props: EditCollectionProps) => {
readOnly
checked={formData.status === 2}
/>
<label className='ml-2 w-8 text-sm text-gray-600 dark:text-gray-400'>
<label className='max-w-10 ml-2 text-sm text-gray-600 dark:text-gray-400'>
{t('collect.public')}
</label>
<span className='ml-1 text-xs text-gray-500'>
Expand All @@ -190,7 +191,7 @@ export const EditCollectionMoal = (props: EditCollectionProps) => {
readOnly
checked={formData.status === 0}
/>
<label className='ml-2 w-8 text-sm text-gray-600 dark:text-gray-400'>
<label className='max-w-8 ml-2 text-sm text-gray-600 dark:text-gray-400'>
{t('collect.pravite')}
</label>
<span className='ml-1 text-xs text-gray-500'>
Expand Down Expand Up @@ -245,7 +246,6 @@ export default function AddCollection({
<EditCollectionMoal
type='add'
title={t('collect.title')}
t={t}
visible={openModal}
onFinish={onFinish}
onClose={() => setOpenModal(false)}
Expand Down
4 changes: 3 additions & 1 deletion src/components/dialog/RepoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export function CreateRepo({ response, t }: CreateRepoProps) {
setLoading(true);
const res = await createRepo({ url, summary, title });
if (res.success) {
Message.success(t('submit_repo.create_success', res.remaining));
Message.success(
t('submit_repo.create_success', { remaining: res.remaining })
);
} else {
Message.error(res.message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog/TagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function TagModal({
key={'group_' + index}
className='text-lg font-medium text-gray-500 dark:text-gray-200'
>
{t(`${group.group_name}`)}
{i18n_lang == 'en' ? group.group_name_en : group.group_name}
</div>,
<div
key={'group_items_' + index}
Expand Down
14 changes: 10 additions & 4 deletions src/components/home/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ interface ItemProps {
is_claimed?: boolean;
name: string;
title: string;
title_en?: string;
comment_total?: number;
summary?: string;
summary_en?: string;
author: string;
lang_color: string;
primary_lang: string;
Expand Down Expand Up @@ -51,8 +53,10 @@ const RepositoryItem = ({
is_claimed,
name,
title,
title_en,
comment_total,
summary,
summary_en,
author,
lang_color,
primary_lang,
Expand Down Expand Up @@ -84,7 +88,7 @@ const RepositoryItem = ({
<span className='truncate text-sm leading-snug md:text-base'>
{index + 1}
<span className='pr-0.5'>.</span>
{title}
{i18n_lang == 'en' ? title_en || title : title || '-'}
</span>
{/* 是否推荐 */}
{is_featured && (
Expand Down Expand Up @@ -133,7 +137,9 @@ const RepositoryItem = ({
</span>
<span className='text-gray-600 dark:text-gray-300'>
{title}
{i18n_lang == 'en'
? title_en || title
: title || '-'}
</span>
</p>
)}
Expand All @@ -151,7 +157,7 @@ const RepositoryItem = ({
</div>
{/* 项目描述 */}
<div className='mt-0.5 truncate text-sm text-gray-400'>
{summary || '-'}
{i18n_lang == 'en' ? summary_en || summary : summary || '-'}
</div>
{/* 技术栈、认证、时间 */}
<div className='mt-1 flex items-center'>
Expand Down Expand Up @@ -179,7 +185,7 @@ const RepositoryItem = ({
className='mr-1 h-4 w-4 rounded-full md:hidden'
/>
)}
<div className='flex max-w-[10rem] items-center truncate text-ellipsis md:w-fit md:max-w-[6rem]'>
<div className='flex max-w-[7rem] items-center truncate text-ellipsis md:w-fit md:max-w-[10rem]'>
{is_claimed && (
<GoVerified
className='mr-0.5 inline-block min-w-min align-[-2px] text-blue-500'
Expand Down
10 changes: 5 additions & 5 deletions src/components/respository/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const useURLOptions = ({ repo, t }: URLoptionProps) => {
return urlOptions;
};

const Info = ({ repo, t }: RepositoryProps) => {
const Info = ({ repo, t, i18n_lang }: RepositoryProps) => {
const { isLogin, login } = useLoginContext();
const [isVoted, setIsVoted] = useState<boolean>(false);
const [voteTotal, setVoteTotal] = useState<number>(repo.votes);
Expand Down Expand Up @@ -323,18 +323,18 @@ const Info = ({ repo, t }: RepositoryProps) => {
</h1>
</CustomLink>
{repo.is_claimed && (
<div className='group relative ml-0.5 cursor-pointer'>
<div className=' group relative ml-0.5 flex cursor-pointer items-center'>
<GoVerified className='ml-0.5 text-xl text-blue-500 group-hover:text-blue-600' />
<div className='absolute hidden flex-row transition-opacity duration-300 group-hover:flex'>
<div className='relative -top-6 left-6 w-0 rounded-md bg-gray-300 p-1 text-xs text-white group-hover:w-max'>
<div className='relative left-6 w-0 rounded-md bg-gray-300 p-1 text-xs font-medium text-white group-hover:w-max dark:bg-gray-700 dark:text-gray-200'>
{t('info.claimed')}
</div>
</div>
</div>
)}
</div>
<div className='truncate text-ellipsis text-xl font-normal text-gray-500'>
{repo.title}
{i18n_lang == 'en' ? repo.title_en || repo.title : repo.title}
</div>
</div>

Expand All @@ -358,7 +358,7 @@ const Info = ({ repo, t }: RepositoryProps) => {
)}
</div>
<span className='text-ellipsis whitespace-pre-wrap text-xl font-normal text-gray-500'>
{repo.title}
{i18n_lang == 'en' ? repo.title_en || repo.title : repo.title}
</span>
</div>
<div className='hidden md:flex'>
Expand Down
4 changes: 2 additions & 2 deletions src/components/respository/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MDRender } from '../mdRender/MDRender';

import { RepositoryProps } from '@/types/repository';

const Tabs = ({ repo, t }: RepositoryProps) => {
const Tabs = ({ repo, t, i18n_lang }: RepositoryProps) => {
const [selectTab, setSelectTab] = useState<string>('summary');

const tabClassName = (tabName: string) =>
Expand All @@ -30,7 +30,7 @@ const Tabs = ({ repo, t }: RepositoryProps) => {
</div>
)}
<div className='w-full p-2 leading-8'>
<MDRender>{repo.summary}</MDRender>
{i18n_lang == 'en' ? repo.summary_en || repo.summary : repo.summary}
</div>

<div className='flex flex-row flex-wrap items-center pt-1'>
Expand Down
2 changes: 1 addition & 1 deletion src/components/side/Recommend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const RecommendList = ({ repositories }: { repositories: RecommendItem[] }) => (
/>
<div className='flex w-4/5 flex-col pl-2'>
<div className='truncate text-ellipsis text-sm capitalize'>
{item.full_name}
{item.full_name.length > 20 ? item.name : item.full_name}
</div>
<div className='flex flex-row pt-1 text-xs text-gray-400'>
<div className='flex items-center pr-4'>
Expand Down
1 change: 0 additions & 1 deletion src/components/user/CollectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ export default function CollectionList({ fid, t, uid }: CollectionListProps) {
type='edit'
visible={openModal === 'edit'}
title={t('favorite.dialog.edit_title')}
t={t}
initValue={curItem as EditCollectionFormData}
onClose={() => setOpenModal(false)}
onFinish={() => updateCollection()}
Expand Down
Loading

0 comments on commit af363e2

Please sign in to comment.