diff --git a/README.md b/README.md index fe5355f6..a10720f6 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ git checkout -b [branch name] ``` PUBLIC_API_URL=https://api.peterportal.org/rest/v0/ PUBLIC_API_GRAPHQL_URL=https://api.peterportal.org/graphql/ -PORT=5000 +PORT=8080 ``` -Note: the port should also match the one set up on the frontend's proxy to the backend under `site/src/setupProxy.js` By default this is 5000. +Note: the port should also match the one set up on the frontend's proxy to the backend under `site/src/setupProxy.js` By default this is 8080. 8. (Optional) Set up your own MongoDB and Google OAuth to be able to test features that require signing in such as leaving reviews or saving roadmaps to your account. Add additional variables/secrets to the .env file from the previous step. ``` @@ -90,7 +90,7 @@ ADMIN_EMAILS=[""] 2. In the first terminal window, enter the client directory with `cd site`. Then run the React development server using `npm start`. Ensure the server is running on port 3000 by default. -3. In the second terminal window, enter the API directory with `cd api`. Then run the Express development server using `npm run dev`. Ensure the server is running on port 5000 by default. +3. In the second terminal window, enter the API directory with `cd api`. Then run the Express development server using `npm run dev`. Ensure the server is running on port 8080 by default. ## Our Mission 🎇 Our mission is to improve the UCI student experience with course planning diff --git a/api/.env.local b/api/.env.local index 30314109..e5fd15f9 100644 --- a/api/.env.local +++ b/api/.env.local @@ -1 +1 @@ -PRODUCTION_DOMAIN=http://localhost:5000 \ No newline at end of file +PRODUCTION_DOMAIN=http://localhost:8080 \ No newline at end of file diff --git a/api/bin/www b/api/bin/www index cb0b203a..e6ee2c90 100644 --- a/api/bin/www +++ b/api/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '5000'); +var port = normalizePort(process.env.PORT || '8080'); app.set('port', port); /** diff --git a/site/src/component/PrereqTree/PrereqTree.tsx b/site/src/component/PrereqTree/PrereqTree.tsx index 68df7650..5832263f 100644 --- a/site/src/component/PrereqTree/PrereqTree.tsx +++ b/site/src/component/PrereqTree/PrereqTree.tsx @@ -1,8 +1,8 @@ -import React, { FC } from 'react'; -import './PrereqTree.scss'; -import { Grid, Popup } from 'semantic-ui-react'; +import React, { FC } from "react"; +import "./PrereqTree.scss"; +import { Grid, Popup } from "semantic-ui-react"; -import { PrerequisiteJSONNode, PrerequisiteJSON, CourseGQLData, CourseLookup } from '../../types/types'; +import { PrerequisiteJSONNode, PrerequisiteJSON, CourseGQLData, CourseLookup } from "../../types/types"; interface NodeProps { node: string; @@ -13,17 +13,25 @@ interface NodeProps { const Node: FC = (props) => { return ( -
+
- {props.label} - + !props.label.startsWith("AP ") ? ( + + {props.label} + + ) : ( + + ) } - content={props.content} basic position='top center' wide='very' /> + content={props.content} + basic + position="top center" + wide="very" + />
); -} +}; interface TreeProps { prerequisiteNames: CourseLookup; @@ -34,94 +42,83 @@ interface TreeProps { const Tree: FC = (props) => { let prerequisite = props.prerequisiteJSON; - let isValueNode = typeof prerequisite === 'string'; + let isValueNode = typeof prerequisite === "string"; // if value is a string, render leaf node if (isValueNode) { - let id = (prerequisite as string).replace(/\s+/g, ''); + let id = (prerequisite as string).replace(/\s+/g, ""); let content = prerequisite; if (props.prerequisiteNames.hasOwnProperty(id)) { content = props.prerequisiteNames[id].title; } return ( -
  • - +
  • +
  • - ) + ); } // if value is an object, render the rest of the sub tree else { return ( -
    -
    - -
    - {prerequisite.hasOwnProperty('OR') ? 'one of' : 'all of'} -
    +
    +
    + +
    {prerequisite.hasOwnProperty("OR") ? "one of" : "all of"}
    -
    -
      - {(prerequisite as PrerequisiteJSON)[Object.keys(prerequisite)[0]].map( - (child, index) => ( - - ) - )} +
      +
        + {(prerequisite as PrerequisiteJSON)[Object.keys(prerequisite)[0]].map((child, index) => ( + + ))}
    - ) + ); } -} +}; -interface PrereqProps extends CourseGQLData { -} +interface PrereqProps extends CourseGQLData {} const PrereqTree: FC = (props) => { - let hasPrereqs = props.prerequisite_tree !== ''; + let hasPrereqs = props.prerequisite_tree !== ""; let hasDependencies = Object.keys(props.prerequisite_for).length !== 0; if (props.id === undefined) return <>; else if (!hasPrereqs && !hasDependencies) return ( -
    -

    - No Dependencies or Prerequisites! -

    +
    +

    No Dependencies or Prerequisites!

    ); return (
    - +
    {/* Display dependencies */} {hasDependencies && ( <> -
      -
      - {Object.values(props.prerequisite_for).map( - (dependency, index) => ( -
    • - -
    • - ) - )} +
        +
        + {Object.values(props.prerequisite_for).map((dependency, index) => ( +
      • + +
      • + ))}
      -
      - -
      - needs -
      +
      + +
      needs
      @@ -134,16 +131,12 @@ const PrereqTree: FC = (props) => {
      } */} {/* Display the class id */} - + {/* Spawns the root of the prerequisite tree */} {hasPrereqs && ( -
      - - +
      +
      )} @@ -152,14 +145,13 @@ const PrereqTree: FC = (props) => { No Prerequisites!

      } */} -
      - {props.prerequisite_text !== '' && ( + {props.prerequisite_text !== "" && (

      @@ -171,6 +163,6 @@ const PrereqTree: FC = (props) => {

      ); -} +}; -export default PrereqTree; \ No newline at end of file +export default PrereqTree; diff --git a/site/src/setupProxy.js b/site/src/setupProxy.js index e82dd698..0fb5ae77 100644 --- a/site/src/setupProxy.js +++ b/site/src/setupProxy.js @@ -4,7 +4,7 @@ module.exports = function(app) { app.use( '/api', createProxyMiddleware({ - target: 'http://localhost:5000', + target: 'http://localhost:8080', changeOrigin: true, }) );