Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sponsors and contributiors and rename files in /data #28

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
npm i && npm run dev
```

## How to improve or add translations
## Improve or add translations

To improve a translation, open the `/locales/` folder and modify the corresponding json file.
To add translations, modify `/i18n.ts` and add the corresponding json file in the `/locales/` folder, open `/app/page.tsx` and change the Script with id redirect.

## How to add a showcase game
## Add a showcase game

Open `/data/gamesData.ts` and add game.
Open `/data/games.ts` and add game.

## add sponsors

Open `/data/sponsors.ts` and edit it.

## Add contributiors

Download [get-webgal-contributors.js](https://gist.github.com/nini22P/1b6060b99f1833fdc1a557fc662e5774) and run `node get-webgal-contributors.js`.

Open `/data/contributiors.ts`, replace with data fetched by the script.
2 changes: 1 addition & 1 deletion app/[locale]/components/Contributor/Contributor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PersonsCard from '@/app/components/PersonsCard/PersonsCard'
import { contributiors } from '@/data/contributiorsData'
import { contributiors } from '@/data/contributiors'
import { useTranslations } from 'next-intl'

const Contributor = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/components/Sponsor/Sponsor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PersonsCard from '@/app/components/PersonsCard/PersonsCard'
import { sponsors } from '@/data/sponsorsData'
import { sponsors } from '@/data/sponsors'

const Sponsor = () => {
return (
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/components/WebGALGames/WebGALGames.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Button from '@/app/components/Button/Button'
import GameCard from '@/app/components/GameCard/GameCard'
import { gamesData, homeGamesId } from '@/data/gamesData'
import { games, homeGamesId } from '@/data/games'
import useRedirect from '@/hooks/useRedirect'
import { gamesDataSort } from '@/utils'
import { gamesSort } from '@/utils'
import { useLocale, useTranslations } from 'next-intl'
import Link from 'next/link'

Expand All @@ -19,7 +19,7 @@ const WebGALGames = () => {
</div>
<div className={'max-w-screen-xl mx-auto grid grid-cols-2 md:grid-cols-4 px-4 gap-4'}>
{
gamesDataSort(gamesData, 'date')
gamesSort(games, 'date')
.filter(game => homeGamesId.find(id => id === game.id))
.map((game) =>
<GameCard game={game} key={game.id} />
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/games/components/GamesList.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { gamesData } from '@/data/gamesData'
import { games } from '@/data/games'
import GameCard from '@/app/components/GameCard/GameCard'
import { gamesDataSort } from '@/utils'
import { gamesSort } from '@/utils'

const GamesList = () => {
return (
<div className={'w-max-fit grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 justify-center p-4 gap-4'}>
{
gamesDataSort(gamesData, 'date')
gamesSort(games, 'date')
.map((game) =>
<GameCard game={game} key={game.id} />
)
Expand Down
80 changes: 40 additions & 40 deletions data/contributiorsData.ts → data/contributiors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,86 @@ export const contributiors: Contributor[] = [
{
name: 'Mahiru',
avatarUrl: 'https://avatars.githubusercontent.com/u/30483415?v=4',
url: 'https://github.com/MakinoharaShoko',
url: 'https://github.com/MakinoharaShoko'
},
{
name: '22',
avatarUrl: 'https://avatars.githubusercontent.com/u/60903333?v=4',
url: 'https://github.com/nini22P'
},
{
name: 'Hoshinokinya',
avatarUrl: 'https://avatars.githubusercontent.com/u/77627831?v=4',
url: 'https://github.com/hshqwq',
url: 'https://github.com/hshqwq'
},
{
name: 'Junbo Xiong',
avatarUrl: 'https://avatars.githubusercontent.com/u/19368807?v=4',
url: 'https://github.com/C6H5-NO2',
name: 'Yuji Sakai',
avatarUrl: 'https://avatars.githubusercontent.com/u/71590526?v=4',
url: 'https://github.com/generalfreed'
},
{
name: 'lykl',
avatarUrl: 'https://avatars.githubusercontent.com/u/42017216?v=4',
url: 'https://github.com/lykl',
name: 'Junbo Xiong',
avatarUrl: 'https://avatars.githubusercontent.com/u/19368807?v=4',
url: 'https://github.com/C6H5-NO2'
},
{
name: 'SakuraSnow',
avatarUrl: 'https://avatars.githubusercontent.com/u/43871064?v=4',
url: 'https://github.com/sliyoxn',
url: 'https://github.com/sliyoxn'
},
{
name: 'bcqsd',
avatarUrl: 'https://avatars.githubusercontent.com/u/92590197?v=4',
url: 'https://github.com/bcqsd',
name: 'lykl',
avatarUrl: 'https://avatars.githubusercontent.com/u/42017216?v=4',
url: 'https://github.com/lykl'
},
{
name: 'Yuji Sakai',
avatarUrl: 'https://avatars.githubusercontent.com/u/71590526?v=4',
url: 'https://github.com/generalfreed',
name: '爱走位的KN_sword',
avatarUrl: 'https://avatars.githubusercontent.com/u/83012768?v=4',
url: 'https://github.com/ShrLeeKNsword'
},
{
name: 'labiker',
avatarUrl: 'https://avatars.githubusercontent.com/u/49630998?v=4',
url: 'https://github.com/labiker',
name: 'bcqsd',
avatarUrl: 'https://avatars.githubusercontent.com/u/92590197?v=4',
url: 'https://github.com/bcqsd'
},
{
name: '德布罗煜',
avatarUrl: 'https://avatars.githubusercontent.com/u/57794772?v=4',
url: 'https://github.com/ch1ny',
},
{
name: '22',
avatarUrl: 'https://avatars.githubusercontent.com/u/60903333?v=4',
url: 'https://github.com/nini22P',
url: 'https://github.com/ch1ny'
},
{
name: 'ShrLeeKNsword',
avatarUrl: 'https://avatars.githubusercontent.com/u/83012768?v=4',
url: 'https://github.com/ShrLeeKNsword',
name: 'Iara',
avatarUrl: 'https://avatars.githubusercontent.com/u/49630998?v=4',
url: 'https://github.com/labiker'
},
{
name: 'Mike Zhou',
avatarUrl: 'https://avatars.githubusercontent.com/u/23418428?v=4',
url: 'https://github.com/mikezzb',
name: 'loliko',
avatarUrl: 'https://avatars.githubusercontent.com/u/60571640?v=4',
url: 'https://github.com/loliko114514'
},
{
name: 'Murasame0721',
avatarUrl: 'https://avatars.githubusercontent.com/u/65087506?v=4',
url: 'https://github.com/Murasame0721',
},
{
name: 'loliko',
avatarUrl: 'https://avatars.githubusercontent.com/u/60571640?v=4',
url: 'https://github.com/loliko114514',
url: 'https://github.com/Murasame0721'
},
{
name: 'Yanggum',
name: 'cwPark',
avatarUrl: 'https://avatars.githubusercontent.com/u/3869819?v=4',
url: 'https://github.com/Yanggum',
url: 'https://github.com/Yanggum'
},
{
name: 'callofblood',
avatarUrl: 'https://avatars.githubusercontent.com/u/70617760?v=4',
url: 'https://github.com/callofblood',
url: 'https://github.com/callofblood'
},
{
name: 'lyle',
avatarUrl: 'https://avatars.githubusercontent.com/u/61548984?v=4',
url: 'https://github.com/lylelove',
url: 'https://github.com/lylelove'
},
{
name: 'Mike Zhou',
avatarUrl: 'https://avatars.githubusercontent.com/u/23418428?v=4',
url: 'https://github.com/mikezzb'
},
]
2 changes: 1 addition & 1 deletion data/gamesData.ts → data/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Game } from '@/types'
export const homeGamesId: Game['id'][] = ['elf-of-era-idols-project', 'hoshinasuzu']

// 全部游戏
export const gamesData: Game[] = [
export const games: Game[] = [
{
id: 'hoshinasuzu',
title: '铃色☆记忆',
Expand Down
6 changes: 5 additions & 1 deletion data/sponsorsData.ts → data/sponsors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const sponsors: Sponsors = {
avatarUrl: 'https://avatars.githubusercontent.com/u/71590526?v=4',
url: 'https://github.com/generalfreed',
},
{
name: 'labiker(Iara)',
avatarUrl: 'https://avatars.githubusercontent.com/u/49630998?v=4',
url: 'https://github.com/labiker',
},
]

}
10 changes: 5 additions & 5 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export const parseReleaseNote = (body: string) => {

/**
* 游戏排序
* @param gamesData 游戏数据
* @param games 游戏
* @param sortBy 根据日期或标题排序
* @returns
*/
export const gamesDataSort = (gamesData: Game[], sortBy: 'date' | 'title') => {
export const gamesSort = (games: Game[], sortBy: 'date' | 'title') => {
if (sortBy === 'date')
return [...gamesData].sort((a, b) => {
return [...games].sort((a, b) => {
const dateA = Number(a.releaseDate.replaceAll('-', ''))
const dateB = Number(b.releaseDate.replaceAll('-', ''))
if (dateA < dateB)
Expand All @@ -54,8 +54,8 @@ export const gamesDataSort = (gamesData: Game[], sortBy: 'date' | 'title') => {
return 0
})
if (sortBy === 'title')
return [...gamesData].sort((a, b) => {
return [...games].sort((a, b) => {
return a.title.localeCompare(b.title, 'en')
})
return gamesData
return games
}
Loading