Code Monkey home page Code Monkey logo

pp1_2018's Introduction

GameSearchMatch

Programming Project 1 - 2018
RMIT University

Tutor

Homy - Amir Homayoon Ashrafzadeh

Authors

s3432752 - Martin Balakrishnan
s3589104 - Duong Bao Toan Au
s3600735 - Tuong Van Cindy Tran
s3431693 - Robert Ludwig Jeffs
s3496839 - Ronald Rinaldy

About

GameSearchMatch exists to match players with other gamers with similar interests using our own matchmaking algorithm. The algorithm used in the application will be based on the Needleman-Wunsch algorithm. The algorithm functions by comparing the results of two users and generates a “similarity score”, the higher a score the greater a match. Over time as users match more, the system will determine preferences that are more or less relevant to the user’s interests. Users will be matched based on their game preferences, region, genre preference, etc. It is through this matchmaking algorithm that users of the application can be matched together to become friends and game with each other.

Setup instructions

Cloning the repo

Clone https://github.com/DeftCorgi/PP1_2018.git into your working directory

Installing Node

Download and install Node at https://nodejs.org/en/download/

Installing dependencies

Navigate into your working directory from the terminal or bash.
Run the command: npm run setup
Wait as npm installs all required packages for the project on both the front and back-end apps.

Setting up keys files

Create a file called dev.js in /app/config/ Copy and paste this code into dev.js: https://gist.githubusercontent.com/DeftCorgi/7030c6704c1744b5575249364ff5b650/raw/a1f254a9d633f5816c320d87f860e23a0c105a13/dev.js
Replace the empty single quotations from the file with your actual keys obtained from google cloud console.

Start the server!

Simply run the command: npm run dev while in the root directory (where server.js is)

pp1_2018's People

Contributors

toan-au avatar martinbalakrishnan avatar ludw1gj avatar vigridian avatar

Watchers

James Cloos avatar  avatar

pp1_2018's Issues

Split Content component into two seperate components...

Suggestion

The Content component is the router component essentially, but lacks the separation of routes for authenticated users vs unauthenticated users. I want to suggest we split the component into two: PublicRoutes and ProtectedRoutes.

./src/components/Content.js

/**
 * PublicRoutes - router for landing, login and register routes, redirect user to
 * landing page if any other route.
 */
export const PublicRoutes = () => {
  return (
    <BrowserRouter>
      <Switch>
        <Route path="/" component={LandingView} />
        <Route exact path="/login" component={LoginView}/>
        <Route exact path="/register" component={RegisterView}/>
        <Redirect to="/"/>
      </Switch>
    </BrowserRouter>
  )
}
/**
 * ProtectedRoutes - router for user's who are authenticated, redirect user's
 * if they try to access login and register pages to the Home page, and
 * redirects any other route not listed to the not found page.
 */
export const ProtectedRoutes = () => {
  return (
    <BrowserRouter>
      <Switch>
        {/* Redirect */}
        <Route exact path="/login" render={() => <Redirect to="/" />} />
        <Route exact path="/register" render={() => <Redirect to="/" />} />
        
        {/* Render */}
        <Route path="/" component={HomeView} />

        <Route exact path="/matches" component={MathesView} />
        <Route exact path="/pending" component={PendingView} />
        <Route exact path="/settings" component={SettingsView} />
        <Route exact path="/auth/logout" component={LogoutView} />

        <Route path="*" component={NotFoundView}/>
      </Switch>
    </BrowserRouter>
  )
}

./App.js
And below could be how the flow of the App component could be. Sorry I cbb coding it fully 🍔

const App = () => {
  if (AppUserStore.isAuthenticated) {
    return <ProtectedRoutes />;
  }
  return <PublicRoutes />;
};

Note: I appended View to page components to be more clear.

Reason

This will simplify routing when dealing with authenticated users vs unauthenticated users.

Alternative

Create a routes.js file at ./src with PublicRoutes and ProtectedRoutes components, and import them into ./src/components/Content.js.

const Content = ({ user }) => {
  if (user) {
    return (
      <main className="Content">
        <ProtectedRoutes />
      </main>
    );
  }
  return (
    <main className="Content">
      <PublicRoutes />
    </main>
  );
};

Rename and move ./src/components/Content.js

Suggestion

  • Rename ./src/components/Content.js to ./src/components/routes.js
  • Move ./src/components/Content.js to ./src/routes.js

Reason

routes.js is an important component which having it at the same directory level as App.js will make things easier to reason with and makes more sense

Login fails for user

What

When the user clicks on Google Login, the page returns to the Landing Page.

Why?

The server responds with "" rather than the user object (req.user), sometimes.

redux -> actions -> user

const response = await axios.get('/api/auth/current');
const user = response.data; // server response data for user is: ""

./routes/auth.js

// returns the current user object
router.get('/current', (req, res) => res.send(req.user));

Create a 404 / Not Found Page

Suggestion

Create a 404 page

Reason

Without handling a 404 page, the user experiences no feedback when routing to a page that doesn't exist. Most websites have a 404 page and it makes sense in routing logic. Lastly it's a quick component to make and won't waste much of our time.

Logo as Favicon

Suggestion

Once the logo is finalised, it could be used as the website's favicon as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.