Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
93c0a06
feat(server): initialize firbase functions
mitch1009 Apr 22, 2023
315de90
feat(server): complete setup
mitch1009 Apr 22, 2023
0820137
Co-authored-by: Dineo Mathibela <MathibelaD@users.noreply.github.com>
Dzunisan Apr 22, 2023
32ecc37
Co-authored-by: sihlemaphanga <sihlemaphanga@users.noreply.github.com>
Dzunisan Apr 22, 2023
6e77bb0
feat: structure done
Daniel-Mokoena Apr 22, 2023
145068b
feat: structure
Daniel-Mokoena Apr 22, 2023
b300d89
feat: imports & export files
Daniel-Mokoena Apr 22, 2023
4ee0b1b
feat: structure done
Daniel-Mokoena Apr 22, 2023
317eb6b
Co-authored-by: Mitch Chimwemwe Chanza <mitch1009@users.noreply.githu…
DanielVaega Apr 22, 2023
8204f1e
fix: auth page
DanielVaega Apr 22, 2023
1538619
fix: firebase emulators
mitch1009 Apr 22, 2023
c6b6811
feat: first end-point
Daniel-Mokoena Apr 22, 2023
26c15e2
Merge branch 'feature/backend' of https://github.com/green-sync/green…
Daniel-Mokoena Apr 22, 2023
d9ac410
fix: emulators
mitch1009 Apr 22, 2023
10488a1
fix: emulators functionality
Daniel-Mokoena Apr 22, 2023
608b4a1
signInWithPassword
MathibelaD Apr 22, 2023
d04cebe
SignInWithEmailAndPassword
MathibelaD Apr 22, 2023
efb9b22
added type of farming to signUp page
MathibelaD Apr 22, 2023
3edf966
createUserWithEmailAndPassword
MathibelaD Apr 22, 2023
153a3a3
handle registration input fields
MathibelaD Apr 22, 2023
b7fb4e0
submitting user details
MathibelaD Apr 22, 2023
35dc5fd
register user
MathibelaD Apr 22, 2023
d34172a
ignore
mitch1009 Apr 24, 2023
002c352
fix: remove duplicate
mitch1009 Apr 24, 2023
35ddda5
Feat: LiveStock Mutation completed.
BrownGitHlungwani Apr 24, 2023
b9dfbfb
feat: farm mutation endpoint completed.
Daniel-Mokoena Apr 24, 2023
7db3bff
fix(client): logs ignore from .gitignore file
mitch1009 Apr 24, 2023
b7e2228
Merge branch 'feature/scotch' into feature/backend
mitch1009 Apr 24, 2023
8cdcbfb
fix: livestock & farm
Daniel-Mokoena Apr 24, 2023
01b7009
Merge branch 'feature/backend' of https://github.com/green-sync/green…
Daniel-Mokoena Apr 24, 2023
883800e
fix: farmMutationResolver fixed
Daniel-Mokoena Apr 24, 2023
3c3a7ae
endpoint: weather
M9china Apr 24, 2023
e242915
endpoint: weather
M9china Apr 24, 2023
183b94b
feat(api): implemet context
mitch1009 Apr 24, 2023
49cd1bf
Merge branch 'feature/backend' into feature/M9china
mitch1009 Apr 24, 2023
c12d285
Merge pull request #23 from Green-sync/feature/M9china
mitch1009 Apr 24, 2023
af242fc
fix:added comma & mutationresolvers
M9china Apr 24, 2023
f4d78aa
query: weather data
M9china Apr 25, 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
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "opher-4f2a6"
}
}
32 changes: 31 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,34 @@ node_modules
.firebase
lib
.env
agritech-project-cf36d-firebase-adminsdk-tushv-f181b44096.json
lib/*
lib/
agritech-project-cf36d-firebase-adminsdk-tushv-f181b44096.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
*.log
node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?


pnpm i -D tailwindcss postcss autoprefixer
pnpx tailwindcss init -p
13 changes: 11 additions & 2 deletions Applications/client/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
PORT=4300
HOST=0.0.0.0
PORT=43000
HOST=0.0.0.0

VITE_REACT_FIREBASE_API_KEY=
VITE_REACT_FIREBASE_AUTH_DOMAIN=
VITE_REACT_FIREBASE_DATABASE_URL=
VITE_REACT_FIREBASE_PROJECT_ID=
VITE_REACT_FIREBASE_STORAGE_BUCKET=
VITE_REACT_FIREBASE_MESSEGING_SENDER_ID=
VITE_REACT_FIREBASE_APP_ID=
VITE_REACT_GRAPHQL_URL=
6 changes: 5 additions & 1 deletion Applications/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

*.log
node_modules
dist
dist-ssr
Expand All @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?


pnpm i -D tailwindcss postcss autoprefixer
pnpx tailwindcss init -p
29 changes: 18 additions & 11 deletions Applications/client/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-N9XaASe+i+0Z0JsmZSfL8fkHdT95TREw78mqcqTIdyLPJ9lBL0sNOIM+vQkDgA0Ll8HQOKHhJ1hy2gMyyo/6Q=="
crossorigin="anonymous" referrerpolicy="no-referrer" /> -->

<title>Vite + React + TS</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
10 changes: 8 additions & 2 deletions Applications/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@
},
"dependencies": {
"@apollo/client": "^3.7.12",
"@heroicons/react": "^2.0.17",
"firebase": "^9.20.0",
"graphql": "^16.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.10.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-react": "^4.0.0-beta.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.38.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.1",
"typescript": "^5.0.2",
"vite": "^4.3.0"
}
}
}
6 changes: 6 additions & 0 deletions Applications/client/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
42 changes: 0 additions & 42 deletions Applications/client/src/App.css

This file was deleted.

45 changes: 13 additions & 32 deletions Applications/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'

import { Routes, Route} from "react-router-dom"
import ErrorPage from "./pages/errorPage"
import LoginPage from "./pages/loginPage"
import DashboardPage from "./pages/dashboard"
import { SignUp } from "./pages/signUpPage"
import {env} from "./utils"
function App() {
const [count, setCount] = useState(0)

console.log(env)
return (
<>
{/*
TODO: Implement functionality for the website
labels: testing
assignees: mitch1009
*/}
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
<Routes>
<Route index path="/" element={<LoginPage/>}/>
<Route path="/signUp" element={<SignUp />} />
<Route path="/dashboard" element={<DashboardPage/>}/>
<Route path="*" element={<ErrorPage/>}/>
</Routes>
</>
)
}
Expand Down
1 change: 0 additions & 1 deletion Applications/client/src/assets/react.svg

