Code Monkey home page Code Monkey logo

eris-old's Introduction

README

Eris is a clone of the chat app Discord. Users can create accounts and log in. Once logged in, they can create servers and view the list of servers they are in.

Eris can be found at https://eris-chat.herokuapp.com

Eris is built with a PostgreSQL database, a Rails backend, and a React/Redux frontend.

Users can log in to the site user a demo account, or they can register an account using their email.

handleSubmit(e) {
  e.preventDefault();
  this.props.clearErrors();
  this.props.processForm(this.state);
}

handleDemo(e) {
  e.preventDefault();
  const demoUser = { email: '[email protected]', password: 'pallas'};
  this.props.demoLogin(demoUser)
}

If there are any errors in the registration or login process, it displays them cleanly next to the relevant fields so that the user can correct them. Only one error per field is displayed at a time.

renderError(type) {
  let errorList = [];
  let errorItem = "";
  Object.entries(this.props.errors).map((entry) => {
    errorList = errorList.concat(Object.entries(entry[1]))
  })
  errorList.forEach((error) => {
    if (type === error[0] && error[1] != null) {
      errorItem = <span className="error-item"> - {error[1][0]}</span>
    }
  })
  return(errorItem);
}

Once logged in, users are directed to a home page, where an index of servers is displayed in a sidebar.

render() {
  let serverList = [];
  let newChannel;
  let activeServer;
  if (this.props.servers.joined) {
    serverList = Object.values(this.props.servers.joined).map((server) => {
      activeServer = (this.props.servers.current == server.id) ? 'active-server' : '';
      if (server.id == this.props.user.home) {
        newChannel = '/channels/@me';
      } else {
        newChannel = `/channels/${server.id}`;
      }
      return(
        <li key={server.id} className="server-list-item">
          <Link className={`server-link ${activeServer}`} to={newChannel}></Link>
          <span className="server-link-info">{server.name}</span>
        </li>
      )
    })
  }
  return(
    <ul className="server-list">
      {serverList}
      <ServerFormContainer />
    </ul>
  )
}

Users start with a home server and can create additional ones.

def create
  @user = User.new(user_params)
  user.home = Server.create('owner_id': @user.id, 'name': 'Home')
  if @user.save
    login!(@user)
    render 'api/users/show'
  else
    render json: @user.errors.messages, status: 422
  end
end

Hovering on a server icon will reveal its name, and clicking on it will navigate to the server's page. Navigating to /channels/@me takes the user to their home server.

shouldComponentUpdate(nextProps, nextState) {
  if (this.props.match.params.serverId === nextProps.match.params.serverId) {
    return false;
  } else {
    return true;
  }
}

componentDidUpdate() {
    if (this.props.match.path === '/channels/@me') {
      this.props.showServer(this.props.user.home)
    } else if (this.props.match.params.serverId == this.props.user.home) {
      this.props.showServer(this.props.match.params.serverId)
        .then(data => this.props.history.push(`/channels/@me`));
    } else {
      this.props.showServer(this.props.match.params.serverId);
    }
}

Some planned additional features include:

  • List of channels per server
  • List of messages per channel
  • Ability to send and receive messages
  • Private message channels on the user's home server

eris-old's People

Contributors

echurilov avatar

Stargazers

 avatar

Watchers

 avatar

eris-old's Issues

MVP: User Auth

User auth has:

  • register (sign up)
  • log in
  • log out
  • log in as demo user
  • display errors on form submission
  • displaying errors does not move around other elements
  • clear errors on resubmit/moving between pages
  • styling closely resembles actual site (for splash, login, & register pages)

MVP: Servers

Servers have:

Create: Users can create new servers
Read: Users can view a list of servers of which they are a member
Users must be logged in to view servers
Adequate styling
Smooth, bug-free navigation
Adequate and appropriate seeds to demonstrate the feature

Full Stack Proposal Feedback

Wiki Page Home

  • Is the first page you see upon entering the wiki
  • Contains a welcome message
  • Contains a link/placeholder for a link to the live page
  • All links in the right sidebar should contain each wiki page and link to the correct page
  • Correctly formatted
    • each wiki page is listed in bullet points
    • all links route the correct page

Comments


MVP List

  • Should have 7 MVPs.
    • 3 of those are User Auth, Heroku, and Production README.
    • The other 4 are from the MVP List or they have clarified them with you
  • Contains a description sentence of the app
  • At least one CRUD feature, which states what CRUD operations are planned (creation, reading, updating, deletion)
  • Estimates how long it will take the code each MVP
  • Correctly formatted
    • MVPs are listed in an ordered list
    • Each MVP is broken down into bullet points

Comments

  • Put user auth first on the MVP list so that you have something to host on Heroku
  • Add these bullets to all of your MVPs
    • Adequate styling
    • Smooth, bug-free navigation
    • Adequate and appropriate seeds to demonstrate the feature
  • Explicitly say which feature uses CRUD
  • Format according to Bluebird
  • Put your production README last

Database Schema

  • Contains correct datatypes

  • Contains appropriate constraints/details

    • primary key
    • not null
    • unique
    • indexed
    • foreign key
  • Contains bullet points after the table that state which foreign keys will reference to which table, or references to the associations which will be made

  • Correctly formatted

    • schema is written in a table format
    • the table's name are back_ticked
    • the table header column names are bolded
    • columns names are lowercased and snaked_cased and back_ticked

Comments

  • Remove the associations page and just add bullets under each table for the associations
  • Rename any foreign keys in the convention _id

Sample State

  • State shape is flat!
  • State's keys are camelCased
  • All keys within the values in the state are accessible in the schema
  • Correctly formatted
    • Sample state is rendered with triple backticks, and the language ```javascript...```). This will display the state as a code block instead of a giant line of text
    • Top level slices
      • entities
      • session
      • errors (here or in ui)
      • ui (if needed)
    • Should NOT have nested slices, aka comments inside of posts
      • Some info from other tables is ok, for instance:
        • the author username and imageurl for a post. basically any info that the user can't change
        • like count and a boolean on whether the user likes the post instead of a likes slice

Comments


Backend Routes

  • Contains the following sections: HTML, API Endpoints(Backend)
  • Each route has a description
  • API Endpoint routes contains wildcard variables written in snake_case
  • Routes does not contain superfluous routes
  • Have API routes that will allow the front end to get all info it needs and does not have unneeded routes:
    • probably doesn't need a GET likes api endpoint because that info comes through the post show

Comments


Frontend Routes

  • Frontend routes contains wildcard variables written in camelCase
  • Correctly formatted
    • Routes are displayed with inline coding text (backticks) - missing this for your general

Comments

  • Follow Bluebird formatting for the frontend routes/components.
  • I think you may want to rethink your frontend routes. The main purpose of the frontend routes is to conditionally display different components, but I think you'll want to display channel index, message creation form, messages, user index, all on the same frontened route.

Good job, Elena! Address the unchecked items above, and then you're good to go!

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.