Skip to content

Commit

Permalink
🔥 ビルド前のテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
wappon28dev committed Jun 22, 2024
1 parent 065faaa commit 26bfe81
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vite.config.mts
src/vite-env.d.ts
functions/

src/lib/services/esa.gen.ts
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"type": "module",
"scripts": {
"prepare": "npm run gen:esa-type",
"test": "tsc && prettier --check ./src/ --check && eslint --ext .ts,.tsx ./src ",
"dev": "vite",
"dev:workers": "wrangler pages dev -- yarn dev",
"build": "tsc && vite build && cpx wrangler.toml dist/ && cpx \"functions/**\" dist/functions",
"build": "yarn test && vite build && cpx wrangler.toml dist/ && cpx \"functions/**\" dist/functions",
"preview": "vite preview",
"fmt": "prettier --write ./src/",
"lint": "eslint --ext .ts,.tsx ./src",
Expand Down
1 change: 1 addition & 0 deletions src/components/achievements/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function Page(): ReactElement {
</Flex>

{achievementTest.tag.map((tag, index) => (
// eslint-disable-next-line react/no-array-index-key
<Text key={index} color="gray">
タグ {tag}
</Text>
Expand Down
22 changes: 10 additions & 12 deletions src/components/member/PercentageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,16 @@ const Padding = styled.div`
`;

const One = styled.div`
font-size:80px;
position:relative;
top: -80px;
left: 25px;
font-size: 80px;
position: relative;
top: -80px;
left: 25px;
`;

const Center = styled.div`
display:flex;
flex-direction:column;
justify-content:center;
display: flex;
flex-direction: column;
justify-content: center;
`;

export function PercentageView(): ReactElement {
Expand All @@ -74,20 +73,19 @@ export function PercentageView(): ReactElement {
<Flag>
<img alt="flag" src={FirstFlag} width="100" />
</Flag>
<One>1</One>
<One>1</One>
</Center>

<StyledIcon icon="material-symbols:account-circle-full" />
</FlexContainer>

<div>
<StyledText>Ryoma osaki</StyledText>
<StyledText>Ryoma osaki</StyledText>
</div>

<div>
<Styledclass> 学部 kk 学年 b1</Styledclass>
<Styledclass> 学部 kk 学年 b1</Styledclass>
</div>

</Padding>
);
}
1 change: 0 additions & 1 deletion src/components/member/RankingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function RankingCard({
index: number;
point: number;
}): ReactElement {

const BoxStyle = styled(Box)`
border-bottom: 1px solid;
border-color: #cbd5e1;
Expand Down
17 changes: 6 additions & 11 deletions src/components/ranking/LogRecentUnlocked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,18 @@ export function LogRecentUnlocked({
unlockedDate: string;
memberEmail: string;
}): ReactElement {

const DateStyle = styled(Text)`
padding-left: 10rem;
`;



// @ts-expect-error
const member: Member = SampleMembers.members.find(
const member = SampleMembers.members.find(
(m) => m.email === memberEmail,
);
) as unknown as Member;

// @ts-expect-error
const achievement: Achievement = SampleAchievements.achievements.find(
const achievement = SampleAchievements.achievements.find(
(a) => a.id === achievementID,
);
) as unknown as Achievement;

return (
<Link params={{ id: achievement.id.toString() }} to="/achievements/:id">
<BoxStyle>
Expand All @@ -52,7 +47,7 @@ export function LogRecentUnlocked({
<Text as="div" color="gray" size="3">
{achievement.name}
</Text>
<DateStyle color="gray" size="1">
<DateStyle color="gray" size="1">
{unlockedDate.slice(0, 10)}
</DateStyle>
</Box>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { useState, type ReactElement } from "react";
import { useForm, type SubmitHandler } from "react-hook-form";
import styled from "styled-components";
import { type Achievement } from "@/types/achievement";
import { type Achievement } from "@/types/post-data/achievements";

export default function create(): ReactElement {
const [selectIcon, setSelectIcon] = useState("");
Expand All @@ -21,6 +21,7 @@ export default function create(): ReactElement {
mode: "onSubmit",
});
const onSubmit: SubmitHandler<Achievement> = (data) => {
// eslint-disable-next-line no-console
console.log(data);
};

Expand Down Expand Up @@ -61,6 +62,7 @@ export default function create(): ReactElement {
<Text as="p" size="1" trim="both">
{iconUrl.map((url, index) => (
<IconButton
// eslint-disable-next-line react/no-array-index-key
key={index}
mr="3"
onClick={() => {
Expand Down
29 changes: 14 additions & 15 deletions src/pages/members/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { Box, Table } from "@radix-ui/themes";
import { type ReactElement } from "react";
import styled from "styled-components";
import SampleMember from "@/assets/members.json";
import SampleUnlockedAchievements from '@/assets/unlockedAchievements.json'
import SampleUnlockedAchievements from "@/assets/unlockedAchievements.json";
import { MemberCard } from "@/components/member/Card";
import { type Member } from "@/types/member";


const BoxStyle = styled(Box)`
margin: 0 auto;
`;

export default function Page(): ReactElement {
let point:number = 0;
let point: number = 0;
return (
<BoxStyle width="70%">
<Table.Root>
Expand All @@ -25,18 +24,18 @@ export default function Page(): ReactElement {
</Table.Header>

<Table.Body>


{SampleMember.members.map((e: any) => {
const member: Member = e as Member;
point = 0;
SampleUnlockedAchievements.unlockedAchievements.forEach((unlockedAchievement)=>{
if(unlockedAchievement.memberEmail === member.email){
point += 1;
}
})
return <MemberCard key="index" member={member} point={point} />
})}
{SampleMember.members.map((e: any) => {
const member: Member = e as Member;
point = 0;
SampleUnlockedAchievements.unlockedAchievements.forEach(
(unlockedAchievement) => {
if (unlockedAchievement.memberEmail === member.email) {
point += 1;
}
},
);
return <MemberCard key="index" member={member} point={point} />;
})}
</Table.Body>
</Table.Root>
</BoxStyle>
Expand Down

0 comments on commit 26bfe81

Please sign in to comment.