forked from boostcampwm-2024/web30-stop-troublepainter
-
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.
refactor: Optimize Largest Contentful Paint (#8)
* refactor: Optimize images to improve page load performance - Compress and resize large images - Convert to modern formats (WebP/AVIF) * refactor: Improve audio performance with metadata attribute * refactor: Implement progressive image loading pattern - Add low quality image placeholder - Implement smooth transition to high-res images - Support multiple formats (AVIF/WebP/PNG) with picture element * refactor: Implement lazy/preloading strategy for optimized page loading - Configure code splitting for game-related pages in GameLayout loader - Add preloading for Lobby, GameRoom and Result pages on MainPage button hover - Implement lazy loading for help modal component with hover-based initialization * refactor: Optimize font loading to eliminate render-blocking resources - Add font-display: swap for system font fallback during loading - Implement preload for woff2 font to prioritize loading * fix: Update index.html with proper formatting * refactor: Optimize asynchronous imports - Changed critical imports to use �wait to ensure they are loaded during the loader's execution. - Handled non-critical imports with �oid Promise.all for asynchronous preloading. * fix: Adjust z-index stacking for modal animations and background
- Loading branch information
Showing
14 changed files
with
185 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,15 @@ | |
</script> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<link | ||
rel="preload" | ||
href="https://cdn.jsdelivr.net/gh/neodgm/[email protected]/neodgm_pro/neodgm_pro.woff2" | ||
as="font" | ||
type="font/woff2" | ||
crossorigin="anonymous" | ||
> | ||
|
||
<meta name="theme-color" content="#7A38FF"> <!-- 브라우저 테마 색상 (violet-500) --> | ||
<meta name="description" content="잘 그렸나? 망쳤나? 정체를 숨긴 방해꾼이 쏘아올린 혼돈 속에서, 그림꾼들의 진실을 찾아내는 구경꾼들의 훈수가 시작됩니다! 🎨🕵️♀️"> | ||
<meta name="keywords" content="게임, 드로잉, 실시간, 멀티플레이어, 웹게임, 온라인게임, 퀴즈게임"> | ||
|
@@ -91,8 +100,6 @@ | |
<!-- 웹 매니페스트 --> | ||
<link rel="manifest" href="/site.webmanifest"> | ||
|
||
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/neodgm/neodgm-pro-webfont@latest/neodgm_pro/style.css" /> | ||
|
||
<title>방해꾼은 못말려 : 그림꾼들의 역습</title> | ||
</head> | ||
|
||
|
@@ -102,4 +109,4 @@ | |
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
|
||
</html> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,52 @@ | ||
import { useEffect, useRef, useState } from 'react'; | ||
import tiny from '@/assets/background-tiny.png'; | ||
import { CDN } from '@/constants/cdn'; | ||
import { cn } from '@/utils/cn'; | ||
|
||
interface BackgroundImageProps { | ||
className?: string; | ||
} | ||
|
||
const BackgroundImage = ({ className }: BackgroundImageProps) => { | ||
const [isLoaded, setIsLoaded] = useState(false); | ||
const imgRef = useRef<HTMLImageElement>(null); | ||
|
||
useEffect(() => { | ||
const img = imgRef.current; | ||
if (img) { | ||
img.onload = () => setIsLoaded(true); | ||
} | ||
}, [imgRef.current]); | ||
|
||
return ( | ||
<> | ||
<div className={cn('absolute inset-0', className)}> | ||
<img | ||
src={tiny} | ||
alt="배경 패턴" | ||
className={cn( | ||
'h-full w-full object-cover transition-opacity duration-300', | ||
isLoaded ? 'opacity-0' : 'opacity-100', | ||
)} | ||
/> | ||
</div> | ||
<picture className={cn('absolute inset-0', className)}> | ||
<source srcSet={CDN.BACKGROUND_IMAGE_AVIF} type="image/avif" /> | ||
<source srcSet={CDN.BACKGROUND_IMAGE_WEBP} type="image/webp" /> | ||
<img | ||
src={CDN.BACKGROUND_IMAGE_PNG} | ||
alt="배경 패턴" | ||
className={cn( | ||
'h-full w-full object-cover transition-opacity duration-300', | ||
isLoaded ? 'opacity-100' : 'opacity-0', | ||
)} | ||
ref={imgRef} | ||
loading="lazy" | ||
decoding="async" | ||
/> | ||
</picture> | ||
</> | ||
); | ||
}; | ||
|
||
export default BackgroundImage; |
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,10 @@ | ||
import { DotLottieReact } from '@lottiefiles/dotlottie-react'; | ||
import loading from '@/assets/lottie/loading.lottie'; | ||
|
||
export const Loading = () => { | ||
return ( | ||
<div className="flex h-screen w-full items-center justify-center"> | ||
<DotLottieReact src={loading} loop autoplay className="h-96 w-96" /> | ||
</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
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 |
---|---|---|
|
@@ -2,6 +2,16 @@ | |
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@font-face { | ||
font-family: 'NeoDunggeunmo Pro'; | ||
src: | ||
url('https://cdn.jsdelivr.net/gh/neodgm/[email protected]/neodgm_pro/neodgm_pro.woff2') format('woff2'), | ||
url('https://cdn.jsdelivr.net/gh/neodgm/[email protected]/neodgm_pro/neodgm_pro.woff') format('woff'), | ||
url('https://cdn.jsdelivr.net/gh/neodgm/[email protected]/neodgm_pro/neodgm_pro.ttf') format('truetype'); | ||
font-weight: normal; | ||
font-display: swap; | ||
} | ||
|
||
@layer components { | ||
/* 스크롤바 hide 기능 */ | ||
/* Hide scrollbar for Chrome, Safari and Opera */ | ||
|
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
Oops, something went wrong.