Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ba02eef
react folder
Jul 29, 2019
a5ba19b
add gitignore for yarn.lock
Jul 29, 2019
d012dfe
Delete yarn.lock
chef27615 Jul 29, 2019
2408912
Merge pull request #1 from cs19-team-f/wei-du
chef27615 Jul 29, 2019
9b2934e
re-initiated front
Jul 30, 2019
f67a2ff
Delete .DS_Store
chef27615 Jul 30, 2019
4bb4093
app displaying and setting up Login
sarahrileydev Jul 30, 2019
270b50e
ammend app
sarahrileydev Jul 30, 2019
6ec73e6
reorg
Jul 30, 2019
23b7325
Merge branch 'wei-du' of https://github.com/cs19-team-f/LambdaMUD-Cli…
Jul 30, 2019
6133d17
render login on home screen
sarahrileydev Jul 30, 2019
94b71b2
refactor login/register together, remove header
sarahrileydev Jul 30, 2019
cc551db
ammend register onclick
sarahrileydev Jul 30, 2019
3f14a81
registration and login working
sarahrileydev Jul 30, 2019
370a381
recode
Jul 30, 2019
d7b5f07
commit-madd init as deshbordand room and room_detail fi
Jul 30, 2019
3f40437
add checkAuth and PriivateRoute fn in App.js file
Jul 30, 2019
3dc9d2c
Merge pull request #2 from cs19-team-f/sarah-riley
sarahrileydev Jul 31, 2019
f3f164a
update for data in room
Jul 31, 2019
9838370
changes from pull
Jul 31, 2019
01b8a36
Merge pull request #4 from cs19-team-f/wei-du
chef27615 Jul 31, 2019
2315318
added token to axios call
sarahrileydev Jul 31, 2019
9172eb6
Merge pull request #5 from cs19-team-f/sarah-riley
sarahrileydev Jul 31, 2019
32404c5
init
Jul 31, 2019
5bf6cf0
change from pull
Jul 31, 2019
9cdf29e
data coming back
Jul 31, 2019
120871e
props rendering in room_detail file
Jul 31, 2019
4dd1ffd
update com
Jul 31, 2019
3f954d4
Merge pull request #6 from cs19-team-f/wei-du
chef27615 Jul 31, 2019
6788854
init data working
sarahrileydev Aug 1, 2019
349e9d4
chages before pull
Aug 1, 2019
c411853
commit before pull
Aug 1, 2019
8f69d23
live linkage
Aug 1, 2019
e0210ac
typo
Aug 1, 2019
2f163be
working on mapping the game
Aug 1, 2019
367b4ca
Merge pull request #7 from cs19-team-f/wei-du
chef27615 Aug 1, 2019
6d36ca9
resolve merge conflicts
sarahrileydev Aug 1, 2019
e74def1
refactor init file and rooms into game file
sarahrileydev Aug 1, 2019
a6ad2a4
Merge pull request #8 from cs19-team-f/sarah-riley
sarahrileydev Aug 1, 2019
bcd6555
commit before pull
Aug 1, 2019
2cd463a
commit after pull
Aug 1, 2019
8e9ccb0
Merge pull request #9 from cs19-team-f/wei-du
chef27615 Aug 1, 2019
a5d684e
refactor
sarahrileydev Aug 2, 2019
b34ff26
ammend
sarahrileydev Aug 2, 2019
7376e5f
move buttons working
sarahrileydev Aug 2, 2019
ca6e877
DOM update moves
Aug 2, 2019
30cf1fe
style change
Aug 2, 2019
60de754
Merge pull request #10 from cs19-team-f/wei-du
chef27615 Aug 2, 2019
0e62fde
fix merge conflicts
sarahrileydev Aug 2, 2019
8db80e7
added .toml file
sarahrileydev Aug 2, 2019
0efe1c3
Merge pull request #11 from cs19-team-f/sarah-riley
sarahrileydev Aug 2, 2019
fead662
basic css
Aug 2, 2019
ea8237a
Merge pull request #12 from cs19-team-f/wei-du
chef27615 Aug 2, 2019
9e3e979
edit toml
sarahrileydev Aug 2, 2019
d599d29
Merge branch 'master' of https://github.com/cs19-team-f/LambdaMUD-Cli…
sarahrileydev Aug 2, 2019
f5bbb64
edit
sarahrileydev Aug 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# LambdaMUD-Client
Front-end for the [LambdaMUD-Project](https://github.com/LambdaSchool/LambdaMUD-Project).

Fork this repo and put your front-end client code in your fork.
25 changes: 25 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
/.DS_Store

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
68 changes: 68 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
9 changes: 9 additions & 0 deletions client/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build]
base = "client"
publish = "client/build"
command = "yarn build"

