Skip to content

Commit

Permalink
[chore] 린트 수정 및 프리티어 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
lybell-art committed Aug 12, 2024
1 parent 232a782 commit 38093c3
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 38 deletions.
18 changes: 7 additions & 11 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build } from "vite";
import { parse, resolve, dirname } from "node:path";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import process from "node:process";
import { readFile, writeFile, rm, mkdir } from "node:fs/promises";
import config from "./vite.config.js";

Expand Down Expand Up @@ -30,14 +31,12 @@ const buildConfig = {
},
}

async function processBuild(mode)
{
async function processBuild(mode) {
await Promise.all([buildClient(mode), buildSSG(mode)]);
await injectSSGToHtml(mode);
}

async function buildClient(mode)
{
async function buildClient(mode) {
await build({
...config,
build: {
Expand All @@ -54,8 +53,7 @@ async function buildClient(mode)
await rm(toAbsolute(`dist/${mode}/mockServiceWorker.js`));
}

function buildSSG(mode)
{
function buildSSG(mode) {
return build({
...config,
build: {
Expand All @@ -72,8 +70,7 @@ function buildSSG(mode)
});
}

async function injectSSGToHtml(mode)
{
async function injectSSGToHtml(mode) {
console.log("--ssg result--");
const {default: render} = await import(`./dist-ssg/${mode}/entry.js`);
const template = await readFile(`dist/${mode}/${buildConfig[mode].clientEntry}`, "utf-8");
Expand All @@ -89,8 +86,7 @@ async function injectSSGToHtml(mode)
await mkdir(dir, { recursive: true });
await writeFile(absolutePath, html);
console.log(`pre-rendered : ${path}`);
}
catch {
} catch {
console.log(`pre-rendered failed : ${path}`);
}
} );
Expand Down
8 changes: 6 additions & 2 deletions src/adminPage/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ function App() {
return (
<>
<Routes>
<Route exact path="/events/create" element={<div>event 생성 화면</div>} />
<Route
exact
path="/events/create"
element={<div>event 생성 화면</div>}
/>
<Route path="/events/:id" element={<div>event 보는 화면</div>} />
<Route path="/events" element={<div>이벤트 목록 화면</div>} />
<Route path="/comments/:id" element={<div>기대평 화면</div>} />
Expand All @@ -16,4 +20,4 @@ function App() {
);
}

export default App;
export default App;
25 changes: 15 additions & 10 deletions src/adminPage/main-client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@ if (import.meta.env.DEV) {
};
enableMocking().then(() => {
const root = createRoot($root);
root.render(<StrictMode>
<BrowserRouter basename="/admin">
<App />
</BrowserRouter>
</StrictMode>);
root.render(
<StrictMode>
<BrowserRouter basename="/admin">
<App />
</BrowserRouter>
</StrictMode>,
);
});
} else {
// 배포 시
hydrateRoot($root, <StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>);
hydrateRoot(
$root,
<StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>,
);
}
2 changes: 1 addition & 1 deletion src/common/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const EVENT_ID = "0";
export const SERVICE_TOKEN_ID = "AWESOME_ORANGE_ACCESS_TOKEN";
export const ADMIN_TOKEN_ID = "AWESOME_ORANGE_ADMIN_ACCESS_TOKEN";
export const ADMIN_TOKEN_ID = "AWESOME_ORANGE_ADMIN_ACCESS_TOKEN";
3 changes: 2 additions & 1 deletion src/common/dataFetch/tokenSaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TokenSaver {
}
set(token) {
this.token = token;
if (typeof window !== "undefined") localStorage.setItem(this.tokenId, token);
if (typeof window !== "undefined")
localStorage.setItem(this.tokenId, token);
this.initialzed = true;
}
has(tokenId = this.tokenId) {
Expand Down
10 changes: 5 additions & 5 deletions src/common/modal/modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ function Modal({ layer }) {
const child = useModalStore(layer);
const [opacity, setOpacity] = useState(0);
const close = useCallback(() => {
return new Promise( (resolve)=>{
return new Promise((resolve) => {
setOpacity(0);

if (timeoutRef.current !== null) return resolve();
timeoutRef.current = setTimeout( ()=>{
timeoutRef.current = setTimeout(() => {
closeModal(layer);
resolve();
}, 150 );
} );
}, 150);
});
}, [layer]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export function convertSecondsToString(time) {
}

export function delay(ms) {
return new Promise( resolve=>setTimeout(resolve, ms) );
return new Promise((resolve) => setTimeout(resolve, ms));
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AuthModal from "@main/auth/AuthModal.jsx";
import openModal from "@common/modal/openModal.js";
import Button from "@common/components/Button.jsx";

import style from "./InteractionAnswer.module.css"
import style from "./InteractionAnswer.module.css";
// import useEventStore from "@main/realtimeEvent/store";

export default function InteractionAnswer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import InteractionAnswer from "./InteractionAnswer.jsx";
import { ModalCloseContext } from "@common/modal/modal.jsx";
import Suspense from "@common/components/Suspense.jsx";
import Button from "@common/components/Button.jsx";
import ResetButton from "@main/components/ResetButton.jsx"
import ResetButton from "@main/components/ResetButton.jsx";

import userStore from "@main/auth/store.js";

Expand Down
5 changes: 3 additions & 2 deletions src/mainPage/features/introSection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import style from "./index.module.css";
import SpinningCarVideo from "./car-spin.webm";
import Pointer from "./pointer.svg";


function IntroSection() {
const videoRef = useRef(null);
const introRef = useRef(null);
Expand Down Expand Up @@ -106,7 +105,9 @@ function IntroSection() {
더뉴 아이오닉5 신차 출시 이벤트
</span>

<span className="text-center text-title-l sm:text-head-s">09/09 (mon) - 09/13 (fri)</span>
<span className="text-center text-title-l sm:text-head-s">
09/09 (mon) - 09/13 (fri)
</span>
</div>

<div className="absolute -bottom-2 w-full h-4 bg-white" />
Expand Down
5 changes: 4 additions & 1 deletion src/mainPage/features/simpleInformation/contentSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default function ContentSection({ content }) {
</span>

<div className="pt-3 flex flex-col md:flex-row justify-between items-start md:items-end">
<p style={highlightDynamicStyle} className="flex-shrink-0 text-title-s min-[440px]:text-title-m text-neutral-800 whitespace-pre-wrap">
<p
style={highlightDynamicStyle}
className="flex-shrink-0 text-title-s min-[440px]:text-title-m text-neutral-800 whitespace-pre-wrap"
>
{makeHighlight(content.desc, style.highlightAnim)}
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/mainPage/shared/realtimeEvent/getEventDateState.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export default function getEventDateState(currrentTimeDate, eventTimeDate) {
if (currentTime < eventTime) return "default";
if (currentTime < eventEndTime) return "active";
return "ended";
}
}
2 changes: 1 addition & 1 deletion src/mainPage/shared/scroll/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export const OTHER_SECTION = 0;
export const INTERACTION_SECTION = 1;
export const DETAIL_SECTION = 2;
export const COMMENT_SECTION = 3;
export const FCFS_SECTION = 4;
export const FCFS_SECTION = 4;

0 comments on commit 38093c3

Please sign in to comment.