Skip to content

Commit

Permalink
more renovation, forcing artist name search in lower case becasue una…
Browse files Browse the repository at this point in the history
…ble to find some artist on spotify when arrtist name contained upper case
  • Loading branch information
sam9116 committed Feb 9, 2024
1 parent c9459a5 commit fcf2f55
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function App() {
className="App-header"
container
spacing={2}>
<Stack item xs={4} md={4} spacing={3}>
<Stack item xs={6} md={6} spacing={3}>
<Box>
<img src={window.location.origin + '/Taver.png'} alt="Taver" />
</Box>
Expand All @@ -64,7 +64,7 @@ function App() {
</Router>
<ConcertList setConcerts={setConcerts} setAllConcerts={setAllConcerts} concerts={concerts}></ConcertList>
</Stack>
<Grid sx={{ height: '100vh' }} item xs={8} md={8}>
<Grid sx={{ height: '100vh' }} item xs={6} md={6}>
<SharePage concerts={concerts} userLocation={userLocation} mapStyle={mapStyle} />
</Grid>
</Grid>
Expand Down
10 changes: 9 additions & 1 deletion src/AuthorizeSpotify.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Button } from "@mui/material";

function AuthorizeSpotify() {

Expand Down Expand Up @@ -38,7 +39,14 @@ function AuthorizeSpotify() {
return (
<div>
<p>Authorize Spotify: </p>
<button onClick={handleSpotifySignIn}>Sign in to Spotify</button>
<Button
sx={{ background: "limegreen" }}
type="submit"
variant="contained"
color="success"
onClick={handleSpotifySignIn}>
Sign in to Spotify
</Button>
</div>
);
}
Expand Down
39 changes: 24 additions & 15 deletions src/BaseInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, forwardRef, useImperativeHandle, useEffect } from "react";
import * as React from 'react';
import { TextField, Button, Stack } from '@mui/material';
import { TextField, Button, Stack, FormControl, InputLabel, NativeSelect } from '@mui/material';

const mapStyles = [
{ mapId: "1fc21c527f198d4e", displayName: "Default Theme", buttonColorCss: "0070d2" },
Expand Down Expand Up @@ -62,7 +62,7 @@ const BaseInput = forwardRef(({ setConcerts, setUserLocation, setMapStyle, start
"content-type": "application/json;charset=utf-8",
},
body: JSON.stringify({
artistName: incomingArtistName,
artistName: incomingArtistName.toLowerCase(),
startDate: startDate,
endDate: endDate
}),
Expand Down Expand Up @@ -147,9 +147,6 @@ const BaseInput = forwardRef(({ setConcerts, setUserLocation, setMapStyle, start
value={artistName} onChange={(e) => setArtistName(e.target.value)}
/>
<Button
sx={{
cursor: 'pointer',
}}
type="submit"
variant="contained"
color="primary">
Expand All @@ -159,16 +156,28 @@ const BaseInput = forwardRef(({ setConcerts, setUserLocation, setMapStyle, start

</form>

<div>
Map Style:{" "}
<select name="mapStyle" id="mapStyle" onChange={(event) => setMapStyle(event.target.value)}>
{mapStyles.map((mapStyle) => (
<option key={mapStyle.mapId} value={mapStyle.mapId}>
{mapStyle.displayName}
</option>
))}
</select>
</div>
<FormControl fullWidth>
<InputLabel
sx={{
color: 'white'
}}
variant="standard" htmlFor="mapStyle">
Map Style:
</InputLabel>
<NativeSelect
sx={{
color: 'white'
}}
defaultValue={mapStyles[0]}
id="mapStyle"
onChange={(event) => setMapStyle(event.target.value)}>
{mapStyles.map((mapStyle) => (
<option style={{backgroundColor: 'darkgrey'}} key={mapStyle.mapId} value={mapStyle.mapId}>
{mapStyle.displayName}
</option >
))}
</NativeSelect>
</FormControl>
</Stack>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/SharePageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SharePageList = ({ concerts }) => {
return (
<List dense>
{concerts.map((concert, index) => (
<Grid item key={index}>
<Grid item key={index}>
<ListItem
key={index}
disablePadding
Expand Down
28 changes: 20 additions & 8 deletions src/YourFavoriteSpotifyArtists.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Grid, Chip, Stack } from '@mui/material';
import { Grid, Chip, Button, Box } from '@mui/material';
import { useLocation } from "react-router-dom";

function YourFavoriteSpotifyArtists({ onChildClick, startDate, endDate }) {
Expand All @@ -19,7 +19,7 @@ function YourFavoriteSpotifyArtists({ onChildClick, startDate, endDate }) {
return (

<Grid item key={index}>
<Chip sx={{ background: "limegreen" }} label={artistName} color="primary" onClick={() => handleClick(artistName)} />
<Chip sx={{ background: "limegreen" }} label={artistName} color="success" onClick={() => handleClick(artistName)} />
</Grid>

);
Expand Down Expand Up @@ -103,15 +103,27 @@ function YourFavoriteSpotifyArtists({ onChildClick, startDate, endDate }) {

// Display spotify token
return (
<div>
<Grid>
<p>Top Artists: </p>
{disableButton ? (
<div>
<Stack xs={4} md={4} container spacing={1} direction="row">
<Box
display="flex"
justifyContent="center"
alignItems="center"

>
<Grid xs={6} md={6} container spacing={1} direction="row" justifyContent="center">
{commaSeparatedfollowedArtists}
</Stack>
</div>) : (<Chip color="primary" label="Get your top artists" sx={{ background: "limegreen" }} onClick={getSpotifyArtist}></Chip>)}
</div>
</Grid>
</Box>) : (
<Button
sx={{ background: "limegreen" }}
variant="contained"
color="success"
onClick={getSpotifyArtist}>
Get your top artists
</Button>)}
</Grid>
);
}

Expand Down

0 comments on commit fcf2f55

Please sign in to comment.