Skip to content
Open

Dev #82

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
27 changes: 16 additions & 11 deletions frontend/src/routes/restaurants/RestaurantProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,19 @@ const RestaurantProfile = () => {
<h2 id="restaurant-name">{ restaurant.name }</h2>
<p className="restaurant-atribute" data-cy="typeOfFood"> Tipo de comida: {restaurant.typeOfFood}</p>
{ restaurant.site && <a className="restaurant-atribute" id="restaurant-site" href={restaurant.site}> Site oficial </a>}
{numRatings !== 1 ? (
<div>
{numRatings} Avaliações
</div>
) : (
<div>
{numRatings} Avaliação
</div>

)}
<div>
<div id ="avg-rating">
{numRatings !== 1 ? (
<div>
{numRatings} Avaliações
</div>
) : (
<div>
{numRatings} Avaliação
</div>

)}


{[...Array(5)].map((star, index) => {
const starValue = index + 1;

Expand All @@ -201,7 +203,10 @@ const RestaurantProfile = () => {
</span>
);
})}

</div>


</div>
</div>

Expand Down
21 changes: 14 additions & 7 deletions frontend/src/routes/reviews/ReviewCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ const ReviewCreate = () => {
const [title, setTitle] = useState('');
const [text, setText] = useState('');

const [rating, setRating] = useState('');
const [rating, setRating] = useState(0);
const [hover, setHover] = useState(null);
const [totalStars, setTotalStars] = useState(5);

const [sabor, setSabor] = useState('');
const [sabor, setSabor] = useState(0);
const [hoverS, setHoverS] = useState(null);
const [totalStarsS, setTotalStarsS] = useState(5);

const [atendimento, setAtendimento] = useState('');
const [atendimento, setAtendimento] = useState(0);
const [hoverA, setHoverA] = useState(null);
const [totalStarsA, setTotalStarsA] = useState(5);

const [tempoDeEspera, setTempoDeEspera] = useState('');
const [tempoDeEspera, setTempoDeEspera] = useState(0);
const [hoverT, setHoverT] = useState(null);
const [totalStarsT, setTotalStarsT] = useState(5);

const [preco, setPreco] = useState('');
const [preco, setPreco] = useState(0);
const [hoverP, setHoverP] = useState(null);
const [totalStarsP, setTotalStarsP] = useState(5);

Expand Down Expand Up @@ -94,7 +94,8 @@ const ReviewCreate = () => {
<div>
<form onSubmit={createNewReview}>
<p>Título</p>
<input type="text" placeholder="Coxinha Boa"
<input type="text" placeholder="Coxinha Boa"
id = "title"
value={title}
onChange={ev => setTitle(ev.target.value)}
required
Expand All @@ -109,9 +110,10 @@ const ReviewCreate = () => {
<input
type="radio"
name="rating"
id = "rating"
value={currentRating}
onChange={() => setRating(currentRating)}
required
required
/>
<span
className="star"
Expand All @@ -135,6 +137,7 @@ const ReviewCreate = () => {
placeholder="Amei a coxinha..."
wrap = "soft"
name = "text"
id = "text"
required
value={text} onChange={ev => setText(ev.target.value)}
/>
Expand All @@ -148,6 +151,7 @@ const ReviewCreate = () => {
<input
type="radio"
name="sabor"
id = "sabor"
value={currentSabor}
onChange={() => setSabor(currentSabor)}
/>
Expand Down Expand Up @@ -175,6 +179,7 @@ const ReviewCreate = () => {
<input
type="radio"
name="atendimento"
id = "atendimento"
value={currentAtendimento}
onChange={() => setAtendimento(currentAtendimento)}
/>
Expand Down Expand Up @@ -202,6 +207,7 @@ const ReviewCreate = () => {
<input
type="radio"
name="tempoDeEspera"
id = "tempoDeEspera"
value={currentTempoDeEspera}
onChange={() => setTempoDeEspera(currentTempoDeEspera)}
/>
Expand Down Expand Up @@ -229,6 +235,7 @@ const ReviewCreate = () => {
<input
type="radio"
name="preco"
id = "preco"
value={currentPreco}
onChange={() => setPreco(currentPreco)}
/>
Expand Down
Loading