[[redirects]]
from = "/*"
to = "/index.html"
status = 200
34 changes: 34 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added client/public/favicon.ico
Binary file not shown.
38 changes: 38 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
28 changes: 28 additions & 0 deletions client/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*{
box-sizing: border-box;
}

.App{
width: 800px;
height: 100vh;
margin: 0 auto;
}
.App .control_panel {
display: flex;
}

.user_info p{
text-align: center;
}
.directions{
display: flex;
padding-bottom: 50px;
}
.disc{
padding-left: 5%;
}
.App .control_panel div {
align-self: center;
/* border: 1px solid black; */
margin: 0 auto
}
24 changes: 24 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { Switch, Route } from 'react-router-dom'
import './App.css'
import Login from './components/Login'
import Game from './components/Game'



function App() {
return (
<div className="App">

<header className="App-header">
<Switch>
<Route exact path="/" component={Login} />
<Route exact path="/game" component={Game} />

</Switch>
</header>
</div>
);
}

export default App;
9 changes: 9 additions & 0 deletions client/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
121 changes: 121 additions & 0 deletions client/src/components/Game.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import React, { Component } from "react";
import axios from "axios";

import Map from "./Map";

export default class Init extends Component {
state = {
uuid: "",
name: "",
title: "",
description: "",
players: [],
key: localStorage.getItem("key")
};
componentDidMount() {
if (localStorage.getItem("key")) {
this.init();
}
}

handleInput = event => {
this.setState({
[event.target.id]: event.target.value
});
};

init = () => {
const header = {
Authorization: `Token ${this.state.key}`
};
console.log("HEADER", header);
axios
.get("https://f-troop-adventures.herokuapp.com/api/adv/init/", {
headers: header
})
.then(res => {
this.setState({
uuid: res.data.uuid,
name: res.data.name,
title: res.data.title,
description: res.data.description,
players: res.data.players
});
});
};

handleMove = (direction) => {
const header = {
Authorization: `Token ${this.state.key}`
};
axios
.post(
"https://f-troop-adventures.herokuapp.com/api/adv/move/",
{ direction: direction },
{
headers: header
}
)
.then(res => {
console.log("MOVE RES", res.data.title);
this.setState({
title: res.data.title, description: res.data.description
})
})
.catch(error => {
console.log(error);
});
};
render() {
const { uuid, name, title, description, players } = this.state;
return (
<div className='control_panel'>
<div className='user_info'>
<h3>Your information:</h3>
<p>{uuid}</p>
<p>Your name: {name}</p>
<p>you are here at {title}</p>
<p>
other player in the same area as you: {players.map(player => player)}
</p>
</div>
<div className="area_map">
<Map />
</div>

<div className="directions">
<button
className="direction-btn"
onClick={() => this.handleMove("n")}
>
North
</button>
<button
className="direction-btn"
onClick={() => this.handleMove("e")}
>
East
</button>
<button
className="direction-btn"
onClick={() => this.handleMove("s")}
>
South
</button>
<button
className="direction-btn"
onClick={() => this.handleMove("w")}
>
West
</button>

</div>
<div className ='disc'>
<h2>{title}</h2>
<p>{description}</p>
</div>

</div>
);
}
}
Loading