Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2b7e8dc
build: initial commit
KH-Pua Oct 9, 2023
b00ab22
Merge pull request #1 from sathyat20/keehui
sathyat20 Oct 9, 2023
ffc1e66
Basic map layout
sathyat20 Oct 9, 2023
841101e
Merge pull request #2 from sathyat20/mapAPI
sathyat20 Oct 9, 2023
8d3fd35
Switched to different API
sathyat20 Oct 10, 2023
484e549
Merge pull request #3 from sathyat20/newMapAPI
sathyat20 Oct 10, 2023
a3f5956
Removed unnecessary packages
sathyat20 Oct 10, 2023
61d1da1
Merge pull request #4 from sathyat20/newMapAPI
sathyat20 Oct 10, 2023
8e01b04
build: Explore.js, placeDetails.js, placeComments.js
KH-Pua Oct 17, 2023
db9b82b
Merge pull request #5 from sathyat20/keehui
sathyat20 Oct 17, 2023
7ddac9c
Explore page + routes in different component
sathyat20 Oct 17, 2023
242b276
fully merged
sathyat20 Oct 17, 2023
eebab9b
Merge pull request #6 from sathyat20/newMapAPI
sathyat20 Oct 17, 2023
1f9fbb2
Bugs fixed + UserId based trip rendering
sathyat20 Oct 18, 2023
8562f02
Merge pull request #7 from sathyat20/newMapAPI
sathyat20 Oct 18, 2023
345dd22
build: Search.js
KH-Pua Oct 18, 2023
4579aac
Merge branch 'main' of https://github.com/sathyat20/project2-bootcamp…
KH-Pua Oct 18, 2023
16478f1
build: Search.js completed
KH-Pua Oct 18, 2023
ccabbdd
Merge pull request #8 from sathyat20/keehui
sathyat20 Oct 18, 2023
639573f
Displaying added trip from explore page but still figuring out adding…
sathyat20 Oct 19, 2023
9a547bb
Merge pull request #9 from sathyat20/newMapAPI
sathyat20 Oct 19, 2023
c0a983c
fix: like, comment & save function in Explore.js, placeComments.js & …
KH-Pua Oct 20, 2023
182b2df
Merge branch 'main' of https://github.com/sathyat20/project2-bootcamp…
KH-Pua Oct 20, 2023
a6fc63c
Merge pull request #10 from sathyat20/keehui
sathyat20 Oct 20, 2023
25622b9
fix: Profile.js
KH-Pua Oct 21, 2023
2507e13
Merge branch 'main' of https://github.com/sathyat20/project2-bootcamp…
KH-Pua Oct 21, 2023
d560cbb
Merge pull request #11 from sathyat20/keehui
sathyat20 Oct 21, 2023
ed3bb39
Updates to trip page
sathyat20 Oct 21, 2023
2dd3c0f
changes to trip page
sathyat20 Oct 21, 2023
71ac7d1
Merge pull request #12 from sathyat20/newMapAPI
sathyat20 Oct 21, 2023
fc523dd
Trips page
sathyat20 Oct 22, 2023
edf8236
Merge pull request #13 from sathyat20/newMapAPI
sathyat20 Oct 22, 2023
7f39b3b
Fixed most bugs
sathyat20 Oct 22, 2023
7b92316
Merge branch 'main' into newMapAPI
sathyat20 Oct 22, 2023
58df717
Merge pull request #14 from sathyat20/newMapAPI
sathyat20 Oct 22, 2023
9d3bfab
fix: Explore.js(Photos for each place)
KH-Pua Oct 23, 2023
a716fc9
fix: revert changes made on Sathya's code
KH-Pua Oct 23, 2023
89d5304
Merge branch 'main' of https://github.com/sathyat20/project2-bootcamp…
KH-Pua Oct 23, 2023
101f6bc
Fixed bugs
sathyat20 Oct 23, 2023
928ed7f
Merge pull request #15 from sathyat20/keehui
sathyat20 Oct 23, 2023
5593486
fixed bug
sathyat20 Oct 23, 2023
6c0ce33
Merge pull request #16 from sathyat20/newMapAPI
sathyat20 Oct 23, 2023
1c01a61
Fixed bugs
sathyat20 Oct 23, 2023
a80c601
Merge pull request #17 from sathyat20/newMapAPI
sathyat20 Oct 23, 2023
282f204
fix: Explore.js, Profile.js, itemCard.js (saved & visited items redir…
KH-Pua Oct 23, 2023
c31ef70
Merge branch 'main' of https://github.com/sathyat20/project2-bootcamp…
KH-Pua Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
15,048 changes: 9,307 additions & 5,741 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@flaticon/flaticon-uicons": "^2.4.0",
"firebase": "^10.4.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1"
},
"scripts": {
Expand All @@ -27,5 +30,11 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"daisyui": "^3.8.0",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"tailwindcss": "^3.3.3"
}
}
90 changes: 76 additions & 14 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,82 @@
import React from "react";
import logo from "./logo.png";
import { useState, useEffect, createContext } from "react";
import { Routes, Route } from "react-router-dom";
import "./App.css";
import { auth } from "./firebase.js";

