Skip to content

Commit

Permalink
Inicia projeto do Gym - Cesmac
Browse files Browse the repository at this point in the history
  • Loading branch information
avoguga committed Oct 3, 2022
0 parents commit decf637
Show file tree
Hide file tree
Showing 28 changed files with 2,610 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "gym",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@firebase/app": "^0.7.33",
"@types/axios": "^0.14.0",
"@types/styled-components": "^5.1.26",
"axios": "^0.27.2",
"firebase": "^9.10.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-draggable": "^4.4.5",
"styled-components": "^5.3.6"
},
"devDependencies": {
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.1.0",
"typescript": "^4.6.4",
"vite": "^3.1.0"
}
}
1 change: 1 addition & 0 deletions public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import Footer from "./components/Footer";
import MainHeader from "./components/MainHeader";
import { Context } from "./contexts/AppContext";
import { Layout } from "./styles/Layout";
import { initializeApp } from "firebase/app";
import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth";
import { useEffect, useState } from "react";
import Content from "./components/Content";
import Sound from "./assets/dale.mp3";

// Types - Interfaces

interface IUser {
name: string;
}

// Config Firebase

// const firebaseConfig = {
// apiKey: import.meta.env.VITE_API_KEY,
// authDomain: import.meta.env.VITE_AUTH_DOMAIN,
// projectId: import.meta.env.VITE_PROJECT_ID,
// storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
// messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
// appId: import.meta.env.VITE_APP_ID,
// };

/** Initialize Firebase */
// const app = initializeApp(firebaseConfig);

// export const auth = getAuth(app);

const provider = new GoogleAuthProvider();

function App() {
// Hooks
const [userProfile, setUserProfile] = useState<IUser>();
const [userEmail, setUserEmail] = useState();
const [userName, setUserName] = useState();
const [error, setError] = useState();
const [isUserLogIn, setIsUserLogIn] = useState(true);

const audioTune = new Audio(Sound);

const [audio, setAudio] = useState(audioTune);
const [playInLoop, setPlayInLoop] = useState(false);
const [isDale, setIsDale] = useState(false);

useEffect(() => {
audioTune.load();
}, []);

useEffect(() => {
audioTune.loop = playInLoop;
}, [playInLoop]);

/** Toca a musica */
const playSound = () => {
audio.play();
setIsDale(true);
};

/** Pausa a musica */
const pauseSound = () => {
setIsDale(false);
audio.pause();
};

/** Para a musica */
const stopSound = () => {
setIsDale(false);
audio.pause();
audio.currentTime = 0;
};

// const signInWithGoogle = () => {
// signInWithPopup(auth, provider)
// .then((result) => {
// const name: any = result.user.displayName;
// const email: any = result.user.email;
// const profilePic: any = result.user.photoURL;

// setUserName(name);
// setUserEmail(email);
// setUserProfile(profilePic);
// setIsUserLogIn(false);
// })
// .catch((error) => {
// console.log(error);
// setError(error);
// });
// };

return (
<Layout>
<Context.Provider
value={{
userName,
userProfile,
// signInWithGoogle,
isUserLogIn,
error,
playSound,
pauseSound,
stopSound,
isDale,
}}
>
<MainHeader />
<Content />
<Footer />
</Context.Provider>
</Layout>
);
}

export default App;
Binary file added src/assets/1663003133164.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/dale.mp3
Binary file not shown.
Binary file added src/assets/gugas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/sound.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/assets/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/components/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
MainContainer,
FirstSection,
SecondSection,
ThirdSection,
} from "./styles";

export function Content() {
return (
<MainContainer>
<FirstSection>


</FirstSection>
</MainContainer>
);
}

export default Content;
26 changes: 26 additions & 0 deletions src/components/Content/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import styled from "styled-components";

export const MainContainer = styled.main`
grid-area: CT;
background-color: whitesmoke;
display: flex;
justify-content: space-around;
align-items: center;
`;

export const FirstSection = styled.div`
height: 100%;
width: 100%;
padding: 10px;
`;

export const SecondSection = styled.div`
height: 100%;
width: 100%;
`;

export const ThirdSection = styled.div`
height: 100%;
width: 100%;
`;
49 changes: 49 additions & 0 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useContext } from "react";
import {
FooterContainer,
SoundButton,
PauseButton,
StopButton,
Text,
SocialMedia,
SoundSection
} from "./styles";
import { Context } from "../../contexts/AppContext";

export function Footer() {
const { userName, isDale, playSound, pauseSound, stopSound }: any =
useContext(Context);

return (
<FooterContainer isDale={isDale}>

<SocialMedia>
<Text>Acesse as redes:</Text>
<br />
<a href="https://www.linkedin.com/" target="_blank">
<img
src="https://www.svgrepo.com/show/138936/linkedin.svg"
alt="Acesse o LinkedIn"
style={{ width: "40px" }}
/>
</a>
<a href="https://twitter.com/" target="_blank">
<img
src="https://www.svgrepo.com/show/157815/twitter.svg"
alt="Acesse o Twitter"
style={{ width: "40px" }}
/>
</a>
<a href="https://www.instagram.com/" target="_blank">
<img
src="https://www.svgrepo.com/show/217758/instagram.svg"
alt="Acesse o Instagram"
style={{ width: "40px" }}
/>
</a>
</SocialMedia>
</FooterContainer>
);
}

export default Footer;
Loading

0 comments on commit decf637

Please sign in to comment.