Skip to content

Commit 07cf19f

Browse files
committed
feat: improved
1 parent d1900ad commit 07cf19f

File tree

14 files changed

+200
-109
lines changed

14 files changed

+200
-109
lines changed

eslint.config.mjs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
});
1+
import next from 'eslint-config-next';
112

123
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
4+
...next,
5+
{
6+
ignores: ['archive/**'],
7+
},
148
];
159

1610
export default eslintConfig;
11+

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
"build": "next build",
99
"postbuild": "next-sitemap --config next-sitemap.config.js",
1010
"start": "next start",
11-
"lint": "next lint",
11+
"lint": "eslint",
1212
"format": "prettier --write src"
1313
},
1414
"dependencies": {
15+
"eslint-plugin-unused-imports": "^4.3.0",
1516
"framer-motion": "^12.23.24",
1617
"gray-matter": "^4.0.3",
1718
"highlight.js": "^11.11.1",

public/games/games.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"id": "infiniteClient",
4+
"link": "/minecraft/infinite-client"
5+
}
6+
]

src/app/[article_year]/[month]/[aid]/components/share.tsx

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { TheInfiniteX } from "./img"; // TheInfiniteX は適切な画像のパスに置き換えてください
33
import "./share.css";
44
import { useTranslations } from "next-intl";
5-
import { useEffect, useState } from "react"; // useEffectとuseStateをインポート
65

