Skip to content

Commit

Permalink
Merge branch 'release/v0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yui10 committed May 7, 2024
2 parents 9f76304 + ade9637 commit d73ea79
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 31 deletions.
44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "icons-karuta",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -11,15 +11,15 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@icons-pack/react-simple-icons": "^9.4.0",
"@mui/icons-material": "^5.15.15",
"@mui/material": "^5.15.15",
"@icons-pack/react-simple-icons": "^9.4.1",
"@mui/icons-material": "^5.15.16",
"@mui/material": "^5.15.16",
"@next/third-parties": "^14.2.0",
"@vercel/analytics": "^1.2.2",
"next": "14.1.4",
"react": "^18",
"react-dom": "^18",
"simple-icons": "^11.12.0"
"simple-icons": "^11.14.0"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
22 changes: 18 additions & 4 deletions src/app/games/NCard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { randomInt } from "@/utils/commonUtil";
import GameUI from "@/components/GameUI";
import { fetchSlugs, randomIcons } from "@/utils/iconUtil";
import { Box, Button, Stack, Typography } from "@mui/material";
import Image from "next/image";
import Link from "next/link";

const numList = [12, 24, 36];

Expand All @@ -32,13 +34,16 @@ const Random = ({ params, searchParams }: { params: { num: string }, searchParam

const onNextClick = (attention: number = 0) => {
const _iconList = iconList.filter((icon) => icon.title !== correctIcon?.title);
setScore(score + 5 - Math.min(4, attention));
const _totalAttention = totalAttention + attention;
const _score = score + 5 - Math.min(4, attention);
setScore(_score);
// setScore(score + 5 - Math.min(5, Math.max(attention - Math.floor(iconList.length / 4), 0)));
setIconList(_iconList);
setCorrectIcon(_iconList[randomInt(0, _iconList.length - 1)]);
setTotalAttention(totalAttention + attention);
setTotalAttention(_totalAttention);
if (_iconList.length === 0) {
setGameEnd(true);
alert(`Total number of touches: ${totalAttention + attention}\nScore: ${score}`);
alert(`Total number of touches: ${_totalAttention}\nScore: ${_score}`);
}
}

Expand All @@ -58,7 +63,16 @@ const Random = ({ params, searchParams }: { params: { num: string }, searchParam
<GameUI correctIcon={correctIcon} iconList={iconList} onNextGame={onNextClick} />
{gameEnd &&
<Box marginTop={4}>
<Stack spacing={2}>
{/** SNS share */}
<Stack spacing={2} direction="row">
<Typography variant="h6" component="h6" >
Share your score :
</Typography>
<Link href={`https://x.com/intent/post?text=icons karuta - Play ${num} Cards Game!!%0aTotal number of touches: ${totalAttention}%0aScore: ${score}%0a&url=${window.location.href}`} passHref target="_blank">
<Image src="https://cdn.simpleicons.org/x" alt="x" width={32} height={32} />
</Link>
</Stack>
<Stack spacing={2} direction="row">
<Button variant="contained" color="primary" onClick={() => window.location.href = `/games/NCard?num=${num}`}>Restart</Button>
<Button variant="contained" color="primary" onClick={() => window.location.href = "/"}>Top Page</Button>
</Stack>
Expand Down

0 comments on commit d73ea79

Please sign in to comment.