Skip to content

Commit

Permalink
Merge pull request #573 from sparcs-kaist/dev
Browse files Browse the repository at this point in the history
Main branch update from Dev branch
  • Loading branch information
14KGun authored May 6, 2023
2 parents 465044a + 0cf65e0 commit bfdb424
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/hooks/usePageFromSearchParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import qs from "qs";
import { useCallback, useEffect, useState } from "react";
import { useLocation } from "react-router-dom";

const usePageFromSearchParams = (totalPages: Number) => {
const usePageFromSearchParams = (totalPages: number) => {
const location = useLocation();
const { search } = location;

Expand Down
10 changes: 8 additions & 2 deletions src/pages/Event/Event2023Spring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Event2023Spring = () => {
이벤트 요약
</Title>
<WhiteContainer padding="0px">
<Carousel autoplay autoplaySpeed={2000}>
<Carousel autoplay autoplaySpeed={5000}>
{[
Card01,
Card02,
Expand Down Expand Up @@ -111,7 +111,12 @@ const Event2023Spring = () => {
/>
를 태그 후 스크린샷으로 인증해 추가로 업로드 하면 당첨확률이 2배!
</div>
<a href="https://bit.ly/2023taxi" target="_blank" rel="noreferrer">
<a
href="https://bit.ly/2023taxi"
target="_blank"
rel="noreferrer"
css={{ textDecoration: "none" }}
>
<Button
type="purple"
padding="14px 0 13px"
Expand Down Expand Up @@ -154,6 +159,7 @@ const Event2023Spring = () => {
href="https://www.instagram.com/sparcs.kaist"
target="_blank"
rel="noreferrer"
css={{ textDecoration: "none" }}
>
<Button
type="purple"
Expand Down
44 changes: 21 additions & 23 deletions src/pages/Home/InfoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ const InfoSection = () => {
const myRooms = useRecoilValue(myRoomsAtom);
const randomTaxiSlogan = useMemo(randomTaxiSloganGenerator, []);

const styleContainer: CSS = {
position: "relative",
const styleContainer = {
position: "relative" as any,
height: "fit-content",
width: "100%",
paddingTop: "5px",
background:
"linear-gradient(to right top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.1) 100%)",
};
const styleImage: CSS = {
const styleImage = {
backgroundSize: "cover",
zIndex: -1,
opacity: 0.8,
width: "100%",
height: "100%",
position: "absolute",
position: "absolute" as any,
inset: "0px",
objectFit: "cover",
objectFit: "cover" as any,
};
const styleTitle = {
...theme.font28,
Expand All @@ -61,22 +61,20 @@ const InfoSection = () => {
if (!sortedMyRoom.length)
return { message: "현재 참여 중인 방이 없습니다.", room: null };
if (notDeparted) {
const departure = moment(notDeparted.time);
const diffDays = departure.diff(getToday(), "days");
const departure = moment(moment(notDeparted.time).format("YYYY-MM-DD"));
const diffDays = departure.diff(getToday().format("YYYY-MM-DD"), "days");
if (diffDays === 0) {
return { message: "오늘 출발하는 방이 있습니다.", room: notDeparted };
} else if (diffDays < 2) {
} else if (diffDays === 1) {
return {
message: "내일 출발 예정인 방이 있습니다.",
room: notDeparted,
};
} else if (!notOver) {
return {
message: `${diffDays}일 후 출발 예정인 방이 있습니다.`,
room: notDeparted,
};
} else {
if (!notOver) {
return {
message: `${diffDays}일 후 출발 예정인 방이 있습니다.`,
room: notDeparted,
};
}
}
}
if (notOver) {
Expand All @@ -90,18 +88,18 @@ const InfoSection = () => {
}, [JSON.stringify(myRooms)]);

return (
<div className="info-section" style={styleContainer}>
<div className="info-section" css={styleContainer}>
<picture>
<source
type="image/webp"
style={styleImage}
css={styleImage}
src={BackgroundImageDesktop}
srcSet={`${BackgroundImageMobile} 430w, ${BackgroundImageDesktop} 1980w`}
/>
<img style={styleImage} src={BackgroundImage} />
<img css={styleImage} src={BackgroundImage} />
</picture>
<RLayout.R1>
<div style={{ padding: "25px 0 32px" }}>
<div css={{ padding: "25px 0 32px" }}>
<TaxiLogoWhite />
<div css={{ height: "32px" }} />
<div css={styleTitle}>
Expand All @@ -111,15 +109,15 @@ const InfoSection = () => {
</div>
<div css={styleSubTitle}>{isLogin ? message : randomTaxiSlogan}</div>
{room ? (
<Link to={`/myroom/${room._id}`} style={{ textDecoration: "none" }}>
<Link to={`/myroom/${room._id}`} css={{ textDecoration: "none" }}>
<Room data={room} marginTop="24px" />
</Link>
) : (
<div
style={{ marginTop: "32px", display: "flex", columnGap: "10px" }}
css={{ marginTop: "32px", display: "flex", columnGap: "10px" }}
>
{isLogin ? (
<Link to="/addroom" style={{ textDecoration: "none" }}>
<Link to="/addroom" css={{ textDecoration: "none" }}>
<Button
type="purple"
padding="12px 20px 11px"
Expand All @@ -141,7 +139,7 @@ const InfoSection = () => {
</Button>
</LinkLogin>
)}
<Link to="/search" style={{ textDecoration: "none" }}>
<Link to="/search" css={{ textDecoration: "none" }}>
<Button
type="white"
padding="12px 20px 11px"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Home/RoomList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const RoomList = (props: RoomListProps) => {
.map((room) => (
<Link
key={room._id}
to={`/home/${room._id}`}
to={`/home/${room._id}?page=${currentPage}`}
replace
style={{ textDecoration: "none" }}
>
Expand Down
9 changes: 7 additions & 2 deletions src/pages/Home/RoomSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ const RoomSection = ({ roomId }: RoomSectionProps) => {
<RLayout.R1>
<ModalRoomSelection
isOpen={!!roomInfo}
onChangeIsOpen={() => history.replace("/home")}
onChangeIsOpen={() =>
history.replace("/home" + history.location.search)
}
roomInfo={roomInfo}
/>
<Title icon="taxi" header>
요일별 출발하는 방
</Title>
<SelectDate
selectedDate={selectedDate}
onClick={([year, month, date]) => setSelectedDate([year, month, date])}
onClick={([year, month, date]) => {
history.replace("/home");
setSelectedDate([year, month, date]);
}}
/>
<RoomList rooms={rooms} />
</RLayout.R1>
Expand Down
1 change: 1 addition & 0 deletions src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Home = () => {
const roomId = _roomId === "privacyPolicy" ? null : _roomId;

useEffect(() => {
if (pathname === "/") history.replace("/home");
if (pathname.startsWith("/invite") && roomId) {
// dynamic link로 웹에서 앱으로 이동가능할 시 이동합니다.
window.location.href = getDynamicLink(`/home/${roomId}`);
Expand Down

0 comments on commit bfdb424

Please sign in to comment.