class App extends React.Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
</header>
</div>
);
import Login from "./pages/Login.js";
import Explore from "./pages/Explore.js";
import Search from "./pages/Search.js";
import Create from "./pages/Create.js";
import Profile from "./pages/Profile.js";
import ErrorPage from "./pages/ErrorPage.js";

import { onAuthStateChanged } from "firebase/auth";

export const UserContext = createContext();

const App = (props) => {
const [user, setUser] = useState({});
const [username, setUsername] = useState("");
const [isLoggedIn, setIsLoggedIn] = useState(false);

const infoToPass = {
user,
setUser,
username,
setUsername,
isLoggedIn,
setIsLoggedIn
}

// that empty [] at the end is the condition for the useEffect to run - useEffect only runs when the stuff in the brackets changes. if nothing is in the brackets, it only runs once on startup, making the whole useEffect block equal to a componentDidMount
useEffect(() => {
onAuthStateChanged(auth, (userInfo) => {
if (userInfo) {
// User signed in
setUser(userInfo);
setIsLoggedIn(true);

///////////redirect to "/Feed" page//////////////////
} else {
// No sign in user
setUser({});
setIsLoggedIn(false);
///////////redirect to "/" Login Page//////////////////
}
});
}, []);

return (
<UserContext.Provider value={infoToPass}>
<Routes>
<Route
path="/"
element={<Login />}
errorElement={<ErrorPage />}
/>
<Route
path="/Explore"
element={<Explore />}
errorElement={<ErrorPage />}
/>
<Route
path="/Search"
element={<Search />}
errorElement={<ErrorPage />}
/>
<Route
path="/Create"
element={<Create />}
errorElement={<ErrorPage />}
/>
<Route
path="/Profile"
element={<Profile />}
errorElement={<ErrorPage />}
/>
</Routes>
</UserContext.Provider>
)
}

export default App;
30 changes: 30 additions & 0 deletions src/components/footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { NavLink } from "react-router-dom";

const Footer = (props) => {
return (
<footer className="btm-nav">
<NavLink
to="/Explore"
className="text-2xl">
<i class="fi fi-rr-marker"></i>
</NavLink>
<NavLink
to="/Search"
className="text-2xl">
<i className="fi fi-rr-search"></i>
</NavLink>
<NavLink
to="/Create"
className="text-2xl">
<i className="fi fi-rr-add"></i>
</NavLink>
<NavLink
to="/Profile"
className="text-2xl">
<i className="fi fi-rr-circle-user"></i>
</NavLink>
</footer>
);
};

export default Footer;
13 changes: 13 additions & 0 deletions src/components/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NavLink } from "react-router-dom";

const Header = () => {
return (
<header className="navbar bg-base-100 text-2xl flex justify-between p-4 border-b">
<a href="/Feeds" className="font-sans">
globalgems
</a>
</header>
);
};

