├── aula 1
└── frontend
│ ├── .eslintrc.json
│ ├── src
│ ├── app
│ │ ├── globals.css
│ │ ├── favicon.ico
│ │ ├── page.tsx
│ │ ├── layout.tsx
│ │ └── room
│ │ │ └── [id]
│ │ │ └── page.tsx
│ ├── components
│ │ ├── Container.tsx
│ │ ├── Button.tsx
│ │ ├── Create.tsx
│ │ ├── Header.tsx
│ │ ├── Join.tsx
│ │ ├── Input.tsx
│ │ ├── Chat.tsx
│ │ ├── FormWrapper.tsx
│ │ └── Footer.tsx
│ └── Icons
│ │ ├── index.ts
│ │ ├── Phone.tsx
│ │ ├── Computer.tsx
│ │ ├── Mic.tsx
│ │ ├── Camera.tsx
│ │ ├── Vercel.tsx
│ │ ├── NoComputer.tsx
│ │ ├── NoMic.tsx
│ │ ├── NoCamera.tsx
│ │ ├── Next.tsx
│ │ └── Logo.tsx
│ ├── public
│ ├── send.png
│ ├── vercel.svg
│ ├── computer.svg
│ ├── no_computer.svg
│ ├── phone.svg
│ ├── next.svg
│ ├── camera.svg
│ ├── no_camera.svg
│ ├── mic.svg
│ ├── no_mic.svg
│ └── logo.svg
│ ├── next.config.mjs
│ ├── postcss.config.js
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── package.json
│ ├── tailwind.config.ts
│ └── README.md
├── aula 2
├── frontend
│ ├── .eslintrc.json
│ ├── src
│ │ ├── app
│ │ │ ├── globals.css
│ │ │ ├── favicon.ico
│ │ │ ├── page.tsx
│ │ │ ├── layout.tsx
│ │ │ └── room
│ │ │ │ └── [id]
│ │ │ │ └── page.tsx
│ │ ├── components
│ │ │ ├── Container.tsx
│ │ │ ├── Button.tsx
│ │ │ ├── Header.tsx
│ │ │ ├── Input.tsx
│ │ │ ├── Join.tsx
│ │ │ ├── Create.tsx
│ │ │ ├── FormWrapper.tsx
│ │ │ ├── Footer.tsx
│ │ │ └── Chat.tsx
│ │ ├── Icons
│ │ │ ├── index.ts
│ │ │ ├── Phone.tsx
│ │ │ ├── Computer.tsx
│ │ │ ├── Mic.tsx
│ │ │ ├── Camera.tsx
│ │ │ ├── Vercel.tsx
│ │ │ ├── NoComputer.tsx
│ │ │ ├── NoMic.tsx
│ │ │ ├── NoCamera.tsx
│ │ │ ├── Next.tsx
│ │ │ └── Logo.tsx
│ │ └── contexts
│ │ │ └── SocketContext.tsx
│ ├── public
│ │ ├── send.png
│ │ ├── vercel.svg
│ │ ├── computer.svg
│ │ ├── no_computer.svg
│ │ ├── phone.svg
│ │ ├── next.svg
│ │ ├── camera.svg
│ │ ├── no_camera.svg
│ │ ├── mic.svg
│ │ ├── no_mic.svg
│ │ └── logo.svg
│ ├── next.config.mjs
│ ├── postcss.config.js
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── package.json
│ ├── tailwind.config.ts
│ └── README.md
└── backend
│ ├── src
│ ├── main.ts
│ └── app.ts
│ ├── package.json
│ └── tsconfig.json
├── aula 3
├── frontend
│ ├── .eslintrc.json
│ ├── public
│ │ ├── send.png
│ │ ├── vercel.svg
│ │ ├── computer.svg
│ │ ├── no_computer.svg
│ │ ├── phone.svg
│ │ ├── next.svg
│ │ ├── camera.svg
│ │ ├── no_camera.svg
│ │ ├── mic.svg
│ │ ├── no_mic.svg
│ │ └── logo.svg
│ ├── src
│ │ ├── app
│ │ │ ├── favicon.ico
│ │ │ ├── globals.css
│ │ │ ├── page.tsx
│ │ │ ├── layout.tsx
│ │ │ └── room
│ │ │ │ └── [id]
│ │ │ │ └── page.tsx
│ │ ├── components
│ │ │ ├── Container.tsx
│ │ │ ├── Button.tsx
│ │ │ ├── Header.tsx
│ │ │ ├── Input.tsx
│ │ │ ├── Create.tsx
│ │ │ ├── Join.tsx
│ │ │ ├── FormWrapper.tsx
│ │ │ ├── Chat.tsx
│ │ │ └── Footer.tsx
│ │ ├── Icons
│ │ │ ├── index.ts
│ │ │ ├── Phone.tsx
│ │ │ ├── Computer.tsx
│ │ │ ├── Mic.tsx
│ │ │ ├── Camera.tsx
│ │ │ ├── Vercel.tsx
│ │ │ ├── NoComputer.tsx
│ │ │ ├── NoMic.tsx
│ │ │ ├── NoCamera.tsx
│ │ │ ├── Next.tsx
│ │ │ └── Logo.tsx
│ │ └── contexts
│ │ │ └── SocketContext.tsx
│ ├── next.config.mjs
│ ├── postcss.config.js
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── package.json
│ ├── tailwind.config.ts
│ └── README.md
└── backend
│ ├── src
│ ├── main.ts
│ └── app.ts
│ ├── package.json
│ └── tsconfig.json
└── README.md
/aula 1/frontend/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/aula 2/frontend/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/aula 3/frontend/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
--------------------------------------------------------------------------------
/aula 2/frontend/src/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
--------------------------------------------------------------------------------
/aula 1/frontend/public/send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 1/frontend/public/send.png
--------------------------------------------------------------------------------
/aula 2/frontend/public/send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 2/frontend/public/send.png
--------------------------------------------------------------------------------
/aula 3/frontend/public/send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 3/frontend/public/send.png
--------------------------------------------------------------------------------
/aula 1/frontend/src/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 1/frontend/src/app/favicon.ico
--------------------------------------------------------------------------------
/aula 2/frontend/src/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 2/frontend/src/app/favicon.ico
--------------------------------------------------------------------------------
/aula 3/frontend/src/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeroCodeBR/semana-heroi-03/HEAD/aula 3/frontend/src/app/favicon.ico
--------------------------------------------------------------------------------
/aula 2/backend/src/main.ts:
--------------------------------------------------------------------------------
1 | import { App } from './app';
2 |
3 | const app = new App();
4 |
5 | app.listen();
6 | app.listenSocket();
7 |
--------------------------------------------------------------------------------
/aula 3/backend/src/main.ts:
--------------------------------------------------------------------------------
1 | import { App } from './app';
2 |
3 | const app = new App();
4 |
5 | app.listen();
6 | app.listenSocket();
7 |
--------------------------------------------------------------------------------
/aula 1/frontend/next.config.mjs:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | export default nextConfig;
5 |
--------------------------------------------------------------------------------
/aula 1/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/aula 2/frontend/next.config.mjs:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | export default nextConfig;
5 |
--------------------------------------------------------------------------------
/aula 2/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/aula 3/frontend/next.config.mjs:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | export default nextConfig;
5 |
--------------------------------------------------------------------------------
/aula 3/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Container.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 |
3 | export default function Container({ children }: { children: ReactNode }) {
4 | return
{children}
;
5 | }
6 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Container.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 |
3 | export default function Container({ children }: { children: ReactNode }) {
4 | return {children}
;
5 | }
6 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | .mirror-mode {
6 | -ms-transform: scaleX(-1);
7 | -webkit-transform: scaleX(-1);
8 | transform: scaleX(-1);
9 |
10 | }
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Container.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 |
3 | export default function Container({ children }: { children: ReactNode }) {
4 | return {children}
;
5 | }
6 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Button.tsx:
--------------------------------------------------------------------------------
1 | interface IButton {
2 | title: string;
3 | type: 'button' | 'submit' | 'reset';
4 | }
5 | export default function Button({ title, type }: IButton) {
6 | return (
7 |
11 | {title}
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Button.tsx:
--------------------------------------------------------------------------------
1 | interface IButton {
2 | title: string;
3 | type: 'button' | 'submit' | 'reset';
4 | }
5 | export default function Button({ title, type }: IButton) {
6 | return (
7 |
11 | {title}
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Button.tsx:
--------------------------------------------------------------------------------
1 | interface IButton {
2 | title: string;
3 | type: 'button' | 'submit' | 'reset';
4 | }
5 | export default function Button({ title, type }: IButton) {
6 | return (
7 |
11 | {title}
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Create.tsx:
--------------------------------------------------------------------------------
1 | import { useRef } from 'react';
2 | import Button from './Button';
3 | import { Input } from './Input';
4 |
5 | export default function CreateRoom() {
6 | const name = useRef(null);
7 |
8 | return (
9 | <>
10 |
11 |
12 |
13 | >
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/app/page.tsx:
--------------------------------------------------------------------------------
1 | import FormWrapper from '@/components/FormWrapper';
2 | import Header from '@/components/Header';
3 |
4 | export default function Home() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/app/page.tsx:
--------------------------------------------------------------------------------
1 | import FormWrapper from '@/components/FormWrapper';
2 | import Header from '@/components/Header';
3 |
4 | export default function Home() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/app/page.tsx:
--------------------------------------------------------------------------------
1 | import FormWrapper from '@/components/FormWrapper';
2 | import Header from '@/components/Header';
3 |
4 | export default function Home() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import Image from 'next/image';
2 | import Container from './Container';
3 |
4 | export default function Header() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import Image from 'next/image';
2 | import Container from './Container';
3 |
4 | export default function Header() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import Image from 'next/image';
2 | import Container from './Container';
3 |
4 | export default function Header() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Join.tsx:
--------------------------------------------------------------------------------
1 | import { useRef } from 'react';
2 | import Button from './Button';
3 | import { Input } from './Input';
4 |
5 | export default function JoinRoom() {
6 | const name = useRef(null);
7 | const id = useRef(null);
8 | return (
9 | <>
10 |
11 |
12 |
13 |
14 | >
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/index.ts:
--------------------------------------------------------------------------------
1 | export { default as Camera } from "./Camera";
2 | export { default as Computer } from "./Computer";
3 | export { default as Hero } from "./Hero";
4 | export { default as Logo } from "./Logo";
5 | export { default as Mic } from "./Mic";
6 | export { default as Next } from "./Next";
7 | export { default as NoCamera } from "./NoCamera";
8 | export { default as NoComputer } from "./NoComputer";
9 | export { default as NoMic } from "./NoMic";
10 | export { default as Phone } from "./Phone";
11 | export { default as Vercel } from "./Vercel";
12 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/index.ts:
--------------------------------------------------------------------------------
1 | export { default as Camera } from "./Camera";
2 | export { default as Computer } from "./Computer";
3 | export { default as Hero } from "./Hero";
4 | export { default as Logo } from "./Logo";
5 | export { default as Mic } from "./Mic";
6 | export { default as Next } from "./Next";
7 | export { default as NoCamera } from "./NoCamera";
8 | export { default as NoComputer } from "./NoComputer";
9 | export { default as NoMic } from "./NoMic";
10 | export { default as Phone } from "./Phone";
11 | export { default as Vercel } from "./Vercel";
12 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/index.ts:
--------------------------------------------------------------------------------
1 | export { default as Camera } from "./Camera";
2 | export { default as Computer } from "./Computer";
3 | export { default as Hero } from "./Hero";
4 | export { default as Logo } from "./Logo";
5 | export { default as Mic } from "./Mic";
6 | export { default as Next } from "./Next";
7 | export { default as NoCamera } from "./NoCamera";
8 | export { default as NoComputer } from "./NoComputer";
9 | export { default as NoMic } from "./NoMic";
10 | export { default as Phone } from "./Phone";
11 | export { default as Vercel } from "./Vercel";
12 |
--------------------------------------------------------------------------------
/aula 1/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 | .yarn/install-state.gz
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /.next/
14 | /out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 |
23 | # debug
24 | npm-debug.log*
25 | yarn-debug.log*
26 | yarn-error.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
34 | # typescript
35 | *.tsbuildinfo
36 | next-env.d.ts
37 |
--------------------------------------------------------------------------------
/aula 2/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 | .yarn/install-state.gz
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /.next/
14 | /out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 |
23 | # debug
24 | npm-debug.log*
25 | yarn-debug.log*
26 | yarn-error.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
34 | # typescript
35 | *.tsbuildinfo
36 | next-env.d.ts
37 |
--------------------------------------------------------------------------------
/aula 3/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 | .yarn/install-state.gz
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /.next/
14 | /out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 |
23 | # debug
24 | npm-debug.log*
25 | yarn-debug.log*
26 | yarn-error.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
34 | # typescript
35 | *.tsbuildinfo
36 | next-env.d.ts
37 |
--------------------------------------------------------------------------------
/aula 2/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "dev": "tsx --watch src/main.ts"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "@types/express": "^4.17.21",
15 | "tsx": "^4.7.0",
16 | "typescript": "^5.3.3"
17 | },
18 | "dependencies": {
19 | "cors": "^2.8.5",
20 | "express": "^4.18.2",
21 | "socket.io": "^4.7.4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/aula 3/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "dev": "tsx --watch src/main.ts"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "@types/express": "^4.17.21",
15 | "tsx": "^4.7.0",
16 | "typescript": "^5.3.3"
17 | },
18 | "dependencies": {
19 | "cors": "^2.8.5",
20 | "express": "^4.18.2",
21 | "socket.io": "^4.7.4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import type { Metadata } from 'next';
2 | import { Rubik } from 'next/font/google';
3 | import './globals.css';
4 |
5 | const rubik = Rubik({ subsets: ['latin'] });
6 |
7 | export const metadata: Metadata = {
8 | title: 'Talk to Me!',
9 | description: 'Generated by create next app',
10 | };
11 |
12 | export default function RootLayout({
13 | children,
14 | }: Readonly<{
15 | children: React.ReactNode;
16 | }>) {
17 | return (
18 |
19 |
20 | {children}
21 |
22 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Input.tsx:
--------------------------------------------------------------------------------
1 | import { ForwardRefRenderFunction, forwardRef } from 'react';
2 | interface IInput {
3 | placeholder: string;
4 | type: string;
5 | }
6 | const InputBase: ForwardRefRenderFunction = (
7 | { placeholder, type, ...rest },
8 | ref,
9 | ) => {
10 | return (
11 |
12 |
19 |
20 | );
21 | };
22 | export const Input = forwardRef(InputBase);
23 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Input.tsx:
--------------------------------------------------------------------------------
1 | import { ForwardRefRenderFunction, forwardRef } from 'react';
2 | interface IInput {
3 | placeholder: string;
4 | type: string;
5 | }
6 | const InputBase: ForwardRefRenderFunction = (
7 | { placeholder, type, ...rest },
8 | ref,
9 | ) => {
10 | return (
11 |
12 |
19 |
20 | );
21 | };
22 | export const Input = forwardRef(InputBase);
23 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Input.tsx:
--------------------------------------------------------------------------------
1 | import { ForwardRefRenderFunction, forwardRef } from 'react';
2 | interface IInput {
3 | placeholder: string;
4 | type: string;
5 | }
6 | const InputBase: ForwardRefRenderFunction = (
7 | { placeholder, type, ...rest },
8 | ref,
9 | ) => {
10 | return (
11 |
12 |
19 |
20 | );
21 | };
22 | export const Input = forwardRef(InputBase);
23 |
--------------------------------------------------------------------------------
/aula 1/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "incremental": true,
15 | "plugins": [
16 | {
17 | "name": "next"
18 | }
19 | ],
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | },
24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25 | "exclude": ["node_modules"]
26 | }
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "incremental": true,
15 | "plugins": [
16 | {
17 | "name": "next"
18 | }
19 | ],
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | },
24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25 | "exclude": ["node_modules"]
26 | }
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "incremental": true,
15 | "plugins": [
16 | {
17 | "name": "next"
18 | }
19 | ],
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | },
24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25 | "exclude": ["node_modules"]
26 | }
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import type { Metadata } from 'next';
2 | import { Rubik } from 'next/font/google';
3 | import './globals.css';
4 | import { SocketProvider } from '@/contexts/SocketContext';
5 |
6 | const rubik = Rubik({ subsets: ['latin'] });
7 |
8 | export const metadata: Metadata = {
9 | title: 'Talk to Me!',
10 | description: 'Generated by create next app',
11 | };
12 |
13 | export default function RootLayout({
14 | children,
15 | }: Readonly<{
16 | children: React.ReactNode;
17 | }>) {
18 | return (
19 |
20 |
21 | {children}
22 |
23 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import type { Metadata } from 'next';
2 | import { Rubik } from 'next/font/google';
3 | import './globals.css';
4 | import { SocketProvider } from '@/contexts/SocketContext';
5 |
6 | const rubik = Rubik({ subsets: ['latin'] });
7 |
8 | export const metadata: Metadata = {
9 | title: 'Talk to Me!',
10 | description: 'Generated by create next app',
11 | };
12 |
13 | export default function RootLayout({
14 | children,
15 | }: Readonly<{
16 | children: React.ReactNode;
17 | }>) {
18 | return (
19 |
20 |
21 | {children}
22 |
23 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/no_computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/no_computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/no_computer.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 1/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint",
10 | "svgr": "svgr --icon --title-prop --no-dimensions --typescript -d src/Icons public"
11 | },
12 | "dependencies": {
13 | "next": "14.1.0",
14 | "react": "^18",
15 | "react-dom": "^18"
16 | },
17 | "devDependencies": {
18 | "@svgr/cli": "^8.1.0",
19 | "@types/node": "^20",
20 | "@types/react": "^18",
21 | "@types/react-dom": "^18",
22 | "autoprefixer": "^10.0.1",
23 | "eslint": "^8",
24 | "eslint-config-next": "14.1.0",
25 | "postcss": "^8",
26 | "tailwindcss": "^3.3.0",
27 | "typescript": "^5"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/contexts/SocketContext.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { ReactNode, createContext, useEffect, useState } from 'react';
4 | import { Socket, io } from 'socket.io-client';
5 |
6 | interface ISocketContext {
7 | socket: Socket | null;
8 | }
9 | export const SocketContext = createContext({} as ISocketContext);
10 |
11 | export function SocketProvider({ children }: { children: ReactNode }) {
12 | const [socket, setSocket] = useState(null);
13 |
14 | useEffect(() => {
15 | const newSocket = io(`${process.env.NEXT_PUBLIC_API_URL}/streams`, {
16 | transports: ['websocket'],
17 | });
18 | setSocket(newSocket);
19 | }, []);
20 | return (
21 |
22 | {children}
23 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/contexts/SocketContext.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { ReactNode, createContext, useEffect, useState } from 'react';
4 | import { Socket, io } from 'socket.io-client';
5 |
6 | interface ISocketContext {
7 | socket: Socket | null;
8 | }
9 | export const SocketContext = createContext({} as ISocketContext);
10 |
11 | export function SocketProvider({ children }: { children: ReactNode }) {
12 | const [socket, setSocket] = useState(null);
13 |
14 | useEffect(() => {
15 | const newSocket = io(`${process.env.NEXT_PUBLIC_API_URL}/streams`, {
16 | transports: ['websocket'],
17 | });
18 | setSocket(newSocket);
19 | }, []);
20 | return (
21 |
22 | {children}
23 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # 🦸🏻♂️ Semana do Herói - Terceira Edição ˜ 🦸🏻♀️
4 |
5 | Bem vindos a terceira edição da Semana do Herói! Aqui você encontra o código do projeto que desenvolvemos dividido por aulas
6 |
7 | ## Não esqueça de deixar uma ⭐ no repositório!
8 |
9 |
10 | # Inscrições abertas para nosso treinamento Hero Pro!!
11 | Acesse o link e aproveite a oportunidade: [Acesse aqui](https://herocode.com.br/hero-pro?utm_campaign=github_repo_sh)
12 |
13 | ## Dúvidas e Suporte
14 |
15 | Toda nossa comunicação será feita na nossa comunidade no discord, então, é crucial você estar lá dentro para interagir e conhecer outros devs.
16 |
17 | Link da comunidade: [clique aqui para entrar](https://discord.gg/rHqjd8uQZd)
18 |
19 | E aí, bora ser um _hero_?
20 |
--------------------------------------------------------------------------------
/aula 2/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint",
10 | "svgr": "svgr --icon --title-prop --no-dimensions --typescript -d src/Icons public"
11 | },
12 | "dependencies": {
13 | "next": "14.1.0",
14 | "react": "^18",
15 | "react-dom": "^18",
16 | "socket.io-client": "^4.7.4"
17 | },
18 | "devDependencies": {
19 | "@svgr/cli": "^8.1.0",
20 | "@types/node": "^20",
21 | "@types/react": "^18",
22 | "@types/react-dom": "^18",
23 | "autoprefixer": "^10.0.1",
24 | "eslint": "^8",
25 | "eslint-config-next": "14.1.0",
26 | "postcss": "^8",
27 | "tailwindcss": "^3.3.0",
28 | "typescript": "^5"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/aula 3/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint",
10 | "svgr": "svgr --icon --title-prop --no-dimensions --typescript -d src/Icons public"
11 | },
12 | "dependencies": {
13 | "next": "14.1.0",
14 | "react": "^18",
15 | "react-dom": "^18",
16 | "socket.io-client": "^4.7.4"
17 | },
18 | "devDependencies": {
19 | "@svgr/cli": "^8.1.0",
20 | "@types/node": "^20",
21 | "@types/react": "^18",
22 | "@types/react-dom": "^18",
23 | "autoprefixer": "^10.0.1",
24 | "eslint": "^8",
25 | "eslint-config-next": "14.1.0",
26 | "postcss": "^8",
27 | "tailwindcss": "^3.3.0",
28 | "typescript": "^5"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/aula 1/frontend/tailwind.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from 'tailwindcss';
2 |
3 | const config: Config = {
4 | content: [
5 | './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
6 | './src/components/**/*.{js,ts,jsx,tsx,mdx}',
7 | './src/app/**/*.{js,ts,jsx,tsx,mdx}',
8 | ],
9 | theme: {
10 | extend: {
11 | backgroundImage: {
12 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
13 | 'gradient-conic':
14 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
15 | },
16 | colors: {
17 | 'gray-1000': '#2E2E2E',
18 | 'gray-950': '#4E4E4E',
19 | black: '#0F0F0F',
20 | primary: '#81E6D9',
21 | secondary: '#212121',
22 | 'gray-900': '#2C2C2C',
23 | },
24 | },
25 | },
26 | plugins: [],
27 | };
28 | export default config;
29 |
--------------------------------------------------------------------------------
/aula 2/frontend/tailwind.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from 'tailwindcss';
2 |
3 | const config: Config = {
4 | content: [
5 | './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
6 | './src/components/**/*.{js,ts,jsx,tsx,mdx}',
7 | './src/app/**/*.{js,ts,jsx,tsx,mdx}',
8 | ],
9 | theme: {
10 | extend: {
11 | backgroundImage: {
12 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
13 | 'gradient-conic':
14 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
15 | },
16 | colors: {
17 | 'gray-1000': '#2E2E2E',
18 | 'gray-950': '#4E4E4E',
19 | black: '#0F0F0F',
20 | primary: '#81E6D9',
21 | secondary: '#212121',
22 | 'gray-900': '#2C2C2C',
23 | },
24 | },
25 | },
26 | plugins: [],
27 | };
28 | export default config;
29 |
--------------------------------------------------------------------------------
/aula 3/frontend/tailwind.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from 'tailwindcss';
2 |
3 | const config: Config = {
4 | content: [
5 | './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
6 | './src/components/**/*.{js,ts,jsx,tsx,mdx}',
7 | './src/app/**/*.{js,ts,jsx,tsx,mdx}',
8 | ],
9 | theme: {
10 | extend: {
11 | backgroundImage: {
12 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
13 | 'gradient-conic':
14 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
15 | },
16 | colors: {
17 | 'gray-1000': '#2E2E2E',
18 | 'gray-950': '#4E4E4E',
19 | black: '#0F0F0F',
20 | primary: '#81E6D9',
21 | secondary: '#212121',
22 | 'gray-900': '#2C2C2C',
23 | },
24 | },
25 | },
26 | plugins: [],
27 | };
28 | export default config;
29 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/phone.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/phone.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/phone.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Phone.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgPhone = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgPhone;
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Phone.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgPhone = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgPhone;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Phone.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgPhone = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgPhone;
27 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Computer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgComputer;
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Computer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgComputer;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Computer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgComputer;
27 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Mic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgMic;
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Mic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgMic;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Mic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgMic;
27 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Camera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgCamera;
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Camera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgCamera;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Camera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgCamera;
27 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Vercel.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgVercel = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgVercel;
27 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Vercel.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgVercel = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgVercel;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Vercel.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgVercel = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
25 | );
26 | export default SvgVercel;
27 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Create.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { FormEvent, useRef } from 'react';
3 | import Button from './Button';
4 | import { Input } from './Input';
5 | import { useRouter } from 'next/navigation';
6 |
7 | export default function CreateRoom() {
8 | const name = useRef(null);
9 | const router = useRouter();
10 |
11 | const handleCreateRoom = (e: FormEvent) => {
12 | e.preventDefault();
13 | if (name.current && name.current.value !== '') {
14 | sessionStorage.setItem('username', name.current.value);
15 | const roomId = generateRandomString();
16 |
17 | window.location.href = `/room/${roomId}`;
18 | }
19 | };
20 |
21 | function generateRandomString() {
22 | const randomString = Math.random().toString(36).substring(2, 7);
23 | return randomString;
24 | }
25 |
26 | return (
27 | <>
28 |
33 | >
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Join.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { FormEvent, useRef } from 'react';
3 | import Button from './Button';
4 | import { Input } from './Input';
5 | import { useRouter } from 'next/navigation';
6 |
7 | export default function JoinRoom() {
8 | const name = useRef(null);
9 | const id = useRef(null);
10 | const router = useRouter();
11 | const handleJoinRoom = (e: FormEvent) => {
12 | e.preventDefault();
13 | if (
14 | name.current &&
15 | name.current.value !== '' &&
16 | id.current &&
17 | id.current.value !== ''
18 | ) {
19 | sessionStorage.setItem('username', name.current.value);
20 | const roomId = id.current.value;
21 | window.location.href = `/room/${roomId}`;
22 | }
23 | };
24 | return (
25 | <>
26 |
32 | >
33 | );
34 | }
35 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Join.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { FormEvent, useRef } from 'react';
3 | import Button from './Button';
4 | import { Input } from './Input';
5 | import { useRouter } from 'next/navigation';
6 |
7 | export default function JoinRoom() {
8 | const name = useRef(null);
9 | const id = useRef(null);
10 | const router = useRouter();
11 | const handleJoinRoom = (e: FormEvent) => {
12 | e.preventDefault();
13 | if (
14 | name.current &&
15 | name.current.value !== '' &&
16 | id.current &&
17 | id.current.value !== ''
18 | ) {
19 | sessionStorage.setItem('username', name.current.value);
20 | const roomId = id.current.value;
21 | window.location.href = `/room/${roomId}`;
22 | }
23 | };
24 | return (
25 | <>
26 |
32 | >
33 | );
34 | }
35 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/NoComputer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
32 |
33 | );
34 | export default SvgNoComputer;
35 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/NoComputer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
32 |
33 | );
34 | export default SvgNoComputer;
35 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/NoComputer.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoComputer = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
32 |
33 | );
34 | export default SvgNoComputer;
35 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Create.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { FormEvent, useRef } from 'react';
3 | import Button from './Button';
4 | import { Input } from './Input';
5 | import { useRouter } from 'next/navigation';
6 |
7 | export default function CreateRoom() {
8 | const name = useRef(null);
9 | const router = useRouter();
10 |
11 | const handleCreateRoom = (e: FormEvent) => {
12 | e.preventDefault();
13 | if (name.current && name.current.value !== '') {
14 | sessionStorage.setItem('username', name.current.value);
15 | const roomId = generateRandomString();
16 | console.log('🚀 ~ handleCreateRoom ~ roomId:', roomId);
17 | router.push(`/room/${roomId}`);
18 | }
19 | };
20 |
21 | function generateRandomString() {
22 | const randomString = Math.random().toString(36).substring(2, 7);
23 | return randomString;
24 | }
25 |
26 | return (
27 | <>
28 |
33 | >
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Chat.tsx:
--------------------------------------------------------------------------------
1 | import Image from 'next/image';
2 |
3 | export default function Chat() {
4 | return (
5 |
6 |
7 |
8 |
9 | Alexia Kattah
10 | 09:15
11 |
12 |
15 |
16 |
17 |
34 |
35 |
36 | );
37 | }
38 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/NoMic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoMic;
36 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/NoMic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoMic;
36 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/NoMic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoMic = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoMic;
36 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/NoCamera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoCamera;
36 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/NoCamera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoCamera;
36 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/NoCamera.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNoCamera = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
33 |
34 | );
35 | export default SvgNoCamera;
36 |
--------------------------------------------------------------------------------
/aula 2/backend/src/app.ts:
--------------------------------------------------------------------------------
1 | import express, { Application } from 'express';
2 | import http from 'http';
3 | import cors from 'cors';
4 | import { Server, Socket } from 'socket.io';
5 | class App {
6 | private app: Application;
7 | private http: http.Server;
8 | private io: Server;
9 | constructor() {
10 | this.app = express();
11 | this.http = new http.Server(this.app);
12 | this.io = new Server(this.http, {
13 | cors: {
14 | origin: '*',
15 | },
16 | });
17 | }
18 | public listen() {
19 | this.http.listen(3333, () => {
20 | console.log('Server running on port 3333');
21 | });
22 | }
23 |
24 | public listenSocket() {
25 | this.io.of('/streams').on('connection', this.socketEvents);
26 | }
27 | private socketEvents(socket: Socket) {
28 | console.log('Socket connected: ' + socket.id);
29 | socket.on('subscribe', (data) => {
30 | console.log('usuario inserido na sala: ' + data.roomId);
31 | socket.join(data.roomId);
32 |
33 | socket.on('chat', (data) => {
34 | console.log('🚀 ~ App ~ socket.on ~ data:', data);
35 | socket.broadcast.to(data.roomId).emit('chat', {
36 | message: data.message,
37 | username: data.username,
38 | time: data.time,
39 | });
40 | });
41 | });
42 | }
43 | }
44 |
45 | export { App };
46 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 1/frontend/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | # or
12 | pnpm dev
13 | # or
14 | bun dev
15 | ```
16 |
17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18 |
19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20 |
21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22 |
23 | ## Learn More
24 |
25 | To learn more about Next.js, take a look at the following resources:
26 |
27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29 |
30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31 |
32 | ## Deploy on Vercel
33 |
34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35 |
36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37 |
--------------------------------------------------------------------------------
/aula 2/frontend/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | # or
12 | pnpm dev
13 | # or
14 | bun dev
15 | ```
16 |
17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18 |
19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20 |
21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22 |
23 | ## Learn More
24 |
25 | To learn more about Next.js, take a look at the following resources:
26 |
27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29 |
30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31 |
32 | ## Deploy on Vercel
33 |
34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35 |
36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37 |
--------------------------------------------------------------------------------
/aula 3/frontend/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | # or
12 | pnpm dev
13 | # or
14 | bun dev
15 | ```
16 |
17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18 |
19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20 |
21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22 |
23 | ## Learn More
24 |
25 | To learn more about Next.js, take a look at the following resources:
26 |
27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29 |
30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31 |
32 | ## Deploy on Vercel
33 |
34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35 |
36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/app/room/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | import Chat from '@/components/Chat';
2 | import Footer from '@/components/Footer';
3 | import Header from '@/components/Header';
4 |
5 | export default function Room({ params }: { params: { id: string } }) {
6 | return (
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Alexia Kattah
15 |
16 |
17 |
18 | Alexia Kattah
19 |
20 |
21 |
22 | Alexia Kattah
23 |
24 |
25 |
26 | Alexia Kattah
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/no_camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/no_camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/no_camera.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/FormWrapper.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { useState } from 'react';
3 | import CreateRoom from './Create';
4 | import JoinRoom from './Join';
5 |
6 | export default function FormWrapper() {
7 | const [selectedRoom, setSelectedRoom] = useState<'create' | 'join'>('join');
8 | const handleSelectRoom = (room: 'create' | 'join') => {
9 | setSelectedRoom(room);
10 | };
11 | return (
12 |
13 |
14 | handleSelectRoom('join')}
20 | >
21 | Ingressar
22 |
23 | handleSelectRoom('create')}
29 | >
30 | Nova reunião
31 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 |
40 | const RoomSelector = ({ selectedRoom }: { selectedRoom: string }) => {
41 | switch (selectedRoom) {
42 | case 'create':
43 | return ;
44 | case 'join':
45 | return ;
46 | default:
47 | return ;
48 | }
49 | };
50 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/FormWrapper.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { useState } from 'react';
3 | import CreateRoom from './Create';
4 | import JoinRoom from './Join';
5 |
6 | export default function FormWrapper() {
7 | const [selectedRoom, setSelectedRoom] = useState<'create' | 'join'>('join');
8 | const handleSelectRoom = (room: 'create' | 'join') => {
9 | setSelectedRoom(room);
10 | };
11 | return (
12 |
13 |
14 | handleSelectRoom('join')}
20 | >
21 | Ingressar
22 |
23 | handleSelectRoom('create')}
29 | >
30 | Nova reunião
31 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 |
40 | const RoomSelector = ({ selectedRoom }: { selectedRoom: string }) => {
41 | switch (selectedRoom) {
42 | case 'create':
43 | return ;
44 | case 'join':
45 | return ;
46 | default:
47 | return ;
48 | }
49 | };
50 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/FormWrapper.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { useState } from 'react';
3 | import CreateRoom from './Create';
4 | import JoinRoom from './Join';
5 |
6 | export default function FormWrapper() {
7 | const [selectedRoom, setSelectedRoom] = useState<'create' | 'join'>('join');
8 | const handleSelectRoom = (room: 'create' | 'join') => {
9 | setSelectedRoom(room);
10 | };
11 | return (
12 |
13 |
14 | handleSelectRoom('join')}
20 | >
21 | Ingressar
22 |
23 | handleSelectRoom('create')}
29 | >
30 | Nova reunião
31 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 |
40 | const RoomSelector = ({ selectedRoom }: { selectedRoom: string }) => {
41 | switch (selectedRoom) {
42 | case 'create':
43 | return ;
44 | case 'join':
45 | return ;
46 | default:
47 | return ;
48 | }
49 | };
50 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/no_mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/no_mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/no_mic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Next.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNext = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
28 |
29 | );
30 | export default SvgNext;
31 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Next.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNext = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
28 |
29 | );
30 | export default SvgNext;
31 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Next.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgNext = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
28 |
29 | );
30 | export default SvgNext;
31 |
--------------------------------------------------------------------------------
/aula 3/backend/src/app.ts:
--------------------------------------------------------------------------------
1 | import express, { Application } from 'express';
2 | import http from 'http';
3 | import cors from 'cors';
4 | import { Server, Socket } from 'socket.io';
5 | class App {
6 | private app: Application;
7 | private http: http.Server;
8 | private io: Server;
9 | constructor() {
10 | this.app = express();
11 | this.http = new http.Server(this.app);
12 | this.io = new Server(this.http, {
13 | cors: {
14 | origin: '*',
15 | },
16 | });
17 | }
18 | public listen() {
19 | this.http.listen(3333, () => {
20 | console.log('Server running on port 3333');
21 | });
22 | }
23 |
24 | public listenSocket() {
25 | this.io.of('/streams').on('connection', this.socketEvents);
26 | }
27 | private socketEvents(socket: Socket) {
28 | console.log('Socket connected: ' + socket.id);
29 | socket.on('subscribe', (data) => {
30 | console.log('usuario inserido na sala: ' + data.roomId);
31 | socket.join(data.roomId);
32 | socket.join(data.socketId);
33 |
34 | const roomsSession = Array.from(socket.rooms);
35 |
36 | if (roomsSession.length > 1) {
37 | socket.to(data.roomId).emit('new user', {
38 | socketId: socket.id,
39 | username: data.username,
40 | });
41 | }
42 | });
43 |
44 | socket.on('newUserStart', (data) => {
45 | console.log('Novo usuario chegou', data);
46 | socket.to(data.to).emit('newUserStart', {
47 | sender: data.sender,
48 | username: data.username,
49 | });
50 | });
51 |
52 | socket.on('sdp', (data) => {
53 | socket.to(data.to).emit('sdp', {
54 | description: data.description,
55 | sender: data.sender,
56 | });
57 | });
58 |
59 | socket.on('ice candidates', (data) => {
60 | socket.to(data.to).emit('ice candidates', {
61 | candidate: data.candidate,
62 | sender: data.sender,
63 | });
64 | });
65 |
66 | socket.on('chat', (data) => {
67 | socket.broadcast.to(data.roomId).emit('chat', {
68 | message: data.message,
69 | username: data.username,
70 | time: data.time,
71 | });
72 | });
73 |
74 | // socket.on('disconnect', () => {
75 | // console.log('Socket desconectado: ' + socket.id);
76 | // socket.disconnect();
77 | // });
78 | }
79 | }
80 |
81 | export { App };
82 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/app/room/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import Chat from '@/components/Chat';
3 | import Footer from '@/components/Footer';
4 | import Header from '@/components/Header';
5 | import { SocketContext } from '@/contexts/SocketContext';
6 | import { useContext, useEffect, useRef } from 'react';
7 |
8 | export default function Room({ params }: { params: { id: string } }) {
9 | const { socket } = useContext(SocketContext);
10 | const localStream = useRef(null);
11 | useEffect(() => {
12 | socket?.on('connect', async () => {
13 | console.log('conectado');
14 | socket?.emit('subscribe', {
15 | roomId: params.id,
16 | socketId: socket.id,
17 | });
18 | await initCamera();
19 | });
20 | }, [socket]);
21 |
22 | const initCamera = async () => {
23 | const video = await navigator.mediaDevices.getUserMedia({
24 | video: true,
25 | audio: true,
26 | });
27 | console.log('🚀 ~ initCamera ~ video:', video);
28 | if (localStream.current) localStream.current.srcObject = video;
29 | };
30 |
31 | return (
32 |
33 |
34 |
35 |
36 |
37 |
38 |
43 | Alexia Kattah
44 |
45 |
46 |
47 | Alexia Kattah
48 |
49 |
50 |
51 | Alexia Kattah
52 |
53 |
54 |
55 | Alexia Kattah
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | );
64 | }
65 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/components/Footer.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | Camera,
4 | Computer,
5 | Mic,
6 | NoCamera,
7 | NoComputer,
8 | NoMic,
9 | Phone,
10 | } from '@/Icons';
11 | import { useState } from 'react';
12 | import Container from './Container';
13 |
14 | export default function Footer() {
15 | const [isMuted, setIsMuted] = useState(false);
16 | const [isCameraOff, setIsCameraOff] = useState(false);
17 | const [isScreenSharing, setIsScreenSharing] = useState(false);
18 | const date = new Date();
19 | const hours = date.getHours().toString().padStart(2, '0') + ':';
20 | const minutes = date.getMinutes().toString().padStart(2, '0');
21 | return (
22 |
23 |
24 |
25 |
26 |
27 | {hours}
28 | {minutes}
29 |
30 |
31 |
32 | {isMuted ? (
33 |
setIsMuted(!isMuted)}
36 | />
37 | ) : (
38 | setIsMuted(!isMuted)}
41 | />
42 | )}
43 | {isCameraOff ? (
44 | setIsCameraOff(!isCameraOff)}
47 | />
48 | ) : (
49 | setIsCameraOff(!isCameraOff)}
52 | />
53 | )}
54 |
55 | {isScreenSharing ? (
56 | setIsScreenSharing(!isScreenSharing)}
59 | />
60 | ) : (
61 | setIsScreenSharing(!isScreenSharing)}
64 | />
65 | )}
66 |
67 |
68 |
69 |
70 |
71 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Footer.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | Camera,
4 | Computer,
5 | Mic,
6 | NoCamera,
7 | NoComputer,
8 | NoMic,
9 | Phone,
10 | } from '@/Icons';
11 | import { useState } from 'react';
12 | import Container from './Container';
13 |
14 | export default function Footer() {
15 | const [isMuted, setIsMuted] = useState(false);
16 | const [isCameraOff, setIsCameraOff] = useState(false);
17 | const [isScreenSharing, setIsScreenSharing] = useState(false);
18 | const date = new Date();
19 | const hours = date.getHours().toString().padStart(2, '0') + ':';
20 | const minutes = date.getMinutes().toString().padStart(2, '0');
21 | return (
22 |
23 |
24 |
25 |
26 |
27 | {hours}
28 | {minutes}
29 |
30 |
31 |
32 | {isMuted ? (
33 |
setIsMuted(!isMuted)}
36 | />
37 | ) : (
38 | setIsMuted(!isMuted)}
41 | />
42 | )}
43 | {isCameraOff ? (
44 | setIsCameraOff(!isCameraOff)}
47 | />
48 | ) : (
49 | setIsCameraOff(!isCameraOff)}
52 | />
53 | )}
54 |
55 | {isScreenSharing ? (
56 | setIsScreenSharing(!isScreenSharing)}
59 | />
60 | ) : (
61 | setIsScreenSharing(!isScreenSharing)}
64 | />
65 | )}
66 |
67 |
68 |
69 |
70 |
71 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/components/Chat.tsx:
--------------------------------------------------------------------------------
1 | import { SocketContext } from '@/contexts/SocketContext';
2 | import Image from 'next/image';
3 | import { FormEvent, useContext, useEffect, useRef, useState } from 'react';
4 | interface IChatMessage {
5 | message: string;
6 | username: string;
7 | roomId: string;
8 | time: string;
9 | }
10 | export default function Chat({ roomId }: { roomId: string }) {
11 | const currentMsg = useRef(null);
12 | const { socket } = useContext(SocketContext);
13 | const [chat, setChat] = useState([]);
14 | useEffect(() => {
15 | socket?.on('chat', (data) => {
16 | console.log('message: ', data);
17 | setChat((prevState) => [...prevState, data]);
18 | });
19 | }, [socket]);
20 |
21 | function sendMessage(e: FormEvent) {
22 | e.preventDefault();
23 | console.log(currentMsg.current?.value);
24 | if (currentMsg.current && currentMsg.current?.value !== '') {
25 | const sendMsgToServer = {
26 | message: currentMsg.current.value,
27 | username: 'Alexia Kattah',
28 | roomId,
29 | time: new Date().toLocaleTimeString(),
30 | };
31 |
32 | socket?.emit('chat', sendMsgToServer);
33 | setChat((prevState) => [...prevState, sendMsgToServer]);
34 |
35 | currentMsg.current.value = '';
36 | }
37 | }
38 | return (
39 |
40 |
41 | {chat.map((chat, index) => {
42 | return (
43 |
44 |
45 | {chat.username}
46 | {chat.time}
47 |
48 |
51 |
52 | );
53 | })}
54 |
55 |
78 |
79 |
80 | );
81 | }
82 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Chat.tsx:
--------------------------------------------------------------------------------
1 | import { SocketContext } from '@/contexts/SocketContext';
2 | import Image from 'next/image';
3 | import { FormEvent, useContext, useEffect, useRef, useState } from 'react';
4 | interface IChatMessage {
5 | message: string;
6 | username: string;
7 | roomId: string;
8 | time: string;
9 | }
10 | export default function Chat({ roomId }: { roomId: string }) {
11 | const currentMsg = useRef(null);
12 | const { socket } = useContext(SocketContext);
13 | const [chat, setChat] = useState([]);
14 | useEffect(() => {
15 | socket?.on('chat', (data) => {
16 | console.log('message: ', data);
17 | setChat((prevState) => [...prevState, data]);
18 | });
19 | }, [socket]);
20 |
21 | function sendMessage(e: FormEvent) {
22 | e.preventDefault();
23 | console.log(currentMsg.current?.value);
24 | if (currentMsg.current && currentMsg.current?.value !== '') {
25 | const sendMsgToServer = {
26 | message: currentMsg.current.value,
27 | username: 'Alexia Kattah',
28 | roomId,
29 | time: new Date().toLocaleTimeString(),
30 | };
31 |
32 | socket?.emit('chat', sendMsgToServer);
33 | setChat((prevState) => [...prevState, sendMsgToServer]);
34 |
35 | currentMsg.current.value = '';
36 | }
37 | }
38 | return (
39 |
40 |
41 | {chat.map((chat, index) => {
42 | return (
43 |
44 |
45 | {chat.username}
46 | {chat.time}
47 |
48 |
51 |
52 | );
53 | })}
54 |
55 |
78 |
79 |
80 | );
81 | }
82 |
--------------------------------------------------------------------------------
/aula 1/frontend/src/Icons/Logo.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgLogo = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
29 |
40 |
46 |
47 |
48 |
52 |
53 |
54 | );
55 | export default SvgLogo;
56 |
--------------------------------------------------------------------------------
/aula 2/frontend/src/Icons/Logo.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgLogo = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
29 |
40 |
46 |
47 |
48 |
52 |
53 |
54 | );
55 | export default SvgLogo;
56 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/Icons/Logo.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import type { SVGProps } from "react";
3 | interface SVGRProps {
4 | title?: string;
5 | titleId?: string;
6 | }
7 | const SvgLogo = ({
8 | title,
9 | titleId,
10 | ...props
11 | }: SVGProps & SVGRProps) => (
12 |
19 | {title ? {title} : null}
20 |
24 |
29 |
40 |
46 |
47 |
48 |
52 |
53 |
54 | );
55 | export default SvgLogo;
56 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/components/Footer.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | Camera,
4 | Computer,
5 | Mic,
6 | NoCamera,
7 | NoComputer,
8 | NoMic,
9 | Phone,
10 | } from '@/Icons';
11 | import { MutableRefObject, useContext, useState } from 'react';
12 | import Container from './Container';
13 | import { SocketContext } from '@/contexts/SocketContext';
14 |
15 | export default function Footer({
16 | videoMediaStream,
17 | peerConnections,
18 | localStream,
19 | logout,
20 | }: {
21 | videoMediaStream: MediaStream;
22 | peerConnections: MutableRefObject>;
23 | localStream: MutableRefObject;
24 | logout: () => void;
25 | }) {
26 | const [isMuted, setIsMuted] = useState(false);
27 | const [isCameraOff, setIsCameraOff] = useState(false);
28 | const [isScreenSharing, setIsScreenSharing] = useState(false);
29 | const date = new Date();
30 | const hours = date.getHours().toString().padStart(2, '0') + ':';
31 | const minutes = date.getMinutes().toString().padStart(2, '0');
32 |
33 | const toggleMuted = () => {
34 | videoMediaStream?.getAudioTracks().forEach((track) => {
35 | track.enabled = !isMuted;
36 | });
37 | setIsMuted(!isMuted);
38 |
39 | Object.values(peerConnections.current).forEach((peerConnection) => {
40 | peerConnection.getSenders().forEach((sender) => {
41 | if (sender.track?.kind === 'audio') {
42 | if (videoMediaStream?.getAudioTracks().length > 0) {
43 | sender.replaceTrack(
44 | videoMediaStream
45 | ?.getAudioTracks()
46 | .find((track) => track.kind === 'audio') || null,
47 | );
48 | }
49 | }
50 | });
51 | });
52 | };
53 |
54 | const toggleVideo = () => {
55 | setIsCameraOff(!isCameraOff);
56 | videoMediaStream?.getVideoTracks().forEach((track) => {
57 | track.enabled = isCameraOff;
58 | });
59 |
60 | Object.values(peerConnections.current).forEach((peerConnection) => {
61 | peerConnection.getSenders().forEach((sender) => {
62 | if (sender.track?.kind === 'video') {
63 | sender.replaceTrack(
64 | videoMediaStream
65 | ?.getVideoTracks()
66 | .find((track) => track.kind === 'video') || null,
67 | );
68 | }
69 | });
70 | });
71 | };
72 |
73 | const toggleScreenSharing = async () => {
74 | if (!isScreenSharing) {
75 | const videoShareScreen = await navigator.mediaDevices.getDisplayMedia({
76 | video: true,
77 | });
78 | if (localStream.current) localStream.current.srcObject = videoShareScreen;
79 |
80 | Object.values(peerConnections.current).forEach((peerConnections) => {
81 | peerConnections.getSenders().forEach((sender) => {
82 | if (sender.track?.kind === 'video') {
83 | sender.replaceTrack(videoShareScreen.getVideoTracks()[0]);
84 | }
85 | });
86 | });
87 |
88 | setIsScreenSharing(!isScreenSharing);
89 | return;
90 | }
91 |
92 | if (localStream.current) localStream.current.srcObject = videoMediaStream;
93 |
94 | Object.values(peerConnections.current).forEach((peerConnections) => {
95 | peerConnections.getSenders().forEach((sender) => {
96 | if (sender.track?.kind === 'video') {
97 | sender.replaceTrack(videoMediaStream?.getVideoTracks()[0]);
98 | }
99 | });
100 | });
101 | setIsScreenSharing(!isScreenSharing);
102 | };
103 |
104 | return (
105 |
106 |
107 |
108 |
109 |
110 | {hours}
111 | {minutes}
112 |
113 |
114 |
115 | {isMuted ? (
116 |
toggleMuted()}
119 | />
120 | ) : (
121 | toggleMuted()}
124 | />
125 | )}
126 | {isCameraOff ? (
127 | toggleVideo()}
130 | />
131 | ) : (
132 | toggleVideo()}
135 | />
136 | )}
137 |
138 | {isScreenSharing ? (
139 | toggleScreenSharing()}
142 | />
143 | ) : (
144 | toggleScreenSharing()}
147 | />
148 | )}
149 |
150 |
154 |
155 |
156 |
157 |
158 | );
159 | }
160 |
--------------------------------------------------------------------------------
/aula 1/frontend/public/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/aula 2/frontend/public/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/aula 3/frontend/public/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/aula 3/frontend/src/app/room/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import Chat from '@/components/Chat';
3 | import Footer from '@/components/Footer';
4 | import Header from '@/components/Header';
5 | import { SocketContext } from '@/contexts/SocketContext';
6 | import { useRouter } from 'next/navigation';
7 | import { useContext, useEffect, useRef, useState } from 'react';
8 | interface IAnswer {
9 | sender: string;
10 | description: RTCSessionDescriptionInit;
11 | }
12 | interface ICandidate {
13 | sender: string;
14 | candidate: RTCIceCandidate;
15 | }
16 | interface IDataStream {
17 | id: string;
18 | stream: MediaStream;
19 | username: string;
20 | }
21 | export default function Room({ params }: { params: { id: string } }) {
22 | const { socket } = useContext(SocketContext);
23 | const localStream = useRef(null);
24 | const router = useRouter();
25 | const peerConnections = useRef>({});
26 | const [remoteStreams, setRemoteStreams] = useState([]);
27 | const [videoMediaStream, setVideoMediaStream] = useState(
28 | null,
29 | );
30 |
31 | useEffect(() => {
32 | const username = sessionStorage.getItem('username');
33 | socket?.on('connect', async () => {
34 | console.log('conectado');
35 | socket?.emit('subscribe', {
36 | roomId: params.id,
37 | socketId: socket.id,
38 | username,
39 | });
40 | await initLocalCamera();
41 | });
42 |
43 | socket?.on('new user', (data) => {
44 | console.log('Novo usuário tentando se conectar', data);
45 | createPeerConnection(data.socketId, false, data.username);
46 | socket.emit('newUserStart', {
47 | to: data.socketId,
48 | sender: socket.id,
49 | username,
50 | });
51 | });
52 |
53 | socket?.on('newUserStart', (data) => {
54 | console.log('Usuário conectado na sala', data);
55 | createPeerConnection(data.sender, true, data.username);
56 | });
57 | socket?.on('sdp', (data) => handleAnswer(data));
58 |
59 | socket?.on('ice candidates', (data) => handleIceCandidates(data));
60 | }, [socket]);
61 |
62 | const handleIceCandidates = async (data: ICandidate) => {
63 | const peerConnection = peerConnections.current[data.sender];
64 | if (data.candidate) {
65 | await peerConnection.addIceCandidate(new RTCIceCandidate(data.candidate));
66 | }
67 | };
68 |
69 | const handleAnswer = async (data: IAnswer) => {
70 | const peerConnection = peerConnections.current[data.sender];
71 | if (data.description.type === 'offer') {
72 | await peerConnection.setRemoteDescription(data.description);
73 |
74 | const answer = await peerConnection.createAnswer();
75 | await peerConnection.setLocalDescription(answer);
76 | console.log('criando uma resposta');
77 | socket?.emit('sdp', {
78 | to: data.sender,
79 | sender: socket?.id,
80 | description: peerConnection.localDescription,
81 | });
82 | } else if (data.description.type === 'answer') {
83 | console.log('ouvindo a oferta');
84 | await peerConnection.setRemoteDescription(
85 | new RTCSessionDescription(data.description),
86 | );
87 | }
88 | };
89 |
90 | const createPeerConnection = async (
91 | socketId: string,
92 | createOffer: boolean,
93 | username: string,
94 | ) => {
95 | const config = {
96 | iceServers: [
97 | {
98 | urls: 'stun:stun.l.google.com:19302',
99 | },
100 | ],
101 | };
102 |
103 | const peer = new RTCPeerConnection(config);
104 | peerConnections.current[socketId] = peer;
105 | const peerConnection = peerConnections.current[socketId];
106 |
107 | if (videoMediaStream) {
108 | videoMediaStream.getTracks().forEach((track) => {
109 | peerConnection.addTrack(track, videoMediaStream);
110 | });
111 | } else {
112 | const video = await initRemoteCamera();
113 | video
114 | .getTracks()
115 | .forEach((track) => peerConnection.addTrack(track, video));
116 | }
117 |
118 | if (createOffer) {
119 | const peerConnection = peerConnections.current[socketId];
120 |
121 | const offer = await peerConnection.createOffer();
122 | await peerConnection.setLocalDescription(offer);
123 | console.log('criando uma oferta');
124 | socket?.emit('sdp', {
125 | to: socketId,
126 | sender: socket?.id,
127 | description: peerConnection.localDescription,
128 | });
129 | }
130 |
131 | peerConnection.ontrack = (event) => {
132 | const remoteStream = event.streams[0];
133 |
134 | const dataStream: IDataStream = {
135 | id: socketId,
136 | stream: remoteStream,
137 | username,
138 | };
139 |
140 | setRemoteStreams((prevState: IDataStream[]) => {
141 | if (!prevState.some((stream) => stream.id === socketId)) {
142 | return [...prevState, dataStream];
143 | }
144 | return prevState;
145 | });
146 | };
147 |
148 | peer.onicecandidate = (event) => {
149 | if (event.candidate) {
150 | socket?.emit('ice candidates', {
151 | to: socketId,
152 | sender: socket?.id,
153 | candidate: event.candidate,
154 | });
155 | }
156 | };
157 | peerConnection.onsignalingstatechange = (event) => {
158 | switch (peerConnection.signalingState) {
159 | case 'closed':
160 | setRemoteStreams((prevState) =>
161 | prevState.filter((stream) => stream.id !== socketId),
162 | );
163 |
164 | break;
165 | }
166 | };
167 | peerConnection.onconnectionstatechange = (event) => {
168 | switch (peerConnection.connectionState) {
169 | case 'disconnected':
170 | setRemoteStreams((prevState) =>
171 | prevState.filter((stream) => stream.id !== socketId),
172 | );
173 | case 'failed':
174 | setRemoteStreams((prevState) =>
175 | prevState.filter((stream) => stream.id !== socketId),
176 | );
177 | case 'closed':
178 | setRemoteStreams((prevState) =>
179 | prevState.filter((stream) => stream.id !== socketId),
180 | );
181 | break;
182 | }
183 | };
184 | };
185 | const logout = () => {
186 | videoMediaStream?.getTracks().forEach((track) => {
187 | track.stop();
188 | });
189 | Object.values(peerConnections.current).forEach((peerConnection) => {
190 | peerConnection.close();
191 | });
192 | socket?.disconnect();
193 | router.push('/');
194 | };
195 |
196 | const initLocalCamera = async () => {
197 | const video = await navigator.mediaDevices.getUserMedia({
198 | video: true,
199 | audio: {
200 | echoCancellation: true,
201 | noiseSuppression: true,
202 | },
203 | });
204 | setVideoMediaStream(video);
205 | if (localStream.current) localStream.current.srcObject = video;
206 | };
207 | const initRemoteCamera = async () => {
208 | const video = await navigator.mediaDevices.getUserMedia({
209 | video: true,
210 | audio: {
211 | echoCancellation: true,
212 | noiseSuppression: true,
213 | },
214 | });
215 | return video;
216 | };
217 |
218 | return (
219 |
220 |
221 |
222 |
223 |
224 |
225 |
230 |
231 | {sessionStorage.getItem('username')}
232 |
233 |
234 | {remoteStreams.map((stream, index) => {
235 | return (
236 |
240 | {
244 | if (video && video.srcObject !== stream.stream)
245 | video.srcObject = stream.stream;
246 | }}
247 | />
248 | {stream.username}
249 |
250 | );
251 | })}
252 |
253 |
254 |
255 |
256 |
262 |
263 | );
264 | }
265 |
--------------------------------------------------------------------------------
/aula 2/backend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig to read more about this file */
4 |
5 | /* Projects */
6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12 |
13 | /* Language and Environment */
14 | "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16 | // "jsx": "preserve", /* Specify what JSX code is generated. */
17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26 |
27 | /* Modules */
28 | "module": "commonjs", /* Specify what module code is generated. */
29 | "rootDir": "./src", /* Specify the root folder within your source files. */
30 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42 | // "resolveJsonModule": true, /* Enable importing .json files. */
43 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */
45 |
46 | /* JavaScript Support */
47 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50 |
51 | /* Emit */
52 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58 | "outDir": "./dist", /* Specify an output folder for all emitted files. */
59 | // "removeComments": true, /* Disable emitting comments. */
60 | // "noEmit": true, /* Disable emitting files from a compilation. */
61 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68 | // "newLine": "crlf", /* Set the newline character for emitting files. */
69 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75 |
76 | /* Interop Constraints */
77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83 |
84 | /* Type Checking */
85 | "strict": true, /* Enable all strict type-checking options. */
86 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104 |
105 | /* Completeness */
106 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107 | "skipLibCheck": true /* Skip type checking all .d.ts files. */
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/aula 3/backend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig to read more about this file */
4 |
5 | /* Projects */
6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12 |
13 | /* Language and Environment */
14 | "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16 | // "jsx": "preserve", /* Specify what JSX code is generated. */
17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26 |
27 | /* Modules */
28 | "module": "commonjs", /* Specify what module code is generated. */
29 | "rootDir": "./src", /* Specify the root folder within your source files. */
30 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42 | // "resolveJsonModule": true, /* Enable importing .json files. */
43 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */
45 |
46 | /* JavaScript Support */
47 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50 |
51 | /* Emit */
52 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58 | "outDir": "./dist", /* Specify an output folder for all emitted files. */
59 | // "removeComments": true, /* Disable emitting comments. */
60 | // "noEmit": true, /* Disable emitting files from a compilation. */
61 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68 | // "newLine": "crlf", /* Set the newline character for emitting files. */
69 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75 |
76 | /* Interop Constraints */
77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83 |
84 | /* Type Checking */
85 | "strict": true, /* Enable all strict type-checking options. */
86 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104 |
105 | /* Completeness */
106 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107 | "skipLibCheck": true /* Skip type checking all .d.ts files. */
108 | }
109 | }
110 |
--------------------------------------------------------------------------------