Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glasgow 06 - Malkit Benning - Full Stack Project Assessment - Level 300 complete #338

Closed
wants to merge 11 commits into from

Conversation

malkitbenning
Copy link

@malkitbenning malkitbenning commented Aug 18, 2023

React app deployed on netlify, server and database on Render. All working - rating updates, adding new videos and deleting from database via calls from netlify app then server.

Added both client and server code into one branch too allow me to run both locally and edit files at the same time.
Code now includes sql calls and also use of env variables so no passwords or database details are accidentally leaked.

@malkitbenning malkitbenning changed the title Glasgow 06 - Malkit Benning - Full Stack Project Assessment - Level 250 React changes Glasgow 06 - Malkit Benning - Full Stack Project Assessment - Level 300 complete Aug 23, 2023
@@ -0,0 +1,70 @@
import React from "react";
import "./MovieCard.css";
function MovieCard(props) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could deconstruct your props in side as in function MovieCard({ movie, setRefreshVideos})
for the key, technically you are passing in movie therefore inside that you've got movie.id.
give it a try and let's see.

import "./MovieCard.css";
function MovieCard(props) {
const fetchAddress = "https://full-stack-server-fofh.onrender.com/";
const movieName = props.movie.url.split("watch?v=")[1];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then any props you simply used directly, therefore remove all props from props.movie.url into movie.url

}

function upVote() {
let newVote = props.movie.rating + 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd change this to const. same as downVote

import React, { useState } from "react";
import "./NewVideoContainer.css";

function NewVideoContainer({ allMovies, setRefreshVideos }) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done

const [newTitle, setNewTitle] = useState("");
const [newURL, setNewURL] = useState("");
function addNewVideo() {
console.log("button clicked");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed here ? usually don't leave console.logs as they can cause security vulnerabilities.

let newRating = 0;

client
.query("INSERT INTO videos (id, title, url, rating) VALUES ($1, $2, $3, $4)", [newId, newTitle, newUrl, newRating])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really nice

@Dedekind561 Dedekind561 closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants