Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions apps/frontend/src/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
//TODO: Make prettier
export const Loader = () => {
return <div>Loading..</div>;
const svgStyle: React.CSSProperties = {
shapeRendering: 'geometricPrecision',
textRendering: 'geometricPrecision',
imageRendering: 'auto',
fillRule: 'evenodd',
clipRule: 'evenodd',
};

const pathStyle: React.CSSProperties = {
fill: '#ffffff',
fillRule: 'nonzero',
};

return (
<div className="flex justify-center h-screen">
<div className=" flex flex-col justify-center">
<svg
xmlns="http://www.w3.org/2000/svg"
width="500"
height="500"
viewBox="0 0 6.827 6.827"
style={svgStyle}
>
<path
d="M4.2 4.311a.106.106 0 0 1 .02-.086c.173-.224.057-.37-.108-.498a3.683 3.683 0 0 0-.147-.106 2.54 2.54 0 0 1-.646-.618 1.078 1.078 0 0 1-.217-.616c0-.168.075-.266.167-.311a.287.287 0 0 1 .218-.016c.085.027.15.094.153.183a.2.2 0 0 0 .06.13c.033.03.084.048.161.045a.538.538 0 0 0 .085-.012c.371-.079.477-.003.634.111.032.023.067.048.107.073a2.246 2.246 0 0 0 .195-.237c.03-.045.055-.083.053-.099-.001-.015-.027-.037-.097-.074a1.322 1.322 0 0 1-.607-.568.429.429 0 0 0-.087-.115.37.37 0 0 0-.113-.074.106.106 0 0 1-.06-.138.582.582 0 0 1 .04-.074.71.71 0 0 0 .082-.176l-.085.096c-.05.058-.096.11-.122.133a.106.106 0 0 1-.096.024 1.457 1.457 0 0 0-.33-.042c-.364-.004-.7.135-.966.364a1.753 1.753 0 0 0-.602 1.297c-.003.238.05.471.127.676.1.264.238.478.347.594.03.027.043.07.03.11a.24.24 0 0 0-.009.03.106.106 0 0 1-.113.08c-.101-.01-.158.004-.18.029l-.003.005a.027.027 0 0 0 .005.016c.02.037.077.072.167.083a.106.106 0 0 1 .094.112c-.014.209-.111.32-.193.416-.071.081-.123.14.057.33.037.04.039.102.003.143a.595.595 0 0 0-.09.122h2.32a.576.576 0 0 0-.087-.12.106.106 0 0 1 0-.144c.18-.19.129-.25.058-.331-.083-.095-.18-.207-.193-.416v-.01a.106.106 0 0 1 .109-.103c.037.001.062-.014.072-.035a.055.055 0 0 0 .001-.05c-.011-.024-.045-.044-.106-.046A.107.107 0 0 1 4.2 4.31zm.275-.089c.063.031.107.078.132.132a.265.265 0 0 1-.003.234.271.271 0 0 1-.143.133.55.55 0 0 0 .125.197c.133.154.232.269 0 .546a.475.475 0 0 1 .053.083.525.525 0 0 1 .048.205.107.107 0 0 1-.106.115H2.007a.107.107 0 0 1-.105-.12.517.517 0 0 1 .047-.2.475.475 0 0 1 .054-.083c-.233-.277-.134-.392 0-.546a.545.545 0 0 0 .125-.2.377.377 0 0 1-.224-.179.238.238 0 0 1-.025-.124.22.22 0 0 1 .054-.13.307.307 0 0 1 .172-.092 2.309 2.309 0 0 1-.285-.535 1.936 1.936 0 0 1-.086-1.19c.099-.4.32-.761.622-1.02a1.662 1.662 0 0 1 1.424-.38c.02-.021.043-.048.068-.077.081-.093.175-.2.23-.23a.106.106 0 0 1 .11.004c.22.145.11.372.027.517a.618.618 0 0 1 .207.236c.04.074.118.164.209.248a1.5 1.5 0 0 0 .306.226c.145.077.202.156.21.243.008.088-.035.156-.087.235a.11.11 0 0 1-.004.005c-.096.142-.272.322-.273.322a.106.106 0 0 1-.13.018c-.084-.044-.144-.087-.197-.125-.112-.081-.187-.135-.467-.076a.747.747 0 0 1-.118.016.423.423 0 0 1-.312-.097.396.396 0 0 1-.131-.28c0-.008-.003.01-.007.01a.077.077 0 0 0-.057.003c-.027.014-.048.05-.048.12 0 .177.071.343.178.496a2.334 2.334 0 0 0 .593.565c.053.037.107.074.155.112.223.173.387.37.233.663z"
style={pathStyle}
/>
<path style={{ fill: 'none' }} d="M0 0h6.827v6.827H0z" />
</svg>
<div className=" flex justify-center text-3xl text-white">
<div>Loading</div>
<div className="flex mt-6 ml-2">
<div className="h-2 w-2 bg-white rounded-full animate-bounce [animation-delay:-0.3s] mr-1"></div>
<div className="h-2 w-2 bg-white rounded-full animate-bounce [animation-delay:-0.15s] mr-1"></div>
<div className="h-2 w-2 bg-white rounded-full animate-bounce"></div>
</div>
</div>
</div>
</div>
);
};
8 changes: 7 additions & 1 deletion apps/frontend/src/screens/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import MovesTable from '../components/MovesTable';
import { useUser } from '@repo/store/useUser';
import { UserAvatar } from '../components/UserAvatar';
import { Loader } from '../components/Loader';

// TODO: Move together, there's code repetition here
export const INIT_GAME = 'init_game';
Expand Down Expand Up @@ -134,7 +135,12 @@ export const Game = () => {
}
}, [chess, socket]);

if (!socket) return <div>Connecting...</div>;
if (!socket)
return (
<div>
<Loader />
</div>
);

return (
<div className="">
Expand Down