Skip to content

Commit ffee559

Browse files
committed
Fix lint, typo
1 parent ab8cccb commit ffee559

File tree

5 files changed

+445
-307
lines changed

5 files changed

+445
-307
lines changed

src/api/session.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import instance from "lib/axios"
2-
import { APIPretalxSessions } from "models/api/session"
1+
import instance from "lib/axios";
2+
import { APIPretalxSessions } from "models/api/session";
33

44
export const listSessions = async () => {
5-
const result = await instance.get('/2024/sessions/')
5+
const result = await instance.get("/2024/sessions/");
66
switch (result.status) {
77
case 200:
8-
return result.data as APIPretalxSessions
8+
return result.data as APIPretalxSessions;
99
default:
10-
throw new Error('세션 목록을 불러오는데 실패했습니다,\n잠시 후 다시 시도해주세요.')
10+
throw new Error("세션 목록을 불러오는데 실패했습니다,\n잠시 후 다시 시도해주세요.");
1111
}
12-
}
12+
};
1313

14-
export const retriveSession = async (code: string) => {
15-
const result = await instance.get(`/2024/sessions/${code}/`)
14+
export const retrieveSession = async (code: string) => {
15+
const result = await instance.get(`/2024/sessions/${code}/`);
1616
switch (result.status) {
1717
case 200:
18-
return result.data as APIPretalxSessions[0]
18+
return result.data as APIPretalxSessions[0];
1919
default:
20-
throw new Error('세션을 불러오는데 실패했습니다,\n잠시 후 다시 시도해주세요.')
20+
throw new Error("세션을 불러오는데 실패했습니다,\n잠시 후 다시 시도해주세요.");
2121
}
22-
}
22+
};

src/pages/Session/detail.tsx

+77-57
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
1-
import { wrap } from '@suspensive/react'
2-
import React from "react"
3-
import Markdown from 'react-markdown'
4-
import * as R from 'remeda'
5-
6-
import { SloganShort } from 'assets/icons'
7-
import { FallbackImg } from 'components/common/FallbackImg'
8-
import Page from "components/common/Page"
9-
import { APIPretalxSessions } from 'models/api/session'
10-
import { useNavigate, useParams } from 'react-router'
11-
import styled from 'styled-components'
12-
import { useRetriveSessionQuery } from 'utils/hooks/useAPI'
13-
import useTranslation from "utils/hooks/useTranslation"
14-
15-
const SessionSpeakerItem: React.FC<{ speaker: APIPretalxSessions[0]['speakers'][0] }> = ({ speaker }) => {
1+
import { wrap } from "@suspensive/react";
2+
import React from "react";
3+
import Markdown from "react-markdown";
4+
import * as R from "remeda";
5+
6+
import { SloganShort } from "assets/icons";
7+
import { FallbackImg } from "components/common/FallbackImg";
8+
import Page from "components/common/Page";
9+
import { APIPretalxSessions } from "models/api/session";
10+
import { useNavigate, useParams } from "react-router";
11+
import styled from "styled-components";
12+
import { useRetrieveSessionQuery } from "utils/hooks/useAPI";
13+
import useTranslation from "utils/hooks/useTranslation";
14+
15+
const SessionSpeakerItem: React.FC<{ speaker: APIPretalxSessions[0]["speakers"][0] }> = ({
16+
speaker,
17+
}) => {
1618
return (
1719
<SessionSpeakerItemStyled>
1820
<SessionSpeakerImageContainerStyled>
19-
<FallbackImg src={speaker.avatar ?? ''} alt={speaker.name} errorFallback={<SloganShort />} />
21+
<FallbackImg
22+
src={speaker.avatar ?? ""}
23+
alt={speaker.name}
24+
errorFallback={<SloganShort />}
25+
/>
2026
</SessionSpeakerImageContainerStyled>
2127
<div>
2228
<h3>{speaker.name}</h3>
2329
<Markdown>{speaker.biography}</Markdown>
2430
</div>
2531
</SessionSpeakerItemStyled>
26-
)
27-
}
32+
);
33+
};
2834