This file was deleted.

11 changes: 11 additions & 0 deletions Applications/client/src/components/profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

const profile = () => {
return (
<div>

</div>
)
}

export default profile
11 changes: 11 additions & 0 deletions Applications/client/src/components/sideBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

const sideBar = () => {
return (
<div>

</div>
)
}

export default sideBar
59 changes: 59 additions & 0 deletions Applications/client/src/firebase/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import {
signInWithEmailAndPassword,
signInWithPopup,
GoogleAuthProvider,
FacebookAuthProvider,
createUserWithEmailAndPassword,
} from "firebase/auth";
import { SocialProviders, UserDetails } from "./firebaseInterfaces";
import {auth} from "../utils";
import firebase from 'firebase/app';

// const auth = getAuth();

const LoginnWithEmailAndPassword = async (data: UserDetails, auth: any) => {
// {email, password, fullname}
try {
const { email, password } = data;
await signInWithEmailAndPassword(auth, email, password);
return true;
} catch (error) {
return error;
}
};

// union type
const SocialLogin = async (provider: SocialProviders,auth:any) => {
// TODO: implement this method
const providers = {
google: new GoogleAuthProvider(),
facebook: new FacebookAuthProvider(),
}
await signInWithPopup(auth, providers[provider as SocialProviders]);
};

const CreateUserAccount = async (data: UserDetails) => {
try {
const {email, password, firstName, lastName, farmType } = data;
await createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
const user = userCredential.user;
// const uid = user.uid;

// // Add more data to the user in the Realtime Database
// const databaseRef = firebase.database().ref(``);
// const userData = { email, firstName, lastName, farmType };
// databaseRef.set(userData);

// console.log('User signed up:', user);
})
.catch((error) => {
console.error('Error signing up:', error);
});
return true
} catch (error) {
return error;
}
}

export { LoginnWithEmailAndPassword, SocialLogin, CreateUserAccount };
16 changes: 16 additions & 0 deletions Applications/client/src/firebase/firebaseInterfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface UserDetails{
email: string;
password: string;
lastName: string;
firstName: string;
farmType: string;
}

export interface Socials{
name: string;
icon: string;

}


export declare type SocialProviders = "google" | "facebook"
2 changes: 2 additions & 0 deletions Applications/client/src/firebase/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./firebase"
export * from "./firebaseInterfaces"
Loading