Skip to content

Commit

Permalink
Migrate from Github Pages to Netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
mvximenko committed Jul 25, 2020
1 parent a18fe0e commit a7f7497
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 133 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ yarn-error.log*

# api keys
.env

# Local Netlify folder
.netlify
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
102 changes: 0 additions & 102 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dunno",
"version": "0.1.0",
"private": true,
"homepage": "https://mvximenko.github.io/dunno",
"homepage": "https://m-dunno.netlify.app",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
Expand All @@ -15,7 +15,6 @@
"@types/react-router-dom": "^5.1.5",
"@types/styled-components": "^5.1.0",
"firebase": "^7.16.1",
"gh-pages": "^3.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-indiana-drag-scroll": "^1.6.1",
Expand All @@ -28,9 +27,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
16 changes: 8 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ const App: React.FC = () => {
<GlobalStyle />
<Header currentUser={currentUser} />
<Switch>
<Route exact path='/dunno' component={Tv} />
<Route exact path='/dunno/movie' component={Movies} />
<Route exact path='/dunno/randomizer' component={Randomizer} />
<Route exact path='/dunno/tv/:titleId' component={Title} />
<Route exact path='/dunno/movie/:titleId' component={Title} />
<Route exact path='/dunno/person/:personId' component={Person} />
<Route exact path='/dunno/signin' component={SignIn} />
<Route exact path='/dunno/signup' component={SignUp} />
<Route exact path='/' component={Tv} />
<Route exact path='/movie' component={Movies} />
<Route exact path='/randomizer' component={Randomizer} />
<Route exact path='/tv/:titleId' component={Title} />
<Route exact path='/movie/:titleId' component={Title} />
<Route exact path='/person/:personId' component={Person} />
<Route exact path='/signin' component={SignIn} />
<Route exact path='/signup' component={SignUp} />
</Switch>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Person.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Person: React.FC<Props> = ({ match }) => {
<Wrapper>
<Heading>{name}</Heading>
{titles.map((title) => (
<Link to={`/dunno/${title.media_type}/${title.id}`} key={title.id}>
<Link to={`/${title.media_type}/${title.id}`} key={title.id}>
<Row>
<Placeholder>
<Img
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const SignIn: React.FC = () => {
<Button type='button' google={true} onClick={signInWithGoogle}>
Sign in with Google
</Button>
<Link to='/dunno/signup'>{'New to Dunno? Sign up'}</Link>
<Link to='/signup'>{'New to Dunno? Sign up'}</Link>
</Form>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const SignUp: React.FC = () => {
required
/>
<Button type='submit'>Sign Up</Button>
<Link to='/dunno/signin'>{'Already have an account? Sign in'}</Link>
<Link to='/signin'>{'Already have an account? Sign in'}</Link>
</Form>
</Container>
);
Expand Down
22 changes: 11 additions & 11 deletions src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ const Header: React.FC<Props> = ({ currentUser }) => {
<>
<StyledHeader>
<Logo>
<LogoLink to='/dunno'>dunno</LogoLink>
<LogoLink to='/'>dunno</LogoLink>
</Logo>

<Nav>
<NavLink exact to='/dunno'>
<NavLink exact to='/'>
TV Shows
</NavLink>
<NavLink exact to='/dunno/movie'>
<NavLink exact to='/movie'>
Movies
</NavLink>
<NavLink exact to='/dunno/randomizer'>
<NavLink exact to='/randomizer'>
Randomizer
</NavLink>
<NavLink exact to='/dunno/favorites'>
<NavLink exact to='/favorites'>
Favorites
</NavLink>
</Nav>
Expand All @@ -51,22 +51,22 @@ const Header: React.FC<Props> = ({ currentUser }) => {
{currentUser ? (
<ProfileIcon src={SignOutPng} onClick={() => auth.signOut()} />
) : (
<Link to='/dunno/signin'>
<Link to='/signin'>
<ProfileIcon src={ProfilePng} />
</Link>
)}
<MenuIcon src={MenuPng} onClick={toggleDrawer} />
</StyledHeader>

<Menu active={drawer} onClick={toggleDrawer}>
<MenuLink to='/dunno'>TV Shows</MenuLink>
<MenuLink to='/dunno/movie'>Movies</MenuLink>
<MenuLink to='/dunno/randomizer'>Randomizer</MenuLink>
<MenuLink to='/dunno/favorites'>Favorites</MenuLink>
<MenuLink to='/'>TV Shows</MenuLink>
<MenuLink to='/movie'>Movies</MenuLink>
<MenuLink to='/randomizer'>Randomizer</MenuLink>
<MenuLink to='/favorites'>Favorites</MenuLink>
{currentUser ? (
<SignOut onClick={() => auth.signOut()}>Sign Out</SignOut>
) : (
<MenuLink to='/dunno/signin'>Sign In</MenuLink>
<MenuLink to='/signin'>Sign In</MenuLink>
)}
</Menu>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const SearchBar: React.FC<Props> = ({ closeMenu }) => {
.filter((item, index) => index < 5)
.map((item) => (
<Link
to={`/dunno/${item.media_type}/${item.id}`}
to={`/${item.media_type}/${item.id}`}
onClick={closeMenu}
key={item.id}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/ListPoster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Props {
const ListPoster: React.FC<Props> = ({ id, mediaType, title, posterPath }) => {
const [loaded, setLoaded] = useState(false);
return (
<Link to={`/dunno/${mediaType}/${id}`}>
<Link to={`/${mediaType}/${id}`}>
<Img
loading='lazy'
alt={title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/title/TitleCast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TitleCast: React.FC<Props> = ({ id, name, profilePath }) => {
const [loaded, setLoaded] = useState(false);
return (
<Column>
<Link to={`/dunno/person/${id}`}>
<Link to={`/person/${id}`}>
<Photo>
<Img
src={
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useLoaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function useLoaded(

useEffect(() => {
if (state) setState(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [backdropPath]);

return [state, loaded];
Expand Down
2 changes: 1 addition & 1 deletion src/store/title/titleActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function useFetchTitle(
dispatch: React.Dispatch<TitleActionTypes>
): void {
useEffect(() => {
const [, , mediaType, titleId] = url.split('/');
const [, mediaType, titleId] = url.split('/');
const key: string = `${mediaType}_${titleId}`;
if (localStorage.getItem(key)) {
const data = JSON.parse(localStorage.getItem(key) as string);
Expand Down

0 comments on commit a7f7497

Please sign in to comment.