76
interface ToXTwitterProps {
87
hashtags?: string[]; // ツイートに含めるハッシュタグの配列 (オプション)
@@ -17,48 +16,36 @@ export default function SNSShare() {
1716
}
1817
export function ToXTwitter({ hashtags, via }: ToXTwitterProps) {
1918
const t = useTranslations("pages.article.content.words"); // 翻訳フック
20-
const [shareUrl, setShareUrl] = useState("#"); // 共有URLを保持するstate。初期値は無効なリンク'#'
2119

22-
useEffect(() => {
23-
// このeffectはクライアントサイドでのみ実行されます
24-
if (typeof window !== "undefined" && typeof document !== "undefined") {
25-
const pageUrl = window.location.href; // 現在のページのURLを自動取得
26-
// ページのタイトルまたは適切なテキストを自動取得(ここではタイトルを使用)
27-
const pageText = document.title || ""; // document.titleがない場合を考慮
20+
const baseUrl = "https://twitter.com/intent/tweet";
21+
const queryParams = new URLSearchParams();
2822

29-
const baseUrl = "https://twitter.com/intent/tweet";
30-
const queryParams = new URLSearchParams({
31-
text: pageText,
32-
url: pageUrl,
33-
});
23+
if (typeof window !== "undefined" && typeof document !== "undefined") {
24+
const pageUrl = window.location.href; // 現在のページのURLを自動取得
25+
const pageText = document.title || ""; // document.titleがない場合を考慮
26+
queryParams.set("text", pageText);
27+
queryParams.set("url", pageUrl);
28+
}
3429

35-
// オプションのハッシュタグを追加
36-
if (hashtags && hashtags.length > 0) {
37-
queryParams.append("hashtags", hashtags.join(","));
38-
}
30+
if (hashtags && hashtags.length > 0) {
31+
queryParams.append("hashtags", hashtags.join(","));
32+
}
3933

40-
// オプションのviaを追加
41-
if (via) {
42-
queryParams.append("via", via);
43-
}
34+
if (via) {
35+
queryParams.append("via", via);
36+
}
4437

45-
// 生成した共有URLをstateにセット
46-
setShareUrl(`${baseUrl}?${queryParams.toString()}`);
47-
}
48-
// hashtags または via props が変更されたらeffectを再実行
49-
}, [hashtags, via]);
38+
const shareUrl = `${baseUrl}?${queryParams.toString()}`;
5039

5140
return (
5241
<a
53-
href={shareUrl} // stateから取得した共有URLを使用
42+
href={shareUrl}
5443
target="_blank"
5544
rel="noopener noreferrer"
56-
className="twitter-share-button" // このクラス名でCSSを適用
57-
aria-label={t("shareX")} // 翻訳されたテキストをaria-labelに使用
45+
className="twitter-share-button"
46+
aria-label={t("shareX")}
5847
>
59-
{/* Xのアイコン画像 - next/imageコンポーネントを使用 */}
6048
{TheInfiniteX}
61-
{/* 共有ボタンのテキスト - 翻訳されたテキストを使用 */}
6249
<p>{t("shareX")}</p>
6350
</a>
6451
);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use client";
2+
import Link from "next/link";
3+
import React from "react";
4+
import { Game } from "@/lib/games";
5+
import { useTranslations } from "next-intl"; // Import useTranslations
6+
7+
interface GameCardProps {
8+
game: Game;
9+
}
10+
11+
export default function GameCard({ game }: GameCardProps) {
12+
const t = useTranslations("pages.game.cards"); // Scope translations to game cards
13+
return (
14+
<section className="section">
15+
<h2>{t(`${game.id}.title`)}</h2>
16+
<p>{t(`${game.id}.description`)}</p>
17+
<Link href={game.link} className="button">
18+
{t("viewDetails")} {/* Use translation key for button */}
19+
</Link>
20+
</section>
21+
);
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// src/app/games/components/GamesList.tsx
2+
import React from "react";
3+
import { Game } from "@/lib/games";
4+
import GameCard from "./GameCard";
5+
6+
interface GamesListProps {
7+
games: Game[];
8+
}
9+
10+
export default function GamesList({ games }: GamesListProps) {
11+
return (
12+
<div className="games-list">
13+
{games.map((game) => (
14+
<GameCard key={game.id} game={game} />
15+
))}
16+
</div>
17+
);
18+
}

src/app/games/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
// src/app/games/page.tsx
12
import "./page.css";
23
import Explains from "./components/explains";
34
import { Metadata } from "next";
5+
import { getGames } from "@/lib/games"; // Import getGames
6+
import GamesList from "./components/GamesList"; // Import GamesList
47

58
export const metadata: Metadata = {
69
title: "The Infinity's Games",
710
description: "Enjoy! with yourself!",
811
};
912

1013
export default function GamePages() {
14+
const games = getGames(); // Fetch game data
1115
return (
1216
<>
1317
<Explains />
18+
<GamesList games={games} /> {/* Render GamesList */}
1419
</>
1520
);
1621
}

src/app/minecraft/infinite-client/page.css

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.section {
2+
min-height: 100vh;
3+
display: flex;
4+
flex-direction: column;
5+
justify-content: center;
6+
align-items: center;
7+
padding: 64px 24px;
8+
box-sizing: border-box;
9+
margin-bottom: 10vh;
10+
margin-left: 5vw;
11+
margin-right: 5vw;
12+
}
13+
14+
.title {
15+
min-height: 100vh;
16+
display: flex;
17+
flex-direction: column;
18+
justify-content: center;
19+
align-items: center;
20+
padding: 64px 24px;
21+
box-sizing: border-box;
22+
}
23+
24+
.titleH1 {
25+
/* Was .title h1 */
26+
font-size: 8vw !important;
27+
font-family: "Chakra Petch", "noto-sans", sans-serif; /* Added font-family */
28+
font-style: italic; /* From globals.css main > section.title > h1 */
29+
font-weight: 600; /* From globals.css main > section.title > h1 */
30+
}
31+
32+
.sectionH1 {
33+
/* Was section h1 */
34+
font-size: 4rem;
35+
margin-bottom: 1rem;
36+
font-family: "Chakra Petch", "noto-sans", sans-serif; /* Added font-family */
37+
}
38+
39+
.sectionH2 {
40+
/* Was section h2 */
41+
font-size: 2.5rem;
42+
margin-bottom: 2rem;
43+
font-family: "Chakra Petch", "noto-sans", sans-serif; /* Added font-family */
44+
}
45+
46+
.sectionP, /* Was section p */
47+
.sectionLi, /* Was section li */
48+
.sectionA {
49+
/* Was section a */
50+
font-size: 1.5rem;
51+
margin-bottom: 1.5rem;
52+
font-family: "Chakra Petch", "noto-sans", sans-serif; /* Added font-family */
53+
}
54+
55+
.sectionUl {
56+
/* Was section ul */
57+
padding-left: 2rem;
58+
}

src/app/minecraft/infinite-client/page.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
"use client";
22
import React from "react";
3-
import "./page.css";
3+
import styles from "./page.module.css"; // Import as module
44
import { useTranslations } from "next-intl";
55

66
export default function InfiniteClientPage() {
77
const t = useTranslations("pages.infiniteClient");
88
return (
99
<>
10-
<section className="title">
11-
<h1>{t("title")}</h1>
10+
<section className={styles.title}>
11+
<h1 className={styles.titleH1}>{t("title")}</h1>
1212
</section>
13-
<section className="section">
14-
<p>{t("description.msg1")}</p>
15-
<p>{t("description.msg2")}</p>
13+
<section className={styles.section}>
14+
<p className={styles.sectionP}>{t("description.msg1")}</p>
15+
<p className={styles.sectionP}>{t("description.msg2")}</p>
1616
</section>
17-
<section className="section">
18-
<h2>{t("features.title")}</h2>
19-
<ul>
20-
<li>{t("features.feature1")}</li>
21-
<li>{t("features.feature2")}</li>
22-
<li>{t("features.feature3")}</li>
23-
<li>{t("features.feature4")}</li>
24-
<li>{t("features.feature5")}</li>
17+
<section className={styles.section}>
18+
<h2 className={styles.sectionH2}>{t("features.title")}</h2>
19+
<ul className={styles.sectionUl}>
20+
<li className={styles.sectionLi}>{t("features.feature1")}</li>
21+
<li className={styles.sectionLi}>{t("features.feature2")}</li>
22+
<li className={styles.sectionLi}>{t("features.feature3")}</li>
23+
<li className={styles.sectionLi}>{t("features.feature4")}</li>
24+
<li className={styles.sectionLi}>{t("features.feature5")}</li>
2525
</ul>
2626
</section>
27-
<section className="section">
28-
<h2>{t("download.title")}</h2>
29-
<p>{t("download.msg1")}</p>
27+
<section className={styles.section}>
28+
<h2 className={styles.sectionH2}>{t("download.title")}</h2>
29+
<p className={styles.sectionP}>{t("download.msg1")}</p>
3030
<a
3131
href="https://github.com/The-Infinitys/minecraft.infinite-client"
3232
target="_blank"
33+
className={styles.sectionA}
3334
>
3435
{t("download.link")}
3536
</a>
3637
</section>
37-
<section className="section">
38-
<h2>{t("support.title")}</h2>
39-
<p>{t("support.msg1")}</p>
38+
<section className={styles.section}>
39+
<h2 className={styles.sectionH2}>{t("support.title")}</h2>
40+
<p className={styles.sectionP}>{t("support.msg1")}</p>
4041
</section>
4142
</>
4243
);

0 commit comments

Comments
 (0)