Skip to content

Commit a5a0976

Browse files
committed
update: file README
1 parent f6ea04c commit a5a0976

File tree

7 files changed

+92
-73
lines changed

7 files changed

+92
-73
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
## 介绍
1+
<p align="center">
2+
<img src="docs/img/2024-08-14.png"/>
3+
<br>中文 | <a href="README_en.md">English</a>
4+
<br>HelloGitHub 是一个发现和分享有趣、入门级开源项目的平台<br>
5+
</p>
26

37
Geese 译为「惊鸿」可理解为轻盈、快速的形态,希望它清爽、简约的界面可以带给你「惊鸿」一般的访问体验。
48

5-
我想让玩开源的人有个“家”,所以就用 Next.js+Tailwind CSS 构建了一个轻量级的开源社区,也就是「HelloGitHub 社区」的源码。
9+
## 介绍
10+
11+
Geese 是用 Next.js+Tailwind CSS 构建了一个轻量级的开源社区,也就是「HelloGitHub 社区」的源码。
612

713
![](docs/img/2023-04-18.png)
814

9-
该社区提供了不同 **编程语言/类别/标签** 有趣、入门级的开源项目,用户可以这里 **发现/搜索/收藏/评论/分享** 感兴趣的开源项目,还可以 **点赞/提交/打分** 开源项目,让优秀的开源项目脱颖而出。围绕开源项目,社区聚集了一群热爱开源的玩家、技术精湛的大牛、热衷分享的作者,感谢**开源**让我们相识,或许开源精神就是一种交朋友的方式吧!
15+
HelloGitHub 社区提供了不同 **编程语言/类别/标签** 有趣、入门级的开源项目,用户可以这里 **发现/搜索/收藏/评论/分享** 感兴趣的开源项目,还可以 **点赞/提交/打分** 开源项目,让优秀的开源项目脱颖而出。围绕开源项目,社区聚集了一群热爱开源的玩家、技术精湛的大牛、热衷分享的作者,感谢**开源**让我们相识,或许开源精神就是一种交朋友的方式吧!
1016

