Skip to content

Commit

Permalink
💄 randomize empty emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
dxanh97 committed Oct 14, 2024
1 parent aaf79e6 commit 2598916
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/components/game-screen/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ function Leaderboard(props: Props) {
</ScrollArea>
) : (
<Empty
emoji="🏜️"
subTitle={
<>
Thêm <b>{3 - rounds.length}</b> ván nữa đê
Expand Down
2 changes: 1 addition & 1 deletion src/components/game-screen/RoundsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function RoundsList(props: Props) {

return (
<ScrollArea>
{rounds.length === 0 && <Empty emoji="🃏" subTitle="Chưa có ván nào" />}
{rounds.length === 0 && <Empty subTitle="Chưa có ván nào" />}

{rounds.map((round, i) => {
const { id, stats, timestamp } = round;
Expand Down
9 changes: 6 additions & 3 deletions src/components/shared/Empty.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { Box, Text } from '@mantine/core';

const emojis = ['👀', '🫥', '🏜️', '🏝️', '💤', '🥱', '🗿', '📂', '🃏', '📜'];

interface Props {
emoji: string;
title?: string;
subTitle?: React.ReactNode;
}

function Empty(props: Props) {
const { emoji, title = 'Trống quắc', subTitle } = props;
const { title = 'Trống quắc', subTitle } = props;

return (
<Box ta="center" py="150px">
<Text fz="100px">{emoji}</Text>
<Text fz="100px">
{emojis[Math.floor(Math.random() * emojis.length)]}
</Text>
<Text fz="h3" fw={500}>
{title}
</Text>
Expand Down
5 changes: 1 addition & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ root.render(
<Container p="sm" pos="relative">
<BrowserRouter>
<Routes>
<Route
path="/"
element={null} // layout component
>
<Route path="/">
<Route index element={<HomePage />} />
<Route path="/new-game" element={<NewGamePage />} />
<Route path="/game/:gameId" element={<GameScreenPage />} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function HomePage() {
<Box>
<TopNav isHome title="Sải Nhà Cố" />

{allGames.length === 0 && <Empty emoji="👀" subTitle="Tạo game mới đê" />}
{allGames.length === 0 && <Empty subTitle="Tạo game mới đê" />}
{allGames.map((x) => (
<Card key={x.id} shadow="sm" p="xs" mt="sm" radius="md" withBorder>
<Group justify="space-between">
Expand Down

0 comments on commit 2598916

Please sign in to comment.