-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from h8570rg/develop
Prd
- Loading branch information
Showing
13 changed files
with
1,567 additions
and
1,648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
"use client"; | ||
|
||
import { Suspense } from "react"; | ||
import { Button } from "@/components/Button"; | ||
import { | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
} from "@/components/Modal"; | ||
import packageJson from "@/package.json"; | ||
import { versionComponents } from "./versions"; | ||
|
||
// バージョンをパースして数値に変換するヘルパー関数 | ||
function parseVersion(version: string) { | ||
return version.split(".").map(Number); | ||
} | ||
|
||
// バージョンの大小を比較する関数 | ||
function isVersionGreater(v1: string, v2: string) { | ||
const parsedV1 = parseVersion(v1); | ||
const parsedV2 = parseVersion(v2); | ||
|
||
for (let i = 0; i < 3; i++) { | ||
if (parsedV1[i] > parsedV2[i]) return true; | ||
if (parsedV1[i] < parsedV2[i]) return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
function setLastVersion() { | ||
localStorage.setItem("lastVersion", packageJson.version); | ||
} | ||
|
||
function ReleaseNotesModal() { | ||
const lastVersion = localStorage.getItem("lastVersion"); | ||
|
||
const newVersions = Object.entries(versionComponents).filter(([v]) => | ||
lastVersion ? isVersionGreater(v, lastVersion) : v === "0.1.0", | ||
); | ||
|
||
if (lastVersion && newVersions.length === 0) { | ||
return null; | ||
} | ||
|
||
const onClose = () => { | ||
setLastVersion(); | ||
}; | ||
|
||
return ( | ||
<Suspense> | ||
<Modal defaultOpen={true} size="xs" placement="center" onClose={onClose}> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1"> | ||
リリース情報 | ||
</ModalHeader> | ||
<ModalBody> | ||
{newVersions.reverse().map(([v, Component]) => ( | ||
<Component key={v} /> | ||
))} | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button variant="light" onPress={onClose}> | ||
閉じる | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</Suspense> | ||
); | ||
} | ||
|
||
export default ReleaseNotesModal; |
16 changes: 16 additions & 0 deletions
16
app/(main)/(components)/ReleaseNotesModal/versions/0_1_0.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default function ReleaseNotes_0_1_0() { | ||
return ( | ||
<> | ||
<p>Janrecoへようこそ!</p> | ||
<p> | ||
現在はベータ版ですが、機能の追加や改善を行っていく予定です。今後のアップデートにご期待ください! | ||
</p> | ||
<h2>- 今後の機能追加予定 -</h2> | ||
<ol className="list-inside list-disc"> | ||
<li>半荘結果編集</li> | ||
<li>ユーザー情報編集</li> | ||
<li>フリー記録 など</li> | ||
</ol> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import V0_1_0 from "./0_1_0"; | ||
|
||
export const versionComponents = { | ||
"0.1.0": V0_1_0, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import dynamic from "next/dynamic"; | ||
import Navbar from "./(components)/Navbar"; | ||
// import { getUser } from "./actions"; | ||
|
||
const ReleaseNotesModal = dynamic( | ||
() => import("./(components)/ReleaseNotesModal"), | ||
{ ssr: false }, | ||
); | ||
|
||
export default async function AppLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
// await getUser(); // TODO: パフォーマンス検証中。うまくいったらコンテキスト流したい。 | ||
return ( | ||
<div className="flex h-full flex-col"> | ||
<Navbar /> | ||
<main className="flex-1 px-4 pb-5">{children}</main> | ||
<main className="flex-1 px-4">{children}</main> | ||
<ReleaseNotesModal /> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.