1117
目前,该社区 **已上线** [在线体验](https://hellogithub.com) 如遇到问题或发现 BUG 可以[一键反馈](https://github.com/HelloGitHub-Team/geese/issues/new)
1218

docs/en/README.md renamed to README_en.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
## Introduction
1+
<p align="center">
2+
<img src="docs/img/2024-08-14_en.png"/>
3+
<br><a href="README.md">中文</a> | English
4+
<br>HelloGitHub is a platform for discovering and sharing beginner-friendly open source projects<br>
5+
</p>
6+
7+
"Geese" translated as "Jinghong" (meaning a fleeting glimpse), embodies a light and swift form, aiming to provide you with a "Jinghong"-like browsing experience through its refreshing and minimalist interface.
28

3-
"Geese," translated as "Jinghong" (meaning a fleeting glimpse), embodies a light and swift form, aiming to provide you with a "Jinghong"-like browsing experience through its refreshing and minimalist interface.
9+
## Introduction
410

511
I wanted to create a home for those who enjoy open-source projects, so I built a lightweight open-source community using Next.js and Tailwind CSS. This repository contains the source code for the [HelloGitHub](https://hellogithub.com/) Community.
612

@@ -27,4 +33,4 @@ Development guidelines can be found [here](../content.md). Thanks to every [cont
2733

2834
<a href="mailto:[email protected]">Contact me</a>
2935

30-
<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh"><img alt="知识共享许可协议" style="border-width: 0" src="https://licensebuttons.net/l/by-nc-nd/4.0/88x31.png"></a><br>This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>.
36+
<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh"><img alt="知识共享许可协议" style="border-width: 0" src="https://licensebuttons.net/l/by-nc-nd/4.0/88x31.png"></a><br>This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>.

data/level_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Everyone is encouraged to share interesting, beginner-friendly open-source proje
88

99
The HelloGitHub Community Level is calculated and upgraded in real-time based on contribution points.
1010

11-
![](https://img.hellogithub.com/article/level.png)
11+
![](https://img.hellogithub.com/article/lSthE0PgBGoUCQd_1723623130.png)
1212

1313
## Earning and Deducting Contribution Points
1414

docs/content_en.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Before Development
2+
3+
Firstly, the project utilizes yarn for package installation, which you can search for and install on your own. After installation is complete, set the version number with the command `yarn set version v1.22.19`.
4+
5+
Next, to get the 'Geese' project running locally, follow these detailed steps:
6+
7+
1. Clone the project: `git clone [email protected]:HelloGitHub-Team/geese.git`
8+
2. Install dependencies: `yarn install`
9+
3. Run the project: `yarn dev`
10+
4. Access in the browser: `http://localhost:3000/`
11+
12+
Potential issues you may encounter after starting up:
13+
14+
1. CORS issue: Please check that the front-end service is started on port `3000` with the host as `localhost` or `127.0.0.1`.
15+
2. Images not displaying: Add `127.0.0.1 dev.hg.com` to the end of your local hosts file, then access `http://dev.hg.com:3000/`.
16+
3. Login status: Obtain a test environment login token from @521xueweihan, then manually add an Authorization: token item to the browser's LocalStorage.
17+
4. If the machine freezes during build, you can resolve this by setting the concurrency number with yarn: `yarn config set cloneConcurrency 1`.
18+
19+
**Tech Stack**
20+
21+
- [Next.js](https://nextjs.org/)
22+
- [Tailwind CSS](https://tailwindcss.com/)
23+
- [SWR](https://swr.vercel.app/zh-CN)
24+
- Scaffold: [ts-nextjs-tailwind-starter](https://github.com/theodorusclarence/ts-nextjs-tailwind-starter)
25+
- Component styles: [hyperui](https://github.com/markmead/hyperui)
26+
27+
Finally, find the API documentation here: [API Docs](https://frp.hellogithub.com/docs#)
28+
29+
After getting the project running, you can play around with it locally. If you find it interesting, [click here](https://github.com/orgs/HelloGitHub-Team/projects/1/views/1) to check out the unclaimed requirements, find a feature, bug, or optimization that interests you, and then let @521xueweihan know 'claim the task' under the corresponding issues before starting development to **prevent duplicate development**.
30+
31+
## During Development
32+
33+
Since this is collaborative development, the `main` branch may be continuously updated. Before each development session, you need to pull the latest code to ensure you are developing based on the most recent `main` branch.
34+
35+
When developing specific requirements, split the code into corresponding directories:
36+
37+
- Components: `components` directory
38+
- Pages: `pages` directory
39+
- Define data: `types` directory
40+
- Requests: `services` directory
41+
42+
After completing feature development/bug fixes, you need to perform self-testing, check code style, and improve code reusability.
43+
44+
Finally, execute the following commands locally and try to resolve any **warnings** you can:
45+
46+
- `yarn lint:fix`
47+
- `yarn lint`
48+
- `yarn typecheck`
49+
50+
## After Development
51+
52+
Get the latest `main` branch code and resolve conflicts locally.
53+
54+
For your first code submission, you need to submit it via a PR (Pull Request).
55+
56+
After your code is successfully merged, @521xueweihan will invite you to become a member of the 'Geese' project. Please check your GitHub notification emails.
57+
58+
For subsequent code submissions, you can develop in a 'self-created branch' or a branch automatically created when 'claiming a requirement.'
59+
60+
After submitting your code, please pay attention to the project's **issues** and **prs** notifications because I will provide feedback and optimization suggestions after reviewing the submitted code.
61+
62+
## Finally
63+
64+
I am very happy to build 'Geese' with you and hope that you also gain something from the process of contributing code.

docs/img/2024-08-14.png

1.38 MB
Loading

docs/img/2024-08-14_en.png

1.34 MB
Loading

src/components/buttons/LanguageSwitcher.tsx

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// components/LanguageSwitcher.tsx
22
import { useRouter } from 'next/router';
3-
import { useRef, useState } from 'react';
3+
import { useState } from 'react';
44
// eslint-disable-next-line @typescript-eslint/no-var-requires
55
const Cookies = require('js-cookie');
66

@@ -11,15 +11,11 @@ type LanguageSwitchProps = {
1111
const LanguageSwitcher = (props: LanguageSwitchProps) => {
1212
const router = useRouter();
1313
const { locale, asPath } = router;
14-
const [isHovered, setIsHovered] = useState(false);
1514
const [selectedLocale, setSelectedLocale] = useState(locale);
16-
const dropdownRef = useRef<HTMLDivElement>(null);
17-
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
1815

1916
const changeLanguage = (language: string) => {
2017
Cookies.set('locale', language);
2118
setSelectedLocale(language);
22-
setIsHovered(false);
2319
router.push(asPath, asPath, { locale: language });
2420
};
2521

@@ -33,68 +29,15 @@ const LanguageSwitcher = (props: LanguageSwitchProps) => {
3329
);
3430
}
3531

36-
const handleMouseEnter = () => {
37-
if (timeoutRef.current) {
38-
clearTimeout(timeoutRef.current);
39-
}
40-
setIsHovered(true);
41-
};
42-
43-
const handleMouseLeave = () => {
44-
timeoutRef.current = setTimeout(() => {
45-
setIsHovered(false);
46-
}, 300);
47-
};
48-
4932
return (
50-
<div
51-
className='relative inline-block text-left'
52-
ref={dropdownRef}
53-
onMouseEnter={handleMouseEnter}
54-
onMouseLeave={handleMouseLeave}
55-
>
56-
<div>
57-
<button
58-
type='button'
59-
className='inline-flex h-8 w-full items-center justify-center rounded-md border border-gray-300 bg-white px-2 text-sm font-medium text-gray-700 shadow-sm transition-colors duration-200 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:hover:bg-gray-700'
60-
id='options-menu'
61-
aria-haspopup='true'
62-
aria-expanded={isHovered ? 'true' : 'false'}
63-
>
64-
{/* <MdTranslate size={16} /> */}
65-
{selectedLocale === 'zh' ? 'EN' : '中文'}
66-
</button>
67-
</div>
68-
69-
{isHovered && (
70-
<div
71-
className='absolute right-0 mt-2 w-[110px] origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-800 dark:ring-gray-600'
72-
onMouseEnter={handleMouseEnter}
73-
onMouseLeave={handleMouseLeave}
74-
>
75-
<div
76-
className='py-1'
77-
role='menu'
78-
aria-orientation='vertical'
79-
aria-labelledby='options-menu'
80-
>
81-
<button
82-
onClick={() => changeLanguage('zh')}
83-
className='block w-full px-4 py-2 text-left text-sm text-gray-700 transition-colors duration-200 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
84-
role='menuitem'
85-
>
86-
🇨🇳 中文
87-
</button>
88-
<button
89-
onClick={() => changeLanguage('en')}
90-
className='block w-full px-4 py-2 text-left text-sm text-gray-700 transition-colors duration-200 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
91-
role='menuitem'
92-
>
93-
🇺🇸 English
94-
</button>
95-
</div>
96-
</div>
97-
)}
33+
<div className='relative inline-block text-left'>
34+
<button
35+
onClick={() => changeLanguage(selectedLocale === 'zh' ? 'en' : 'zh')}
36+
type='button'
37+
className='inline-flex h-8 w-full items-center justify-center rounded-md border border-gray-300 bg-white px-2 text-sm font-medium text-gray-700 shadow-sm transition-colors duration-200 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:hover:bg-gray-700'
38+
>
39+
{selectedLocale === 'zh' ? 'EN' : '中文'}
40+
</button>
9841
</div>
9942
);
10043
};

0 commit comments

Comments
 (0)