export default Header;
25 changes: 25 additions & 0 deletions src/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getDatabase } from "firebase/database";
import { getStorage } from "firebase/storage";
import { getAuth } from "firebase/auth";

// TODO: Replace with your app's Firebase project configuration
const firebaseConfig = {
apiKey: process.env.REACT_APP_API_KEY,
authDomain: process.env.REACT_APP_AUTH_DOMAIN,
// The value of `databaseURL` depends on the location of the database
databaseURL: process.env.REACT_APP_DATABASE_URL,
projectId: process.env.REACT_APP_PROJECT_ID,
storageBucket: process.env.REACT_APP_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID,
appId: process.env.REACT_APP_APP_ID
};

// Initialize Firebase
const firebaseApp = initializeApp(firebaseConfig);

// Get a reference to the database service and export the reference for other modules
export const database = getDatabase(firebaseApp);
export const storage = getStorage(firebaseApp);
export const auth = getAuth(firebaseApp);
7 changes: 7 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "~@flaticon/flaticon-uicons/css/regular/rounded";
@import "~@flaticon/flaticon-uicons/css/solid/rounded";
@import "~@flaticon/flaticon-uicons/css/brands/all";

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import { BrowserRouter } from "react-router-dom";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
</React.StrictMode>
</BrowserRouter>
);
52 changes: 52 additions & 0 deletions src/pages/Create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, { useState, useEffect, useContext } from "react";
import { useNavigate } from "react-router-dom";
import "../App.css";
import Header from "../components/header.js";
import Footer from "../components/footer.js";

import { database, storage } from "../firebase.js";
import { UserContext } from "../App.js";

import {
ref,
set,
push,
onChildAdded,
onChildRemoved,
onValue,
} from "firebase/database";

import {
ref as sRef,
uploadBytes,
getDownloadURL
} from "firebase/storage";

/////////// DECALRE FIREBASE LIST NAME HERE ///////////
/////////// e.g. const DB_POSTS_KEY = "posts"; ///////////

const Create = (props) => {
// User Object brought in via useContext();
const { user } = useContext(UserContext);
const navigate = useNavigate();

/////////// DECALRE STATES HERE ///////////

//Equivalent to "componentDidMount()"
useEffect(() => {

}, []);

return (
<div className="App">
<Header />
<div
className="flex flex-col h-screen justify-center text-center content-center overflow-auto"
style={{ height: "calc(100% - 128px)" }}
></div>
<Footer />
</div>
);
};

export default Create;
26 changes: 26 additions & 0 deletions src/pages/ErrorPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useRouteError } from "react-router-dom";
import "../App.css";

import Header from "../components/header.js";

const ErrorPage = () => {

const error = useRouteError();
console.error(error);

return (
<div className="App">
<Header />
<div>
<br />
<h2>Oops!</h2>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
</div>
</div>
);
};

export default ErrorPage;
45 changes: 45 additions & 0 deletions src/pages/Explore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { useState, useEffect, useContext } from "react";
import "../App.css";
import Header from "../components/header.js";
import Footer from "../components/footer.js";

import { database } from "../firebase.js";
import { UserContext } from "../App.js";

import {
ref,
set,
push,
onChildAdded,
onChildRemoved,
onValue,
} from "firebase/database";

/////////// DECALRE FIREBASE LIST NAME HERE ///////////
/////////// e.g. const DB_POSTS_KEY = "posts"; ///////////

const Feeds = (props) => {
// User Object brought in via useContext();
const { user } = useContext(UserContext);

/////////// DECALRE STATES HERE ///////////

//Equivalent to "componentDidMount()"
useEffect(() => {

}, []);

return (
<div className="App">
<Header />
<div
className="flex flex-col h-screen justify-center text-center content-center overflow-auto"
style={{ height: "calc(100% - 128px)" }}
>
</div>
<Footer />
</div>
);
};

export default Feeds;
Loading