diff --git a/19-semana/futurebook/src/data/feedDataBase.ts b/19-semana/futurebook/src/data/feedDataBase.ts index 2d859a3..90d4848 100644 --- a/19-semana/futurebook/src/data/feedDataBase.ts +++ b/19-semana/futurebook/src/data/feedDataBase.ts @@ -54,7 +54,7 @@ export class FeedDB extends BaseDB implements FeedGateway{ return undefined; }; - return result[0].map((post: any) => { + return await result[0].map((post: any) => { return new Feed( post.id, post.photo, diff --git a/21-22-semana/futuretube/backend/src/business/gateways/userGateway.ts b/21-22-semana/futuretube/backend/src/business/gateways/userGateway.ts index 5164b9d..ed25932 100644 --- a/21-22-semana/futuretube/backend/src/business/gateways/userGateway.ts +++ b/21-22-semana/futuretube/backend/src/business/gateways/userGateway.ts @@ -4,5 +4,6 @@ export interface UserGateway { signUp(user: User): Promise; login(email: string): Promise; getAllUsers(): Promise; - getUserById(id: string, email: string): Promise; + getUserById(id: string): Promise; + updatePassword(id: string, password: string): Promise; } \ No newline at end of file diff --git a/21-22-semana/futuretube/backend/src/business/gateways/videoGateway.ts b/21-22-semana/futuretube/backend/src/business/gateways/videoGateway.ts index 0f45c8b..1c7733b 100644 --- a/21-22-semana/futuretube/backend/src/business/gateways/videoGateway.ts +++ b/21-22-semana/futuretube/backend/src/business/gateways/videoGateway.ts @@ -6,7 +6,7 @@ export interface VideoGateway{ createVideo(video: Video): Promise; getVideos(orderBy: string, orderType: string, limit: number, offset: number): Promise; getVideoById(id: string): Promise; - deleteVideo(id: string): Promise; - updateVideo(id: string, description: string, title: string): Promise; - getVideoByUser(id: string): Promise; + deleteVideo(id: string, user_id: string): Promise; + updateVideo(id: string, user_id: string, title: string, description: string): Promise; + getAllUserVideos(id: string): Promise; } \ No newline at end of file diff --git a/21-22-semana/futuretube/backend/src/business/usecase/user/signUp.ts b/21-22-semana/futuretube/backend/src/business/usecase/user/signUp.ts index 1dc1152..8743590 100644 --- a/21-22-semana/futuretube/backend/src/business/usecase/user/signUp.ts +++ b/21-22-semana/futuretube/backend/src/business/usecase/user/signUp.ts @@ -19,6 +19,7 @@ export class SignUpUC { if(user){ throw new Error("This email has already been registered!") } + const id = v4() let type = UserType.USER diff --git a/21-22-semana/futuretube/backend/src/business/usecase/user/updatePassword.ts b/21-22-semana/futuretube/backend/src/business/usecase/user/updatePassword.ts new file mode 100644 index 0000000..a23bffe --- /dev/null +++ b/21-22-semana/futuretube/backend/src/business/usecase/user/updatePassword.ts @@ -0,0 +1,50 @@ +import { UserGateway } from "../../gateways/userGateway"; +import { AuthenticationGateway } from "../../gateways/authenticationGateway"; +import { CryptographyGateway } from "../../gateways/cryptographyGateway"; +import { InvalidParameterError } from "../../error/InvalidParams"; + +export class UpdatePasswordUC { + constructor( + private userGateway: UserGateway, + private authenticationGateway: AuthenticationGateway, + private cryptographyGateway: CryptographyGateway + ){} + + public async execute(input: UpdatePasswordUCInput): Promise{ + const userInfo = await this.authenticationGateway.getUsersInfoFromToken(input.token) + + if(!userInfo){ + throw new Error("User not found!") + } + + const user = await this.userGateway.getUserById(userInfo.id) + + if(!user){ + throw new Error("User not found!") + } + + const oldPassword = await this.cryptographyGateway.compare(input.oldPassword, user.getPassword()); + + if(!oldPassword){ + throw new InvalidParameterError("Invalid password!"); + }; + + const newPassword = await this.cryptographyGateway.encrypt(input.newPassword) + + await this.userGateway.updatePassword(userInfo.id, newPassword) + + return { + message: "Password updated successfully!" + } + } +} + +export interface UpdatePasswordUCInput{ + token: string; + oldPassword: string; + newPassword: string; +} + +export interface UpdatePasswordUCOutput{ + message: string; +} \ No newline at end of file diff --git a/21-22-semana/futuretube/backend/src/business/usecase/video/createVideo.ts b/21-22-semana/futuretube/backend/src/business/usecase/video/createVideo.ts index 02767a3..06355d5 100644 --- a/21-22-semana/futuretube/backend/src/business/usecase/video/createVideo.ts +++ b/21-22-semana/futuretube/backend/src/business/usecase/video/createVideo.ts @@ -21,7 +21,7 @@ export class CreateVideoUC { const userInfo = this.authenticationGateway.getUsersInfoFromToken(input.token) if(!userInfo){ - throw new Error("User info are wrong") + throw new Error("User info is wrong") } const video = new Video( diff --git a/21-22-semana/futuretube/backend/src/business/usecase/video/deleteVideo.ts b/21-22-semana/futuretube/backend/src/business/usecase/video/deleteVideo.ts index 2989bb0..2503fc8 100644 --- a/21-22-semana/futuretube/backend/src/business/usecase/video/deleteVideo.ts +++ b/21-22-semana/futuretube/backend/src/business/usecase/video/deleteVideo.ts @@ -20,7 +20,11 @@ export class DeleteVideoUC{ throw new Error("Video not found") } - await this.videoGateway.deleteVideo(input.id) + if(userInfo.id !== video.getUser_id()){ + throw new Error("You cannot delete this Video") + } + + await this.videoGateway.deleteVideo(input.id, userInfo.id) return { message: `Video ${input.id} Deleted Successfully!` diff --git a/21-22-semana/futuretube/backend/src/business/usecase/video/getVideoByUser.ts b/21-22-semana/futuretube/backend/src/business/usecase/video/getAllUserVideos.ts similarity index 75% rename from 21-22-semana/futuretube/backend/src/business/usecase/video/getVideoByUser.ts rename to 21-22-semana/futuretube/backend/src/business/usecase/video/getAllUserVideos.ts index 19b338d..f1cc287 100644 --- a/21-22-semana/futuretube/backend/src/business/usecase/video/getVideoByUser.ts +++ b/21-22-semana/futuretube/backend/src/business/usecase/video/getAllUserVideos.ts @@ -2,13 +2,13 @@ import { VideoGateway } from "../../gateways/videoGateway"; import { AuthenticationGateway } from "../../gateways/authenticationGateway"; import { Feed } from "../../entites/feed"; -export class GetVideoByUserUC { +export class GetAllUserVideosUC { constructor( private videoGateway: VideoGateway, private authenticationGateway: AuthenticationGateway ){} - public async execute(input: GetVideoByUserUCInput): Promise{ + public async execute(input: GetAllUserVideosUCInput): Promise{ const userInfo = await this.authenticationGateway.getUsersInfoFromToken(input.token) let videos: Feed[] | undefined; @@ -18,10 +18,10 @@ export class GetVideoByUserUC { } if(input.id){ - videos = await this.videoGateway.getVideoByUser(input.id) + videos = await this.videoGateway.getAllUserVideos(input.id) } else if (!input.id){ - videos = await this.videoGateway.getVideoByUser(userInfo.id) + videos = await this.videoGateway.getAllUserVideos(userInfo.id) } if(!videos) { @@ -45,16 +45,16 @@ export class GetVideoByUserUC { } } -export interface GetVideoByUserUCInput { +export interface GetAllUserVideosUCInput { token: string; id: string; } -export interface GetVideoByUserUCOuput { - videos: GetVideoByUserUCOutputVideo[] +export interface GetAllUserVideosUCOuput { + videos: GetAllUserVideosUCOutputVideo[] } -export interface GetVideoByUserUCOutputVideo { +export interface GetAllUserVideosUCOutputVideo { id: string; title: string; link: string; diff --git a/21-22-semana/futuretube/backend/src/business/usecase/video/updateVideo.ts b/21-22-semana/futuretube/backend/src/business/usecase/video/updateVideo.ts index 7cea83f..e320f40 100644 --- a/21-22-semana/futuretube/backend/src/business/usecase/video/updateVideo.ts +++ b/21-22-semana/futuretube/backend/src/business/usecase/video/updateVideo.ts @@ -13,14 +13,18 @@ export class UpdateVideoUC { if(!userInfo){ throw new Error("You must be connected!") } - + const video = await this.videoGateway.getVideoById(input.id); if(!video){ throw new Error("Video not found"); } - await this.videoGateway.updateVideo(input.id, input.title, input.description) + if(userInfo.id !== video.getUser_id()){ + throw new Error("You cannot update this video!") + } + + await this.videoGateway.updateVideo(input.id, userInfo.id, input.title, input.description) return { message: `Video ${input.title} updated Successfully!` diff --git a/21-22-semana/futuretube/backend/src/data/userDatabase.ts b/21-22-semana/futuretube/backend/src/data/userDatabase.ts index 6d13fc8..36f586d 100644 --- a/21-22-semana/futuretube/backend/src/data/userDatabase.ts +++ b/21-22-semana/futuretube/backend/src/data/userDatabase.ts @@ -20,18 +20,11 @@ export class UserDB extends BaseDB implements UserGateway{ ) } - private mapDateToDbDate(input: Date): string { - const year = input.getFullYear(); - const month = input.getMonth() + 1; - const date = input.getDate(); - return `${year + "-" + month + "-" + date}`; - } - - public async getUserById(id: string, email: string): Promise{ + public async getUserById(id: string): Promise{ const result = await this.connection.raw(` SELECT * FROM ${this.userTableName} - WHERE id = '${id}' AND email = '${email}' + WHERE id = '${id}' `) if(!result[0][0]){ @@ -56,6 +49,14 @@ export class UserDB extends BaseDB implements UserGateway{ `) } + public async updatePassword(id: string, password: string): Promise{ + await this.connection.raw(` + UPDATE ${this.userTableName} + SET password = '${password}' + WHERE id = '${id}' + `) + } + public async login(email: string): Promise{ const user = await this.connection.raw(` SELECT * diff --git a/21-22-semana/futuretube/backend/src/data/videoDatabase.ts b/21-22-semana/futuretube/backend/src/data/videoDatabase.ts index 864782c..07659b3 100644 --- a/21-22-semana/futuretube/backend/src/data/videoDatabase.ts +++ b/21-22-semana/futuretube/backend/src/data/videoDatabase.ts @@ -75,19 +75,18 @@ export class VideoDB extends BaseDB implements VideoGateway{ `); }; - - public async deleteVideo(id: string): Promise{ + public async deleteVideo(id: string, user_id: string): Promise{ await this.connection.raw(` DELETE FROM ${this.videoTableName} - WHERE id = '${id}'; + WHERE id = '${id}' AND user_id = '${user_id}'; `) } - public async updateVideo(id: string, title: string, description: string): Promise{ + public async updateVideo(id: string, user_id: string, title: string, description: string): Promise{ await this.connection.raw(` UPDATE ${this.videoTableName} SET title = '${title}', description = '${description}' - WHERE id = '${id}' + WHERE id = '${id}' AND user_id = '${user_id}' `) } @@ -120,7 +119,7 @@ export class VideoDB extends BaseDB implements VideoGateway{ }); }; - public async getVideoByUser(id: string): Promise{ + public async getAllUserVideos(id: string): Promise{ const result = await this.connection.raw(` SELECT v.*, u.name FROM ${this.videoTableName} v diff --git a/21-22-semana/futuretube/backend/src/presentation/endpoints/user/updatePassword.ts b/21-22-semana/futuretube/backend/src/presentation/endpoints/user/updatePassword.ts new file mode 100644 index 0000000..46ae1d5 --- /dev/null +++ b/21-22-semana/futuretube/backend/src/presentation/endpoints/user/updatePassword.ts @@ -0,0 +1,31 @@ +import { Request, Response } from "express"; +import { UpdatePasswordUC } from "../../../business/usecase/user/updatePassword"; +import { UserDB } from "../../../data/userDatabase"; +import { JwtAuthorizer } from "../../lambda/services/jwtAuthorizer"; +import { BcryptService } from "../../lambda/services/bcryptServices"; + +export const UpdatePasswordEndpoint = async (req: Request, res: Response) => { + try { + + const oldPassword = req.body.oldPassword; + const newPassword = req.body.newPassword; + const token = req.headers.auth as string; + + if(oldPassword === newPassword){ + throw new Error("You cannot use the last same password!") + } + + const updatePasswordUC = new UpdatePasswordUC(new UserDB(), new JwtAuthorizer(), new BcryptService()); + const result = await updatePasswordUC.execute({ + token, + oldPassword, + newPassword + }) + + res.status(200).send(result) + } catch(err) { + res.status(400).send({ + message: err.message + }) + } +} \ No newline at end of file diff --git a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/deleteVideo.ts b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/deleteVideo.ts index 1f52eec..5ca03fe 100644 --- a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/deleteVideo.ts +++ b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/deleteVideo.ts @@ -8,7 +8,7 @@ export const DeleteVideoEndpoint = async (req: Request, res: Response) => { const deleteVideoUC = new DeleteVideoUC(new VideoDB(), new JwtAuthorizer()); const result = await deleteVideoUC.execute({ token: req.headers.auth as string, - id: req.query.id + id: req.params.id }) res.status(200).send(result) diff --git a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoByUser.ts b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getAllUserVideos.ts similarity index 50% rename from 21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoByUser.ts rename to 21-22-semana/futuretube/backend/src/presentation/endpoints/video/getAllUserVideos.ts index 12da867..e958694 100644 --- a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoByUser.ts +++ b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getAllUserVideos.ts @@ -1,14 +1,15 @@ import { Request, Response } from "express"; -import { GetVideoByUserUC } from "../../../business/usecase/video/getVideoByUser"; +import { GetAllUserVideosUC } from "../../../business/usecase/video/getAllUserVideos"; import { VideoDB } from "../../../data/videoDatabase"; import { JwtAuthorizer } from "../../lambda/services/jwtAuthorizer"; -export const GetVideoByUserEndpoint = async (req: Request, res: Response) => { +export const GetAllUserVideosEndpoint = async (req: Request, res: Response) => { try{ - const getVideoByUserUC = new GetVideoByUserUC(new VideoDB, new JwtAuthorizer()) - const result = await getVideoByUserUC.execute({ + + const getAllUserVideosUC = new GetAllUserVideosUC(new VideoDB, new JwtAuthorizer()) + const result = await getAllUserVideosUC.execute({ token: req.headers.auth as string, - id: req.query.id + id: req.query ? req.query.id : "" }) res.status(200).send(result) diff --git a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoDetail.ts b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoDetail.ts index eb7eabc..cc47773 100644 --- a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoDetail.ts +++ b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/getVideoDetail.ts @@ -6,7 +6,7 @@ export const GetVideoDetailEndpoint = async (req: Request, res: Response) => { try { const getVideoDetailuc = new GetVideoDetailUC(new VideoDB()); const result = await getVideoDetailuc.execute({ - id: req.query.id + id: req.params.id }) res.status(200).send(result) diff --git a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/updateVideo.ts b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/updateVideo.ts index 2eb9e41..2930a4d 100644 --- a/21-22-semana/futuretube/backend/src/presentation/endpoints/video/updateVideo.ts +++ b/21-22-semana/futuretube/backend/src/presentation/endpoints/video/updateVideo.ts @@ -8,7 +8,7 @@ export const UpdateVideoEndpoint = async (req: Request, res: Response) => { const updateVideoUC = new UpdateVideoUC(new VideoDB(), new JwtAuthorizer()); const result = await updateVideoUC.execute({ token: req.headers.auth as string, - id: req.query.id, + id: req.params.id, title: req.body.title, description: req.body.description }) diff --git a/21-22-semana/futuretube/backend/src/presentation/lambda/index.ts b/21-22-semana/futuretube/backend/src/presentation/lambda/index.ts index fb90593..774f2b5 100644 --- a/21-22-semana/futuretube/backend/src/presentation/lambda/index.ts +++ b/21-22-semana/futuretube/backend/src/presentation/lambda/index.ts @@ -23,8 +23,10 @@ export const handler = async (event: LambdaEvent): Promise => { const response = { statusCode: err.statusCode || 400, body: JSON.stringify({ - message: err.message || "An unknown error occured" - }) + message: err.data + ? err.data.message + : err.message || "An unknown error occured", + }), }; console.log("Error output: ", response); diff --git a/21-22-semana/futuretube/backend/src/presentation/routes.ts b/21-22-semana/futuretube/backend/src/presentation/routes.ts index e9a8659..6f2bee0 100644 --- a/21-22-semana/futuretube/backend/src/presentation/routes.ts +++ b/21-22-semana/futuretube/backend/src/presentation/routes.ts @@ -7,7 +7,8 @@ import { GetAllUsersEndpoint } from "./endpoints/user/getAllUsers"; import { DeleteVideoEndpoint } from "./endpoints/video/deleteVideo"; import { UpdateVideoEndpoint } from "./endpoints/video/updateVideo"; import { GetVideoDetailEndpoint } from "./endpoints/video/getVideoDetail"; -import { GetVideoByUserEndpoint } from "./endpoints/video/getVideoByUser"; +import { GetAllUserVideosEndpoint } from "./endpoints/video/getAllUserVideos"; +import { UpdatePasswordEndpoint } from "./endpoints/user/updatePassword"; const app = express(); app.use(express.json()); // Linha mágica (middleware) @@ -16,30 +17,14 @@ app.use(express.json()); // Linha mágica (middleware) app.post("/signup", SignUpEndpoint); app.get("/login", LoginEndpoint); app.get("/users", GetAllUsersEndpoint); +app.post("/updatePassword", UpdatePasswordEndpoint); // video app.post("/createVideo", CreateVideoEndpoint); app.get("/feed", FeedOfVideosEndpoint) -app.delete("/deleteVideo", DeleteVideoEndpoint); -app.post("/updateVideo", UpdateVideoEndpoint); -app.get("/getVideoDetail", GetVideoDetailEndpoint); -app.get("/getVideoByUser", GetVideoByUserEndpoint); - -app.get('/', (req: Request, res: Response) => { - const resposta = { - endpoints: { - '/': 'Retorna lista com todos os endpoints', - '/signup': 'Criação dos usuários', - '/login': 'Login do usuário', - '/users': 'Retorna todos usuários. Apenas administradores podem usar esse endpoint', - '/createVideo': 'Cria um video', - '/feed': 'Mostra todos videos', - '/deleteVideo': 'Deleta um vídeo ao passar um id no body', - '/updateVideo': 'Atualiza um video ao passar o id e os dados no body', - '/getVideoByUser/:id': 'pega todos videos de um usuário específico' - } - }; - res.send(resposta) -}); +app.delete("/deleteVideo/:id", DeleteVideoEndpoint); +app.post("/updateVideo/:id", UpdateVideoEndpoint); +app.get("/getVideoDetail/:id", GetVideoDetailEndpoint); +app.get("/getAllUserVideos", GetAllUserVideosEndpoint); export default app; diff --git a/21-22-semana/futuretube/frontend/futuretube/.gitignore b/21-22-semana/futuretube/frontend/.gitignore similarity index 95% rename from 21-22-semana/futuretube/frontend/futuretube/.gitignore rename to 21-22-semana/futuretube/frontend/.gitignore index fe83568..4d29575 100644 --- a/21-22-semana/futuretube/frontend/futuretube/.gitignore +++ b/21-22-semana/futuretube/frontend/.gitignore @@ -1,7 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -node_modules/ +/node_modules /.pnp .pnp.js diff --git a/21-22-semana/futuretube/frontend/futuretube/README.md b/21-22-semana/futuretube/frontend/README.md similarity index 100% rename from 21-22-semana/futuretube/frontend/futuretube/README.md rename to 21-22-semana/futuretube/frontend/README.md diff --git a/21-22-semana/futuretube/frontend/futuretube/src/actions/index.js b/21-22-semana/futuretube/frontend/futuretube/src/actions/index.js deleted file mode 100644 index 533a5f6..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/actions/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import axios from 'axios'; -// import { push } from 'connected-react-router' -// import { routes } from '../containers/Router'; - -const baseUrl = "https://vj4kbpy8c0.execute-api.us-east-1.amazonaws.com/v1" - -const setVideoAction = (videos) => ({ - type: "SET_VIDEOS_ACTION", - payload: { - videos, - } -}) - -export const getVideos = () => async (dispatch) => { - try { - const response = await axios.get(`${baseUrl}/feed`) - - dispatch(setVideoAction(response.data.videos)) - } catch (err) { - window.alert("Erro de renderização") - } -} \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/index.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/index.js deleted file mode 100644 index d2522a2..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { StyledFooter, StyledP } from './styled'; - -function Footer (props){ - return( - - created by Brian © 2020 - - ) -} - -export default Footer; \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/styled.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/styled.js deleted file mode 100644 index fd345e4..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Footer/styled.js +++ /dev/null @@ -1,20 +0,0 @@ -import styled from 'styled-components'; - -export const StyledFooter = styled.footer` - width: 100%; - height: 140px; - background-color: #6f0000; - color: white; - display: flex; - flex-direction: column; - justify-content: flex-start; - align-items: center; - position: fixed; - bottom: 0; -` - -export const StyledP = styled.p` - color: white; - position: fixed; - bottom: 0; -` \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Header/index.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Header/index.js deleted file mode 100644 index 030ad99..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Header/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { StyledHeader, StyledButton, StyledInput, StyledLogoImage } from './styled'; -import Logo from '../../containers/images/logofutureTube.png'; - -function Header (props) { - return ( - - - - {props.text} - - ) -} - -export default Header; \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Header/styled.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Header/styled.js deleted file mode 100644 index 10c99b6..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Header/styled.js +++ /dev/null @@ -1,49 +0,0 @@ -import styled from 'styled-components'; - -export const StyledHeader = styled.header` - width: 100%; - height: 70px; - background-color: #a50f1e; - position: fixed; - top: 0; - display: flex; - justify-content: center; - align-items: center; -` - -export const StyledButton = styled.button ` - width: 120px; - height: 30px; - border-radius: 5px; - border: #a50f1e; - background-color: white; - color: #a50f1e; - position: fixed; - top: 20px; - right: 20px; - :hover{ - background-color: #6f0000; - color: white; - } -` - -export const StyledInput = styled.input` - min-width: 500px; - height: 25px; - outline: none; - border: 0; - position: fixed; - top: 20px; - color: black; - border-bottom: 1px solic white; - border-radius: 5px; - padding-left: 30px; -` - -export const StyledLogoImage = styled.img` - width: 80px; - height: 60px; - position: fixed; - left: 40px; - top: 5px; -` \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/index.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/index.js deleted file mode 100644 index 25ca4a0..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import React, { Fragment } from "react"; -import { Loading, Triangle } from "./styled"; - -function Loader ( ) { - return ( - - - - Loading... - - - ) -} - -export default Loader; \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/styled.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/styled.js deleted file mode 100644 index ebd2647..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Loader/styled.js +++ /dev/null @@ -1,15 +0,0 @@ -import styled, { keyframes } from 'styled-components'; - -export const Loading = styled.text ` - font-size: 9px; - text-align: center; -` - -const dash = keyframes ` - 100% { stroke-dashoffset: 136; } -` - -export const Triangle = styled.polygon` - stroke-dasharray: 17; - animation: ${dash} 2.5s cubic-bezier(0.35, 0.04, 0.63, 0.95) infinite; -` \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Main/index.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Main/index.js deleted file mode 100644 index fae7a10..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Main/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { StyledMain, StyledMenu, StyledVideoFeed } from "./styled"; - -function Main (props) { - return ( - - - - - ) -} - -export default Main; \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/components/Main/styled.js b/21-22-semana/futuretube/frontend/futuretube/src/components/Main/styled.js deleted file mode 100644 index 68d9407..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/components/Main/styled.js +++ /dev/null @@ -1,27 +0,0 @@ -import styled from 'styled-components'; - -export const StyledMain = styled.main ` - width: 100%; - position: fixed; - top: 80px; - min-height: 64vh; - display: flex; - justify-content: center; - align-items: center; -` - -export const StyledMenu = styled.menu` - width: 200px; - margin: 0; - height: 65vh; - border: none; - border-right: 1px solid #cfced1; -` - -export const StyledVideoFeed = styled.section ` - width: 100%; - padding: 5px; - height: 65vh; - display: flex; - flex-wrap: wrap; -` \ No newline at end of file diff --git a/21-22-semana/futuretube/frontend/futuretube/src/containers/App/index.js b/21-22-semana/futuretube/frontend/futuretube/src/containers/App/index.js deleted file mode 100644 index 3694e2d..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/containers/App/index.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from "react"; -import { Provider } from "react-redux"; -import thunk from "redux-thunk"; -import { MuiThemeProvider, CssBaseline } from "@material-ui/core"; -import theme from "../../style/theme"; -import Router from "../Router"; -import { createBrowserHistory } from "history"; -import { createStore, applyMiddleware, compose } from "redux"; -import { generateReducers } from "../../reducers"; -import { routerMiddleware } from "connected-react-router"; - -export const history = createBrowserHistory(); - -const middlewares = [ - applyMiddleware(routerMiddleware(history), thunk), - window.__REDUX_DEVTOOLS_EXTENSION__ - ? window.__REDUX_DEVTOOLS_EXTENSION__() - : f => f -]; - -const store = createStore(generateReducers(history), compose(...middlewares)); - -export const App = () => ( - - - - - - -); - -export default App; diff --git a/21-22-semana/futuretube/frontend/futuretube/src/containers/FeedPage/index.js b/21-22-semana/futuretube/frontend/futuretube/src/containers/FeedPage/index.js deleted file mode 100644 index 6ae5bf0..0000000 --- a/21-22-semana/futuretube/frontend/futuretube/src/containers/FeedPage/index.js +++ /dev/null @@ -1,66 +0,0 @@ -import React, { Fragment } from 'react' -import { StyledBody } from './styled'; -import { push } from 'connected-react-router'; -import { routes } from '../Router'; -import { connect } from 'react-redux'; -import { getVideos } from '../../actions'; -import Loader from '../../components/Loader' -import Header from '../../components/Header'; -import Footer from '../../components/Footer'; -import Main from '../../components/Main'; - -class FeedPage extends React.Component{ - constructor(props){ - super(props); - this.state = { - - } - } - - componentDidMount(){ - this.props.getVideos() - } - - handleLogOut = () => { - localStorage.removeItem("token") - this.props.goToLoginPage() - }; - - render () { - - // const { videos } = this.state; - - const videosIsReady = this.props.videos.length === 0 ? : ( - - {this.props.videos.map((video) => -

{video.title}

- )} -
- ) - - return ( - -
-
- {videosIsReady} -
-