Skip to content

Commit

Permalink
#
Browse files Browse the repository at this point in the history
  • Loading branch information
xvpc committed Mar 3, 2024
1 parent e6b502a commit 1bf1d3f
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 38 deletions.
2 changes: 2 additions & 0 deletions components/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Button } from '@mui/material'

// Icons
import { FcMoneyTransfer } from 'react-icons/fc'

// Utils
import { siteInfo } from '@/utils/Assets'


Expand Down
6 changes: 4 additions & 2 deletions components/Game.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'
import React, { useContext, useEffect, useRef, useState } from 'react'

// NextJs
import { useRouter } from 'next/router';
Expand All @@ -7,11 +7,13 @@ import { useRouter } from 'next/router';
import { Button, FormControl, InputLabel, MenuItem, Select, SelectChangeEvent } from '@mui/material';

// Icons
import { BsCursorText } from 'react-icons/bs';
import { CiCircleRemove } from 'react-icons/ci';

// Utils
import FormatTime from '@/utils/Format';
import { userContext } from '@/utils/UserProvider';


type GameProps = {
text: string,
}
Expand Down
10 changes: 8 additions & 2 deletions components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ export default function Home(){
const [loading, setLoading] = useState(true);

useEffect(() => {
if(user && textData?.length > 0){
if(user && textData){
try{
setText(textData[Math.floor(Math.random() * textData.length)]);
if(user.time > 180){
setText(textData.lvl3[Math.floor(Math.random() * textData.lvl3.length)]);
}else if(user.time > 60 && user.time != 180){
setText(textData.lvl2[Math.floor(Math.random() * textData.lvl2.length)]);
}else{
setText(textData.lvl1[Math.floor(Math.random() * textData.lvl1.length)]);
}
}catch(err: any){
setError(err || "Something went wrong!");
console.log(err);
Expand Down
18 changes: 12 additions & 6 deletions components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import React, { createContext } from 'react'
import React from 'react'

// NextJs
import Head from 'next/head';
import Link from 'next/link';

// Fonts
import { Inter } from "next/font/google";
const inter = Inter({ subsets: ["latin"] });

// Themes
import { useState, useEffect } from 'react'
import { FiMoon, FiSun } from 'react-icons/fi';
import { useTheme } from 'next-themes';
import { Button, FormControlLabel, Switch, styled } from '@mui/material';

// Mui
import { FormControlLabel, Switch, styled } from '@mui/material';

// Icons
import { IoIosArrowDown } from 'react-icons/io';
import { FcMoneyTransfer } from 'react-icons/fc';
import Link from 'next/link';


// Utils
import { siteInfo } from '@/utils/Assets';


type LayoutProps = {
children: React.ReactNode,
title?: string,
Expand All @@ -30,7 +36,7 @@ export default function Layout({ children, title, description, keywords, image }
const { systemTheme, theme, setTheme } = useTheme();
const currentTheme = theme === 'system' ? systemTheme : theme;


// Thme Switch
const MaterialUISwitch = styled(Switch)(({ theme }) => ({
width: 62,
height: 34,
Expand Down
4 changes: 1 addition & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// NextJs
import Image from "next/image";
import React from "react";

// Components
import Home from "@/components/Home";



export default function Main(){

return <Home />
Expand Down
Loading

0 comments on commit 1bf1d3f

Please sign in to comment.