diff --git a/src/App.test.tsx b/src/app.test.tsx similarity index 91% rename from src/App.test.tsx rename to src/app.test.tsx index a61bacb..b184a7d 100644 --- a/src/App.test.tsx +++ b/src/app.test.tsx @@ -1,7 +1,7 @@ import React from "react" import { screen } from "@testing-library/react" import { render } from "./test-utils" -import App from "./App" +import App from "./app" test("renders learn react link", () => { render() diff --git a/src/App.tsx b/src/app.tsx similarity index 94% rename from src/App.tsx rename to src/app.tsx index a476b63..da036e1 100644 --- a/src/App.tsx +++ b/src/app.tsx @@ -8,14 +8,14 @@ import { Text, VStack, } from "@chakra-ui/react"; -import { AuthProvider } from "./services/Firebase/AuthProvider"; +import { AuthProvider } from "./services/firebase/authProvider"; import { useGetWindowDimensionsHook } from "./utilities/useGetDdimensionsHook"; import logo from "./assets/images/logo/Mendisphere Logo colour.png"; import mendisphereTheme from "./theme"; import Routing from "./routing"; -import { Paths } from "./routing/Paths"; -import Header from "./components/Header"; -import Footer from "./components/Footer"; +import { Paths } from "./routing/paths"; +import Header from "./components/header"; +import Footer from "./components/footer"; function App() { const { width } = useGetWindowDimensionsHook(); diff --git a/src/components/Breadcrumbs/index.ts b/src/components/Breadcrumbs/index.ts deleted file mode 100644 index c4be285..0000000 --- a/src/components/Breadcrumbs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Breadcrumbs"; \ No newline at end of file diff --git a/src/components/Container/index.ts b/src/components/Container/index.ts deleted file mode 100644 index c81c92a..0000000 --- a/src/components/Container/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Container"; diff --git a/src/components/Footer/index.ts b/src/components/Footer/index.ts deleted file mode 100644 index d6d8d55..0000000 --- a/src/components/Footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Footer"; \ No newline at end of file diff --git a/src/components/Header/index.ts b/src/components/Header/index.ts deleted file mode 100644 index 243d8ed..0000000 --- a/src/components/Header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Header"; \ No newline at end of file diff --git a/src/components/NavigationButton/index.ts b/src/components/NavigationButton/index.ts deleted file mode 100644 index 380c540..0000000 --- a/src/components/NavigationButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./NavigationButton"; diff --git a/src/components/ScrollAnimation/index.ts b/src/components/ScrollAnimation/index.ts deleted file mode 100644 index ce4c805..0000000 --- a/src/components/ScrollAnimation/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Animate } from "./ScrollAnimation"; diff --git a/src/components/Breadcrumbs/Breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx similarity index 93% rename from src/components/Breadcrumbs/Breadcrumbs.tsx rename to src/components/breadcrumbs/breadcrumbs.tsx index 699d793..d17ce69 100644 --- a/src/components/Breadcrumbs/Breadcrumbs.tsx +++ b/src/components/breadcrumbs/breadcrumbs.tsx @@ -8,8 +8,8 @@ import { Text, } from "@chakra-ui/react"; import { HomeIcon } from "@primer/octicons-react"; -import { Organisation } from "../../data/Model/Organisation"; -import { Paths } from "../../routing/Paths"; +import { Organisation } from "../../data/model/organisation"; +import { Paths } from "../../routing/paths"; const currentPageStyle = { color: "#3959FF", diff --git a/src/components/breadcrumbs/index.ts b/src/components/breadcrumbs/index.ts new file mode 100644 index 0000000..8184058 --- /dev/null +++ b/src/components/breadcrumbs/index.ts @@ -0,0 +1 @@ +export { default } from "./breadcrumbs"; diff --git a/src/components/container/index.ts b/src/components/container/index.ts new file mode 100644 index 0000000..3d520d7 --- /dev/null +++ b/src/components/container/index.ts @@ -0,0 +1 @@ +export { default } from "./container"; diff --git a/src/components/Footer/Footer.tsx b/src/components/footer/footer.tsx similarity index 97% rename from src/components/Footer/Footer.tsx rename to src/components/footer/footer.tsx index e5e74e4..7ff92ce 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/footer/footer.tsx @@ -10,9 +10,9 @@ import { Spacer, } from "@chakra-ui/react"; import "../../pages/style.scss"; -import { SocialType } from "../../data/Enums/social-type.enum"; +import { SocialType } from "../../data/enums/social-type.enum"; import { GetIconForSocials } from "../../utilities/iconMappings/iconMapping"; -import { Social } from "../../data/Model/OrganisationSummary"; +import { Social } from "../../data/model/organisationSummary"; const Footer: React.FC = () => { const socials: Social[] = [ diff --git a/src/components/footer/index.ts b/src/components/footer/index.ts new file mode 100644 index 0000000..7614ec3 --- /dev/null +++ b/src/components/footer/index.ts @@ -0,0 +1 @@ +export { default } from "./footer"; diff --git a/src/components/Header/Header.tsx b/src/components/header/header.tsx similarity index 97% rename from src/components/Header/Header.tsx rename to src/components/header/header.tsx index 97b0368..b6be90b 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/header/header.tsx @@ -9,8 +9,8 @@ import { Spacer, } from "@chakra-ui/react"; import { Link as ReactRouterLink } from "react-router-dom"; -import NavigationButton from "../NavigationButton"; -import { Paths } from "../../routing/Paths"; +import NavigationButton from "../navigationButton"; +import { Paths } from "../../routing/paths"; import "../../pages/style.scss"; import logo from "../../assets/images/logo/Mendisphere Logo colour.png"; diff --git a/src/components/header/index.ts b/src/components/header/index.ts new file mode 100644 index 0000000..43ff0ea --- /dev/null +++ b/src/components/header/index.ts @@ -0,0 +1 @@ +export { default } from "./header"; diff --git a/src/components/navigationButton/index.ts b/src/components/navigationButton/index.ts new file mode 100644 index 0000000..fcce4d4 --- /dev/null +++ b/src/components/navigationButton/index.ts @@ -0,0 +1 @@ +export { default } from "./navigationButton"; diff --git a/src/components/scrollAnimation/index.ts b/src/components/scrollAnimation/index.ts new file mode 100644 index 0000000..19b19d0 --- /dev/null +++ b/src/components/scrollAnimation/index.ts @@ -0,0 +1 @@ +export { Animate } from "./scrollAnimation"; diff --git a/src/data/Auth/AuthContext.tsx b/src/data/Auth/AuthContext.tsx deleted file mode 100644 index d68e5a9..0000000 --- a/src/data/Auth/AuthContext.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from "react"; -import { AuthContextModel } from "./AuthContextModel"; - -export const AuthContext = React.createContext( - {} as AuthContextModel -); diff --git a/src/data/Auth/LoginCredentials.ts b/src/data/Auth/LoginCredentials.ts deleted file mode 100644 index 09b60d8..0000000 --- a/src/data/Auth/LoginCredentials.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function instanceOfLoginCredentials(object:any) { - return 'email' in object - && 'password' in object - && 'validated' in object -} \ No newline at end of file diff --git a/src/data/Auth/UserContext.ts b/src/data/Auth/UserContext.ts deleted file mode 100644 index 23c50cb..0000000 --- a/src/data/Auth/UserContext.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createContext } from "react" - -export interface UserContextState { - isAuthenticated: boolean - isLoading: boolean - id?: string - } - - export const UserStateContext = createContext( - {} as UserContextState, - ) \ No newline at end of file diff --git a/src/data/Enums/captial-goal.enum.ts b/src/data/Enums/captial-goal.enum.ts deleted file mode 100644 index ac79d3f..0000000 --- a/src/data/Enums/captial-goal.enum.ts +++ /dev/null @@ -1,25 +0,0 @@ -export enum CapitalGoal { - max2K = "$0-$2,000", - max5K = "$2,001-$5,000", - max10K = "$5,001-$10,000", - max20K = "$10,001-$20,000", - max50K = "$20,001-$50,000", - max100K = "$50,001-$100,000", - min100K = ">$100,000", -} - -export interface CaptialGoalEnumOption { - value: CapitalGoal; - label: string; - key?: string; - disabled?: boolean; -} - -export const capitalGoalEnumOptions: CaptialGoalEnumOption[] = Object.keys( - CapitalGoal -).map((key) => { - return { - label: key, - value: CapitalGoal[key as keyof typeof CapitalGoal], - }; -}); diff --git a/src/data/Enums/social-type.enum.ts b/src/data/Enums/social-type.enum.ts deleted file mode 100644 index d876e13..0000000 --- a/src/data/Enums/social-type.enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum SocialType { - Facebook, - LinkedIn, - TikTok, - Instagram, - Youtube -} \ No newline at end of file diff --git a/src/data/Enums/specialisation.enum.ts b/src/data/Enums/specialisation.enum.ts deleted file mode 100644 index 4ca419a..0000000 --- a/src/data/Enums/specialisation.enum.ts +++ /dev/null @@ -1,25 +0,0 @@ -export enum Specialisation { - AntiStigmatism = "Anti-Stigmatism", - YouthMentalWellness = "Youth Mental Wellness", - OCD = "Obsessive Compulsive Disorder", - OverallMentalWellbeing = "Overall Mental Wellbeing", - Therapy = "Therapy", - Anxiety = "Anxiety", - PostPartum = "Post-Partum", - Corporate = "Corporate", -} - -export interface SpecialisationEnumOption { - value: Specialisation; - label: string; - key?: string; - disabled?: boolean; -} - -export const specialisationEnumOptions: SpecialisationEnumOption[] = - Object.keys(Specialisation).map((key) => { - return { - label: key, - value: Specialisation[key as keyof typeof Specialisation], - }; - }); diff --git a/src/data/Enums/user-role.enum.ts b/src/data/Enums/user-role.enum.ts deleted file mode 100644 index e916df9..0000000 --- a/src/data/Enums/user-role.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum UserRole { - admin, - contributor, - viewer -} \ No newline at end of file diff --git a/src/data/Model/Organisation.ts b/src/data/Model/Organisation.ts deleted file mode 100644 index 706d96c..0000000 --- a/src/data/Model/Organisation.ts +++ /dev/null @@ -1,296 +0,0 @@ -import { - collection, - addDoc, - DocumentData, - FirestoreDataConverter, - getDocs, - QueryDocumentSnapshot, - SnapshotOptions, - QuerySnapshot, - where, - query, - QueryConstraint, - getDoc, - doc, - limit, - startAfter, - DocumentSnapshot, - getCountFromServer, -} from "firebase/firestore"; -import { Collections } from "../../services/Firebase/Names"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { - createOrganisationAdminData, - IOrganisationAdminData, -} from "./OrganisationAdmin"; -import { SupportArea } from "../Enums/support-area.enum"; -import { Specialisation } from "../Enums/specialisation.enum"; -import { Service } from "../Enums/service.enum"; -import { IPCStatus } from "../Enums/ipc-status.enum"; -import { VerificationStatus } from "../Enums/verification-status.enum"; -import { - IOrganisationSummary, - createOrganisationSummary, -} from "./OrganisationSummary"; - -export interface IOrganisation { - name?: string; - ipcApproved?: IPCStatus; - verified?: VerificationStatus; - mainSpecialisation?: Specialisation; - mainSupportArea?: SupportArea; - services?: Service[]; - description?: string; - cardImageUrl?: string; -} - -export class Organisation implements IOrganisation { - id: string; - name: string; - ipcApproved: IPCStatus; - verified: VerificationStatus; - mainSpecialisation: Specialisation; - mainSupportArea: SupportArea; - services: Service[]; - description: string; - cardImageUrl: string; - - constructor( - _id: string, - _name: string, - _ipcApproved: IPCStatus, - _verified: VerificationStatus, - _mainSpecialisation: Specialisation, - _mainSupportArea: SupportArea, - _services: Service[], - _description?: string, - _cardImageUrl?: string - ) { - this.id = _id; - this.name = _name; - this.ipcApproved = _ipcApproved; - this.verified = _verified; - this.mainSpecialisation = _mainSpecialisation; - this.mainSupportArea = _mainSupportArea; - this.services = _services; - this.description = _description ?? ""; - this.cardImageUrl = _cardImageUrl ?? ""; - } - - toString() { - return JSON.stringify(this, null, 2); - } -} - -export const organisationConverter: FirestoreDataConverter = { - toFirestore(org: Organisation): DocumentData { - return { - name: org.name, - ipcApproved: org.ipcApproved, - verified: org.verified, - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): Organisation { - const data: DocumentData = snapshot.data(options); - return new Organisation( - snapshot.id, - data.name, - data.ipcApproved, - data.verified, - data.mainSpecialisation, - data.mainSupportArea, - data.services, - data.description, - data.cardImageUrl - ); - }, -}; - -export type OrganisationListingQueryFilters = { - specialisations?: Specialisation[]; - services?: Service[]; - ipcStatus?: IPCStatus[]; - supportAreas?: SupportArea[]; -}; -// get all organisations in the collection with pagination -// list parameters must be limited to a size of 10 due to -// limitations in firestore -export async function getOrganisationsForListingsPage( - filters?: OrganisationListingQueryFilters, - skipOrgName?: string, - limitNum: number = 0, - lastVisible?: DocumentSnapshot -): Promise<{ - organisations: Organisation[]; - lastVisible: DocumentSnapshot | null; - totalCount: number; -}> { - const queryConstraints: QueryConstraint[] = []; - let onlyServicesFilter = false; - - if (filters) { - if ((filters.specialisations?.length ?? 0) > 10) { - return Promise.reject( - new RangeError( - `Specialisations provided for filter exceeds maximum allowed limit of 10.` - ) - ); - } - - if ((filters.services?.length ?? 0) > 10) { - return Promise.reject( - new RangeError( - `Services provided for filter exceeds maximum allowed limit of 10.` - ) - ); - } - - if ((filters.supportAreas?.length ?? 0) > 10) { - return Promise.reject( - new RangeError( - `Support areas provided for filter exceeds maximum allowed limit of 10.` - ) - ); - } - - if (filters.specialisations !== undefined) { - queryConstraints.push( - where("mainSpecialisation", "in", filters.specialisations) - ); - } - - if (filters.ipcStatus !== undefined) { - queryConstraints.push(where("ipcApproved", "in", filters.ipcStatus)); - } - - if (filters.supportAreas !== undefined) { - queryConstraints.push( - where("mainSupportArea", "in", filters.supportAreas) - ); - } - - if (filters.services !== undefined && !queryConstraints.length) { - onlyServicesFilter = true; - queryConstraints.push( - where("services", "array-contains-any", filters.services) - ); - } - } - - if (skipOrgName) { - queryConstraints.push(where("name", "!=", skipOrgName)); - } - - if (lastVisible) { - queryConstraints.push(startAfter(lastVisible)); - } - - const orgsRef = collection(db, Collections.organisations).withConverter( - organisationConverter - ); - - // Get total count - const totalCountSnapshot = await getCountFromServer( - query(orgsRef, ...queryConstraints) - ); - const totalCount = totalCountSnapshot.data().count; - - if (limitNum > 0) { - queryConstraints.push(limit(limitNum)); - } - - // Get paginated organisations - const querySnapshot: QuerySnapshot = await getDocs( - query(orgsRef, ...queryConstraints) - ); - - const orgs: Organisation[] = []; - querySnapshot.forEach((doc) => { - orgs.push(doc.data()); - }); - - return { - organisations: orgs, - lastVisible: - querySnapshot.docs.length > 0 - ? querySnapshot.docs[querySnapshot.docs.length - 1] - : null, - totalCount: totalCount, - }; -} - -// get an organisation for profile page -export async function getOrganisationForProfilePage( - orgId: string -): Promise { - console.log(`Getting organisation data for: ${orgId}`); - const docRef = doc( - db, - Collections.organisations, - orgId - ).withConverter(organisationConverter); - const org = (await getDoc(docRef)).data(); - return org; -} - -// add organisation document to the collection and create Organisation object using the id. -export async function createOrganisation( - orgData: IOrganisation -): Promise { - const res = await addDoc(collection(db, Collections.organisations), orgData); - if ( - orgData.name == null || - orgData.ipcApproved == null || - orgData.verified == null || - orgData.mainSpecialisation == null || - orgData.mainSupportArea == null || - orgData.services == null || - orgData.description == null || - orgData.cardImageUrl == null - ) { - throw Error(`Unable to create org. Missing data: ${orgData}`); - } - - return new Organisation( - res.id, - orgData.name, - orgData.ipcApproved, - orgData.verified, - orgData.mainSpecialisation, - orgData.mainSupportArea, - orgData.services, - orgData.description, - orgData.cardImageUrl - ); -} - -export async function createOrganisationOnSignUp( - org: IOrganisation, - orgAdminData: IOrganisationAdminData, - orgSummary: IOrganisationSummary -): Promise { - const result = await createOrganisation(org); - if (result == null || result.id == null) { - throw new Error("Unable to add new organisation to database."); - } - const newOrgId = result.id; - - return new Promise((resolve) => { - resolve(newOrgId); - }) - .then(() => { - console.log("org data added"); - // set the organisation id from firestore - orgAdminData.orgId = newOrgId; - }) - .then(() => createOrganisationAdminData(orgAdminData)) - .then(() => console.log("org admin data added")) - .then(() => createOrganisationSummary(newOrgId, orgSummary)) - .then(() => console.log("org summary data added")) - .then(() => { - return newOrgId; - }); -} diff --git a/src/data/Model/OrganisationAdmin.ts b/src/data/Model/OrganisationAdmin.ts deleted file mode 100644 index c56bf52..0000000 --- a/src/data/Model/OrganisationAdmin.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - addDoc, - collection, - DocumentData, - FirestoreDataConverter, - QueryDocumentSnapshot, - SnapshotOptions, -} from "firebase/firestore"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../services/Firebase/Names"; -import { CapitalGoal } from "../Enums/captial-goal.enum"; -import { OrgSize } from "../Enums/org-size.enum"; - -export interface IOrganisationAdminData { - orgId?: string; - address?: string; - size?: OrgSize; - capitalCurrent?: string; - capitalGoal?: CapitalGoal; - lastFundingDate?: Date; - ipcExpiry?: Date; - uen?: string; -} - -export class OrganisationAdminData implements IOrganisationAdminData { - orgId: string; - address: string; - size: OrgSize; - capitalGoal: CapitalGoal; - lastFundingDate?: Date; - ipcExpiry?: Date; - capitalCurrent: string; - uen: string; - - // potentially create reference to parent organisation object, if queries require it - - constructor( - _orgId: string, - _address: string, - _size: OrgSize, - _capitalGoal: CapitalGoal, - _uen: string, - _ipcExpiry?: Date, - _lastFundingDate?: Date, - _capitalCurrent?: string - ) { - this.orgId = _orgId; - this.address = _address; - this.size = _size; - this.capitalGoal = _capitalGoal; - this.ipcExpiry = _ipcExpiry; - this.lastFundingDate = _lastFundingDate; - this.capitalCurrent = _capitalCurrent ?? ""; - this.uen = _uen; - } - - toString() { - return `Organisation Admin data {orgId: ${this.orgId}}`; - } -} - -export const organisationAdminConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationAdminData): DocumentData { - return { - orgId: data.orgId ?? "", - address: data.address, - size: data.size, - ipcExpiry: data.ipcExpiry?.toISOString() ?? "", - uen: data.uen, - capitalGoal: data.capitalGoal, - capitalCurrent: data.capitalCurrent, - lastFundingDate: data.lastFundingDate?.toISOString() ?? "", - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationAdminData { - const data: DocumentData = snapshot.data(options); - return new OrganisationAdminData( - data.orgId, - data.address, - data.size, - data.capitalGoal, - data.uen, - data.ipcExpiry !== "" ? new Date(data.ipcExpiry) : undefined, - data.lastFundingDate !== "" - ? new Date(data.lastFundingDate) - : undefined, - data.capitalCurrent - ); - }, - }; - -export async function createOrganisationAdminData( - orgAdminData: IOrganisationAdminData -): Promise { - const docRef = await addDoc( - collection(db, Collections.organisationsAdminData), - orgAdminData - ); - return docRef.id; -} diff --git a/src/data/Model/OrganisationProfile/OrganisationProfileFAQ.ts b/src/data/Model/OrganisationProfile/OrganisationProfileFAQ.ts deleted file mode 100644 index 77ad9ef..0000000 --- a/src/data/Model/OrganisationProfile/OrganisationProfileFAQ.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { - DocumentData, - FirestoreDataConverter, - QueryDocumentSnapshot, - SnapshotOptions, - doc, - getDoc, - setDoc, -} from "firebase/firestore"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../../services/Firebase/Names"; - -export interface IFAQ { - question: string; - answer: string; -} - -export class OrganisationProfileFAQ { - orgId: string; - FAQ: IFAQ[]; - - constructor(_orgId: string, _faqs: IFAQ[]) { - this.orgId = _orgId; - this.FAQ = _faqs; - } -} - -export const organisationFAQConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationProfileFAQ): DocumentData { - return { - FAQ: data.FAQ.map((obj) => { - return { - ...obj, - }; - }), - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationProfileFAQ { - const data: DocumentData = snapshot.data(options); - return new OrganisationProfileFAQ( - snapshot.id, - data.FAQ.map((obj: any) => { - const faq: IFAQ = { - question: obj.question, - answer: obj.answer, - }; - - return faq; - }) - ); - }, - }; - -export async function createOrganisationProfileFAQ( - orgId: string, - orgFAQData: IFAQ[] -): Promise { - const docRef = doc(db, Collections.organisationFAQ, orgId).withConverter( - organisationFAQConverter - ); - await setDoc(docRef, new OrganisationProfileFAQ(orgId, orgFAQData)); -} - -export async function getOrganisationProfileFAQ( - orgId: string -): Promise { - const docRef = doc( - db, - Collections.organisationFAQ, - orgId - ).withConverter(organisationFAQConverter); - return (await getDoc(docRef)).data(); -} diff --git a/src/data/Model/OrganisationProfile/OrganisationProfileImpact.ts b/src/data/Model/OrganisationProfile/OrganisationProfileImpact.ts deleted file mode 100644 index c54a428..0000000 --- a/src/data/Model/OrganisationProfile/OrganisationProfileImpact.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - DocumentData, - FirestoreDataConverter, - QueryDocumentSnapshot, - SnapshotOptions, - doc, - getDoc, - setDoc, -} from "firebase/firestore"; -import { Collections } from "../../../services/Firebase/Names"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { - IProfileContent, - convertContentToFireStore, - convertFirestoreToContent, -} from "./ProfileContent"; - -export class OrganisationProfileImpact { - orgId: string; - content: IProfileContent[]; - - constructor(_orgId: string, _content: IProfileContent[]) { - this.orgId = _orgId; - this.content = _content; - } -} - -export const organisationProfileImpactConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationProfileImpact): DocumentData { - return { - content: data.content.map((obj) => { - return convertContentToFireStore(obj); - }), - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationProfileImpact { - const data: DocumentData = snapshot.data(options); - return new OrganisationProfileImpact( - snapshot.id, - data.content.map((obj: any) => { - return convertFirestoreToContent(obj); - }) - ); - }, - }; - -export async function createOrganisationProfileImpact( - orgId: string, - orgImpactData: IProfileContent[] -): Promise { - const docRef = doc(db, Collections.organisationImpact, orgId).withConverter( - organisationProfileImpactConverter - ); - await setDoc(docRef, new OrganisationProfileImpact(orgId, orgImpactData)); -} - -export async function getOrganisationProfileImpact( - orgId: string -): Promise { - const docRef = doc( - db, - Collections.organisationOurStory, - orgId - ).withConverter( - organisationProfileImpactConverter - ); - return (await getDoc(docRef)).data(); -} diff --git a/src/data/Model/OrganisationProfile/OrganisationProfileOurStory.ts b/src/data/Model/OrganisationProfile/OrganisationProfileOurStory.ts deleted file mode 100644 index f6c360d..0000000 --- a/src/data/Model/OrganisationProfile/OrganisationProfileOurStory.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - DocumentData, - FirestoreDataConverter, - QueryDocumentSnapshot, - SnapshotOptions, - doc, - getDoc, - setDoc, -} from "firebase/firestore"; -import { Collections } from "../../../services/Firebase/Names"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { - IProfileContent, - convertContentToFireStore, - convertFirestoreToContent, -} from "./ProfileContent"; - -export class OrganisationProfileOurStory { - orgId: string; - content: IProfileContent[]; - - constructor(_orgId: string, _content: IProfileContent[]) { - this.orgId = _orgId; - this.content = _content; - } -} - -export const organisationOurStoryConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationProfileOurStory): DocumentData { - return { - content: data.content.map((obj) => { - return convertContentToFireStore(obj); - }), - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationProfileOurStory { - const data: DocumentData = snapshot.data(options); - return new OrganisationProfileOurStory( - snapshot.id, - data.content.map((obj: any) => { - return convertFirestoreToContent(obj); - }) - ); - }, - }; - -export async function createOrganisationProfileOurStory( - orgId: string, - orgOurStoryData: IProfileContent[] -): Promise { - const docRef = doc(db, Collections.organisationOurStory, orgId).withConverter( - organisationOurStoryConverter - ); - await setDoc(docRef, new OrganisationProfileOurStory(orgId, orgOurStoryData)); -} - -export async function getOrganisationProfileOurStory( - orgId: string -): Promise { - const docRef = doc( - db, - Collections.organisationOurStory, - orgId - ).withConverter(organisationOurStoryConverter); - return (await getDoc(docRef)).data(); -} diff --git a/src/data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight.ts b/src/data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight.ts deleted file mode 100644 index 4b9cf8a..0000000 --- a/src/data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { - DocumentData, - FirestoreDataConverter, - QueryDocumentSnapshot, - SnapshotOptions, - doc, - getDoc, - setDoc, -} from "firebase/firestore"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../../services/Firebase/Names"; -import { Social } from "../OrganisationSummary"; - -export interface IPeopleSpotlight { - name: string; - jobTitle: string; - description: string; - photoUrl: string; - socials: Social[]; - learnMore: { question: string; answer: string }; -} - -export class OrganisationProfilePeopleSpotlight { - orgId: string; - content: IPeopleSpotlight[]; - - constructor(_orgId: string, _content: IPeopleSpotlight[]) { - this.orgId = _orgId; - this.content = _content; - } -} - -export const organisationProfilePeopleSpotlightConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationProfilePeopleSpotlight): DocumentData { - return { - content: data.content.map((obj) => { - return { - ...obj, - socials: obj.socials.map((s) => { - return { ...s }; - }), - }; - }), - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationProfilePeopleSpotlight { - const data: DocumentData = snapshot.data(options); - return new OrganisationProfilePeopleSpotlight( - snapshot.id, - data.content.map((obj: any) => { - const p: IPeopleSpotlight = { - ...obj, - socials: obj.socials.map((s: any) => { - const social: Social = { ...s }; - return social; - }), - }; - return p; - }) - ); - }, - }; - -export async function createOrganisationProfilePeopleSpotlight( - orgId: string, - orgPeopleSpotlight: IPeopleSpotlight[] -): Promise { - const docRef = doc( - db, - Collections.organisationPeopleSpotlight, - orgId - ).withConverter(organisationProfilePeopleSpotlightConverter); - await setDoc( - docRef, - new OrganisationProfilePeopleSpotlight(orgId, orgPeopleSpotlight) - ); -} - -export async function getOrganisationProfilePeopleSpotlight( - orgId: string -): Promise { - const docRef = doc( - db, - Collections.organisationPeopleSpotlight, - orgId - ).withConverter( - organisationProfilePeopleSpotlightConverter - ); - return (await getDoc(docRef)).data(); -} diff --git a/src/data/Model/OrganisationSummary.ts b/src/data/Model/OrganisationSummary.ts deleted file mode 100644 index e9d9593..0000000 --- a/src/data/Model/OrganisationSummary.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - doc, - DocumentData, - FirestoreDataConverter, - getDoc, - QueryDocumentSnapshot, - setDoc, - SnapshotOptions, -} from "firebase/firestore"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../services/Firebase/Names"; -import { SocialType } from "../Enums/social-type.enum"; - -export type Social = { - socialType: SocialType; - url: string; -}; - -export interface IOrganisationSummary { - videoUrl?: string; - websiteUrl?: string; - donationUrl?: string; - mission?: string; - email?: string; - socials?: Social[]; -} - -export class OrganisationSummary implements IOrganisationSummary { - orgId: string; - videoUrl: string; - websiteUrl: string; - donationUrl: string; - mission: string; - email: string; - socials: Social[]; - - // potentially create reference to parent organisation object, if queries require it - - constructor( - _orgId: string, - _videoUrl: string, - _websiteUrl: string, - _donationUrl: string, - _mission: string, - _email: string, - _socials: Social[] - ) { - this.orgId = _orgId; - this.videoUrl = _videoUrl; - this.websiteUrl = _websiteUrl; - this.donationUrl = _donationUrl; - this.mission = _mission; - this.email = _email; - this.socials = _socials ?? []; - } - - toString() { - return `Organisation summary data {orgId: ${this.orgId}}`; - } -} - -export const organisationSummaryConverter: FirestoreDataConverter = - { - toFirestore(data: OrganisationSummary): DocumentData { - return { - videoUrl: data.videoUrl, - websiteUrl: data.websiteUrl, - donationUrl: data.donationUrl, - mission: data.mission, - email: data.email, - socials: data.socials, - }; - }, - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): OrganisationSummary { - const data: DocumentData = snapshot.data(options); - return new OrganisationSummary( - snapshot.id, - data.videoUrl, - data.websiteUrl, - data.donationUrl, - data.mission, - data.email, - data.socials - ); - }, - }; - -export async function createOrganisationSummary( - orgId: string, - orgSummaryData: IOrganisationSummary -): Promise { - const docRef = doc(db, Collections.organisationSummary, orgId).withConverter( - organisationSummaryConverter - ); - await setDoc(docRef, orgSummaryData); -} - -export async function getOrganisationSummary( - orgId: string -): Promise { - const docRef = doc( - db, - Collections.organisationSummary, - orgId - ).withConverter(organisationSummaryConverter); - return (await getDoc(docRef)).data(); -} diff --git a/src/data/Model/User.ts b/src/data/Model/User.ts deleted file mode 100644 index fc841b7..0000000 --- a/src/data/Model/User.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - doc, - setDoc, -} from "firebase/firestore"; -import { Collections } from "../../services/Firebase/Names"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { UserRole } from "../Enums/user-role.enum"; - -export interface IUser { - id: string; - role: UserRole; - orgRef: string; -} - -export class User { - id: string; - role: UserRole; - orgRef: string; - - constructor(_id: string, _role: UserRole, _orgRef: string) { - this.id = _id; - this.role = _role; - this.orgRef = _orgRef; - } -} - -export async function createUser( - userID: string, - orgID: string, - userRole: UserRole -): Promise { - await setDoc(doc(db, Collections.users, userID), { - orgID: orgID, - role: userRole, - }).then(() => console.log("user Data added")); -} diff --git a/src/data/auth/authContext.tsx b/src/data/auth/authContext.tsx index d68e5a9..73baa70 100644 --- a/src/data/auth/authContext.tsx +++ b/src/data/auth/authContext.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { AuthContextModel } from "./AuthContextModel"; +import { AuthContextModel } from "./authContextModel"; export const AuthContext = React.createContext( {} as AuthContextModel diff --git a/src/data/auth/authContextModel.ts b/src/data/auth/authContextModel.ts deleted file mode 100644 index e181b82..0000000 --- a/src/data/auth/authContextModel.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Auth, User, UserCredential } from "firebase/auth" - -export interface AuthContextModel { - auth: Auth - user: User | null - signIn: (email: string, password: string) => Promise - signUp: (email: string, password: string) => Promise - sendPasswordResetEmail?: (email: string) => Promise - } \ No newline at end of file diff --git a/src/data/auth/authRequestData.ts b/src/data/auth/authRequestData.ts deleted file mode 100644 index 3457a01..0000000 --- a/src/data/auth/authRequestData.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface AuthenticationRequestData { - userName: string; -} - -export interface LoginCredentialsData { - email: string; - password: string; -} \ No newline at end of file diff --git a/src/data/enums/ipc-status.enum.ts b/src/data/enums/ipc-status.enum.ts deleted file mode 100644 index 0d63aa1..0000000 --- a/src/data/enums/ipc-status.enum.ts +++ /dev/null @@ -1,11 +0,0 @@ -export enum IPCStatus { - NotApproved, - Approved, - Pending, -} - -export const IPCStatusViewMap: Map = new Map([ - [IPCStatus.Approved, "Yes"], - [IPCStatus.NotApproved, "No"], - [IPCStatus.Pending, "Pending"], -]); diff --git a/src/data/enums/org-size.enum.ts b/src/data/enums/org-size.enum.ts deleted file mode 100644 index 924d6c1..0000000 --- a/src/data/enums/org-size.enum.ts +++ /dev/null @@ -1,24 +0,0 @@ -export enum OrgSize { - max5 = "1-5", - max10 = "6-10", - max20 = "11-20", - max50 = "21-50", - max100 = "51-100", - min100 = ">100", -} - -export interface OrgSizeEnumOption { - value: OrgSize; - label: string; - key?: string; - disabled?: boolean; -} - -export const orgSizeEnumOptions: OrgSizeEnumOption[] = Object.keys(OrgSize).map( - (key) => { - return { - label: key, - value: OrgSize[key as keyof typeof OrgSize], - }; - } -); diff --git a/src/data/enums/service.enum.ts b/src/data/enums/service.enum.ts deleted file mode 100644 index 4827644..0000000 --- a/src/data/enums/service.enum.ts +++ /dev/null @@ -1,29 +0,0 @@ -export enum Service { - Youth = "Youth", - Workshops = "Workshops", - OCD = "OCD", - SupportGroup = "Support Group", - OverallMentalWellbeing = "Overall Mental Wellbeing", - TrainingProvider = "Training Provider", - Counselling = "Counselling", - SpeakingEngagements = "Speaking Engagements", - CorporateTraining = "Corporate Training", - TextBasedChatPlatform = "Text-based Chat Platform", - PeerSupportCircles= "Peer Support Circles" -} - -export interface ServiceEnumOption { - value: Service; - label: string; - key?: string; - disabled?: boolean; -} - -export const serviceEnumOptions: ServiceEnumOption[] = Object.keys(Service).map( - (key) => { - return { - label: key, - value: Service[key as keyof typeof Service], - }; - } -); diff --git a/src/data/enums/support-area.enum.ts b/src/data/enums/support-area.enum.ts deleted file mode 100644 index 4cf2bd5..0000000 --- a/src/data/enums/support-area.enum.ts +++ /dev/null @@ -1,21 +0,0 @@ -export enum SupportArea { - PartnershipOpportunities = "Partnership Opportunities", - FundingSupport = "Funding Support", - Volunteers = "Volunteers", -} - -export interface SupportAreaEnumOption { - value: SupportArea; - label: string; - key?: string; - disabled?: boolean; -} - -export const supportAreaEnumOptions: SupportAreaEnumOption[] = Object.keys( - SupportArea -).map((key) => { - return { - label: key, - value: SupportArea[key as keyof typeof SupportArea], - }; -}); diff --git a/src/data/enums/verification-status.enum.ts b/src/data/enums/verification-status.enum.ts deleted file mode 100644 index 7588ca3..0000000 --- a/src/data/enums/verification-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum VerificationStatus { - NotVerified, - Verified, - Pending, -} diff --git a/src/data/model/organisation.ts b/src/data/model/organisation.ts index 706d96c..117ed5b 100644 --- a/src/data/model/organisation.ts +++ b/src/data/model/organisation.ts @@ -17,21 +17,21 @@ import { DocumentSnapshot, getCountFromServer, } from "firebase/firestore"; -import { Collections } from "../../services/Firebase/Names"; -import { db } from "../../services/Firebase/FirebaseConfig"; +import { Collections } from "../../services/firebase/names"; +import { db } from "../../services/firebase/firebaseConfig"; import { createOrganisationAdminData, IOrganisationAdminData, -} from "./OrganisationAdmin"; -import { SupportArea } from "../Enums/support-area.enum"; -import { Specialisation } from "../Enums/specialisation.enum"; -import { Service } from "../Enums/service.enum"; -import { IPCStatus } from "../Enums/ipc-status.enum"; -import { VerificationStatus } from "../Enums/verification-status.enum"; +} from "./organisationAdmin"; +import { SupportArea } from "../enums/support-area.enum"; +import { Specialisation } from "../enums/specialisation.enum"; +import { Service } from "../enums/service.enum"; +import { IPCStatus } from "../enums/ipc-status.enum"; +import { VerificationStatus } from "../enums/verification-status.enum"; import { IOrganisationSummary, createOrganisationSummary, -} from "./OrganisationSummary"; +} from "./organisationSummary"; export interface IOrganisation { name?: string; diff --git a/src/data/model/organisationAdmin.ts b/src/data/model/organisationAdmin.ts index c56bf52..52deefa 100644 --- a/src/data/model/organisationAdmin.ts +++ b/src/data/model/organisationAdmin.ts @@ -6,10 +6,10 @@ import { QueryDocumentSnapshot, SnapshotOptions, } from "firebase/firestore"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../services/Firebase/Names"; -import { CapitalGoal } from "../Enums/captial-goal.enum"; -import { OrgSize } from "../Enums/org-size.enum"; +import { db } from "../../services/firebase/firebaseConfig"; +import { Collections } from "../../services/firebase/names"; +import { CapitalGoal } from "../enums/captial-goal.enum"; +import { OrgSize } from "../enums/org-size.enum"; export interface IOrganisationAdminData { orgId?: string; diff --git a/src/data/model/organisationProfile/organisationProfileFAQ.ts b/src/data/model/organisationProfile/organisationProfileFAQ.ts index 77ad9ef..5a3a30d 100644 --- a/src/data/model/organisationProfile/organisationProfileFAQ.ts +++ b/src/data/model/organisationProfile/organisationProfileFAQ.ts @@ -7,8 +7,8 @@ import { getDoc, setDoc, } from "firebase/firestore"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../../services/Firebase/Names"; +import { db } from "../../../services/firebase/firebaseConfig"; +import { Collections } from "../../../services/firebase/names"; export interface IFAQ { question: string; diff --git a/src/data/model/organisationProfile/organisationProfileImpact.ts b/src/data/model/organisationProfile/organisationProfileImpact.ts index c54a428..b3ecc5f 100644 --- a/src/data/model/organisationProfile/organisationProfileImpact.ts +++ b/src/data/model/organisationProfile/organisationProfileImpact.ts @@ -7,13 +7,13 @@ import { getDoc, setDoc, } from "firebase/firestore"; -import { Collections } from "../../../services/Firebase/Names"; -import { db } from "../../../services/Firebase/FirebaseConfig"; +import { Collections } from "../../../services/firebase/names"; +import { db } from "../../../services/firebase/firebaseConfig"; import { IProfileContent, convertContentToFireStore, convertFirestoreToContent, -} from "./ProfileContent"; +} from "./profileContent"; export class OrganisationProfileImpact { orgId: string; diff --git a/src/data/model/organisationProfile/organisationProfileOurStory.ts b/src/data/model/organisationProfile/organisationProfileOurStory.ts index f6c360d..3d3e26f 100644 --- a/src/data/model/organisationProfile/organisationProfileOurStory.ts +++ b/src/data/model/organisationProfile/organisationProfileOurStory.ts @@ -7,13 +7,13 @@ import { getDoc, setDoc, } from "firebase/firestore"; -import { Collections } from "../../../services/Firebase/Names"; -import { db } from "../../../services/Firebase/FirebaseConfig"; +import { Collections } from "../../../services/firebase/names"; +import { db } from "../../../services/firebase/firebaseConfig"; import { IProfileContent, convertContentToFireStore, convertFirestoreToContent, -} from "./ProfileContent"; +} from "./profileContent"; export class OrganisationProfileOurStory { orgId: string; diff --git a/src/data/model/organisationProfile/organisationProfilePeopleSpotlight.ts b/src/data/model/organisationProfile/organisationProfilePeopleSpotlight.ts index 4b9cf8a..324d9bb 100644 --- a/src/data/model/organisationProfile/organisationProfilePeopleSpotlight.ts +++ b/src/data/model/organisationProfile/organisationProfilePeopleSpotlight.ts @@ -7,9 +7,9 @@ import { getDoc, setDoc, } from "firebase/firestore"; -import { db } from "../../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../../services/Firebase/Names"; -import { Social } from "../OrganisationSummary"; +import { db } from "../../../services/firebase/firebaseConfig"; +import { Collections } from "../../../services/firebase/names"; +import { Social } from "../organisationSummary"; export interface IPeopleSpotlight { name: string; diff --git a/src/data/model/organisationProfile/profileContent.ts b/src/data/model/organisationProfile/profileContent.ts deleted file mode 100644 index eafc093..0000000 --- a/src/data/model/organisationProfile/profileContent.ts +++ /dev/null @@ -1,35 +0,0 @@ -export interface ISection { - subHeader: string; - text: string; -} - -export interface IProfileContent { - header: string; - section: ISection[]; - imageUrl: string; -} - -export function convertContentToFireStore(content: IProfileContent) { - return { - ...content, - section: content.section.map((data) => { - return { ...data }; - }), - }; -} - -export function convertFirestoreToContent(data: any): IProfileContent { - const profileContent: IProfileContent = { - header: data.header, - section: data.section.map((obj: { subHeader: any; text: any }) => { - const section: ISection = { - subHeader: obj.subHeader, - text: obj.text, - }; - return section; - }), - imageUrl: data.imageUrl, - }; - - return profileContent; -} diff --git a/src/data/model/organisationSummary.ts b/src/data/model/organisationSummary.ts index e9d9593..f8f32da 100644 --- a/src/data/model/organisationSummary.ts +++ b/src/data/model/organisationSummary.ts @@ -7,9 +7,9 @@ import { setDoc, SnapshotOptions, } from "firebase/firestore"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { Collections } from "../../services/Firebase/Names"; -import { SocialType } from "../Enums/social-type.enum"; +import { db } from "../../services/firebase/firebaseConfig"; +import { Collections } from "../../services/firebase/names"; +import { SocialType } from "../enums/social-type.enum"; export type Social = { socialType: SocialType; diff --git a/src/data/model/user.ts b/src/data/model/user.ts index fc841b7..4ecca68 100644 --- a/src/data/model/user.ts +++ b/src/data/model/user.ts @@ -2,9 +2,9 @@ import { doc, setDoc, } from "firebase/firestore"; -import { Collections } from "../../services/Firebase/Names"; -import { db } from "../../services/Firebase/FirebaseConfig"; -import { UserRole } from "../Enums/user-role.enum"; +import { Collections } from "../../services/firebase/names"; +import { db } from "../../services/firebase/firebaseConfig"; +import { UserRole } from "../enums/user-role.enum"; export interface IUser { id: string; diff --git a/src/index.tsx b/src/index.tsx index ea9920c..c114312 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,7 +2,7 @@ import { ColorModeScript } from "@chakra-ui/react"; import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { BrowserRouter } from "react-router-dom"; -import App from "./App"; +import App from "./app"; import reportWebVitals from "./reportWebVitals"; import * as serviceWorker from "./serviceWorker"; import 'typeface-inter' diff --git a/src/mocks/FirestoreMock.tsx b/src/mocks/firestoreMock.tsx similarity index 87% rename from src/mocks/FirestoreMock.tsx rename to src/mocks/firestoreMock.tsx index 54c9cf8..dfdd461 100644 --- a/src/mocks/FirestoreMock.tsx +++ b/src/mocks/firestoreMock.tsx @@ -4,18 +4,18 @@ import { Component } from "react"; import { getOrganisationsForListingsPage, OrganisationListingQueryFilters, -} from "../data/Model/Organisation"; -import { db, storage } from "../services/Firebase/FirebaseConfig"; -import { Collections, StorageDirectory } from "../services/Firebase/Names"; -import { IPCStatus } from "../data/Enums/ipc-status.enum"; -import { testOrgs } from "./TestOrganisationsMock"; -import { listingsFolder } from "../services/Firebase/Storage"; +} from "../data/model/organisation"; +import { db, storage } from "../services/firebase/firebaseConfig"; +import { Collections, StorageDirectory } from "../services/firebase/names"; +import { IPCStatus } from "../data/enums/ipc-status.enum"; +import { testOrgs } from "./testOrganisationsMock"; +import { listingsFolder } from "../services/firebase/storage"; import { getDownloadURL, ref, uploadBytes } from "@firebase/storage"; -import { createOrganisationSummary } from "../data/Model/OrganisationSummary"; -import { createOrganisationProfileOurStory } from "../data/Model/OrganisationProfile/OrganisationProfileOurStory"; -import { createOrganisationProfilePeopleSpotlight } from "../data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight"; +import { createOrganisationSummary } from "../data/model/organisationSummary"; +import { createOrganisationProfileOurStory } from "../data/model/organisationProfile/organisationProfileOurStory"; +import { createOrganisationProfilePeopleSpotlight } from "../data/model/organisationProfile/organisationProfilePeopleSpotlight"; import { faker } from "@faker-js/faker"; -import { QuillEditor } from "./QuillEditor"; +import { QuillEditor } from "./quillEditor"; class FirestoreMockPage extends Component { parseData = async () => { diff --git a/src/mocks/InitialOrganisationsMock.ts b/src/mocks/initialOrganisationsMock.ts similarity index 95% rename from src/mocks/InitialOrganisationsMock.ts rename to src/mocks/initialOrganisationsMock.ts index 8424379..8e694d7 100644 --- a/src/mocks/InitialOrganisationsMock.ts +++ b/src/mocks/initialOrganisationsMock.ts @@ -1,14 +1,14 @@ -import { IPCStatus } from "../data/Enums/ipc-status.enum"; -import { Service } from "../data/Enums/service.enum"; -import { Specialisation } from "../data/Enums/specialisation.enum"; -import { SupportArea } from "../data/Enums/support-area.enum"; -import { VerificationStatus } from "../data/Enums/verification-status.enum"; -import { IOrganisation } from "../data/Model/Organisation"; -import { IProfileContent } from "../data/Model/OrganisationProfile/ProfileContent"; -import { IOrganisationSummary } from "../data/Model/OrganisationSummary"; +import { IPCStatus } from "../data/enums/ipc-status.enum"; +import { Service } from "../data/enums/service.enum"; +import { Specialisation } from "../data/enums/specialisation.enum"; +import { SupportArea } from "../data/enums/support-area.enum"; +import { VerificationStatus } from "../data/enums/verification-status.enum"; +import { IOrganisation } from "../data/model/organisation"; +import { IProfileContent } from "../data/model/organisationProfile/profileContent"; +import { IOrganisationSummary } from "../data/model/organisationSummary"; import { faker } from "@faker-js/faker"; -import { SocialType } from "../data/Enums/social-type.enum"; -import { IPeopleSpotlight } from "../data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight"; +import { SocialType } from "../data/enums/social-type.enum"; +import { IPeopleSpotlight } from "../data/model/organisationProfile/organisationProfilePeopleSpotlight"; export const testOrg1: IOrganisation = { name: "Over The Rainbow (OTR)", diff --git a/src/mocks/TestOrganisationsMock.ts b/src/mocks/testOrganisationsMock.ts similarity index 95% rename from src/mocks/TestOrganisationsMock.ts rename to src/mocks/testOrganisationsMock.ts index f8eb9fe..d962b8d 100644 --- a/src/mocks/TestOrganisationsMock.ts +++ b/src/mocks/testOrganisationsMock.ts @@ -1,14 +1,14 @@ -import { IPCStatus } from "../data/Enums/ipc-status.enum"; -import { Service } from "../data/Enums/service.enum"; -import { Specialisation } from "../data/Enums/specialisation.enum"; -import { SupportArea } from "../data/Enums/support-area.enum"; -import { VerificationStatus } from "../data/Enums/verification-status.enum"; -import { IOrganisation } from "../data/Model/Organisation"; -import { IProfileContent } from "../data/Model/OrganisationProfile/ProfileContent"; -import { IOrganisationSummary } from "../data/Model/OrganisationSummary"; +import { IPCStatus } from "../data/enums/ipc-status.enum"; +import { Service } from "../data/enums/service.enum"; +import { Specialisation } from "../data/enums/specialisation.enum"; +import { SupportArea } from "../data/enums/support-area.enum"; +import { VerificationStatus } from "../data/enums/verification-status.enum"; +import { IOrganisation } from "../data/model/organisation"; +import { IProfileContent } from "../data/model/organisationProfile/profileContent"; +import { IOrganisationSummary } from "../data/model/organisationSummary"; import { faker } from "@faker-js/faker"; -import { SocialType } from "../data/Enums/social-type.enum"; -import { IPeopleSpotlight } from "../data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight"; +import { SocialType } from "../data/enums/social-type.enum"; +import { IPeopleSpotlight } from "../data/model/organisationProfile/organisationProfilePeopleSpotlight"; export const testOrg1: IOrganisation = { name: "Over The Rainbow (OTR)", diff --git a/src/pages/Home/index.ts b/src/pages/Home/index.ts deleted file mode 100644 index ffa7931..0000000 --- a/src/pages/Home/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Home"; diff --git a/src/pages/Login/index.ts b/src/pages/Login/index.ts deleted file mode 100644 index cd3a8ca..0000000 --- a/src/pages/Login/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Login"; diff --git a/src/pages/OrganisationList/index.ts b/src/pages/OrganisationList/index.ts deleted file mode 100644 index ef9dac9..0000000 --- a/src/pages/OrganisationList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./OrganisationList"; diff --git a/src/pages/OrganisationProfile/index.ts b/src/pages/OrganisationProfile/index.ts deleted file mode 100644 index 3acb985..0000000 --- a/src/pages/OrganisationProfile/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./OrganisationProfile"; diff --git a/src/pages/Registration/index.ts b/src/pages/Registration/index.ts deleted file mode 100644 index b1dcea6..0000000 --- a/src/pages/Registration/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Registration'; \ No newline at end of file diff --git a/src/pages/UserDashboard/index.ts b/src/pages/UserDashboard/index.ts deleted file mode 100644 index bf6cd32..0000000 --- a/src/pages/UserDashboard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./UserDashboard"; diff --git a/src/pages/Home/HeroSection.tsx b/src/pages/home/heroSection.tsx similarity index 97% rename from src/pages/Home/HeroSection.tsx rename to src/pages/home/heroSection.tsx index 92baf97..23869fc 100644 --- a/src/pages/Home/HeroSection.tsx +++ b/src/pages/home/heroSection.tsx @@ -1,5 +1,5 @@ import { Flex, Stack, Box, Image, Heading } from "@chakra-ui/react"; -import NavigationButton from "../../components/NavigationButton"; +import NavigationButton from "../../components/navigationButton"; const HeroSection = () => { return ( diff --git a/src/pages/Home/Home.tsx b/src/pages/home/home.tsx similarity index 97% rename from src/pages/Home/Home.tsx rename to src/pages/home/home.tsx index 604891a..8b2b969 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/home/home.tsx @@ -1,8 +1,8 @@ import { VStack } from "@chakra-ui/react"; import { useNavigate } from "react-router-dom"; -import HeroSection from "./HeroSection"; -import SupportSection from "./SupportSection"; -import TogetherSection from "./TogetherSection"; +import HeroSection from "./heroSection"; +import SupportSection from "./supportSection"; +import TogetherSection from "./togetherSection"; import "../style.scss"; const Home: React.FC = () => { diff --git a/src/pages/home/index.ts b/src/pages/home/index.ts new file mode 100644 index 0000000..ba04027 --- /dev/null +++ b/src/pages/home/index.ts @@ -0,0 +1 @@ +export { default } from "./home"; diff --git a/src/pages/login/index.ts b/src/pages/login/index.ts new file mode 100644 index 0000000..f50f6a0 --- /dev/null +++ b/src/pages/login/index.ts @@ -0,0 +1 @@ +export { default } from "./login"; diff --git a/src/pages/Login/Login.tsx b/src/pages/login/login.tsx similarity index 79% rename from src/pages/Login/Login.tsx rename to src/pages/login/login.tsx index a37af83..b33cddb 100644 --- a/src/pages/Login/Login.tsx +++ b/src/pages/login/login.tsx @@ -1,6 +1,6 @@ import { Box, Flex } from "@chakra-ui/react"; -import LoginDesign from "./LoginDesign"; -import LoginSection from "./LoginSection"; +import LoginDesign from "./loginDesign"; +import LoginSection from "./loginSection"; import "./style.scss"; const Login = () => { diff --git a/src/pages/Login/LoginForm.tsx b/src/pages/login/loginForm.tsx similarity index 91% rename from src/pages/Login/LoginForm.tsx rename to src/pages/login/loginForm.tsx index 0776385..30200b8 100644 --- a/src/pages/Login/LoginForm.tsx +++ b/src/pages/login/loginForm.tsx @@ -9,10 +9,10 @@ import { } from "@chakra-ui/react"; import { ViewIcon, ViewOffIcon } from "@chakra-ui/icons"; import { useState } from "react"; -import ForgotPassword from "./ForgotPassword"; -import Signup from "./SignUp"; -import GoogleSignInButton from "./GoogleSignInButton"; -import SignInButton from "./SignInButton"; +import ForgotPassword from "./forgotPassword"; +import Signup from "./signUp"; +import GoogleSignInButton from "./googleSignInButton"; +import SignInButton from "./signInButton"; export default function LoginForm() { const [show, setShow] = useState(false); diff --git a/src/pages/Login/LoginSection.tsx b/src/pages/login/loginSection.tsx similarity index 89% rename from src/pages/Login/LoginSection.tsx rename to src/pages/login/loginSection.tsx index dd29178..c64c42e 100644 --- a/src/pages/Login/LoginSection.tsx +++ b/src/pages/login/loginSection.tsx @@ -1,7 +1,7 @@ import { ArrowBackIcon } from "@chakra-ui/icons"; import { Container, Link, StackDivider, Text, VStack } from "@chakra-ui/react"; -import LoginForm from "./LoginForm"; -import LoginMenuMessage from "./LoginMenuMessage"; +import LoginForm from "./loginForm"; +import LoginMenuMessage from "./loginMenuMessage"; export default function LoginSection() { return ( diff --git a/src/pages/Login/SignInButton.tsx b/src/pages/login/signInButton.tsx similarity index 92% rename from src/pages/Login/SignInButton.tsx rename to src/pages/login/signInButton.tsx index c7fc037..da2d516 100644 --- a/src/pages/Login/SignInButton.tsx +++ b/src/pages/login/signInButton.tsx @@ -2,8 +2,8 @@ import { Button, VStack } from "@chakra-ui/react"; import { User, UserCredential } from "firebase/auth"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; -import { AuthenticationRequestData } from "../../data/Auth/AuthRequestData"; -import { useAuth } from "../../services/Firebase/AuthProvider"; +import { AuthenticationRequestData } from "../../data/auth/authRequestData"; +import { useAuth } from "../../services/firebase/authProvider"; interface LoginCredentials { email: string; diff --git a/src/pages/OrganisationList/CardView.tsx b/src/pages/organisationList/cardView.tsx similarity index 83% rename from src/pages/OrganisationList/CardView.tsx rename to src/pages/organisationList/cardView.tsx index 9e14ed6..ef5f8d2 100644 --- a/src/pages/OrganisationList/CardView.tsx +++ b/src/pages/organisationList/cardView.tsx @@ -1,7 +1,7 @@ import { Grid, GridItem, LinkBox, LinkOverlay } from "@chakra-ui/react"; -import { Organisation } from "../../data/Model/Organisation"; -import { buildOrgProfilePath } from "../../routing/Paths"; -import OrgCard from "./OrganisationCard"; +import { Organisation } from "../../data/model/organisation"; +import { buildOrgProfilePath } from "../../routing/paths"; +import OrgCard from "./organisationCard"; const CardView: React.FC<{ organisationList: Organisation[] }> = ({ organisationList, diff --git a/src/pages/OrganisationList/Const.ts b/src/pages/organisationList/const.ts similarity index 87% rename from src/pages/OrganisationList/Const.ts rename to src/pages/organisationList/const.ts index c740425..4f5b4ac 100644 --- a/src/pages/OrganisationList/Const.ts +++ b/src/pages/organisationList/const.ts @@ -1,7 +1,7 @@ -import { IPCStatus, IPCStatusViewMap } from "../../data/Enums/ipc-status.enum"; -import { Specialisation } from "../../data/Enums/specialisation.enum"; -import { Service } from "../../data/Enums/service.enum"; -import { SupportArea } from "../../data/Enums/support-area.enum"; +import { IPCStatus, IPCStatusViewMap } from "../../data/enums/ipc-status.enum"; +import { Specialisation } from "../../data/enums/specialisation.enum"; +import { Service } from "../../data/enums/service.enum"; +import { SupportArea } from "../../data/enums/support-area.enum"; export const serviceOptions = [ { diff --git a/src/pages/organisationList/index.ts b/src/pages/organisationList/index.ts new file mode 100644 index 0000000..d297778 --- /dev/null +++ b/src/pages/organisationList/index.ts @@ -0,0 +1 @@ +export { default } from "./organisationList"; diff --git a/src/pages/OrganisationList/ListView.tsx b/src/pages/organisationList/listView.tsx similarity index 92% rename from src/pages/OrganisationList/ListView.tsx rename to src/pages/organisationList/listView.tsx index c0cfefd..df20447 100644 --- a/src/pages/OrganisationList/ListView.tsx +++ b/src/pages/organisationList/listView.tsx @@ -14,9 +14,9 @@ import { ReactComponent as NotApproved } from "../../assets/icons/statusNotAppro import { ReactComponent as Pending } from "../../assets/icons/statusPending.svg"; import { ReactComponent as Verified } from "../../assets/icons/statusVerified.svg"; import { ReactComponent as NotVerified } from "../../assets/icons/statusNotVerified.svg"; -import { Organisation } from "../../data/Model/Organisation"; -import { VerificationStatus } from "../../data/Enums/verification-status.enum"; -import { IPCStatus } from "../../data/Enums/ipc-status.enum"; +import { Organisation } from "../../data/model/organisation"; +import { VerificationStatus } from "../../data/enums/verification-status.enum"; +import { IPCStatus } from "../../data/enums/ipc-status.enum"; const ipcUIMap = { [IPCStatus.Approved]: , diff --git a/src/pages/OrganisationList/OrganisationCard.tsx b/src/pages/organisationList/organisationCard.tsx similarity index 93% rename from src/pages/OrganisationList/OrganisationCard.tsx rename to src/pages/organisationList/organisationCard.tsx index 0f7c4ee..099ae76 100644 --- a/src/pages/OrganisationList/OrganisationCard.tsx +++ b/src/pages/organisationList/organisationCard.tsx @@ -1,4 +1,4 @@ -import { Organisation } from "../../data/Model/Organisation"; +import { Organisation } from "../../data/model/organisation"; import { Box, Text, @@ -9,8 +9,8 @@ import { TagLeftIcon, Flex, } from "@chakra-ui/react"; -import { VerificationStatus } from "../../data/Enums/verification-status.enum"; -import { IPCStatus } from "../../data/Enums/ipc-status.enum"; +import { VerificationStatus } from "../../data/enums/verification-status.enum"; +import { IPCStatus } from "../../data/enums/ipc-status.enum"; import { SearchIcon, CheckCircleIcon, createIcon } from "@chakra-ui/icons"; // person icon diff --git a/src/pages/OrganisationList/OrganisationList.tsx b/src/pages/organisationList/organisationList.tsx similarity index 97% rename from src/pages/OrganisationList/OrganisationList.tsx rename to src/pages/organisationList/organisationList.tsx index 8693f6c..341df1e 100644 --- a/src/pages/OrganisationList/OrganisationList.tsx +++ b/src/pages/organisationList/organisationList.tsx @@ -11,15 +11,15 @@ import { Button, } from "@chakra-ui/react"; import React, { useEffect, useState } from "react"; -import CardView from "./CardView"; -import ListView from "./ListView"; -import ViewToggle from "./ViewToggle"; +import CardView from "./cardView"; +import ListView from "./listView"; +import ViewToggle from "./viewToggle"; import { getOrganisationsForListingsPage, Organisation, OrganisationListingQueryFilters, -} from "../../data/Model/Organisation"; -import Breadcrumbs from "../../components/Breadcrumbs"; +} from "../../data/model/organisation"; +import Breadcrumbs from "../../components/breadcrumbs"; import "../style.scss"; import { MultiSelect } from "react-multi-select-component"; import { @@ -27,7 +27,7 @@ import { serviceOptions, specialisationsOptions, supportAreaOptions, -} from "./Const"; +} from "./const"; import { DocumentData, DocumentSnapshot } from "firebase/firestore"; import { colors } from "../../theme/colours"; diff --git a/src/pages/OrganisationList/ViewToggle.tsx b/src/pages/organisationList/viewToggle.tsx similarity index 98% rename from src/pages/OrganisationList/ViewToggle.tsx rename to src/pages/organisationList/viewToggle.tsx index 463ca4a..3c1b974 100644 --- a/src/pages/OrganisationList/ViewToggle.tsx +++ b/src/pages/organisationList/viewToggle.tsx @@ -1,5 +1,5 @@ import { Box, Text } from "@chakra-ui/react"; -import { EViewOption } from "./OrganisationList"; +import { EViewOption } from "./organisationList"; import { ReactComponent as ViewCardActive } from "../../assets/icons/viewCardActive.svg"; import { ReactComponent as ViewCardInactive } from "../../assets/icons/viewCardInactive.svg"; import { ReactComponent as ViewListActive } from "../../assets/icons/viewListActive.svg"; diff --git a/src/pages/organisationProfile/index.ts b/src/pages/organisationProfile/index.ts new file mode 100644 index 0000000..ec55e70 --- /dev/null +++ b/src/pages/organisationProfile/index.ts @@ -0,0 +1 @@ +export { default } from "./organisationProfile"; diff --git a/src/pages/OrganisationProfile/OrganisationProfile.tsx b/src/pages/organisationProfile/organisationProfile.tsx similarity index 82% rename from src/pages/OrganisationProfile/OrganisationProfile.tsx rename to src/pages/organisationProfile/organisationProfile.tsx index 713dbb3..5c7a7c2 100644 --- a/src/pages/OrganisationProfile/OrganisationProfile.tsx +++ b/src/pages/organisationProfile/organisationProfile.tsx @@ -1,14 +1,14 @@ import { VStack } from "@chakra-ui/react"; -import Profile from "./Profile"; -import Services from "./Services"; -import Summary from "./Summary"; -import Breadcrumbs from "../../components/Breadcrumbs"; +import Profile from "./profile"; +import Services from "./services"; +import Summary from "./summary"; +import Breadcrumbs from "../../components/breadcrumbs"; import { useParams } from "react-router-dom"; import { useEffect, useState } from "react"; import { getOrganisationForProfilePage, Organisation, -} from "../../data/Model/Organisation"; +} from "../../data/model/organisation"; import "../style.scss"; const OrganisationProfile = () => { diff --git a/src/pages/OrganisationProfile/Profile.tsx b/src/pages/organisationProfile/profile.tsx similarity index 96% rename from src/pages/OrganisationProfile/Profile.tsx rename to src/pages/organisationProfile/profile.tsx index 25cbecc..6a25421 100644 --- a/src/pages/OrganisationProfile/Profile.tsx +++ b/src/pages/organisationProfile/profile.tsx @@ -15,21 +15,21 @@ import { import { useEffect, useState } from "react"; import { GetIconForSocials } from "../../utilities/iconMappings/iconMapping"; import "./profile.scss"; -import { Organisation } from "../../data/Model/Organisation"; +import { Organisation } from "../../data/model/organisation"; import { IFAQ, getOrganisationProfileFAQ, -} from "../../data/Model/OrganisationProfile/OrganisationProfileFAQ"; -import { getOrganisationProfileOurStory } from "../../data/Model/OrganisationProfile/OrganisationProfileOurStory"; +} from "../../data/model/organisationProfile/organisationProfileFAQ"; +import { getOrganisationProfileOurStory } from "../../data/model/organisationProfile/organisationProfileOurStory"; import { IPeopleSpotlight, getOrganisationProfilePeopleSpotlight, -} from "../../data/Model/OrganisationProfile/OrganisationProfilePeopleSpotlight"; +} from "../../data/model/organisationProfile/organisationProfilePeopleSpotlight"; import { IProfileContent, ISection, -} from "../../data/Model/OrganisationProfile/ProfileContent"; -import { ProfileContent } from "./ProfileContent"; +} from "../../data/model/organisationProfile/profileContent"; +import { ProfileContent } from "./profileContent"; // TODO move this to model when class is defined export interface IFeaturedProjects { diff --git a/src/pages/OrganisationProfile/ProfileContent.tsx b/src/pages/organisationProfile/profileContent.tsx similarity index 98% rename from src/pages/OrganisationProfile/ProfileContent.tsx rename to src/pages/organisationProfile/profileContent.tsx index b85db30..c077ff9 100644 --- a/src/pages/OrganisationProfile/ProfileContent.tsx +++ b/src/pages/organisationProfile/profileContent.tsx @@ -1,6 +1,6 @@ import { Box, Heading } from "@chakra-ui/layout"; import parse, { domToReact, HTMLReactParserOptions } from "html-react-parser"; -import { Header, ProfileSidebar } from "./ProfileSidebar"; +import { Header, ProfileSidebar } from "./profileSidebar"; import { Flex } from "@chakra-ui/react"; const htmlContent = diff --git a/src/pages/OrganisationProfile/Services.tsx b/src/pages/organisationProfile/services.tsx similarity index 93% rename from src/pages/OrganisationProfile/Services.tsx rename to src/pages/organisationProfile/services.tsx index bdaed04..9145288 100644 --- a/src/pages/OrganisationProfile/Services.tsx +++ b/src/pages/organisationProfile/services.tsx @@ -7,8 +7,8 @@ import { StackDivider, } from "@chakra-ui/react"; import { Component } from "react"; -import { Service } from "../../data/Enums/service.enum"; -import { SupportArea } from "../../data/Enums/support-area.enum"; +import { Service } from "../../data/enums/service.enum"; +import { SupportArea } from "../../data/enums/support-area.enum"; import { GetIcon } from "../../utilities/iconMappings/iconMapping"; import "./services.scss"; import "../style.scss"; diff --git a/src/pages/OrganisationProfile/SimilarOrganisations.tsx b/src/pages/organisationProfile/similarOrganisations.tsx similarity index 90% rename from src/pages/OrganisationProfile/SimilarOrganisations.tsx rename to src/pages/organisationProfile/similarOrganisations.tsx index db7e389..a4b9508 100644 --- a/src/pages/OrganisationProfile/SimilarOrganisations.tsx +++ b/src/pages/organisationProfile/similarOrganisations.tsx @@ -6,9 +6,9 @@ import { getOrganisationsForListingsPage, Organisation, OrganisationListingQueryFilters, -} from "../../data/Model/Organisation"; -import CardView from "../OrganisationList/CardView"; -import { Specialisation } from "../../data/Enums/specialisation.enum"; +} from "../../data/model/organisation"; +import CardView from "../organisationList/cardView"; +import { Specialisation } from "../../data/enums/specialisation.enum"; const SimilarOrganisations: React.FC<{ org: Organisation }> = ({ org }) => { // store organisation card data diff --git a/src/pages/OrganisationProfile/Summary.tsx b/src/pages/organisationProfile/summary.tsx similarity index 97% rename from src/pages/OrganisationProfile/Summary.tsx rename to src/pages/organisationProfile/summary.tsx index 9156638..f64f0b1 100644 --- a/src/pages/OrganisationProfile/Summary.tsx +++ b/src/pages/organisationProfile/summary.tsx @@ -16,11 +16,11 @@ import { GetIconForSocials, } from "../../utilities/iconMappings/iconMapping"; import { useEffect, useState } from "react"; -import { Organisation } from "../../data/Model/Organisation"; +import { Organisation } from "../../data/model/organisation"; import { OrganisationSummary, getOrganisationSummary, -} from "../../data/Model/OrganisationSummary"; +} from "../../data/model/organisationSummary"; import "./summary.scss"; const emailButtonStyle = { diff --git a/src/pages/Registration/GoalsForm.tsx b/src/pages/registration/goalsForm.tsx similarity index 96% rename from src/pages/Registration/GoalsForm.tsx rename to src/pages/registration/goalsForm.tsx index 0c431f5..26b19e1 100644 --- a/src/pages/Registration/GoalsForm.tsx +++ b/src/pages/registration/goalsForm.tsx @@ -6,11 +6,11 @@ import { Select, Text, } from "@chakra-ui/react"; -import { OrgDataFormProps } from "./ProfileSetup"; +import { OrgDataFormProps } from "./profileSetup"; import { CapitalGoal, capitalGoalEnumOptions, -} from "../../data/Enums/captial-goal.enum"; +} from "../../data/enums/captial-goal.enum"; const GoalsForm = ({ orgFormData, diff --git a/src/pages/registration/index.ts b/src/pages/registration/index.ts new file mode 100644 index 0000000..1c5ad8b --- /dev/null +++ b/src/pages/registration/index.ts @@ -0,0 +1 @@ +export { default } from "./registration"; diff --git a/src/pages/Registration/OrganisationInfoForm.tsx b/src/pages/registration/organisationInfoForm.tsx similarity index 96% rename from src/pages/Registration/OrganisationInfoForm.tsx rename to src/pages/registration/organisationInfoForm.tsx index f93355f..0a548ee 100644 --- a/src/pages/Registration/OrganisationInfoForm.tsx +++ b/src/pages/registration/organisationInfoForm.tsx @@ -8,20 +8,20 @@ import { Image, } from "@chakra-ui/react"; import { MultiSelect } from "react-multi-select-component"; -import { OrgDataFormProps } from "./ProfileSetup"; +import { OrgDataFormProps } from "./profileSetup"; import { Specialisation, specialisationEnumOptions, -} from "../../data/Enums/specialisation.enum"; +} from "../../data/enums/specialisation.enum"; import { SupportArea, supportAreaEnumOptions, -} from "../../data/Enums/support-area.enum"; +} from "../../data/enums/support-area.enum"; import { ServiceEnumOption, serviceEnumOptions, -} from "../../data/Enums/service.enum"; -import { OrgSize, orgSizeEnumOptions } from "../../data/Enums/org-size.enum"; +} from "../../data/enums/service.enum"; +import { OrgSize, orgSizeEnumOptions } from "../../data/enums/org-size.enum"; import { useState } from "react"; const OrganisationInfoForm = ({ diff --git a/src/pages/Registration/ProfileSetup.tsx b/src/pages/registration/profileSetup.tsx similarity index 93% rename from src/pages/Registration/ProfileSetup.tsx rename to src/pages/registration/profileSetup.tsx index efece43..ceb3a29 100644 --- a/src/pages/Registration/ProfileSetup.tsx +++ b/src/pages/registration/profileSetup.tsx @@ -21,15 +21,15 @@ import { import { Step, Steps, useSteps } from "chakra-ui-steps"; import { useEffect, useState } from "react"; import { useLocation, useNavigate } from "react-router-dom"; -import { instanceOfLoginCredentials } from "../../data/Auth/LoginCredentials"; -import OrgInfoForm from "./OrganisationInfoForm"; -import GoalsForm from "./GoalsForm"; -import SignUpWaiting from "./SignUpWaiting"; +import { instanceOfLoginCredentials } from "../../data/auth/loginCredentials"; +import OrgInfoForm from "./organisationInfoForm"; +import GoalsForm from "./goalsForm"; +import SignUpWaiting from "./signUpWaiting"; import "./setup.scss"; -import { Paths } from "../../routing/Paths"; -import { IOrganisation } from "../../data/Model/Organisation"; -import { IOrganisationAdminData } from "../../data/Model/OrganisationAdmin"; -import { IOrganisationSummary } from "../../data/Model/OrganisationSummary"; +import { Paths } from "../../routing/paths"; +import { IOrganisation } from "../../data/model/organisation"; +import { IOrganisationAdminData } from "../../data/model/organisationAdmin"; +import { IOrganisationSummary } from "../../data/model/organisationSummary"; const steps = [ { label: "Organisation Information" }, diff --git a/src/pages/Registration/Registration.tsx b/src/pages/registration/registration.tsx similarity index 76% rename from src/pages/Registration/Registration.tsx rename to src/pages/registration/registration.tsx index 1ba22b2..6a95827 100644 --- a/src/pages/Registration/Registration.tsx +++ b/src/pages/registration/registration.tsx @@ -1,7 +1,7 @@ import { Box, Flex } from "@chakra-ui/react"; -import RegistrationDesign from "./RegistrationDesign"; -import RegistrationSection from "./RegistrationSection"; +import RegistrationDesign from "./registrationDesign"; +import RegistrationSection from "./registrationSection"; import "./registration.scss"; const Registration = () => { diff --git a/src/pages/Registration/RegistrationForm.tsx b/src/pages/registration/registrationForm.tsx similarity index 99% rename from src/pages/Registration/RegistrationForm.tsx rename to src/pages/registration/registrationForm.tsx index ed193e7..6147e39 100644 --- a/src/pages/Registration/RegistrationForm.tsx +++ b/src/pages/registration/registrationForm.tsx @@ -12,7 +12,7 @@ import { } from "@chakra-ui/react"; import { ViewIcon, ViewOffIcon } from "@chakra-ui/icons"; import { useState } from "react"; -import SignUpButton from "./SignUpButton"; +import SignUpButton from "./signUpButton"; import { IsPasswordMinLength, // DoPasswordsMatch, @@ -23,7 +23,7 @@ import { PasswordContainsSymbol, PasswordContainsUppercase, } from "../../utilities/validators"; -import SignIn from "./SignIn"; +import SignIn from "./signIn"; import { ImCheckboxChecked, ImCross } from "react-icons/im"; const RegistrationForm = () => { diff --git a/src/pages/Registration/RegistrationSection.tsx b/src/pages/registration/registrationSection.tsx similarity index 83% rename from src/pages/Registration/RegistrationSection.tsx rename to src/pages/registration/registrationSection.tsx index 4320de3..aa1a8d8 100644 --- a/src/pages/Registration/RegistrationSection.tsx +++ b/src/pages/registration/registrationSection.tsx @@ -1,8 +1,8 @@ import { ArrowBackIcon } from "@chakra-ui/icons"; import { Container, Link, StackDivider, VStack } from "@chakra-ui/react"; -import RegistrationMenuMessage from "./RegistrationMenuMessage"; -import RegistrationForm from "./RegistrationForm"; -import { Paths } from "../../routing/Paths"; +import RegistrationMenuMessage from "./registrationMenuMessage"; +import RegistrationForm from "./registrationForm"; +import { Paths } from "../../routing/paths"; const RegistrationSection = () => { return ( diff --git a/src/pages/Registration/SignUpButton.tsx b/src/pages/registration/signUpButton.tsx similarity index 85% rename from src/pages/Registration/SignUpButton.tsx rename to src/pages/registration/signUpButton.tsx index 2de7b09..85156df 100644 --- a/src/pages/Registration/SignUpButton.tsx +++ b/src/pages/registration/signUpButton.tsx @@ -1,7 +1,7 @@ import { Button } from "@chakra-ui/react"; import { useNavigate } from "react-router-dom"; -import { Paths } from "../../routing/Paths"; -import { LoginCredentials } from "./SignUpWaiting"; +import { Paths } from "../../routing/paths"; +import { LoginCredentials } from "./signUpWaiting"; const SignUpButton = (LoginCredentials: LoginCredentials) => { const disable: boolean = !LoginCredentials.validated; diff --git a/src/pages/Registration/SignUpWaiting.tsx b/src/pages/registration/signUpWaiting.tsx similarity index 88% rename from src/pages/Registration/SignUpWaiting.tsx rename to src/pages/registration/signUpWaiting.tsx index 13e9b6c..3c66a1f 100644 --- a/src/pages/Registration/SignUpWaiting.tsx +++ b/src/pages/registration/signUpWaiting.tsx @@ -3,18 +3,18 @@ import { Center, Image, Spinner, Text, VStack } from "@chakra-ui/react"; import { User, UserCredential } from "firebase/auth"; import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; -import { useAuth } from "../../services/Firebase/AuthProvider"; -import { IOrgFormData } from "./ProfileSetup"; +import { useAuth } from "../../services/firebase/authProvider"; +import { IOrgFormData } from "./profileSetup"; import { IOrganisation, createOrganisationOnSignUp, -} from "../../data/Model/Organisation"; -import { IPCStatus } from "../../data/Enums/ipc-status.enum"; -import { VerificationStatus } from "../../data/Enums/verification-status.enum"; -import { IOrganisationAdminData } from "../../data/Model/OrganisationAdmin"; -import { IOrganisationSummary } from "../../data/Model/OrganisationSummary"; -import { UserRole } from "../../data/Enums/user-role.enum"; -import { createUser } from "../../data/Model/User"; +} from "../../data/model/organisation"; +import { IPCStatus } from "../../data/enums/ipc-status.enum"; +import { VerificationStatus } from "../../data/enums/verification-status.enum"; +import { IOrganisationAdminData } from "../../data/model/organisationAdmin"; +import { IOrganisationSummary } from "../../data/model/organisationSummary"; +import { UserRole } from "../../data/enums/user-role.enum"; +import { createUser } from "../../data/model/user"; export interface LoginCredentials { email: string; diff --git a/src/pages/userDashboard/index.ts b/src/pages/userDashboard/index.ts new file mode 100644 index 0000000..a938ab5 --- /dev/null +++ b/src/pages/userDashboard/index.ts @@ -0,0 +1 @@ +export { default } from "./userDashboard"; diff --git a/src/pages/UserDashboard/UserDashboard.tsx b/src/pages/userDashboard/userDashboard.tsx similarity index 91% rename from src/pages/UserDashboard/UserDashboard.tsx rename to src/pages/userDashboard/userDashboard.tsx index 34f067d..9a4678e 100644 --- a/src/pages/UserDashboard/UserDashboard.tsx +++ b/src/pages/userDashboard/userDashboard.tsx @@ -1,5 +1,5 @@ import { Box, Flex } from "@chakra-ui/react"; -import { AuthContext } from "../../data/Auth/AuthContext"; +import { AuthContext } from "../../data/auth/authContext"; import { useContext } from "react"; import { Navigate } from "react-router-dom"; diff --git a/src/routing/index.ts b/src/routing/index.ts index b0173f7..f83a072 100644 --- a/src/routing/index.ts +++ b/src/routing/index.ts @@ -1 +1 @@ -export { default } from "./Routing"; +export { default } from "./routing"; diff --git a/src/routing/Routing.tsx b/src/routing/routing.tsx similarity index 62% rename from src/routing/Routing.tsx rename to src/routing/routing.tsx index fc2eb15..4b7136e 100644 --- a/src/routing/Routing.tsx +++ b/src/routing/routing.tsx @@ -1,13 +1,13 @@ import { Route, Routes } from "react-router-dom"; -import { Paths } from "./Paths"; -import OrganisationList from "../pages/OrganisationList"; -import LoginPage from "../pages/Login"; -import UserDashboardPage from "../pages/UserDashboard"; -import Registration from "../pages/Registration"; -import ProfileSetupPage from "../pages/Registration/ProfileSetup"; -import OrgProfilePage from "../pages/OrganisationProfile"; -import FirestoreMock from "../mocks/FirestoreMock"; -import Home from "../pages/Home"; +import { Paths } from "./paths"; +import OrganisationList from "../pages/organisationList"; +import LoginPage from "../pages/login"; +import UserDashboardPage from "../pages/userDashboard"; +import Registration from "../pages/registration"; +import ProfileSetupPage from "../pages/registration/profileSetup"; +import OrgProfilePage from "../pages/organisationProfile"; +import FirestoreMock from "../mocks/firestoreMock"; +import Home from "../pages/home"; const Routing = () => { return ( diff --git a/src/services/Firebase/AuthProvider.tsx b/src/services/Firebase/AuthProvider.tsx deleted file mode 100644 index 9f9a338..0000000 --- a/src/services/Firebase/AuthProvider.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { useEffect,useState,useContext} from 'react' -import { auth } from './FirebaseConfig' -import { UserCredential,User,createUserWithEmailAndPassword,signInWithEmailAndPassword,sendPasswordResetEmail,} from 'firebase/auth' -import { AuthProviderProps } from './AuthProviderProps' -import { UserContextState, UserStateContext } from '../../data/Auth/UserContext' -import { AuthContextModel } from '../../data/Auth/AuthContextModel' -import { AuthContext } from '../../data/Auth/AuthContext' - -export function useAuth(): AuthContextModel { - return useContext(AuthContext); -} - -export const AuthProvider = ({ children }: AuthProviderProps): JSX.Element => { - const [user, setUser] = useState(null); - - function signUp(email: string, password: string): Promise { - return createUserWithEmailAndPassword(auth, email, password); - } - - function signIn(email: string, password: string): Promise { - return signInWithEmailAndPassword(auth, email, password); - } - - function resetPassword(email: string): Promise { - return sendPasswordResetEmail(auth, email); - } - - useEffect(() => { - //function that firebase notifies you if a user is set - const unsubscribe = auth.onAuthStateChanged((user) => { - setUser(user); - }); - return unsubscribe; - }, []); - - const values = { - signUp, - user, - signIn, - resetPassword, - auth, - }; - return {children}; -}; - -export const useUserContext = (): UserContextState => { - return useContext(UserStateContext); -}; diff --git a/src/services/Firebase/Names.ts b/src/services/Firebase/Names.ts deleted file mode 100644 index 11fe648..0000000 --- a/src/services/Firebase/Names.ts +++ /dev/null @@ -1,18 +0,0 @@ -// define collections names used in firestore -export class Collections { - static readonly organisations = "organisations"; - static readonly users = "users"; - static readonly organisationsAdminData = "organisationAdminData"; - static readonly organisationPeopleSpotlight = "organisationPeopleSpotlight"; - static readonly organisationFAQ = "organisationFAQ"; - static readonly organisationOurStory = "organisationOurStory"; - static readonly organisationImpact = "organisationImpact"; - static readonly organisationSummary = "organisationSummary"; -} - -export class StorageDirectory { - static readonly listingsDirectory = "/organisations/listing-data"; - static readonly profilesDirectory = "/organisations/profile-data"; - static readonly profilesOurStoryDirectory = `${StorageDirectory.profilesDirectory}/:orgId/our-story`; - static readonly profilesPeopleSpotlightDirectory = `${StorageDirectory.profilesDirectory}/:orgId/people-spotlight`; -} diff --git a/src/services/Firebase/Rules/firestore.rules b/src/services/Firebase/Rules/firestore.rules deleted file mode 100644 index 08751ba..0000000 --- a/src/services/Firebase/Rules/firestore.rules +++ /dev/null @@ -1,40 +0,0 @@ -rules_version = '2'; -service cloud.firestore { - match /databases/{database}/documents { - match /users/{uid} { - // To create (setDoc) new document for user registered data - allow read: if request.auth.uid !=null; - allow write: if true; // TODO replace if request.auth != null; - // To update user's registered data - // allow update: if request.auth.uid == uid; // TODO return - } - match /organisations/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - match /organisationAdminData/{org} { - allow read: if request.auth.uid != null; - allow write: if request.auth.uid != null; - } - match /organisationSummary/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - match /organisationFAQ/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - match /organisationOurStory/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - match /organisationPeopleSpotlight/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - match /organisationImpact/{org} { - allow read; - allow write: if true; //request.auth.uid != null; - } - } -} \ No newline at end of file diff --git a/src/services/Firebase/Rules/storage.rules b/src/services/Firebase/Rules/storage.rules deleted file mode 100644 index f1e646b..0000000 --- a/src/services/Firebase/Rules/storage.rules +++ /dev/null @@ -1,8 +0,0 @@ -rules_version = '2'; -service firebase.storage { - match /b/{bucket}/o { - match /{allPaths=**} { - allow read, write; - } - } -} \ No newline at end of file diff --git a/src/services/Firebase/Storage.ts b/src/services/Firebase/Storage.ts deleted file mode 100644 index 03ecd28..0000000 --- a/src/services/Firebase/Storage.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { getStorage, ref } from "firebase/storage"; -import { StorageDirectory } from "./Names"; - -export const storage = getStorage(); -export const listingsFolder = ref(storage, StorageDirectory.listingsDirectory); -export const profilesFolder = ref(storage, StorageDirectory.profilesDirectory); diff --git a/src/services/Firebase/emulator-readme.md b/src/services/Firebase/emulator-readme.md deleted file mode 100644 index 5b5010d..0000000 --- a/src/services/Firebase/emulator-readme.md +++ /dev/null @@ -1,13 +0,0 @@ -This document is a quick guide on starting the firebase emulators for development testing. For a more comprehensive guide, refer to firebase documentation: (Firebase Emulator Suite)[https://firebase.google.com/docs/emulator-suite] - -**Pre-requisite** - -1. Install firebase cli: `npm install -g firebase-tools` - -**Start-up** - -1. Verify that **firebase.json** in root directory has all the required services configured in the "emulators" key. -2. Run firebase emulator in terminal: `firebase emulators:start` -3. Upon successful startup, navigate to the firebase emulator UI. Default is (http://localhost:4000)[http://localhost:4000] -4. Connect to required emulators in **firebaseConfig.ts**. The default configuration is to use the emulators. -5. Start app. diff --git a/src/services/Authentication.ts b/src/services/authentication.ts similarity index 70% rename from src/services/Authentication.ts rename to src/services/authentication.ts index 48dd77d..23e9a26 100644 --- a/src/services/Authentication.ts +++ b/src/services/authentication.ts @@ -1,5 +1,5 @@ -import { AuthenticationRequestData } from "../data/Auth/AuthRequestData"; -import http from "./HttpCommon"; +import { AuthenticationRequestData } from "../data/auth/authRequestData"; +import http from "./httpCommon"; const authenticate = (data: AuthenticationRequestData) => { diff --git a/src/services/firebase/authProvider.tsx b/src/services/firebase/authProvider.tsx index 9f9a338..ec44c81 100644 --- a/src/services/firebase/authProvider.tsx +++ b/src/services/firebase/authProvider.tsx @@ -1,10 +1,10 @@ -import { useEffect,useState,useContext} from 'react' -import { auth } from './FirebaseConfig' -import { UserCredential,User,createUserWithEmailAndPassword,signInWithEmailAndPassword,sendPasswordResetEmail,} from 'firebase/auth' -import { AuthProviderProps } from './AuthProviderProps' -import { UserContextState, UserStateContext } from '../../data/Auth/UserContext' -import { AuthContextModel } from '../../data/Auth/AuthContextModel' -import { AuthContext } from '../../data/Auth/AuthContext' +import { useEffect,useState,useContext} from "react" +import { auth } from "./firebaseConfig" +import { UserCredential,User,createUserWithEmailAndPassword,signInWithEmailAndPassword,sendPasswordResetEmail,} from "firebase/auth" +import { AuthProviderProps } from "./authProviderProps" +import { UserContextState, UserStateContext } from "../../data/auth/userContext" +import { AuthContextModel } from "../../data/auth/authContextModel" +import { AuthContext } from "../../data/auth/authContext" export function useAuth(): AuthContextModel { return useContext(AuthContext); diff --git a/src/services/firebase/authProviderProps.ts b/src/services/firebase/authProviderProps.ts deleted file mode 100644 index a174781..0000000 --- a/src/services/firebase/authProviderProps.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ReactNode } from "react"; - -export interface AuthProviderProps { - children?: ReactNode - } \ No newline at end of file diff --git a/src/services/firebase/firebaseConfig.ts b/src/services/firebase/firebaseConfig.ts deleted file mode 100644 index 49ff6d2..0000000 --- a/src/services/firebase/firebaseConfig.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { initializeApp } from "firebase/app"; -import { Auth, getAuth, connectAuthEmulator } from "firebase/auth"; -import { - connectFirestoreEmulator, - Firestore, - getFirestore, -} from "firebase/firestore"; -import { - getStorage, - connectStorageEmulator, - FirebaseStorage, -} from "firebase/storage"; - -const firebaseConfig = { - apiKey: process.env.REACT_APP_MINDBETTER_APIKEY, - authDomain: process.env.REACT_APP_MINDBETTER_AUTHDOMAIN, - projectId: process.env.REACT_APP_MINDBETTER_PROJECT_ID, - storageBucket: process.env.REACT_APP_MINDBETTER_STORAGE_BUCKET, - messagingSenderId: process.env.REACT_APP_MINDBETTER_MESSAGING_SENDER_ID, - appId: process.env.REACT_APP_MINDBETTER_APP_ID, - measurementId: process.env.REACT_APP_MINDBETTER_MEASUREMENT_ID, -}; - -const app = initializeApp(firebaseConfig); - -export const db: Firestore = getFirestore(app); -export const auth: Auth = getAuth(app); -export const storage: FirebaseStorage = getStorage(app); - -if (process.env.NODE_ENV === "development") { - // ensure that firebase emulator suite is up - // refer to emulator-readme - connectFirestoreEmulator(db, "localhost", 9999); - connectAuthEmulator(auth, "http://localhost:9099"); - connectStorageEmulator(storage, "localhost", 9199); -} diff --git a/src/services/firebase/storage.ts b/src/services/firebase/storage.ts index 03ecd28..cd28bbe 100644 --- a/src/services/firebase/storage.ts +++ b/src/services/firebase/storage.ts @@ -1,5 +1,5 @@ import { getStorage, ref } from "firebase/storage"; -import { StorageDirectory } from "./Names"; +import { StorageDirectory } from "./names"; export const storage = getStorage(); export const listingsFolder = ref(storage, StorageDirectory.listingsDirectory); diff --git a/src/utilities/iconMappings/iconMapping.tsx b/src/utilities/iconMappings/iconMapping.tsx index 6d29b10..f5ff46e 100644 --- a/src/utilities/iconMappings/iconMapping.tsx +++ b/src/utilities/iconMappings/iconMapping.tsx @@ -10,10 +10,10 @@ import { ReactComponent as PartnershipOpportunitiesIcon } from "../../assets/ico import { ReactComponent as FundingSupportIcon } from "../../assets/icons/services/funding-support.svg"; import { ReactComponent as CounsellingIcon } from "../../assets/icons/services/counselling.svg"; import { ReactComponent as CorporateTrainingIcon } from "../../assets/icons/services/corporate-training.svg"; -import { SocialType } from "../../data/Enums/social-type.enum"; -import { Specialisation } from "../../data/Enums/specialisation.enum"; -import { Service } from "../../data/Enums/service.enum"; -import { SupportArea } from "../../data/Enums/support-area.enum"; +import { SocialType } from "../../data/enums/social-type.enum"; +import { Specialisation } from "../../data/enums/specialisation.enum"; +import { Service } from "../../data/enums/service.enum"; +import { SupportArea } from "../../data/enums/support-area.enum"; export function GetIconForIssue(issue: Readonly) { switch (issue) {