GithubHelp home page GithubHelp logo

slothdude / thoughts Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.79 MB

React/Firebase web app with accounts, newsfeed, and profile picture upload

HTML 7.05% CSS 9.04% JavaScript 83.91%
react firebase webapp

thoughts's Introduction

Trying it yourself

git clone (project url) npm install npm start

Overview

Thoughts is a web app where a user can log in (using firebase auth), and leave a message that is added to the firebase realtime database, which the newsfeed pulls from. This app could be ran on local state by pulling the thoughts feed from local state, but this would mean that everyone's thoughts would be lost on refresh. If you click the top right icon, you will be brought to a profile page where you can update your name and a picture. These will replace your name and picture on all previous thoughts automatically. Click the top left icon from the profile page to go back to the thoughts feed. Even though there is a link on this website, and the profile page is at the "/profile" endpoint, typing in the url or refreshing will cause you to log out because I did not set up login persistence.

Challenges

CSS

  1. I was unable to center the logos inside of the top border: thoughtsprob1.PNG Somehow I missed that there was a float: left style attribute on the logo class, so I changed that to position: relative. The whole top border is actually a table, to help with ease in css.

  2. I was curious why the background color for the elements would fail to cover the whole page: prob2.PNG I fixed this by doing html {background-color: #F8E691}. I never knew you could style the entire html document.

  3. My icons were squishing when I tried to crop them. I fixed this by making the img tag a div and changing the <img src = {this.state.propicURL} className = 'thumb'/> to

<div className = "thumb"
     style = {{backgroundImage: `url(${this.state.propicURL})`}}
     alt = "your propic"/>

React

  1. I was having a lot of trouble making the pictures at the top be links using react-router. I tried nesting the image inside the link like
<Link to="/">
  <img src={logo}>
 </Link>

and also tried putting a background-img property on the link. The image would show up, but the link wouldn't redirect. Eventually, I found a component on stackoverflow that I changed to be an image instead of a button.

  1. I was wondering why the page was refreshing whenever I submitted a form. Fix: place e.preventDefault(); in handleSubmit(e) handler function.

  2. I was having some problems with displaying the name instead of the ID created for the post by firebase.database().ref('posts').push();, javascripts annoying synchronicity strikes again: the state wasn't updating before I was trying to use it. I fixed this by making a separate component for getting the name and did a similar thing for the picture icons.

thoughts's People

Contributors

slothdude avatar

Watchers

James Cloos avatar

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.