Skip to content

Commit 79a9106

Browse files
committed
Show session detail pages
1 parent ffee559 commit 79a9106

File tree

3 files changed

+23
-29
lines changed

3 files changed

+23
-29
lines changed
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import React from 'react'
1+
import React from "react";
22

33
type FallbackImgProps = React.HTMLAttributes<HTMLImageElement> & {
4-
src: string
5-
alt: string
6-
loading?: 'lazy' | 'eager'
7-
errorFallback: React.ReactNode
8-
}
4+
src: string;
5+
alt: string;
6+
loading?: "lazy" | "eager";
7+
errorFallback: React.ReactNode;
8+
};
99

1010
export const FallbackImg: React.FC<FallbackImgProps> = (props) => {
11-
const [isError, setIsError] = React.useState(false)
12-
return isError ? props.errorFallback : <img src={props.src} alt={props.alt} onError={() => setIsError(true)} />
13-
}
11+
const [isError, setIsError] = React.useState(!props.src ? true : false);
12+
return isError ? (
13+
props.errorFallback
14+
) : (
15+
<img src={props.src} alt={props.alt} onError={() => setIsError(true)} />
16+
);
17+
};

src/pages/Session/list.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,21 @@ import { APIPretalxSessions } from "models/api/session";
1010
import { useListSessionsQuery } from "utils/hooks/useAPI";
1111
import useTranslation from "utils/hooks/useTranslation";
1212

13-
const ENABLE_PROFILE_IMG_AND_DETAILS = false;
14-
1513
const SessionItem: React.FC<{ session: APIPretalxSessions[0] }> = ({ session }) => {
1614
const t = useTranslation();
1715
const navigate = useNavigate();
1816

19-
const h4Props = ENABLE_PROFILE_IMG_AND_DETAILS
20-
? { onClick: () => navigate(`/session/${session.code}`) }
21-
: {};
22-
2317
return (
2418
<SessionItemEl>
25-
{ENABLE_PROFILE_IMG_AND_DETAILS && (
26-
<SessionItemImgContainer>
27-
<FallbackImg
28-
src={session.image || ""}
29-
alt={session.title}
30-
errorFallback={<SloganShort />}
31-
/>
32-
</SessionItemImgContainer>
33-
)}
19+
<SessionItemImgContainer>
20+
<FallbackImg
21+
src={session.image || ""}
22+
alt={session.title}
23+
errorFallback={<SloganShort />}
24+
/>
25+
</SessionItemImgContainer>
3426
<SessionItemInfoContainer>
35-
<h4 {...h4Props}>{session.title}</h4>
27+
<h4 onClick={() => navigate(`/session/${session.code}`)}>{session.title}</h4>
3628
<p>{session.abstract}</p>
3729
<SessionSpeakerContainer>
3830
by{" "}
@@ -183,7 +175,7 @@ const SessionItemInfoContainer = styled.div`
183175
h4 {
184176
color: #febd99;
185177
margin-bottom: 0.2rem;
186-
cursor: ${ENABLE_PROFILE_IMG_AND_DETAILS ? "pointer" : "default"};
178+
cursor: pointer;
187179
}
188180
189181
p {

src/pages/Session/timetable.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { useNavigate } from "react-router";
99
import { useListSessionsQuery } from "utils/hooks/useAPI";
1010
import useTranslation from "utils/hooks/useTranslation";
1111

12-
const ENABLE_DETAILS = false;
13-
1412
const TD_HEIGHT = 2.5;
1513
const TD_WIDTH = 12.5;
1614
const TD_WIDTH_MOBILE = 20;
@@ -109,7 +107,7 @@ const SessionColumn: React.FC<{
109107
session: APIPretalxSessions[0];
110108
}> = ({ rowSpan, colSpan, session }) => {
111109
const navigate = useNavigate();
112-
const clickable = ENABLE_DETAILS && R.isArray(session.speakers) && !R.isEmpty(session.speakers);
110+
const clickable = R.isArray(session.speakers) && !R.isEmpty(session.speakers);
113111
// Firefox는 rowSpan된 td의 height를 계산할 때 rowSpan을 고려하지 않습니다. 따라서 직접 계산하여 height를 설정합니다.
114112
const sessionBoxHeight = `${TD_HEIGHT * rowSpan}rem`;
115113
return (

0 commit comments

Comments
 (0)