2935
const SessionDetail: React.FC<{ session: APIPretalxSessions[0] }> = ({ session }) => {
30-
const t = useTranslation()
36+
const t = useTranslation();
3137

32-
let locale = '알 수 없음'
38+
let locale = "알 수 없음";
3339
switch (session.content_locale) {
34-
case 'ko':
35-
locale = '한국어'
40+
case "ko":
41+
locale = "한국어";
3642
break;
37-
case 'en':
38-
locale = '영어'
43+
case "en":
44+
locale = "영어";
3945
break;
40-
case 'ja':
41-
locale = '일본어'
46+
case "ja":
47+
locale = "일본어";
4248
break;
4349
default:
44-
locale = '알 수 없음'
50+
locale = "알 수 없음";
4551
}
4652

4753
return (
@@ -50,61 +56,75 @@ const SessionDetail: React.FC<{ session: APIPretalxSessions[0] }> = ({ session }
5056
<h4>{session.abstract}</h4>
5157
<hr />
5258
<SessionInfoContainerStyled>
53-
<p>{t('언어')} : {t(locale)}</p>
54-
<p>{t('발표 시간')} : {session.duration}{t('분')}</p>
55-
<p>{t('발표 장소')} : {t(session.slot?.room[Object.keys(session.slot?.room ?? {})[0]] ?? '알 수 없음')}</p>
59+
<p>
60+
{t("언어")} : {t(locale)}
61+
</p>
62+
<p>
63+
{t("발표 시간")} : {session.duration}
64+
{t("분")}
65+
</p>
66+
<p>
67+
{t("발표 장소")} :{" "}
68+
{t(session.slot?.room[Object.keys(session.slot?.room ?? {})[0]] ?? "알 수 없음")}
69+
</p>
5670
<p>
5771
<TagContainer>
58-
<div style={{ margin: 0 }}>{t('태그')} :</div>
59-
{session.tags.map(tag => <Tag key={tag}>{t(tag)}</Tag>)}
60-
{session.do_not_record && <Tag>{t('녹화 불가')}</Tag>}
72+
<div style={{ margin: 0 }}>{t("태그")} :</div>
73+
{session.tags.map((tag) => (
74+
<Tag key={tag}>{t(tag)}</Tag>
75+
))}
76+
{session.do_not_record && <Tag>{t("녹화 불가")}</Tag>}
6177
</TagContainer>
6278
</p>
6379
</SessionInfoContainerStyled>
6480
<hr />
65-
<h3>{t('설명')}</h3>
81+
<h3>{t("설명")}</h3>
6682
<Markdown>{session.description}</Markdown>
6783
<hr />
68-
<h3>{t('발표자 소개')}</h3>
69-
{session.speakers.map(speaker => <SessionSpeakerItem speaker={speaker} key={speaker.code} />)}
84+
<h3>{t("발표자 소개")}</h3>
85+
{session.speakers.map((speaker) => (
86+
<SessionSpeakerItem speaker={speaker} key={speaker.code} />
87+
))}
7088
<hr />
7189
</SessionDetailStyled>
72-
)
73-
}
90+
);
91+
};
7492

7593
export const SessionDetailPage: React.FC = () => {
76-
const t = useTranslation()
77-
const { code } = useParams<{ code: string }>()
78-
const navigate = useNavigate()
94+
const t = useTranslation();
95+
const { code } = useParams<{ code: string }>();
96+
const navigate = useNavigate();
7997

80-
React.useEffect(() => window.scrollTo(0, 0), [])
98+
React.useEffect(() => window.scrollTo(0, 0), []);
8199

82100
if (!(R.isString(code) && !R.isEmpty(code))) {
83-
navigate('/session')
84-
return null
101+
navigate("/session");
102+
return null;
85103
}
86104

87105
const SessionDetailWrapper = wrap
88106
.ErrorBoundary({ fallback: <h4>{t("세션 정보를 불러오는 중 에러가 발생했습니다.")}</h4> })
89107
.Suspense({ fallback: <h4>{t("세션 정보를 불러오는 중 입니다.")}</h4> })
90108
.on(() => {
91109
// eslint-disable-next-line react-hooks/rules-of-hooks
92-
const { data } = useRetriveSessionQuery(code)
93-
return <SessionDetail session={data} />
94-
})
110+
const { data } = useRetrieveSessionQuery(code);
111+
return <SessionDetail session={data} />;
112+
});
95113

96114
return (
97115
<Page>
98-
<ReturnToSessionList onClick={() => navigate(-1)}>⬅️ {t('세션 목록으로 돌아가기')}</ReturnToSessionList>
116+
<ReturnToSessionList onClick={() => navigate(-1)}>
117+
⬅️ {t("세션 목록으로 돌아가기")}
118+
</ReturnToSessionList>
99119
<SessionDetailWrapper />
100120
</Page>
101-
)
102-
}
121+
);
122+
};
103123

104124
const ReturnToSessionList = styled.small`
105125
color: rgba(255, 255, 255, 0.4);
106126
cursor: pointer;
107-
`
127+
`;
108128

109129
const SessionDetailStyled = styled.div`
110130
h1 {
@@ -126,13 +146,13 @@ const SessionDetailStyled = styled.div`
126146
font-size: 1rem;
127147
}
128148
}
129-
`
149+
`;
130150

131151
const SessionInfoContainerStyled = styled.div`
132152
* {
133153
margin: 0.5rem 0;
134154
}
135-
`
155+
`;
136156

137157
const SessionSpeakerItemStyled = styled.div`
138158
display: flex;
@@ -145,7 +165,7 @@ const SessionSpeakerItemStyled = styled.div`
145165
margin-top: 0;
146166
color: #fff;
147167
}
148-
`
168+
`;
149169

150170
const SessionSpeakerImageContainerStyled = styled.div`
151171
flex: 0 0 auto;
@@ -170,17 +190,17 @@ const SessionSpeakerImageContainerStyled = styled.div`
170190
171191
border-radius: 50%;
172192
}
173-
`
193+
`;
174194

175195
const TagContainer = styled.div`
176196
display: flex;
177197
align-items: center;
178198
justify-content: flex-start;
179199
gap: 0.5rem;
180-
`
200+
`;
181201

182202
const Tag = styled.kbd`
183203
margin: 0;
184204
background-color: #b0a8fe;
185205
font-family: var(--pico-font-family);
186-
`
206+
`;

0 commit comments

Comments
 (0)