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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added back-end-semana-01/.gitignore
Empty file.
40 changes: 40 additions & 0 deletions back-end-semana-01/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//Exercício 1

if(process.argv[4] === true) {console.log("Envie apenas um argumento")}
//console.log( `Ei ${process.argv[2]}! Você tem ${process.argv[3]} anos.` )

if(process.argv[4] === false) {console.log("Envie dois argumentos")}
//console.log( `Ei ${process.argv[2]}! Você tem ${Number(process.argv[3]) } anos. Em 7 anos você terá ${Number(process.argv[3]) + 7} anos.` )

// Exercício 2

/*
switch(process.argv[2]){
case "soma":
console.log( `${process.argv[3]} + ${process.argv[4]} = ${ Number(process.argv[3]) + Number(process.argv[4]) } ` )
break;
case "sub":
console.log( `${process.argv[3]} - ${process.argv[4]} = ${ Number(process.argv[3]) - Number(process.argv[4]) } ` )
break;

case "mult":
console.log( `${process.argv[3]} x ${process.argv[4]} = ${ Number(process.argv[3]) * Number(process.argv[4]) } ` )
break;

case "div":
console.log( `${process.argv[3]} / ${process.argv[4]} = ${ Number(process.argv[3]) / Number(process.argv[4]) } ` )
break;

default:
console.log("Comando não identificado! Use soma, sub, mult ou div")

}

*/

//Exercício 3

const tarefas = ['Dobrar roupas']

tarefas.push(process.argv[2])
console.log( '\x1b[36m%s\x1b[0m', tarefas);
12 changes: 12 additions & 0 deletions back-end-semana-01/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "back-end-semana-01",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "clear && node ./index.js"
},
"author": "Rafael Cacilhas",
"license": "ISC"
}
55 changes: 55 additions & 0 deletions back-end-semana-01/typescript/src/exercicio1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// a)

const minhaString: string = "Olá"

console.log(minhaString)
console.log("")
// const minhaStringNumero: string = 25 //Erro de compilação



// b)

const meuNumero: number | string = "ei"

console.log(meuNumero)
console.log("")


//c) e d)

enum CORES {
VERMELHO = 'Vermelho',
LARANJA = 'Laranja',
AMARELO = 'Amarelo',
VERDE = 'Verde',
ANIL = 'Anil',
AZUL = 'Azul',
VIOLETA = 'Violeta'
}

type pessoa = {
nome: string,
idade: number,
corFavorita: string
}

const rafael:pessoa = {
nome: 'Rafael',
idade: 29,
corFavorita: CORES.AZUL
}


const maria:pessoa = {
nome: 'Maria',
idade: 22,
corFavorita: CORES.ANIL
}

const jose:pessoa = {
nome: 'José',
idade: 59,
corFavorita: CORES.VERDE
}

34 changes: 34 additions & 0 deletions back-end-semana-01/typescript/src/exercicio2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 2 a) Entrada: array de numeros. Saída: Array de números


function obterEstatisticas( numeros: Array<number> ) {

const numerosOrdenados = numeros.sort(
(a:number, b:number) => a - b
)

let soma:number = 0

for (let num of numeros) {
soma += num
}

const estatisticas:{maior:number, menor:number, media:number} = {
maior: numerosOrdenados[numeros.length - 1],
menor: numerosOrdenados[0],
media: soma / numeros.length
}

return estatisticas
}


type entrada = {
numeros: Array<number>
}

const amostraDeIdades: entrada = {
numeros: [21, 18, 65, 44, 15, 18],
}

console.log(obterEstatisticas(amostraDeIdades.numeros))
36 changes: 36 additions & 0 deletions back-end-semana-01/typescript/src/exercicio3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
type postagens = {
autor: string,
texto: string
}

function buscarPostsPorAutor( posts: Array<postagens> , autorInformado: string) {
return posts.filter(
(post) => {
return post.autor === autorInformado
}
)
}

const posts: Array<postagens> = [
{
autor: "Alvo Dumbledore",
texto: "Não vale a pena viver sonhando e se esquecer de viver"
},
{
autor: "Severo Snape",
texto: "Menos 10 pontos para Grifinória!"
},
{
autor: "Hermione Granger",
texto: "É levi-ô-sa, não levio-sá!"
},
{
autor: "Dobby",
texto: "Dobby é um elfo livre!"
},
{
autor: "Lord Voldemort",
texto: "Avada Kedavra!"
}
]

40 changes: 40 additions & 0 deletions back-end-semana-01/typescript/src/exercicio4.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
type pokemon = {
name: string,
types: string,
healthPoints: number
}

const pokemon1: pokemon = {
name: "Charmander",
types: "Fire",
healthPoints: 28
}

const pokemon2: pokemon = {
name: "Bulbasaur",
types: "Grass/Poison",
healthPoints: 31
}

const pokemon3: pokemon = {
name: "Squirtle",
types: "Water",
healthPoints: 35
}


// a) Rodar o comando tsc
// b) Não, desde que você edite o arquivo tsconfig.json
// c) Aparentemente sim

// d) O arquivo gerado possui as configurações:

// "esModuleInterop": true,
// "forceConsistentCasingInFileNames": true

// enquanto o dos slides também possuem:

// "outDir": "./build", /* Redirect output structure to the directory. */
// "rootDir": "./src", /* Specify the root directory of input files. */
// "removeComments": true, /* Do not emit comments to output. */
// "noImplicitAny": true, /* Raise error on declarations with an implied 'any' type. */
1 change: 1 addition & 0 deletions back-end-semana-01/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello World")
23 changes: 23 additions & 0 deletions back-end-semana-01/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version */
"module": "commonjs", /* Specify module code generation */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "./build", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. */
"removeComments": true, /* Do not emit comments to output. */
"noImplicitAny": true, /* Raise error on declarations with an implied 'any' type. */
}
}
/*

{
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
}
}

*/
27 changes: 9 additions & 18 deletions semana-10/labex/src/Components/Paginas/AdminHomePage.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

import React, {useEffect, useState} from "react";
import {useHistory} from 'react-router-dom';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
import Card from '@mui/material/Card';
import CardMedia from '@mui/material/CardMedia';
import { CardActionArea } from '@mui/material';
import React, {useEffect} from "react";
import {useHistory} from 'react-router-dom';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';

import TripDetailsPage from "./TripDetailsPage"
import CreateTripPage from "./CreateTripPage"

export default function AdminHomePage() {

const [pag,setPag] = useState("nada")


const history = useHistory()
Expand All @@ -26,9 +22,6 @@ export default function AdminHomePage() {
}, [history])


const renderizaPagina = () => {
return <TripDetailsPage />
}

return (

Expand Down Expand Up @@ -60,14 +53,12 @@ return (
</Box>


<Box sx={{ height: 400, marginTop: 10 }}>
<h2>quede a pag?</h2>
{renderizaPagina}
<Box sx={{ height: 800, marginTop: 10 }}>
<CreateTripPage />
</Box>




</Box>
)
</Box> )
}
Loading