Git Product home page Git Product logo

gradebook-app's Introduction

INFO-I400/590 Gradebook Application

Made in React Native and Firebase

Firebase hosted web url: https://fir-1ee6c.web.app/

  • Notes: there should be a drawer menu icon on the upper left side, but I haven't figured out why the icon disappears, but it can be clicked.

image

Intialize a Firestore project

  • Firestore setup
    1. Navigate to your Firebase Console.
    2. Go to the Firestore Database section and click on Create Database.
    3. Choose Start in test mode and Enable.
    4. After the database is ready, navigate to it and click on Start Collection.
    5. Enter students as the Collection ID and hit Next to create the collection.

Add FirestoreConfig

  • create a .env, and save the apiKey in it.
  • use EXPO_PUBLIC_API_KEY or dotenv
  • use expo-constants package.
    npx expo install expo-constants
    
    and import import Constants from 'expo-constants';

Add/set data to Firestore

Fetch data from Firestore

useEffect(() => {
    const fetchData = async () => {
      const dbCol = collection(db, "students"); //get collection `students`
      const dbDocs = await getDocs(dbCol); //get documents
      const studentData = [];
      dbDocs.forEach((doc) => {
        studentData.push(doc.data());
      });
      setGradebook(studentData);
    };

    fetchData();
  }, []);

Expo export as a web

  • resource: https://docs.expo.dev/workflow/web/
  • Install: npx expo install react-dom react-native-web @expo/webpack-config
  • SUPER IMPORTANT!!!! add the following config in App.json:
"web": {
      "favicon": "./assets/favicon.png",
      "bundler": "metro"
    }
  • start the dev server, and you are supposed to get a web generated automatically. npx expo start --web
  • Publish your web. Run the following code and you are supposed to have a new folder called dist npx expo export -p web

Host your React Native app on Firebase

  • resource:https://docs.expo.dev/distribution/publishing-websites/#firebase-hosting
  • Install the Firebase CLI by running npm install -g firebase-tools
  • run firebase init and choose host, or run firebase init hosting, and MUST TYPE dist when the prompt asks the pbulic path.
  • Then the following prompts questions: NO, NO, NO. (No overwrite, or your web will always be the dafault Firebase page)
  • Deploy: run npm run deploy-hosting or firebase deploy

gradebook-app's People

Contributors

yishanhsieh avatar

Watchers

 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.