-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from softeerbootcamp4th/feature/13-fcfs
[feat] 선착순 이벤트 일부 구현
- Loading branch information
Showing
33 changed files
with
691 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import use from "./use.js"; | ||
|
||
const queryMap = new Map(); | ||
const CACHE_DURATION = 10 * 60 * 1000; | ||
|
||
function isSame(arr1, arr2) { | ||
if (arr1.length !== arr2.length) return false; | ||
return arr1.every((value, i) => value === arr2[i]); | ||
} | ||
|
||
export function getQuery(key, promiseFn, dependencyArray = []) { | ||
if (queryMap.has(key)) { | ||
const { promise, depArr } = queryMap.get(key); | ||
if (isSame(depArr, dependencyArray)) return promise; | ||
} | ||
const promise = promiseFn(); | ||
queryMap.set(key, { promise, depArr: dependencyArray }); | ||
setTimeout(() => queryMap.delete(key), CACHE_DURATION); | ||
return promise; | ||
} | ||
|
||
export function useQuery(key, promiseFn, dependencyArray = []) { | ||
return use(getQuery(key, promiseFn, dependencyArray)); | ||
} | ||
|
||
export const getQuerySuspense = useQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default function use(promise) { | ||
if (promise.status === "resolved") return promise.value; | ||
if (promise.status === "rejected") throw promise.error; | ||
if (promise.status === "pending") throw promise; | ||
|
||
promise.status = "pending"; | ||
promise | ||
.then((e) => { | ||
promise.status = "resolved"; | ||
promise.value = e; | ||
return e; | ||
}) | ||
.catch((e) => { | ||
promise.status = "rejected"; | ||
promise.error = e; | ||
}); | ||
|
||
throw promise; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import makeHighlight from "./makeHighlight.jsx"; | ||
|
||
export default function EventDetail({ | ||
durationYear, | ||
duration, | ||
announceDate, | ||
announceDateCaption, | ||
howto, | ||
}) { | ||
return ( | ||
<div className="flex flex-col"> | ||
<span className="text-body-l pb-10 text-neutral-50 font-bold"> | ||
상세 안내 | ||
</span> | ||
|
||
<div className="flex gap-5"> | ||
<div className="bg-neutral-900 p-6 flex flex-col font-bold"> | ||
<span className="text-body-m text-neutral-300">이벤트 기간</span> | ||
|
||
<span className="pt-6 text-body-m text-blue-100">{durationYear}</span> | ||
|
||
<span className="text-body-l text-blue-400">{duration}</span> | ||
</div> | ||
|
||
<div className="bg-neutral-900 p-6 flex flex-col"> | ||
<span className="text-body-m text-neutral-300 font-bold"> | ||
당첨자 발표 | ||
</span> | ||
|
||
<span className="pt-6 text-body-l text-white font-bold"> | ||
{makeHighlight(announceDate, "font-normal text-neutral-300")} | ||
</span> | ||
|
||
<span className="pt-2 text-body-s text-neutral-300"> | ||
{announceDateCaption} | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div className="mt-5 p-6 bg-neutral-900 flex flex-col font-bold"> | ||
<span className="pb-6 text-body-m text-neutral-300">참여방법</span> | ||
|
||
<ul className="flex flex-col gap-2"> | ||
{howto.map((description, index) => ( | ||
<li key={`howTo-${index}`} className="flex gap-2"> | ||
<span className="size-6 flex justify-center items-center bg-neutral-100 text-neutral-900 text-body-s px-2 py-0.5 rounded flex-shrink-0"> | ||
{index + 1} | ||
</span> | ||
<p className="text-neutral-400 text-body-m"> | ||
{makeHighlight(description, "text-white")} | ||
</p> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// **매일매일 공개되는** 더 뉴 아이오닉과 관련된 **인터랙션을 수행한다.** | ||
// **...**로 감싸진 것은 강조입니다. | ||
|
||
function makeHighlight(plainText, highlightClass) { | ||
const tokened = plainText.split(/\*\*(.*?)\*\*/gm); | ||
|
||
return tokened.map((content, index) => { | ||
if (index % 2 === 0) return content; | ||
return ( | ||
<span key={content + index} className={highlightClass}> | ||
{content} | ||
</span> | ||
); | ||
}); | ||
} | ||
|
||
export default makeHighlight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import EventDetail from "@/eventDescription/EventDetail.jsx"; | ||
import content from "./content.json"; | ||
|
||
function FcfsDescription() { | ||
return ( | ||
<div> | ||
<EventDetail {...content} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default FcfsDescription; |
Oops, something went wrong.