Skip to content

sparklerfish/purrojects

Repository files navigation

purrojects logo

Table of Contents


Introduction

Purrojects is an Instructables clone for finding and sharing instructions for creating projects for cats. front page

Live link to Purrojects!


Technologies

Backend

Purrojects is built on a Ruby on Rails framework with a PostgreSQL database. User-uploaded images are hosted with Amazon Web Services.

Frontend

Purrojects uses React and Redux to dynamically update and respond to user interaction in a single-page app.


Features

  • Users can browse projects project index

    • Project list is structured with a container component populated with reusable project index item presentational components. Project index component:
        <div className="project-list">
          {projects.map(project => (
            <ProjectIndexItem project={project} users={users} key={`project-${project.id}`}/>
          ))}
        </div>
  • Users can view projects with step-by-step directions project show

    • Project view is structured with a container component populated with reusable step presentational components.

        <div className="project-title">{this.props.project.title}</div>
        <p>by {this.props.project.author.username}</p>
        {this.props.project.imageUrl ? (
          <img className="project-show-image" src={this.props.project.imageUrl} />
        ) : null}
        <div className="project-body">{this.props.project.body}</div>
        <StepList
          projectId={this.props.project.id}
          steps={this.props.steps}
        />
      <ul className="step-list">
        {steps.map((step, idx) => (
          <StepListItem step={step} key={`step-${step.id}`} idx={idx}/>
        ))}
      </ul>
  • Users can create and update projects project create

    • Steps can be edited or deleted individually
    • Users can add photos to projects and steps project image
      • Image upload form displays an image preview if one has been uploaded
          <div className="edit-box-left">
              {this.state.imageUrl || this.props.step.imageUrl ? this.previewImage() : this.imageForm()}
          </div>
    • Users can edit and delete projects that they have authored project delete
  • Users can search for projects based on keywords in project title project search

    • Search dispatches an action to fetch projects with a title that matches the query param

      Async action to search projects:

      export const searchProjects = search => dispatch => (
        ProjectAPIUtil.searchProjects(search)
          .then(projects => dispatch(receiveProjects(projects)))
      );

      Ajax request to project API endpoint

      export const searchProjects = search => (
        $.ajax({
            method: "GET",
            url: `/api/projects`,
            data: { search }
        })
      )
  • Users can add comments to projects comment form

    • Clicking "Add Comment" or "Cancel" toggles visibility of comment form
      <div className="new-submit" id="comment-form">
        {this.state.clickable ? this.clickableButton() : this.unclickableButton()}
        {this.state.formVisible ? (
        <CommentFormContainer
            projectId={this.props.projectId}
            toggleForm={this.toggleForm}
        />
        ) : null}
      </div>

Future Direction

  • Filtering projects by category