([]);
62 | const allBlogData: BlogType[] = await getBlogData();
63 |
64 | const handleAddSaveBlog = (data: SavedBlogType) => {
65 | savedBlogs.push(data);
66 | localStorage.setItem('sampark-saved-items', JSON.stringify(savedBlogs));
67 | setSavedBlogs([...savedBlogs]);
68 | };
69 |
70 | const handleDeleteSavedBlog = (id: number) => {
71 | const savedBlogList = localStorage.getItem('sampark-saved-items');
72 |
73 | if (savedBlogList) {
74 | const parsedBlogsData = JSON.parse(savedBlogList);
75 | const updatedBlogsData = parsedBlogsData.filter(
76 | (item: { id: number }) => item.id !== id,
77 | );
78 | localStorage.setItem(
79 | 'sampark-saved-items',
80 | JSON.stringify(updatedBlogsData),
81 | );
82 | setSavedBlogs(updatedBlogsData);
83 | }
84 | };
85 | return (
86 |
87 |
88 |
89 |
90 |
91 | {
97 | router.push('/');
98 | }}
99 | >
100 | Go Back
101 |
102 |
110 | {' '}
111 | {allBlogData.map((item:BlogType, index:number) => (
112 |
119 | ))}
120 |
121 |
122 |
123 | );
124 | };
125 |
126 | export default BlogsPage;
127 |
--------------------------------------------------------------------------------
/app/events/[slug]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | AspectRatio,
4 | Button,
5 | Card,
6 | Container,
7 | createStyles,
8 | Header,
9 | Paper,
10 | } from '@mantine/core';
11 | import Image from 'next/image';
12 | import { IconArrowLeft } from '@tabler/icons';
13 | import { useRouter } from 'next/navigation';
14 | import React from 'react';
15 | // import { GetStaticPaths, NextPage } from 'next';
16 |
17 | const useStyles = createStyles(() => ({
18 | header: {
19 | display: 'flex',
20 | justifyContent: 'space-between',
21 | alignItems: 'center',
22 | height: '100%',
23 | },
24 | blog: {
25 | textAlign: 'left',
26 | width: '50%',
27 | },
28 | back: {
29 | display: 'flex',
30 | alignItems: 'center',
31 | },
32 | image: {
33 | border: '1px solid #a3a3a2',
34 | borderRadius: '10px',
35 | margin: ' 20px 0',
36 | },
37 | }));
38 |
39 | interface SingleEventsType {
40 | name: string;
41 | slug: string;
42 | organizer: string;
43 | description: string;
44 | date: Date;
45 | image: string;
46 | }
47 |
48 | interface ParamsType {
49 | slug: string;
50 | }
51 |
52 | const getEventData = async (slug: string) => {
53 | const res = await fetch(
54 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/event/slug/${slug}`,
55 | { next: { revalidate: 10 } },
56 | );
57 | const response = await res.json();
58 | return response.event;
59 | };
60 |
61 | const SingleEvents = async ({ params }: { params: ParamsType }) => {
62 | const { classes } = useStyles();
63 | const router = useRouter();
64 | const eventsdata: SingleEventsType = await getEventData(params.slug);
65 |
66 | return (
67 | <>
68 |
78 |
79 |
80 | {
84 | router.push('/');
85 | }}
86 | >
87 | {' '}
88 | Go Back
89 |
90 |
91 |
96 |
102 |
103 |
104 | {eventsdata.description as string}
105 |
106 | >
107 | );
108 | };
109 |
110 | export default SingleEvents;
111 |
--------------------------------------------------------------------------------
/app/events/events.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
--------------------------------------------------------------------------------
/app/events/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { Button, Container, createStyles, SimpleGrid } from '@mantine/core';
3 | import { useRouter } from 'next/navigation';
4 | import HomeHeader from '../../src/components/HomeHeader/HomeHeader';
5 | import { data } from '../../src/components/Events/eventContent';
6 | import './events.css';
7 | import { EventCard } from '../../src/components/Events/EventsCard';
8 | import React from 'react';
9 |
10 | const useStyles = createStyles((theme) => ({
11 | body: {
12 | background: 'white',
13 | },
14 | header: {
15 | display: 'flex',
16 | justifyContent: 'space-between',
17 | alignItems: 'center',
18 | height: '100%',
19 | },
20 | blog: {
21 | marginTop: '2rem',
22 | justifyItems: 'center',
23 | },
24 | back: {
25 | display: 'flex',
26 | alignItems: 'center',
27 | marginLeft: '4%',
28 | ...theme.fn.hover({
29 | transition: 'transform 150ms ease, box-shadow 150ms ease',
30 | transform: 'scale(1.01)',
31 | boxShadow: theme.shadows.md,
32 | }),
33 | },
34 | }));
35 |
36 | interface EventsType {
37 | slug: string;
38 | name: string;
39 | organizer: string;
40 | address: string;
41 | description: string;
42 | date: string;
43 | image: string;
44 | duration: number;
45 | index: number;
46 | }
47 |
48 | const getEventData = async () => {
49 | const res = await fetch(
50 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/event`,
51 | { next: { revalidate: 10 } },
52 | );
53 | const response = await res.json();
54 | return response.event;
55 | };
56 | const EventsPage = async () => {
57 | const router = useRouter();
58 | const { classes } = useStyles();
59 |
60 | const allEventData: EventsType[] = await getEventData();
61 |
62 | return (
63 |
64 |
65 |
66 |
67 |
68 | {
74 | router.push('/');
75 | }}
76 | >
77 | Go Back
78 |
79 |
87 | {' '}
88 | {allEventData.map((item, index) => (
89 |
94 | ))}
95 |
96 |
97 |
98 | );
99 | };
100 |
101 | export default EventsPage;
102 |
--------------------------------------------------------------------------------
/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/app/favicon.ico
--------------------------------------------------------------------------------
/app/gallery/gallery.css:
--------------------------------------------------------------------------------
1 | .gPadding {
2 | margin-bottom: 10rem;
3 | }
4 |
5 | .grid-container {
6 | display: grid;
7 | column-gap: 50px;
8 | row-gap: 50px;
9 | grid-template-columns: auto auto auto;
10 | padding: 10px;
11 | margin-top: 4rem;
12 | }
13 |
14 | .grid-item {
15 | border: 1px solid white;
16 | padding: 20px;
17 | font-size: 30px;
18 | text-align: center;
19 | border-radius: 10px;
20 | }
21 |
22 | .grid-item img {
23 | border-radius: 10px;
24 | }
25 |
26 | @media only screen and (max-width: 800px) {
27 | .grid-container {
28 | grid-template-columns: 1fr;
29 | }
30 |
31 | .grid-item img {
32 | width: 100%;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/gallery/galleryData.ts:
--------------------------------------------------------------------------------
1 | export const galleryData = [{
2 | image:'https://drive.google.com/uc?export=download&id=1LvVkueNKCOxWMZhmENlciL98fFnO1Iyl'
3 | },{
4 | image:'https://drive.google.com/uc?export=download&id=1Lrgi5PCH0MKgY6LYyaa3oGkXGiCRyYiK'
5 | },{
6 | image:'https://drive.google.com/uc?export=download&id=1LxlU3X8-1WH4TLDM4YSP9x21g4HVjggU'
7 | },{
8 | image:'https://drive.google.com/uc?export=download&id=1LtNaPzQYG_3AgRI__hB1BGKBWFh6Ulvo'
9 | },{
10 | image:'https://drive.google.com/uc?export=download&id=1Lr0fIwip2Fa5VyrThq4wx00vIUYkOxTO'
11 | },{
12 | image:'https://drive.google.com/uc?export=download&id=1MTxwomYotps5z_-BHpHhXvwSr1ISw-de'
13 | },
14 | ]
--------------------------------------------------------------------------------
/app/gallery/page.tsx:
--------------------------------------------------------------------------------
1 |
2 | 'use client';
3 |
4 | import { Container, Header } from '@mantine/core';
5 | import { useRouter } from 'next/navigation';
6 | import Image from 'next/image';
7 | import './gallery.css';
8 | import React from 'react';
9 | import { NextPage } from 'next';
10 | import {galleryData} from './galleryData'
11 |
12 | interface GalleryType{
13 | image: string;
14 | }
15 | const GalleryPage: NextPage =()=>{
16 | const router = useRouter();
17 | return (
18 | <>
19 |
20 |
21 | router.push('/')}
28 | />
29 |
30 |
31 |
32 |
Gallery
33 |
34 | {galleryData.map((data:GalleryType, index:number)=>
35 |
36 |
42 |
43 | )}
44 |
45 |
46 |
47 |
48 | >
49 | );
50 | }
51 |
52 | export default GalleryPage;
53 |
--------------------------------------------------------------------------------
/app/globals.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --max-width: 1100px;
3 | --border-radius: 12px;
4 | --font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
5 | 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
6 | 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
7 | }
8 |
9 | * {
10 | box-sizing: border-box;
11 | padding: 0;
12 | margin: 0;
13 | }
14 |
15 | html,
16 | body {
17 | max-width: 100vw;
18 | overflow-x: hidden;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/app/impact/[slug]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | AspectRatio,
4 | Button,
5 | Card,
6 | Container,
7 | createStyles,
8 | Header,
9 | Paper,
10 | } from '@mantine/core';
11 | import Image from 'next/image';
12 | import { IconArrowLeft } from '@tabler/icons';
13 | import { useRouter } from 'next/navigation';
14 | import React from 'react';
15 |
16 | const useStyles = createStyles(() => ({
17 | header: {
18 | display: 'flex',
19 | justifyContent: 'space-between',
20 | alignItems: 'center',
21 | height: '100%',
22 | },
23 | blog: {
24 | textAlign: 'left',
25 | width: '50%',
26 | },
27 | back: {
28 | display: 'flex',
29 | alignItems: 'center',
30 | },
31 | image: {
32 | border: '1px solid #a3a3a2',
33 | borderRadius: '10px',
34 | margin: ' 20px 0',
35 | },
36 | }));
37 |
38 | interface SingleImpactType {
39 | name: string;
40 | slug: string;
41 | address: Date;
42 | description: string;
43 | image: string;
44 | }
45 |
46 | interface ParamsType {
47 | slug: string;
48 | }
49 |
50 | const getImpactData = async (slug: string) => {
51 | const res = await fetch(
52 | `${
53 | process.env.NEXT_PUBLIC_API_ENDPOINT as string
54 | }/api/impact/slug/${slug}`,
55 | { next: { revalidate: 10 } },
56 | );
57 | const response = await res.json();
58 | return response.impact;
59 | };
60 |
61 | const SingleImpact = async ({ params }: { params: ParamsType }) => {
62 | const { classes } = useStyles();
63 | const router = useRouter();
64 | const impactData: SingleImpactType = await getImpactData(params.slug);
65 |
66 | return (
67 | <>
68 |
78 |
79 |
80 | {
84 | router.push('/');
85 | }}
86 | >
87 | {' '}
88 | Go Back
89 |
90 |
91 |
96 |
103 |
104 |
105 | {impactData.description as string}
106 |
107 | >
108 | );
109 | };
110 |
111 | export default SingleImpact;
112 |
--------------------------------------------------------------------------------
/app/impact/impact.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/app/impact/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | Button,
4 | Container,
5 | createStyles,
6 | SimpleGrid,
7 | Text,
8 | } from '@mantine/core';
9 |
10 | // import Image from 'next/image';
11 |
12 | import { useRouter } from 'next/navigation';
13 | import { data } from '../../src/components/Impact/impactContent';
14 | import './impact.css';
15 | import { ImpactCard } from '../../src/components/Impact/ImpactCard';
16 | import React from 'react';
17 | import { NextPage } from 'next';
18 | import HomeHeader from '../../src/components/HomeHeader/HomeHeader';
19 |
20 | const useStyles = createStyles((theme) => ({
21 | header: {
22 | display: 'flex',
23 | justifyContent: 'space-between',
24 | alignItems: 'center',
25 | height: '100%',
26 | },
27 | blog: {
28 | marginTop: '2rem',
29 | justifyItems: 'center',
30 | },
31 | back: {
32 | display: 'flex',
33 | alignItems: 'center',
34 | marginLeft: '4%',
35 | ...theme.fn.hover({
36 | transition: 'transform 150ms ease, box-shadow 150ms ease',
37 | transform: 'scale(1.01)',
38 | boxShadow: theme.shadows.md,
39 | }),
40 | },
41 | }));
42 | interface ImapctsType {
43 | image: string;
44 | impactData: string;
45 | }
46 | const ImapctsPage = () => {
47 | const router = useRouter();
48 | const { classes } = useStyles();
49 |
50 | return (
51 |
52 |
53 |
54 |
55 |
56 | {
62 | router.push('/');
63 | }}
64 | >
65 | Go Back
66 |
67 |
75 | {' '}
76 | {data.map((item: ImapctsType, index: number) => (
77 |
83 | ))}
84 |
85 |
86 |
87 | );
88 | };
89 |
90 | export default ImapctsPage;
91 |
--------------------------------------------------------------------------------
/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import './globals.css'
2 | import type { Metadata } from 'next'
3 | import { Inter } from 'next/font/google'
4 | import React from 'react'
5 |
6 | const inter = Inter({ subsets: ['latin'] })
7 |
8 | export const metadata: Metadata = {
9 | title: 'Create Next App',
10 | description: 'Generated by create next app',
11 | }
12 |
13 | export default function RootLayout({
14 | children,
15 | }: {
16 | children: React.ReactNode
17 | }) {
18 | return (
19 |
20 | {children}
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/app/login/page.tsx:
--------------------------------------------------------------------------------
1 |
2 | 'use client';
3 |
4 | import React from 'react';
5 | import Auth from '../../src/components/Auth/Login';
6 | import { NextPage } from 'next';
7 |
8 | const LoginPage: NextPage = () => {
9 | return ;
10 | };
11 |
12 | export default LoginPage;
13 |
--------------------------------------------------------------------------------
/app/ngos/[slug]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | AspectRatio,
4 | Button,
5 | Card,
6 | Container,
7 | createStyles,
8 | Header,
9 | Paper,
10 | } from '@mantine/core';
11 | import Image from 'next/image';
12 | import { IconArrowLeft } from '@tabler/icons';
13 | import { useRouter } from 'next/navigation';
14 | import React from 'react';
15 |
16 | const useStyles = createStyles(() => ({
17 | header: {
18 | display: 'flex',
19 | justifyContent: 'space-between',
20 | alignItems: 'center',
21 | height: '100%',
22 | },
23 | blog: {
24 | textAlign: 'left',
25 | width: '50%',
26 | },
27 | back: {
28 | display: 'flex',
29 | alignItems: 'center',
30 | },
31 | image: {
32 | border: '1px solid #a3a3a2',
33 | borderRadius: '10px',
34 | margin: ' 20px 0',
35 | },
36 | }));
37 |
38 | interface SingleNgoType {
39 | name: string;
40 | slug: string;
41 | description: string;
42 | address: Date;
43 | image: string;
44 | }
45 |
46 | interface ParamsType {
47 | slug: string;
48 | }
49 | const getNgoData = async (slug: string) => {
50 | const res = await fetch(
51 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/ngo/slug/${slug}`,
52 | { next: { revalidate: 10 } },
53 | );
54 | const response = await res.json();
55 | return response.ngo;
56 | };
57 |
58 | const SingleNgo = async ({ params }: { params: ParamsType }) => {
59 | const { classes } = useStyles();
60 | const router = useRouter();
61 | const ngoData: SingleNgoType = await getNgoData(params.slug);
62 |
63 | return (
64 | <>
65 |
75 |
76 |
77 | {
81 | router.push('/');
82 | }}
83 | >
84 | {' '}
85 | Go Back
86 |
87 |
88 |
93 |
100 |
101 |
102 | {ngoData.description as string}
103 |
104 | >
105 | );
106 | };
107 |
108 | export default SingleNgo;
109 |
--------------------------------------------------------------------------------
/app/ngos/ngo.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
--------------------------------------------------------------------------------
/app/ngos/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { Button, Container, createStyles, SimpleGrid } from '@mantine/core';
3 | import { useRouter } from 'next/navigation';
4 | import HomeHeader from '../../src/components/HomeHeader/HomeHeader';
5 | import './ngo.css';
6 | import { NgoCard } from '../../src/components/Ngos/NgosCard';
7 | import React from 'react';
8 |
9 | const useStyles = createStyles((theme) => ({
10 | body: {
11 | background: 'white',
12 | },
13 | header: {
14 | display: 'flex',
15 | justifyContent: 'space-between',
16 | alignItems: 'center',
17 | height: '100%',
18 | },
19 | blog: {
20 | marginTop: '2rem',
21 | justifyItems: 'center',
22 | },
23 | back: {
24 | display: 'flex',
25 | alignItems: 'center',
26 | marginLeft: '4%',
27 | ...theme.fn.hover({
28 | transition: 'transform 150ms ease, box-shadow 150ms ease',
29 | transform: 'scale(1.01)',
30 | boxShadow: theme.shadows.md,
31 | }),
32 | },
33 | }));
34 |
35 | interface NgosType {
36 | id: number;
37 | name: string;
38 | content: string;
39 | author: string;
40 | image: string;
41 | }
42 |
43 | const getNgoData = async () => {
44 | const res = await fetch(
45 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/ngo`,
46 | { next: { revalidate: 10 } },
47 | );
48 | const response = await res.json();
49 | return response.ngo;
50 | };
51 | const NgosPage = async () => {
52 | const router = useRouter();
53 | const { classes } = useStyles();
54 |
55 | const allNgoData: NgosType[] = await getNgoData();
56 |
57 | return (
58 |
59 |
60 |
61 |
62 |
63 | {
69 | router.push('/');
70 | }}
71 | >
72 | Go Back
73 |
74 |
82 | {' '}
83 | {allNgoData.map((data: NgosType, index: number) => (
84 |
92 | ))}
93 |
94 |
95 |
96 | );
97 | };
98 |
99 | export default NgosPage;
100 |
101 |
--------------------------------------------------------------------------------
/app/orphanages/[slug]/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import {
3 | AspectRatio,
4 | Button,
5 | Card,
6 | Container,
7 | createStyles,
8 | Header,
9 | Paper,
10 | } from '@mantine/core';
11 | import Image from 'next/image';
12 | import { IconArrowLeft } from '@tabler/icons';
13 | import { useRouter } from 'next/navigation';
14 | import React from 'react';
15 |
16 | const useStyles = createStyles(() => ({
17 | header: {
18 | display: 'flex',
19 | justifyContent: 'space-between',
20 | alignItems: 'center',
21 | height: '100%',
22 | },
23 | blog: {
24 | textAlign: 'left',
25 | width: '50%',
26 | },
27 | back: {
28 | display: 'flex',
29 | alignItems: 'center',
30 | },
31 | image: {
32 | border: '1px solid #a3a3a2',
33 | borderRadius: '10px',
34 | margin: ' 20px 0',
35 | },
36 | }));
37 |
38 | interface SingleOrphanageType {
39 | name: string;
40 | slug: string;
41 | address: Date;
42 | description: string;
43 | image: string;
44 | }
45 |
46 | interface ParamsType {
47 | slug: string;
48 | }
49 |
50 | const getOrphanageData = async (slug: string) => {
51 | const res = await fetch(
52 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/orphanage/slug/${slug}`,
53 | { next: { revalidate: 10 } },
54 | );
55 | const response = await res.json();
56 | return response.orphanage;
57 | };
58 |
59 | const SingleOrphanage = async ({ params }: { params: ParamsType }) => {
60 | const { classes } = useStyles();
61 | const router = useRouter();
62 | const orphanageData: SingleOrphanageType = await getOrphanageData(
63 | params.slug,
64 | );
65 |
66 | return (
67 | <>
68 |
78 |
79 |
80 | {
84 | router.push('/');
85 | }}
86 | >
87 | {' '}
88 | Go Back
89 |
90 |
91 |
96 |
103 |
104 |
105 | {orphanageData.description as string}
106 |
107 | >
108 | );
109 | };
110 |
111 | export default SingleOrphanage;
--------------------------------------------------------------------------------
/app/orphanages/orphanage.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
--------------------------------------------------------------------------------
/app/orphanages/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { Button, Container, createStyles, SimpleGrid } from '@mantine/core';
3 | import { useRouter } from 'next/navigation';
4 | import HomeHeader from '../../src/components/HomeHeader/HomeHeader';
5 | import { data } from '../../src/components/Orphanages/orphanageContent';
6 | import './orphanage.css';
7 | import { OrphanageCard } from '../../src/components/Orphanages/OrphanagesCard';
8 | import React from 'react';
9 |
10 | const useStyles = createStyles((theme) => ({
11 | body: {
12 | background: 'white',
13 | },
14 | header: {
15 | display: 'flex',
16 | justifyContent: 'space-between',
17 | alignItems: 'center',
18 | height: '100%',
19 | },
20 | blog: {
21 | marginTop: '2rem',
22 | justifyItems: 'center',
23 | },
24 | back: {
25 | display: 'flex',
26 | alignItems: 'center',
27 | marginLeft: '4%',
28 | ...theme.fn.hover({
29 | transition: 'transform 150ms ease, box-shadow 150ms ease',
30 | transform: 'scale(1.01)',
31 | boxShadow: theme.shadows.md,
32 | }),
33 | },
34 | }));
35 |
36 | interface OrphanagesType {
37 | id: number;
38 | name: string;
39 | content: string;
40 | author: string;
41 | image: string;
42 | }
43 |
44 | const getOrphanageData = async () => {
45 | const res = await fetch(
46 | `${process.env.NEXT_PUBLIC_API_ENDPOINT as string}/api/orphanage`,
47 | { next: { revalidate: 10 } },
48 | );
49 | const response = await res.json();
50 | return response.orphanage;
51 | };
52 | const OrphanagesPage = async () => {
53 | const router = useRouter();
54 | const { classes } = useStyles();
55 |
56 | const allOrphanageData: OrphanagesType[] = await getOrphanageData();
57 |
58 | return (
59 |
60 |
61 |
62 |
63 |
64 | {
70 | router.push('/');
71 | }}
72 | >
73 | Go Back
74 |
75 |
83 | {' '}
84 | {allOrphanageData.map((item: OrphanagesType, index: number) => (
85 |
90 | ))}
91 |
92 |
93 |
94 | );
95 | };
96 |
97 | export default OrphanagesPage;
98 |
--------------------------------------------------------------------------------
/app/page.tsx:
--------------------------------------------------------------------------------
1 |
2 | "use client"
3 | import HeroSection from '../src/components/HeroSection/HeroSection';
4 | import { ContactUs } from '../src/components/ContactUs/ContactUs';
5 | import OurValues1 from '../src/components/HomeOurValues/OurValues1';
6 | import MainBlogs from '../src/components/MainBlogs/MainBlogs';
7 | import { Divider } from '@mantine/core';
8 | import HomeHeader from '../src/components/HomeHeader/HomeHeader';
9 | import useStyles from './styles';
10 | import MapBox from '../src/components/MapBox/MapBox';
11 | import ImageGallery from '../src/components/ImageGallery/ImageGallery';
12 | import Faq from '../src/components/Faq/Faq';
13 | import React from 'react';
14 |
15 | export default function Home() {
16 | const { classes } = useStyles();
17 | return (
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/app/provider/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import { AppShell } from '@mantine/core';
3 | // import { Route, Routes } from 'react-router';
4 | import MainHeader from '../../src/components/MainHeader/MainHeader';
5 | import HomeNavbar from '../../src/components/Navbar/Navbar';
6 | // import ProviderCollegeTeam from '../../src/components/ProviderCollegeTeam/ProviderCollegeTeam';
7 | // import ProviderMain from '../../src/components/ProviderMain/ProviderMain';
8 | import React from 'react';
9 | // import { NextPage } from 'next';
10 |
11 | const Provider = () => {
12 | return (
13 | }
16 | header={ }
17 | styles={(theme) => ({
18 | main: {
19 | backgroundColor:
20 | theme.colorScheme === 'dark'
21 | ? theme.colors.dark[8]
22 | : theme.colors.gray[0],
23 | },
24 | })}
25 | >
26 | {/*
27 | } />
28 | } />
29 | */}
30 |
31 | );
32 | };
33 |
34 | export default Provider;
35 |
--------------------------------------------------------------------------------
/app/register/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 | import React from 'react';
3 | import Register from '../../src/components/Auth/Register';
4 | import { NextPage } from 'next';
5 |
6 | const RegisterPage: NextPage = () => {
7 | return (
8 | <>
9 |
10 | >
11 | );
12 | };
13 | export default RegisterPage;
14 |
--------------------------------------------------------------------------------
/app/seeker/page.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { AppShell } from '@mantine/core';
4 | // import { Route, Routes } from 'react-router';
5 | import MainHeader from '../../src/components/MainHeader/MainHeader';
6 | import HomeNavbar from '../../src/components/SeekerNavbar/Navbar';
7 | // import ProviderCollegeTeam from '../../components/ProviderCollegeTeam/ProviderCollegeTeam';
8 | // import SeekerMain from '../../src/components/SeekerMain/SeekerMain';
9 | // import ProgramSection from '../../src/components/SeekerProgramSection/ProgramSection';
10 | import React from 'react';
11 | // import React from 'react';
12 | // import { NextPage } from 'next';
13 |
14 | const Seeker = () => {
15 |
16 | return (
17 | }
20 | header={ }
21 | styles={(theme) => ({
22 | main: {
23 | backgroundColor:
24 | theme.colorScheme === 'dark'
25 | ? theme.colors.dark[8]
26 | : theme.colors.gray[0],
27 | },
28 | })}
29 | >
30 | {/*
31 | } />
32 | } />
33 | } />
34 | } />
35 | } />
36 |
37 |
38 |
39 | */}
40 | {/* Your application here */}
41 |
42 | );
43 | };
44 |
45 | export default Seeker;
46 |
--------------------------------------------------------------------------------
/app/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/styles';
2 |
3 | const useStyles = createStyles((theme) => ({
4 | main: {
5 | position: 'relative',
6 | },
7 | }));
8 |
9 | export default useStyles;
10 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | app:
5 | build:
6 | context: .
7 | dockerfile: Dockerfile
8 | ports:
9 | - 5173:5173
10 | volumes:
11 | - .:/app
12 | networks:
13 | - main
14 | emulator:
15 | image: spine3/firebase-emulator
16 | environment:
17 | ENABLE_UI: true
18 | GCP_PROJECT: demo-sampark
19 | ports:
20 | - 5001:5001
21 | - 9000:9000
22 | - 8080:8080
23 | - 8085:8085
24 | - 5000:5000
25 | - 4000:4000
26 | networks:
27 | - main
28 |
29 | networks:
30 | main: {}
31 |
--------------------------------------------------------------------------------
/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "emulators": {
3 | "database": {
4 | "port": "5000",
5 | "host": "0.0.0.0"
6 | },
7 | "ui": {
8 | "port": "4000",
9 | "host": "0.0.0.0"
10 | },
11 | "firestore": {
12 | "port": "8080",
13 | "host": "0.0.0.0"
14 | },
15 | "auth": {
16 | "port": "9099",
17 | "host": "0.0.0.0"
18 | },
19 | "storage": {
20 | "port": "9000",
21 | "host": "0.0.0.0"
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
42 |
46 |
47 |
51 |
56 |
57 |
58 |
62 |
63 | Sampark
64 |
65 |
66 |
67 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: false,
4 | swcMinify: true,
5 | images: {
6 | domains: ['drive.google.com'],
7 | },
8 | };
9 |
10 | export default nextConfig;
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sampark",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "next dev",
8 | "build": "next build",
9 | "start": "next start",
10 | "lint": "next lint"
11 | },
12 | "dependencies": {
13 | "@emotion/react": "^11.10.6",
14 | "@googlemaps/react-wrapper": "^1.1.35",
15 | "@mantine/carousel": "^5.10.5",
16 | "@mantine/core": "^5.10.5",
17 | "@mantine/dates": "^5.10.5",
18 | "@mantine/dropzone": "^5.10.5",
19 | "@mantine/form": "^5.10.5",
20 | "@mantine/hooks": "^5.10.5",
21 | "@mantine/modals": "^5.10.5",
22 | "@mantine/notifications": "^5.10.5",
23 | "@mantine/nprogress": "^5.10.5",
24 | "@mantine/prism": "^5.10.5",
25 | "@mantine/spotlight": "^5.10.5",
26 | "@mantine/tiptap": "^5.10.5",
27 | "@tabler/icons": "^1.119.0",
28 | "@tabler/icons-react": "^2.22.0",
29 | "@tiptap/extension-link": "^2.0.0-beta.218",
30 | "@tiptap/react": "^2.0.0-beta.218",
31 | "@tiptap/starter-kit": "^2.0.0-beta.218",
32 | "dayjs": "^1.11.7",
33 | "dotenv": "^16.0.3",
34 | "dotenv-webpack": "^8.0.1",
35 | "embla-carousel-react": "^7.0.9",
36 | "firebase": "^9.17.2",
37 | "google-map-react": "^2.2.0",
38 | "mapbox-gl": "^2.13.0",
39 | "next": "13.4.10",
40 | "react": "^18.2.0",
41 | "react-dom": "^18.2.0",
42 | "react-icons": "^4.9.0",
43 | "react-loader-spinner": "^5.3.4",
44 | "react-map-gl": "^7.0.21",
45 | "react-router-dom": "^6.8.2",
46 | "react-toastify": "^9.1.3",
47 | "tabler-icons-react": "^1.56.0"
48 | },
49 | "devDependencies": {
50 | "@types/google.maps": "^3.52.0",
51 | "@types/node": "^18.14.2",
52 | "@types/react": "^18.0.27",
53 | "@types/react-dom": "^18.0.10",
54 | "@typescript-eslint/eslint-plugin": "^5.53.0",
55 | "@typescript-eslint/parser": "^5.53.0",
56 | "@vitejs/plugin-react": "^3.1.0",
57 | "eslint": "^8.35.0",
58 | "eslint-plugin-react": "^7.32.2",
59 | "husky": "^8.0.3",
60 | "lint-staged": "^13.1.2",
61 | "prettier": "^2.8.4",
62 | "typescript": "^4.9.3",
63 | "vite": "^4.1.0"
64 | },
65 | "husky": {
66 | "hooks": {
67 | "pre-commit": "lint-staged"
68 | }
69 | },
70 | "lint-staged": {
71 | "**/*.{js,jsx,json}": [
72 | "eslint . --fix",
73 | "prettier --write ."
74 | ]
75 | },
76 | "description": "",
77 | "main": "webpack.config.js",
78 | "repository": {
79 | "type": "git",
80 | "url": "git+https://github.com/Gaurav-Verma07/sampark.git"
81 | },
82 | "keywords": [],
83 | "author": "",
84 | "license": "ISC",
85 | "bugs": {
86 | "url": "https://github.com/Gaurav-Verma07/sampark/issues"
87 | },
88 | "homepage": "https://github.com/Gaurav-Verma07/sampark#readme"
89 | }
90 |
--------------------------------------------------------------------------------
/public/assets/Images/NGO testimonial.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/assets/Images/NGO testimonial.jpeg
--------------------------------------------------------------------------------
/public/assets/Images/homeImg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/assets/Images/homeImg.jpg
--------------------------------------------------------------------------------
/public/assets/Images/impact1_riya.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/assets/Images/impact1_riya.jpeg
--------------------------------------------------------------------------------
/public/assets/Images/impact3_rahul.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/assets/Images/impact3_rahul.jpeg
--------------------------------------------------------------------------------
/public/assets/Images/samparklogotransparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/assets/Images/samparklogotransparent.png
--------------------------------------------------------------------------------
/public/assets/googleLogo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/sampark-logo-transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/public/sampark-logo-transparent.png
--------------------------------------------------------------------------------
/public/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | https://sampark-nine.vercel.app/
10 | 2023-06-22T18:39:52+00:00
11 |
12 |
13 | https://sampark-nine.vercel.app/#gallery
14 | 2023-06-22T18:39:52+00:00
15 |
16 |
17 | https://sampark-nine.vercel.app/#blogs
18 | 2023-06-22T18:39:52+00:00
19 |
20 |
21 | https://sampark-nine.vercel.app/#values
22 | 2023-06-22T18:39:52+00:00
23 |
24 |
25 | https://sampark-nine.vercel.app/#faq
26 | 2023-06-22T18:39:52+00:00
27 |
28 |
29 | https://sampark-nine.vercel.app/#contact
30 | 2023-06-22T18:39:52+00:00
31 |
32 |
33 | https://sampark-nine.vercel.app/login
34 | 2023-06-22T18:39:52+00:00
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
3 | yarn.lock
--------------------------------------------------------------------------------
/server/index.ts:
--------------------------------------------------------------------------------
1 | // import * as express from 'express';
2 | import { Express, Request, Response } from 'express';
3 | import express from 'express';
4 | import cors from 'cors';
5 | import cookieParser from 'cookie-parser';
6 | import * as dotenv from 'dotenv';
7 | // import * as cors from 'cors';
8 | // import * as cookieParser from 'cookie-parser';
9 | import { connectToMongo } from './schema/mongo.connect';
10 | import { orphanageRouter } from './src/orphnages/orphanage.router';
11 | import { ngoRouter } from './src/ngos/ngo.router';
12 | import { eventRouter } from './src/events/event.router';
13 | import { blogRouter } from './src/blogs/blog.router';
14 | import { userRouter } from './src/users/user.router';
15 | import { impactRouter } from './src/impact/impact.router';
16 |
17 | dotenv.config({ path: '.env' });
18 | const app: Express = express();
19 | const port = process.env.PORT;
20 | const allowedOrigins = [process.env.UI_ENDPOINT as string];
21 | // const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(',') || [];
22 |
23 | const options = {
24 | origin: allowedOrigins,
25 | credentials: true,
26 | };
27 |
28 | app.use(cors(options));
29 | app.use(express.json());
30 | app.use(cookieParser(process.env.COOKIE_SECRET as string));
31 |
32 | app.get('/', (req: Request, res: Response) => {
33 | throw new Error('');
34 | });
35 |
36 | app.use('/api/orphanage', orphanageRouter);
37 | app.use('/api/impact', impactRouter);
38 | app.use('/api/ngo', ngoRouter);
39 | app.use('/api/event', eventRouter);
40 | app.use('/api/blog', blogRouter);
41 | app.use('/api/user', userRouter);
42 |
43 | async function startServer() {
44 | try {
45 | await connectToMongo();
46 | app.listen(port, () => console.log(`Server is running on port ${port}`));
47 | } catch (error) {
48 | console.error('Error starting the server:', error);
49 | process.exit(1); // Terminate the process on server startup failure
50 | }
51 | }
52 |
53 | startServer();
54 |
--------------------------------------------------------------------------------
/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "opensource",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "type": "commonjs",
7 | "scripts": {
8 | "build": "yarn tsc",
9 | "start": "node dist/index.js",
10 | "dev": "concurrently \"yarn tsc --watch\" \"nodemon -q dist/index.js\""
11 | },
12 | "author": "",
13 | "license": "ISC",
14 | "dependencies": {
15 | "@types/cookie-parser": "^1.4.3",
16 | "bcryptjs": "^2.4.3",
17 | "body-parser": "^1.20.2",
18 | "cookie-parser": "^1.4.6",
19 | "cors": "^2.8.5",
20 | "dotenv": "^16.3.1",
21 | "eslint": "^8.43.0",
22 | "express": "^4.18.2",
23 | "express-validator": "^7.0.1",
24 | "http": "^0.0.1-security",
25 | "jsonwebtoken": "^9.0.0",
26 | "mongodb": "^5.6.0",
27 | "mongoose": "^7.3.1"
28 | },
29 | "devDependencies": {
30 | "@types/bcryptjs": "^2.4.2",
31 | "@types/cors": "^2.8.12",
32 | "@types/express": "^4.17.14",
33 | "@types/jsonwebtoken": "^8.5.9",
34 | "@types/node": "^18.11.18",
35 | "concurrently": "^7.4.0",
36 | "ts-node": "^10.9.1",
37 | "typescript": "^4.9.4"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/server/schema/blogs/BlogsSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const BlogSchema = new Schema(
4 | {
5 | title: {
6 | type: String,
7 | required: true,
8 | },
9 | author: {
10 | type: String,
11 | required: true,
12 | },
13 | content: {
14 | type: String,
15 | required: true,
16 | },
17 | tags: {
18 | type: [{id: String, name: String}],
19 | required: true,
20 | },
21 | publishedDate: {
22 | type: Date,
23 | required: true,
24 | },
25 | featuredImage: {
26 | type: String,
27 | required: true,
28 | },
29 | comments: {
30 | type: [
31 | {
32 | name: String,
33 | email: String,
34 | comment: String,
35 | date: { type: Date, default: Date.now },
36 | },
37 | ],
38 | required: false,
39 | },
40 | likes: {
41 | type: Number,
42 | default: 0,
43 | },
44 | },
45 | {
46 | timestamps: true,
47 | },
48 | );
49 |
50 | export const BlogModel = model('blogs', BlogSchema);
--------------------------------------------------------------------------------
/server/schema/events/EventsSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const EventSchema = new Schema(
4 | {
5 | eventName: {
6 | type: String,
7 | required: true,
8 | },
9 | eventType: {
10 | type: String,
11 | required: true,
12 | },
13 | eventDate: {
14 | type: Date,
15 | required: true,
16 | },
17 | eventLocation: {
18 | type: String,
19 | required: true,
20 | },
21 | description: {
22 | type: String,
23 | required: true,
24 | },
25 | organizingOrganization: {
26 | type: String,
27 | required: true,
28 | },
29 | targetAudience: {
30 | type: String,
31 | required: true,
32 | },
33 | activities: {
34 | type: [{ name: String, description: String }],
35 | required: true,
36 | },
37 | volunteering: {
38 | type: { isVolunteer: Boolean, contact: String },
39 | required: false,
40 | },
41 | donations: {
42 | type: { isDonations: Boolean, contact: String },
43 | required: false,
44 | },
45 | logo: {
46 | type: String,
47 | required: true,
48 | },
49 | contactInformation: {
50 | type: { phone: String,
51 | website: String,
52 | email: String },
53 | required: true,
54 | },
55 | socialMediaLinks: {
56 | type: { twitter: String, linkedIn: String },
57 | required: false,
58 | },
59 | registrationLink: {
60 | type: { isRegistration: Boolean, link: String },
61 | required: true,
62 | },
63 | },
64 | {
65 | timestamps: true,
66 | },
67 | );
68 |
69 | export const EventModel = model('events', EventSchema);
70 |
--------------------------------------------------------------------------------
/server/schema/impacts/ImpactSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const ImpactSchema = new Schema(
4 | {
5 | domain: {
6 | type: String,
7 | require: true,
8 | },
9 | title: {
10 | type: String,
11 | require: true,
12 | },
13 | name: {
14 | type: String,
15 | require: true,
16 | },
17 | slug: {
18 | type: String,
19 | require: true,
20 | },
21 | address: {
22 | type: String,
23 | required: true,
24 | },
25 | testimonial: {
26 | type: String,
27 | require: true,
28 | },
29 | image: {
30 | type: String,
31 | require: true,
32 | },
33 | },
34 | {
35 | timestamps: true,
36 | },
37 | );
38 |
39 | export const ImpactModel = model('impacts', ImpactSchema);
40 |
--------------------------------------------------------------------------------
/server/schema/mongo.connect.ts:
--------------------------------------------------------------------------------
1 | import mongoose, { connect } from 'mongoose';
2 |
3 | //surprass deprication warning
4 | mongoose.set('strictQuery', false);
5 |
6 | export const connectToMongo = async () => {
7 | const connectionString =
8 | (process.env.MONGODB_PROTO as string) +
9 | process.env.MONGODB_USER +
10 | ':' +
11 | process.env.MONGODB_PASSWORD +
12 | '@' +
13 | process.env.MONGODB_URL +
14 | '/' +
15 | process.env.MONGODB_DATABASE;
16 | try {
17 | console.log('connection');
18 | await connect(connectionString);
19 | } catch (error) {
20 | throw new Error(String(error));
21 | }
22 | };
23 |
--------------------------------------------------------------------------------
/server/schema/ngos/NgosSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const NgoSchema = new Schema(
4 | {
5 | name: {
6 | type: String,
7 | required: true,
8 | },
9 | location: {
10 | type: String,
11 | required: true,
12 | },
13 | contactInformation: {
14 | type: { phone: String, website: String, email: String },
15 | required: true,
16 | },
17 | vision: {
18 | type: String,
19 | required: true,
20 | },
21 | focusAreas: {
22 | type: [String],
23 | required: true,
24 | },
25 | projects: {
26 | type: [{ name: String, description: String }],
27 | required: true,
28 | },
29 | teamMembers: {
30 | type: [{ name: String, designation: String }],
31 | required: true,
32 | },
33 | donations: {
34 | type: { isDonations: Boolean, contact: String },
35 | required: false,
36 | },
37 | volunteering: {
38 | type: { isVolunteer: Boolean, contact: String },
39 | required: false,
40 | },
41 | logo: {
42 | type: String,
43 | required: true,
44 | },
45 | testimonials: {
46 | type: [{ name: String, testimony: String }],
47 | required: false,
48 | },
49 | socialMediaLinks: {
50 | type: { twitter: String, linkedIn: String },
51 | required: false,
52 | },
53 | license: {
54 | type: String,
55 | },
56 | funding: {
57 | type: String,
58 | },
59 | },
60 | {
61 | timestamps: true,
62 | },
63 | );
64 |
65 | export const NgoModel = model('ngos', NgoSchema);
66 |
--------------------------------------------------------------------------------
/server/schema/orphanage/OrphanagesSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const OrphanageSchema = new Schema(
4 | {
5 | name: {
6 | type: String,
7 | required: true,
8 | },
9 | location: {
10 | type: String,
11 | required: true,
12 | },
13 | contactInformation: {
14 | type: String,
15 | required: true,
16 | },
17 | vision: {
18 | type: String,
19 | required: true,
20 | },
21 | description: {
22 | type: String,
23 | required: true,
24 | },
25 | capacity: {
26 | type: Number,
27 | required: true,
28 | },
29 | servicesProvided: {
30 | type: [String],
31 | required: true,
32 | },
33 | startAge: {
34 | type: Number,
35 | required: true,
36 | },
37 | endAge: {
38 | type: Number,
39 | required: true,
40 | },
41 | logo: {
42 | type: String,
43 | required: true,
44 | },
45 | operatingHours: {
46 | type: Number,
47 | required: true,
48 | },
49 | license: {
50 | type: String,
51 | required: true,
52 | },
53 | staffInformation: {
54 | type: [{ name: String, qualification: String }],
55 | required: true,
56 | },
57 | donationInformation: {
58 | type: { isDonations: Boolean, contact: String },
59 | required: true,
60 | },
61 | testimonials: {
62 | type: [{ name: String, testimony: String }],
63 | required: false,
64 | },
65 | },
66 | {
67 | timestamps: true,
68 | },
69 | );
70 |
71 | export const OrphanageModel = model('orphanages', OrphanageSchema);
72 |
--------------------------------------------------------------------------------
/server/schema/user/UserSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema, model } from 'mongoose';
2 |
3 | const UserSchema = new Schema(
4 | {
5 | name: {
6 | type: String,
7 | require: true,
8 | },
9 | email: {
10 | type: String,
11 | require: true,
12 | },
13 | password: {
14 | type: String,
15 | require: true,
16 | },
17 | image: {
18 | type: Buffer,
19 | require: false,
20 | },
21 | bio: {
22 | type: String,
23 | require: false,
24 | },
25 | currentCity: {
26 | type: String,
27 | required: true,
28 | },
29 | address: {
30 | type: String,
31 | required: true,
32 | },
33 | whatsappNumber: {
34 | type: String,
35 | required: true,
36 | },
37 | collegeName: {
38 | type: String,
39 | required: true,
40 | },
41 | inspiration: {
42 | type: String,
43 | required: false,
44 | },
45 | },
46 | {
47 | timestamps: true,
48 | },
49 | );
50 |
51 | export const UserModel = model('user', UserSchema);
52 |
--------------------------------------------------------------------------------
/server/src/blogs/blog.interface.ts:
--------------------------------------------------------------------------------
1 | export interface BlogType {
2 | name: string;
3 | slug: string;
4 | image: string;
5 | title: string;
6 | author: string;
7 | content: string;
8 | tags: [{ name: string; id: string }];
9 | publishedDate: Date;
10 | featuredImage: string;
11 | }
12 |
--------------------------------------------------------------------------------
/server/src/blogs/blog.service.ts:
--------------------------------------------------------------------------------
1 | import { BlogModel } from '../../schema/blogs/BlogsSchema';
2 | import { BlogType } from './blog.interface';
3 |
4 | const getFirstBlog = async () => {
5 | try {
6 | const blogData = await BlogModel.findOne();
7 | return blogData;
8 | } catch (error) {
9 | throw new Error(error as string);
10 | }
11 | };
12 |
13 | const getAllBlogs = async () => {
14 | try {
15 | const blogData = await BlogModel.find({});
16 |
17 | return blogData;
18 | } catch (error) {
19 | throw new Error(error as string);
20 | }
21 | };
22 |
23 | const getBlogById = async (_id: string) => {
24 | try {
25 | const blogData = await BlogModel.findOne({ _id });
26 |
27 | return blogData;
28 | } catch (error) {
29 | throw new Error(error as string);
30 | }
31 | };
32 |
33 | const getBlogBySlug = async (slug: string) => {
34 | try {
35 | const blogData = await BlogModel.findOne({ slug });
36 |
37 | return blogData;
38 | } catch (error) {
39 | throw new Error(error as string);
40 | }
41 | };
42 |
43 | const getBlogByAuthor = async (author: string) => {
44 | try {
45 | const blogData = await BlogModel.findOne({ author });
46 |
47 | return blogData;
48 | } catch (error) {
49 | throw new Error(error as string);
50 | }
51 | };
52 |
53 | const createBlog = async (blogInfo: BlogType) => {
54 | try {
55 | const blogData = new BlogModel(blogInfo);
56 | await blogData?.save();
57 |
58 | return blogData;
59 | } catch (error) {
60 | throw new Error(error as string);
61 | }
62 | };
63 |
64 | const updateBlog = async (_id: string, blogInfo: BlogType) => {
65 | try {
66 | const blogData = await BlogModel.findOneAndUpdate(
67 | { _id },
68 | { setValue: blogInfo },
69 | { returnNewDocument: true },
70 | );
71 |
72 | return blogData;
73 | } catch (error) {
74 | throw new Error(error as string);
75 | }
76 | };
77 |
78 | const deleteBlog = async (_id: string) => {
79 | try {
80 | // const blogData = await BlogModel.deleteOne({ _id: _id });
81 | // return blogData;
82 | return true;
83 | } catch (error) {
84 | throw new Error(error as string);
85 | }
86 | };
87 | export const BlogService = {
88 | getFirstBlog,
89 | getAllBlogs,
90 | getBlogById,
91 | getBlogBySlug,
92 | getBlogByAuthor,
93 | createBlog,
94 | updateBlog,
95 | deleteBlog,
96 | };
97 |
--------------------------------------------------------------------------------
/server/src/events/event.interface.ts:
--------------------------------------------------------------------------------
1 | export interface EventType {
2 | eventName: string;
3 | eventType: [string];
4 | eventDate: Date;
5 | eventLocation: string;
6 | description: string;
7 | organizingOrganization: string;
8 | targetAudience: string;
9 | activities: { name: string; description: string }[];
10 | volunteering?: { isVolunteer: boolean; contact: string };
11 | donations?: { isDonations: boolean; contact: string };
12 | logo: string;
13 | contactInformation: {
14 | phone: string;
15 | website: string;
16 | email: string;
17 | };
18 | socialMediaLinks?: {
19 | twitter: string;
20 | linkedIn: string;
21 | };
22 | registrationLink: {
23 | isRegistration: boolean;
24 | link: string;
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/server/src/events/event.service.ts:
--------------------------------------------------------------------------------
1 | import { EventModel } from '../../schema/events/EventsSchema';
2 | import { EventType } from './event.interface';
3 |
4 | const getFirstEvent = async () => {
5 | try {
6 | const eventData = await EventModel.findOne();
7 | return eventData;
8 | } catch (error) {
9 | throw new Error(error as string);
10 | }
11 | };
12 |
13 | const getAllEvents = async () => {
14 | try {
15 | const eventData = await EventModel.find({});
16 | return eventData;
17 | } catch (error) {
18 | throw new Error(error as string);
19 | }
20 | };
21 |
22 | const getEventById = async (_id: string) => {
23 | try {
24 | const eventData = await EventModel.findOne({ _id });
25 | return eventData;
26 | } catch (error) {
27 | throw new Error(error as string);
28 | }
29 | };
30 |
31 | const getEventBySlug = async (slug: string) => {
32 | try {
33 | const eventData = await EventModel.findOne({ slug });
34 | return eventData;
35 | } catch (error) {
36 | throw new Error(error as string);
37 | }
38 | };
39 |
40 | const getEventByLocation = async (location: string) => {
41 | try {
42 | const eventData = await EventModel.findOne({ location });
43 | return eventData;
44 | } catch (error) {
45 | throw new Error(error as string);
46 | }
47 | };
48 |
49 | const createEvent = async (eventInfo: EventType) => {
50 | try {
51 | const eventData = new EventModel(eventInfo);
52 | await eventData?.save();
53 | return eventData;
54 | } catch (error) {
55 | throw new Error(error as string);
56 | }
57 | };
58 |
59 | const updateEvent = async (_id: string, eventInfo: EventType) => {
60 | try {
61 | const eventData = await EventModel.findOneAndUpdate(
62 | { _id },
63 | { setValue: eventInfo },
64 | { returnNewDocument: true },
65 | );
66 |
67 | return eventData;
68 | } catch (error) {
69 | throw new Error(error as string);
70 | }
71 | };
72 |
73 | const deleteEvent = async (_id: string) => {
74 | try {
75 | const eventData = await EventModel.deleteOne({ _id });
76 | return eventData;
77 | } catch (error) {
78 | throw new Error(error as string);
79 | }
80 | };
81 | export const EventService = {
82 | getFirstEvent,
83 | getAllEvents,
84 | getEventById,
85 | getEventBySlug,
86 | getEventByLocation,
87 | createEvent,
88 | updateEvent,
89 | deleteEvent,
90 | };
91 |
--------------------------------------------------------------------------------
/server/src/impact/impact.interface.ts:
--------------------------------------------------------------------------------
1 | export interface ImpactType {
2 | domain: string;
3 | title: string;
4 | name: string;
5 | slug: string;
6 | testimonial: string;
7 | image: string;
8 | }
9 |
--------------------------------------------------------------------------------
/server/src/impact/impact.service.ts:
--------------------------------------------------------------------------------
1 |
2 | import { ImpactModel } from '../../schema/impacts/ImpactSchema';
3 | import { ImpactType } from './impact.interface';
4 |
5 | const getFirstImpact = async () => {
6 | try {
7 | const impactData = await ImpactModel.findOne();
8 | return impactData;
9 | } catch (error) {
10 | throw new Error(error as string);
11 | }
12 | };
13 |
14 | const getAllImpacts = async () => {
15 | try {
16 | const impactData = await ImpactModel.find({});
17 | return impactData;
18 | } catch (error) {
19 | throw new Error(error as string);
20 | }
21 | };
22 |
23 | const getImpactById = async (_id: string) => {
24 | try {
25 | const impactData = await ImpactModel.findOne({ _id });
26 | return impactData;
27 | } catch (error) {
28 | throw new Error(error as string);
29 | }
30 | };
31 |
32 | const getImpactBySlug = async (slug: string) => {
33 | try {
34 | const impactData = await ImpactModel.findOne({ slug });
35 | return impactData;
36 | } catch (error) {
37 | throw new Error(error as string);
38 | }
39 | };
40 |
41 | const getImpactByLocation = async (location: string) => {
42 | try {
43 | const impactData = await ImpactModel.findOne({ location });
44 | return impactData;
45 | } catch (error) {
46 | throw new Error(error as string);
47 | }
48 | };
49 |
50 | const createImpact = async (impactInfo: ImpactType) => {
51 | try {
52 | const impactData = new ImpactModel(impactInfo);
53 | await impactData?.save();
54 | return impactData;
55 | } catch (error) {
56 | throw new Error(error as string);
57 | }
58 | };
59 |
60 | const updateImpact = async (_id: string, impactInfo: ImpactType) => {
61 | try {
62 | const impactData = await ImpactModel.findOneAndUpdate(
63 | { _id },
64 | { setValue: impactInfo },
65 | { returnNewDocument: true },
66 | );
67 |
68 | return impactData;
69 | } catch (error) {
70 | throw new Error(error as string);
71 | }
72 | };
73 |
74 | const deleteImpact = async (_id: string) => {
75 | try {
76 | const impactData = await ImpactModel.deleteOne({ _id });
77 | return impactData;
78 | } catch (error) {
79 | throw new Error(error as string);
80 | }
81 | };
82 | export const ImpactService = {
83 | getFirstImpact,
84 | getAllImpacts,
85 | getImpactById,
86 | getImpactBySlug,
87 | getImpactByLocation,
88 | createImpact,
89 | updateImpact,
90 | deleteImpact,
91 | };
92 |
--------------------------------------------------------------------------------
/server/src/middleware/auth.middleware.ts:
--------------------------------------------------------------------------------
1 | import * as jwt from 'jsonwebtoken';
2 | import { Request, Response, NextFunction } from 'express';
3 |
4 | export const checkAuth = (req: Request, res: Response, next: NextFunction) => {
5 | const authorization = req.headers['authorization'];
6 | const token = authorization && authorization.split(' ')[1];
7 |
8 | if (token == null)
9 | return res.status(401).json({ success: false, message: 'Invalid token.' });
10 |
11 | jwt.verify(
12 | token,
13 | process.env.TOKEN_SECRET as string,
14 | (err: jwt.VerifyErrors | null, user: any) => {
15 | console.log(err);
16 |
17 | if (err)
18 | return res
19 | .status(403)
20 | .json({ success: false, message: 'Access denied.' });
21 |
22 | console.log(user);
23 |
24 | next();
25 | },
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/server/src/ngos/ngo.interface.ts:
--------------------------------------------------------------------------------
1 | export interface NgoType {
2 | name: string;
3 | location: string;
4 | contactInformation: {
5 | phone: string;
6 | website: string;
7 | email: string;
8 | };
9 | vision: string;
10 | focusAreas: string[];
11 | projects: { name: string; description: string }[];
12 | teamMembers: { name: string; designation: string }[];
13 | donations: { isDonations: boolean; contact: string };
14 | volunteering: { isVolunteer: boolean; contact: string };
15 | logo: string;
16 | testimonials: { name: string; testimony: string }[];
17 | socialMediaLinks: { twitter: string; linkedIn: string };
18 | license: string;
19 | funding: string;
20 | }
21 |
--------------------------------------------------------------------------------
/server/src/ngos/ngo.service.ts:
--------------------------------------------------------------------------------
1 | import { NgoModel } from '../../schema/ngos/NgosSchema';
2 | import { NgoType } from './ngo.interface';
3 |
4 | const getFirstNgo = async () => {
5 | try {
6 | const ngoData = await NgoModel.findOne();
7 | return ngoData;
8 | } catch (error) {
9 | throw new Error(error as string);
10 | }
11 | };
12 |
13 | const getAllNgos = async () => {
14 | try {
15 | const ngoData = await NgoModel.find({});
16 |
17 | return ngoData;
18 | } catch (error) {
19 | throw new Error(error as string);
20 | }
21 | };
22 |
23 | const getNgoById = async (_id: string) => {
24 | try {
25 | const ngoData = await NgoModel.findOne({ _id });
26 |
27 | return ngoData;
28 | } catch (error) {
29 | throw new Error(error as string);
30 | }
31 | };
32 |
33 | const getNgoBySlug = async (slug: string) => {
34 | try {
35 | const ngoData = await NgoModel.findOne({ slug });
36 |
37 | return ngoData;
38 | } catch (error) {
39 | throw new Error(error as string);
40 | }
41 | };
42 |
43 | const getNgoByLocation = async (location: string) => {
44 | try {
45 | const ngoData = await NgoModel.findOne({ location });
46 |
47 | return ngoData;
48 | } catch (error) {
49 | throw new Error(error as string);
50 | }
51 | };
52 |
53 | const createNgo = async (eventInfo: NgoType) => {
54 | try {
55 | const ngoData = new NgoModel(eventInfo);
56 | await ngoData?.save();
57 |
58 | return ngoData;
59 | } catch (error) {
60 | throw new Error(error as string);
61 | }
62 | };
63 |
64 | const updateNgo = async (_id: string, eventInfo: NgoType) => {
65 | try {
66 | const ngoData = await NgoModel.findOneAndUpdate(
67 | { _id },
68 | { setValue: eventInfo },
69 | { returnNewDocument: true },
70 | );
71 |
72 | return ngoData;
73 | } catch (error) {
74 | throw new Error(error as string);
75 | }
76 | };
77 |
78 | const deleteNgo = async (_id: string) => {
79 | try {
80 | // const ngoData = await NgoModel.deleteOne({ _id });
81 | // return ngoData;
82 | return true;
83 | } catch (error) {
84 | throw new Error(error as string);
85 | }
86 | };
87 |
88 | export const NgoService = {
89 | getFirstNgo,
90 | getAllNgos,
91 | getNgoById,
92 | getNgoBySlug,
93 | getNgoByLocation,
94 | createNgo,
95 | updateNgo,
96 | deleteNgo,
97 | };
98 |
--------------------------------------------------------------------------------
/server/src/orphnages/orphanage.interface.ts:
--------------------------------------------------------------------------------
1 | export interface OrphanageType {
2 | name: string;
3 | location: string;
4 | contactInformation: string;
5 | vision: string;
6 | description: string;
7 | capacity: number;
8 | servicesProvided: string[];
9 | startAge: number;
10 | endAge: number;
11 | logo: string;
12 | operatingHours: number;
13 | license: string;
14 | staffInformation: { name: string; qualification: string }[];
15 | donationInformation: { isDonations: boolean; contact: string };
16 | testimonials?: { name: string; testimony: string }[];
17 | }
18 |
--------------------------------------------------------------------------------
/server/src/orphnages/orphanage.service.ts:
--------------------------------------------------------------------------------
1 | import { OrphanageModel } from '../../schema/orphanage/OrphanagesSchema';
2 | import { OrphanageType } from './orphanage.interface';
3 |
4 | const getFirstOrphanage = async () => {
5 | try {
6 | const orphanage = await OrphanageModel.findOne();
7 | return orphanage;
8 | } catch (error) {
9 | throw new Error(error as string);
10 | }
11 | };
12 |
13 | const getAllOrphanages = async () => {
14 | try {
15 | const orphanage = await OrphanageModel.find({});
16 |
17 | return orphanage;
18 | } catch (error) {
19 | throw new Error(error as string);
20 | }
21 | };
22 |
23 | const getOrphanageById = async (_id: string) => {
24 | try {
25 | const orphanage = await OrphanageModel.findOne({ _id });
26 |
27 | return orphanage;
28 | } catch (error) {
29 | throw new Error(error as string);
30 | }
31 | };
32 |
33 | const getOrphanageBySlug = async (slug: string) => {
34 | try {
35 | const orphanage = await OrphanageModel.findOne({ slug });
36 |
37 | return orphanage;
38 | } catch (error) {
39 | throw new Error(error as string);
40 | }
41 | };
42 |
43 | const getOrphanageByLocation = async (location: string) => {
44 | try {
45 | const orphanage = await OrphanageModel.findOne({ location });
46 |
47 | return orphanage;
48 | } catch (error) {
49 | throw new Error(error as string);
50 | }
51 | };
52 |
53 | const createOrphanage = async (eventInfo: OrphanageType) => {
54 | try {
55 | const orphanage = new OrphanageModel(eventInfo);
56 | await orphanage?.save();
57 |
58 | return orphanage;
59 | } catch (error) {
60 | throw new Error(error as string);
61 | }
62 | };
63 |
64 | const updateOrphanage = async (_id: string, eventInfo: OrphanageType) => {
65 | try {
66 | const orphanage = await OrphanageModel.findOneAndUpdate(
67 | { _id },
68 | { setValue: eventInfo },
69 | { returnNewDocument: true },
70 | );
71 |
72 | return orphanage;
73 | } catch (error) {
74 | throw new Error(error as string);
75 | }
76 | };
77 |
78 | const deleteOrphanage = async (_id: string) => {
79 | try {
80 | const orphanage = await OrphanageModel.deleteOne({ _id });
81 | return orphanage;
82 | //return true
83 | } catch (error) {
84 | throw new Error(error as string);
85 | }
86 | };
87 |
88 | export const OrphanageService = {
89 | getFirstOrphanage,
90 | getAllOrphanages,
91 | getOrphanageById,
92 | getOrphanageBySlug,
93 | getOrphanageByLocation,
94 | createOrphanage,
95 | updateOrphanage,
96 | deleteOrphanage,
97 | };
98 |
--------------------------------------------------------------------------------
/server/src/users/user.interface.ts:
--------------------------------------------------------------------------------
1 | export interface UserType {
2 | name: string;
3 | email: string;
4 | password: string;
5 | bio: string;
6 | address: string;
7 | image: string;
8 | currentCity: string;
9 | whatsappNumber: string;
10 | collegeName: string;
11 | inspiration: string;
12 | }
13 |
--------------------------------------------------------------------------------
/server/src/users/user.service.ts:
--------------------------------------------------------------------------------
1 | import { UserModel } from '../../schema/user/UserSchema.js';
2 | import { UserType } from './user.interface';
3 | import * as bcrypt from 'bcryptjs';
4 |
5 | const register = async (userInfo: UserType) => {
6 | try {
7 | const user = await UserModel.findOne({ email: { $eq: userInfo.email } });
8 | if (user) {
9 | return { status: 409, message: 'User already exists' };
10 | }
11 | const hashedPassword = await bcrypt.hash(userInfo.password, 10);
12 | userInfo.password = hashedPassword;
13 | const newUser = new UserModel(userInfo);
14 | await newUser.save();
15 | return {
16 | status: 200,
17 | id: newUser._id,
18 | messsage: 'registration successful',
19 | };
20 | } catch (error) {
21 | throw new Error(error as string);
22 | }
23 | };
24 |
25 | const login = async (userInfo: UserType) => {
26 | try {
27 | const user = await UserModel.findOne({ email: { $eq: userInfo.email } });
28 | console.log(user);
29 | if (!user) {
30 | return { status: 404, message: 'User not found' };
31 | }
32 | // if (!user.password) {
33 | // return { status: 500, message: 'Internal server error' };
34 | // }
35 | if (user.password) {
36 | const validPassword = await bcrypt.compare(
37 | userInfo.password,
38 | user.password,
39 | );
40 | if (!validPassword) {
41 | return { status: 401, message: 'Invalid Credentials' };
42 | }
43 |
44 | return { status: 200, id: user._id, message: 'login successful' };
45 | } else {
46 | return { status: 500, message: 'Internal server error' };
47 | }
48 | } catch (error) {
49 | throw new Error(error as string);
50 | }
51 | };
52 |
53 | const updateUser = async (_id: string, userInfo: UserType) => {
54 | try {
55 | const user = await UserModel.findOneAndUpdate(
56 | { _id: _id },
57 | { $set: userInfo },
58 | { returnOriginal: false },
59 | );
60 | return user;
61 | } catch (error) {
62 | throw new Error(error as string);
63 | }
64 | };
65 |
66 | const getUser = async (_id: string) => {
67 | try {
68 | const user = await UserModel.findOne({ _id });
69 | return user;
70 | } catch (error) {
71 | throw new Error(error as string);
72 | }
73 | };
74 |
75 | export const UserService = {
76 | register,
77 | login,
78 | updateUser,
79 | getUser,
80 | };
81 |
--------------------------------------------------------------------------------
/server/validationSchema/blogValidationSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema } from 'express-validator';
2 |
3 | const createBlogSchema: Schema = {
4 | title: {
5 | in: ['body'],
6 | isString: true,
7 | notEmpty: true,
8 | },
9 | author: {
10 | in: ['body'],
11 | isString: true,
12 | notEmpty: true,
13 | },
14 | content: {
15 | in: ['body'],
16 | isString: true,
17 | notEmpty: true,
18 | },
19 | tags: {
20 | in: ['body'],
21 | custom: {
22 | options: (value) => {
23 | if (!Array.isArray(JSON.parse(value))) {
24 | throw new Error('Tags must be an array');
25 | }
26 | return true;
27 | },
28 | },
29 | notEmpty: true,
30 | },
31 | publishedDate: {
32 | in: ['body'],
33 | isDate: true,
34 | notEmpty: true,
35 | },
36 | featuredImage: {
37 | in: ['body'],
38 | isString: true,
39 | notEmpty: true,
40 | },
41 | };
42 |
43 | const deleteSchema: Schema = {
44 | id: {
45 | in: ['body'],
46 | isString: {
47 | errorMessage: 'Invalid id value',
48 | },
49 | notEmpty: {
50 | errorMessage: 'id cannot be empty',
51 | },
52 | },
53 | };
54 |
55 | export const blogValidationSchema = {
56 | createBlogSchema,
57 | deleteSchema,
58 | };
59 |
--------------------------------------------------------------------------------
/server/validationSchema/impactValidationSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema } from 'express-validator';
2 |
3 | const createImpactSchema: Schema = {
4 | domain: {
5 | in: ['body'],
6 | isString: {
7 | errorMessage: 'Invalid domain value',
8 | },
9 | notEmpty: {
10 | errorMessage: 'domain cannot be empty',
11 | },
12 | },
13 | title: {
14 | in: ['body'],
15 | isString: {
16 | errorMessage: 'Invalid title value',
17 | },
18 | notEmpty: {
19 | errorMessage: 'title cannot be empty',
20 | },
21 | },
22 | name: {
23 | in: ['body'],
24 | isString: {
25 | errorMessage: 'Invalid name value',
26 | },
27 | notEmpty: {
28 | errorMessage: 'name cannot be empty',
29 | },
30 | },
31 | testimonial: {
32 | in: ['body'],
33 | isString: {
34 | errorMessage: 'Invalid testimonial value',
35 | },
36 | notEmpty: {
37 | errorMessage: 'testimonial cannot be empty',
38 | },
39 | },
40 |
41 | address: {
42 | in: ['body'],
43 | isString: {
44 | errorMessage: 'Invalid address value',
45 | },
46 | notEmpty: {
47 | errorMessage: 'address cannot be empty',
48 | },
49 | },
50 | image: {
51 | in: ['body'],
52 | isString: {
53 | errorMessage: 'Invalid image value',
54 | },
55 | notEmpty: {
56 | errorMessage: 'image cannot be empty',
57 | },
58 | },
59 | };
60 |
61 | const deleteSchema: Schema = {
62 | id: {
63 | in: ['body'],
64 | isString: {
65 | errorMessage: 'Invalid id value',
66 | },
67 | notEmpty: {
68 | errorMessage: 'id cannot be empty',
69 | },
70 | },
71 | };
72 |
73 | export const impactValidationSchema = {
74 | createImpactSchema,
75 | deleteSchema,
76 | };
77 |
--------------------------------------------------------------------------------
/server/validationSchema/userValidationSchema.ts:
--------------------------------------------------------------------------------
1 | import { Schema } from 'express-validator';
2 |
3 | const createUserSchema: Schema = {
4 | name: {
5 | in: ['body'],
6 | isLength: {
7 | options: { min: 3 },
8 | errorMessage: 'Name must be at least 3 characters long',
9 | },
10 | notEmpty: {
11 | errorMessage: 'Name cannot be empty',
12 | },
13 | },
14 |
15 | email: {
16 | in: ['body'],
17 | custom: {
18 | options: (value: string) => {
19 | if (!/@.*\.com$/.test(value)) {
20 | throw new Error('Invalid email format');
21 | }
22 | return true;
23 | },
24 | },
25 | notEmpty: {
26 | errorMessage: 'Email cannot be empty',
27 | },
28 | },
29 | password: {
30 | in: ['body'],
31 | custom: {
32 | options: (value: string) => {
33 | if (!/(?=.*[a-zA-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{6,}/.test(value)) {
34 | throw new Error(
35 | 'Password must contain at least one alphabet, one number, one special character, and be minimum 6 characters long',
36 | );
37 | }
38 | return true;
39 | },
40 | },
41 | notEmpty: {
42 | errorMessage: 'password cannot be empty',
43 | },
44 | },
45 | currentCity: {
46 | in: ['body'],
47 | isString: true,
48 | notEmpty: {
49 | errorMessage: 'Current city cannot be empty',
50 | },
51 | },
52 | address: {
53 | in: ['body'],
54 | isString: true,
55 | notEmpty: {
56 | errorMessage: 'Address cannot be empty',
57 | },
58 | },
59 | whatsappNumber: {
60 | in: ['body'],
61 | isMobilePhone: true,
62 | notEmpty: {
63 | errorMessage: 'Whatsapp number cannot be empty',
64 | },
65 | },
66 | collegeName: {
67 | in: ['body'],
68 | isString: true,
69 | notEmpty: {
70 | errorMessage: 'College name cannot be empty',
71 | },
72 | },
73 | inspiration: {
74 | in: ['body'],
75 | isString: true,
76 | optional: true,
77 | },
78 | image: {
79 | in: ['body'],
80 | custom: {
81 | options: (value: string) => {
82 | if (!/\.(png|jpg|jpeg)$/.test(value)) {
83 | throw new Error('Image must have a valid extension png, jpg, jpeg');
84 | }
85 | return true;
86 | },
87 | },
88 | optional: true,
89 | },
90 | bio: {
91 | in: ['body'],
92 | isString: {
93 | errorMessage: 'Invalid bio',
94 | },
95 | optional: true,
96 | },
97 | };
98 |
99 | const loginUserSchema: Schema = {
100 | email: {
101 | in: ['body'],
102 | custom: {
103 | options: (value: string) => {
104 | if (!/@.*\.com$/.test(value)) {
105 | throw new Error('Invalid email');
106 | }
107 | return true;
108 | },
109 | },
110 | notEmpty: {
111 | errorMessage: 'Email cannot be empty',
112 | },
113 | },
114 | password: {
115 | in: ['body'],
116 | custom: {
117 | options: (value: string) => {
118 | if (!/(?=.*[a-zA-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{6,}/.test(value)) {
119 | throw new Error(
120 | 'Password must contain at least one alphabet, one number, one special character, and be minimum 6 characters long',
121 | );
122 | }
123 | return true;
124 | },
125 | },
126 | notEmpty: {
127 | errorMessage: 'password cannot be empty',
128 | },
129 | },
130 | };
131 |
132 | export const userValidationSchema = {
133 | createUserSchema,
134 | loginUserSchema,
135 | };
--------------------------------------------------------------------------------
/src/assets/Images/NGO testimonial.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/src/assets/Images/NGO testimonial.jpeg
--------------------------------------------------------------------------------
/src/assets/Images/homeImg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/src/assets/Images/homeImg.jpg
--------------------------------------------------------------------------------
/src/assets/Images/impact1_riya.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/src/assets/Images/impact1_riya.jpeg
--------------------------------------------------------------------------------
/src/assets/Images/impact3_rahul.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/src/assets/Images/impact3_rahul.jpeg
--------------------------------------------------------------------------------
/src/assets/Images/samparklogotransparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gaurav-Verma07/sampark/12bdb898895fd3e6b64b10548d1f369b7e7bf5c5/src/assets/Images/samparklogotransparent.png
--------------------------------------------------------------------------------
/src/assets/googleLogo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/Admin/Blog/AllBlogs.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useState, useEffect } from 'react';
3 | import { toast, ToastContainer } from 'react-toastify';
4 | import 'react-toastify/dist/ReactToastify.css';
5 | import { Button, Text } from '@mantine/core';
6 | import BlogAdminCard from './BlogAdminCard';
7 |
8 | interface BlogsDataType {
9 | _id:string;
10 | name: string;
11 | content: string;
12 | image: string;
13 | author:string;
14 | }
15 |
16 | function AllBlogs() {
17 | const [initialLoading, setInitialLoading] = useState(false);
18 |
19 | const [allBlogsData, setAllBlogsData] = useState([]);
20 | const [deleteId, setDeleteId] = useState('');
21 |
22 | useEffect(() => {
23 | getData();
24 | }, []);
25 |
26 | useEffect(() => {
27 | setAllBlogsData((prevData) =>
28 | prevData.filter((data: BlogsDataType) => data._id !== deleteId),
29 | );
30 | }, [deleteId]);
31 |
32 | const getData = async () => {
33 | setInitialLoading(true);
34 | try {
35 | const res = await fetch(`/api/admin/blogs/getall`).then((response) =>
36 | response.json(),
37 | );
38 | if (res.data.success) {
39 | setAllBlogsData(res.data.blog);
40 | setInitialLoading(false);
41 | }
42 | } catch (error) {
43 | toast.error('Something went wrong. Please Try Again', {
44 | position: 'top-right',
45 | autoClose: 1000,
46 | hideProgressBar: false,
47 | closeOnClick: true,
48 | pauseOnHover: true,
49 | draggable: true,
50 | progress: undefined,
51 | closeButton: false,
52 | });
53 | }
54 | };
55 |
56 | return (
57 |
58 | {initialLoading ? (
59 | 'Loading'
60 | ) : (
61 |
69 |
70 |
71 | All Blogs
72 |
73 | Add Blogs
74 |
75 |
76 |
83 | {allBlogsData.length > 0 ? (
84 | allBlogsData.map((data: BlogsDataType, index: number) => (
85 |
90 | ))
91 | ) : (
92 |
99 |
100 | No Blog created
101 |
102 |
103 | )}
104 |
105 |
106 | )}
107 |
119 |
120 | );
121 | }
122 |
123 | export default AllBlogs;
124 |
--------------------------------------------------------------------------------
/src/components/Admin/Events/AllEvents.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useState, useEffect } from 'react';
3 | import { toast, ToastContainer } from 'react-toastify';
4 | import 'react-toastify/dist/ReactToastify.css';
5 | import { Modal, Button, Text } from '@mantine/core';
6 | import EventAdminCard from './EventsAdminCard';
7 |
8 | interface EventsDataType {
9 | _id: string;
10 | name: string;
11 | organizer: string;
12 | address: string;
13 | description: string;
14 | date: string;
15 | image: string;
16 | duration: number;
17 | index: number;
18 | }
19 |
20 | function AllEvents() {
21 | const [initialLoading, setInitialLoading] = useState(false);
22 | const [deleteId, setDeleteId] = useState('');
23 | const [allEventsData, setAllEventsData] = useState([]);
24 |
25 | useEffect(() => {
26 | getData();
27 | }, []);
28 |
29 | useEffect(() => {
30 | setAllEventsData((prevData) =>
31 | prevData.filter((data: EventsDataType) => data._id !== deleteId),
32 | );
33 | }, [deleteId]);
34 |
35 | const getData = async () => {
36 | setInitialLoading(true);
37 | try {
38 | const res = await fetch(`/api/admin/events/getall`).then((response) =>
39 | response.json(),
40 | );
41 | if (res.data.success) {
42 | setAllEventsData(res.data.event);
43 | setInitialLoading(false);
44 | }
45 | } catch (error) {
46 | toast.error('Something went wrong. Please Try Again', {
47 | position: 'top-right',
48 | autoClose: 1000,
49 | hideProgressBar: false,
50 | closeOnClick: true,
51 | pauseOnHover: true,
52 | draggable: true,
53 | progress: undefined,
54 | closeButton: false,
55 | });
56 | }
57 | };
58 |
59 | return (
60 |
61 | {initialLoading ? (
62 | 'Loading'
63 | ) : (
64 |
72 |
73 |
74 | All Events
75 |
76 | Add Events
77 |
78 |
79 |
86 | {allEventsData.length > 0 ? (
87 | allEventsData.map((data: EventsDataType, index: number) => (
88 |
93 | ))
94 | ) : (
95 |
102 |
103 | No Event created
104 |
105 |
106 | )}
107 |
108 |
109 | )}
110 |
122 |
123 | );
124 | }
125 |
126 | export default AllEvents;
127 |
--------------------------------------------------------------------------------
/src/components/Admin/Ngos/AllNgos.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useState, useEffect } from 'react';
3 | import { toast, ToastContainer } from 'react-toastify';
4 | import 'react-toastify/dist/ReactToastify.css';
5 | import { Button, Text } from '@mantine/core';
6 | import NgoAdminCard from './NgoAdminCard';
7 |
8 | interface NgosDataType {
9 | _id: string;
10 | name: string;
11 | address: string;
12 | description: string;
13 | image: string;
14 | }
15 |
16 | function AllNgos() {
17 | const [initialLoading, setInitialLoading] = useState(false);
18 |
19 | const [allNgosData, setAllNgosData] = useState([]);
20 | const [deleteId, setDeleteId] = useState('');
21 |
22 | useEffect(() => {
23 | getData();
24 | }, []);
25 |
26 | useEffect(() => {
27 | setAllNgosData((prevData) =>
28 | prevData.filter((data: NgosDataType) => data._id !== deleteId),
29 | );
30 | }, [deleteId]);
31 |
32 | const getData = async () => {
33 | setInitialLoading(true);
34 | try {
35 | const res = await fetch(`/api/admin/ngos/getall`).then((response) =>
36 | response.json(),
37 | );
38 | console.log(res);
39 | if (res.data.success) {
40 | setAllNgosData(res.data.ngo);
41 | setInitialLoading(false);
42 | }
43 | } catch (error) {
44 | console.log(error);
45 | toast.success('Something went wrong. Please Try Again', {
46 | position: 'top-right',
47 | autoClose: 1000,
48 | hideProgressBar: false,
49 | closeOnClick: true,
50 | pauseOnHover: true,
51 | draggable: true,
52 | progress: undefined,
53 | closeButton: false,
54 | });
55 | }
56 | };
57 |
58 | return (
59 |
60 | {initialLoading ? (
61 | 'Loading'
62 | ) : (
63 |
71 |
72 |
73 | All Ngos
74 |
75 | Add Ngos
76 |
77 |
78 |
85 | {allNgosData.length > 0 ? (
86 | allNgosData.map((data: NgosDataType, index: number) => (
87 |
92 | ))
93 | ) : (
94 |
101 |
102 | No Ngo created
103 |
104 |
105 | )}
106 |
107 |
108 | )}
109 |
121 |
122 | );
123 | }
124 |
125 | export default AllNgos;
126 |
--------------------------------------------------------------------------------
/src/components/Blogs/SavedBlogs.tsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 | import { Box, Paper, SimpleGrid, Title } from '@mantine/core';
3 | import { BlogCard } from './BlogCard';
4 | import React from 'react';
5 |
6 | interface savedBlogType {
7 | id: number;
8 | data: string;
9 | image: string;
10 | }
11 |
12 | const Blogs = () => {
13 | const [savedBlogData, setSavedBlogData] = useState([]);
14 |
15 | useEffect(() => {
16 | const savedBlogList = localStorage.getItem('sampark-saved-items');
17 | if (savedBlogList) {
18 | setSavedBlogData(JSON.parse(savedBlogList));
19 | }
20 | }, []);
21 | const handleDeleteSavedBlog = (id: number) => {
22 | const savedBlogList = localStorage.getItem('sampark-saved-items');
23 |
24 | if (savedBlogList) {
25 | const parsedBlogsData = JSON.parse(savedBlogList);
26 | const updatedBlogsData = parsedBlogsData.filter(
27 | (item: { id: number }) => item.id !== id,
28 | );
29 | localStorage.setItem(
30 | 'sampark-saved-items',
31 | JSON.stringify(updatedBlogsData),
32 | );
33 | setSavedBlogData(updatedBlogsData);
34 | }
35 | };
36 |
37 | return (
38 | <>
39 |
40 |
41 |
50 | {savedBlogData.length > 0 ? 'Your Saved Blogs' : 'No Saved Blogs'}
51 |
52 |
53 |
54 | {savedBlogData.map((blog: savedBlogType, index: number) => (
55 |
62 | ))}
63 |
64 |
65 | >
66 | );
67 | };
68 |
69 | export default Blogs;
70 |
--------------------------------------------------------------------------------
/src/components/Blogs/blogs.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/ContactUs/ContactUs.css:
--------------------------------------------------------------------------------
1 | .email_contactUS{
2 | display: flex;
3 | }
4 | .phone_contactUs{
5 | display: flex;
6 | }
7 | .map_contactUs{
8 | display: flex;
9 | }
10 | .icons{
11 | margin-right: 7px;
12 | transition: transform 0.3s ease-in-out;
13 | }
14 | .icons:hover{
15 | transform: scale(1.2);
16 | }
--------------------------------------------------------------------------------
/src/components/Events/EventsCard.tsx:
--------------------------------------------------------------------------------
1 | import { createStyles, Card, Image, Group, Text, Avatar } from '@mantine/core';
2 | import React from 'react';
3 | import { useState, useEffect } from 'react';
4 | import { useRouter } from 'next/navigation';
5 |
6 | const useStyles = createStyles((theme) => ({
7 | card: {
8 | backgroundColor: theme.white,
9 | },
10 |
11 | title: {
12 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
13 | },
14 | }));
15 |
16 | interface EventCardType {
17 | slug: string;
18 | name: string;
19 | organizer: string;
20 | address: string;
21 | description: string;
22 | date: string;
23 | image: string;
24 | duration: number;
25 | index: number;
26 | }
27 |
28 | export function EventCard({
29 | slug,
30 | name,
31 | organizer,
32 | address,
33 | description,
34 | date,
35 | duration,
36 | image,
37 | index,
38 | }: EventCardType) {
39 | const router = useRouter();
40 | const { classes } = useStyles();
41 |
42 | return (
43 | {
48 | router.push(`/events/${index}`);
49 | }}
50 | >
51 |
52 |
53 |
54 |
55 |
56 | {name}
57 |
58 |
59 |
60 |
61 | {'Gaurav'}
62 |
63 |
64 | {description}
65 |
66 |
67 |
68 |
69 | );
70 | }
71 |
--------------------------------------------------------------------------------
/src/components/Faq/Faq.tsx:
--------------------------------------------------------------------------------
1 | import { Container, Title, Accordion } from '@mantine/core';
2 | import '../Faq/Faqstyles.css';
3 | const placeholder = [
4 | {
5 | problem:'What is the purpose of this social platform?',
6 | solution: 'The platform aims to foster meaningful connections between schools and colleges with slums and orphanages to facilitate educational support and engagement, promoting social inclusion and uplifting the underprivileged communities.'
7 | },
8 | {
9 | problem: 'How can I reset my password?',
10 | solution:
11 | 'To reset password you need to visit login page and press forget password button and then follow given procedure',
12 | },
13 | {
14 | problem: 'Can I create more that one account?',
15 | solution:
16 | 'No,it is not recommended to hold multiple accounts unless untill you are facing any problem with previous account',
17 | },
18 | {
19 | problem: 'How you help poor kids?',
20 | solution:
21 | 'We are group of students providing a platform to NGOs and helping them in raising funds which directly goes for poor people',
22 | },
23 | {
24 | problem: 'How many ways are there to donate?',
25 | solution: "It's very simple,on home page only you can simply donate",
26 | },
27 | {
28 | problem: 'What payment systems do you work with?',
29 | solution: 'We use various digital payment methods via UPI,debit,credit and Phone wallet',
30 | },
31 | {
32 | problem: 'Are there any safety measures in place for the involvement of students in the slums and orphanages?',
33 | solution: 'Yes, the platform encourages schools and colleges to ensure proper supervision and follow safety protocols when engaging their students in activities within slums and orphanages.'
34 | },
35 | {
36 | problem:'Can individuals or organizations from different countries participate?',
37 | solution: 'Absolutely! The platform is open to participants from all around the world, allowing cross-cultural exchange and global collaboration for social causes.'
38 | },
39 |
40 | {
41 | problem:'How can volunteers get involved?',
42 | solution: 'Volunteers can join the platform and search for projects or initiatives that match their skills and interests. They can offer their time, expertise, and support to help schools, colleges, slums, and orphanages achieve their objectives.'
43 | },
44 | {
45 | problem:'Is financial assistance a part of this platform\'s offerings?',
46 | solution: 'While the platform does not directly provide financial aid, schools and colleges can arrange fundraisers or crowdfunding campaigns for specific projects or requirements identified by the slums and orphanages.'
47 | }
48 | ];
49 | export default function Faq() {
50 | return (
51 |
52 |
53 | FAQs
54 |
55 |
56 | {placeholder.map((item, index) => (
57 |
58 |
59 | {item.problem}
60 | {item.solution}
61 |
62 |
63 | ))}
64 |
65 | );
66 | }
67 |
--------------------------------------------------------------------------------
/src/components/Faq/Faqstyles.css:
--------------------------------------------------------------------------------
1 | /* @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300&display=swap'); */
2 | @import url('https://fonts.googleapis.com/css2?family=Rubik&display=swap');
3 | .title {
4 | margin-bottom: 70px;
5 | /* font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji,
6 | Segoe UI Emoji; */
7 | font-family: 'Rubik', sans-serif;
8 | letter-spacing: 1px;
9 | }
10 | .wrapper {
11 | min-height: 700px;
12 | padding-bottom: 0px;
13 | font-family: 'Rubik', sans-serif;
14 | padding-top: 50px;
15 | border: none;
16 | background: none;
17 | }
18 | .item {
19 | border: none;
20 | background: none;
21 | margin-bottom: 0.5rem;
22 | font-family: 'Rubik', sans-serif;
23 | }
24 |
25 | .item_question{
26 | font-size: 20spx;
27 | font-family: 'Rubik', sans-serif;
28 | font-weight: 300;
29 | }
30 | .item_question:hover{
31 | color:rgb(22, 218, 22);
32 | font-family: 'Rubik', sans-serif;
33 | }
34 | .faq_content {
35 | color: #777777;
36 | text-align: left;
37 | border: none;
38 | background: none;
39 | font-family: 'Rubik', sans-serif;
40 | }
41 |
--------------------------------------------------------------------------------
/src/components/GoToTopButton/GoToTop.css:
--------------------------------------------------------------------------------
1 | .wrapper_btn{
2 | display: flex;
3 | justify-content: center;
4 | align-items: center;
5 | position: relative;
6 | }
7 |
8 | .wrapper_btn .top-btn {
9 | font-size: 1.2rem;
10 | width: 3rem;
11 | height: 3rem;
12 | color: #fff;
13 | background-color: black;
14 | border-radius: 50%;
15 | position: fixed;
16 | bottom: 3rem;
17 | right: 2rem;
18 | z-index: 999;
19 | display: flex;
20 | justify-content: center;
21 | align-items: center;
22 | cursor: pointer;
23 | }
24 |
25 | .wrapper_btn .top-btn--icon {
26 | animation: gototop 1.2s linear infinite alternate-reverse;
27 | }
28 |
29 | @keyframes gototop {
30 | 0% {
31 | transform: translateY(-0.10rem);
32 | }
33 | 100% {
34 | transform: translateY(0.4rem);
35 | }
36 | }
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/components/GoToTopButton/GoToTop.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react';
2 | import './GoToTop.css';
3 | import { IconArrowUp } from '@tabler/icons';
4 |
5 | const GoToTop = () => {
6 | const [isVisible, setIsVisible] = useState(false);
7 |
8 | const goToBtn = () => {
9 | window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
10 | };
11 |
12 | const listenToScroll = () => {
13 | const heightToHidden = 250;
14 | const winScroll = document.body.scrollTop || document.documentElement.scrollTop;
15 |
16 | if (winScroll > heightToHidden) {
17 | setIsVisible(true);
18 | } else {
19 | setIsVisible(false);
20 | }
21 | };
22 |
23 | useEffect(() => {
24 | window.addEventListener('scroll', listenToScroll);
25 | return () => window.removeEventListener('scroll', listenToScroll);
26 | }, []);
27 |
28 | return (
29 |
30 | {isVisible && (
31 |
32 |
33 |
34 | )}
35 |
36 | );
37 | };
38 |
39 | export default GoToTop;
40 |
--------------------------------------------------------------------------------
/src/components/HeroSection/HeroSection.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './styles.css';
3 |
4 | function HeroSection() {
5 | return (
6 | <>
7 |
8 |
9 |
SAMPARK
10 |
11 | We connect slum and orphanage kids with local colleges and NGOs to
12 | end poverty.
13 |
14 |
15 | Donate
16 |
17 |
18 |
19 | >
20 | );
21 | }
22 |
23 | export default HeroSection;
24 |
--------------------------------------------------------------------------------
/src/components/HeroSection/styles.css:
--------------------------------------------------------------------------------
1 | .navbar {
2 | margin-bottom: 5rem;
3 | }
4 |
5 | .hero-section {
6 | width: 99vw;
7 | height: 100vh;
8 | background-image: url('../../assets/Images/homeImg.jpg');
9 | display: flex;
10 | align-items: center;
11 | justify-content: center;
12 | flex-direction: column;
13 | background-size: cover;
14 | color: white;
15 | }
16 |
17 | .hero-section h1 {
18 | font-size: 4rem;
19 | font-family: 'Tilt Neon', cursive;
20 | }
21 | .hero-section p {
22 | font-family: 'Poppins', sans-serif;
23 | font-size: 1.5rem;
24 | }
25 | .hero-section button {
26 | margin: 1rem;
27 | padding: 0.5rem;
28 | font-size: 1.5rem;
29 | border-radius: 0.2rem;
30 | box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
31 | rgba(0, 0, 0, 0.3) 0px 30px 60px -30px,
32 | rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;
33 | cursor: pointer;
34 | transition: all 0.5s;
35 | border: none;
36 | }
37 | .hero-section button:hover {
38 | transform: scale(1.1);
39 | background-color: aquamarine;
40 | }
41 | .container {
42 | display: flex;
43 | align-items: center;
44 | justify-content: center;
45 | flex-direction: column;
46 | max-width: 1000px;
47 | width: 80%;
48 | text-align: center;
49 | }
50 |
51 | .value-section h1 {
52 | margin: 2rem;
53 | font-size: 3rem;
54 | text-align: center;
55 | font-family: 'futura-pt', sans-serif;
56 | }
57 |
--------------------------------------------------------------------------------
/src/components/HomeHeader/HomeHeader.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | Header,
3 | Container,
4 | Group,
5 | Burger,
6 | Paper,
7 | Transition,
8 | // Image,
9 | Button,
10 | Avatar,
11 | } from '@mantine/core';
12 | import { useDisclosure } from '@mantine/hooks';
13 | import Image from 'next/image';
14 | import useStyles from './styles';
15 | import { useRouter } from 'next/navigation';
16 | import React from 'react';
17 |
18 | const HEADER_HEIGHT = '5rem';
19 | const links: any = [
20 | { link: '/gallery', label: 'Gallery' },
21 | { link: '/blogs', label: 'Blogs' },
22 | { link: '/impact', label: 'Impact' },
23 | { link: '#values', label: 'Values' },
24 | { link: '#faq', label: 'FAQ' },
25 | { link: '#contact', label: 'Contact' },
26 | ];
27 |
28 | const HomeHeader = () => {
29 | // const user: any = localStorage.getItem('user_uid');
30 | const [opened, { toggle }] = useDisclosure(false);
31 | const { classes, cx } = useStyles();
32 | const router = useRouter();
33 |
34 | const items = links.map((link: any) => (
35 |
36 | {link.label}
37 |
38 | ));
39 |
40 | // const isLoggedIn = user ? (
41 | // {
44 | // router.push('/provider/home');
45 | // }}
46 | // />
47 | // ) : (
48 | // {
50 | // router.push('/login');
51 | // }}
52 | // >
53 | // Sign In
54 | //
55 | // );
56 |
57 | return (
58 |
59 |
60 |
66 |
67 | {items}
68 | {/* {isLoggedIn} */}
69 |
70 |
71 |
77 |
78 |
79 | {(styles) => (
80 |
81 | {items}
82 | Sign In
83 |
84 | )}
85 |
86 |
87 |
88 | );
89 | };
90 |
91 | export default HomeHeader;
92 |
--------------------------------------------------------------------------------
/src/components/HomeHeader/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/styles';
2 | const HEADER_HEIGHT = '5rem';
3 |
4 | const useStyles = createStyles((theme) => ({
5 | root: {
6 | position: 'absolute',
7 | zIndex: 1,
8 | backgroundColor: 'transparent',
9 | border: 'none',
10 | },
11 |
12 | dropdown: {
13 | position: 'absolute',
14 | top: HEADER_HEIGHT,
15 | color: '#000 !important',
16 | left: 0,
17 | right: 0,
18 | zIndex: 0,
19 | borderTopRightRadius: 0,
20 | borderTopLeftRadius: 0,
21 | borderTopWidth: 0,
22 | overflow: 'hidden',
23 | paddingBottom: '1rem',
24 | // marginRight: '-500px',
25 | [theme.fn.largerThan('sm')]: {
26 | display: 'none',
27 | },
28 | },
29 |
30 | header: {
31 | display: 'flex',
32 | justifyContent: 'space-between',
33 | alignItems: 'center',
34 | height: '100%',
35 | },
36 |
37 | links: {
38 | [theme.fn.smallerThan('sm')]: {
39 | display: 'none',
40 | },
41 | },
42 |
43 | burger: {
44 | [theme.fn.largerThan('sm')]: {
45 | display: 'none',
46 | color: 'white',
47 | fontWeight: 'bolder',
48 | },
49 | },
50 |
51 | link: {
52 | color: theme.white,
53 | display: 'block',
54 | lineHeight: 1,
55 | padding: `.3rem 1rem`,
56 | textDecoration: 'none',
57 | fontSize: theme.fontSizes.lg,
58 | fontWeight: 300,
59 | position: 'relative',
60 |
61 | '&::after': {
62 | content: '""',
63 | width: '0%',
64 | height: '1px',
65 | backgroundColor: 'white',
66 | position: 'absolute',
67 | bottom: '0',
68 | left: '0',
69 | marginTop: '2px',
70 | transition: '.4s',
71 | transformOriginal: 'left',
72 | },
73 |
74 | '&:hover::after': {
75 | width: '80%',
76 | },
77 |
78 | [theme.fn.smallerThan('sm')]: {
79 | borderRadius: 0,
80 | padding: theme.spacing.md,
81 | color: theme.black,
82 | },
83 | },
84 | }));
85 |
86 | export default useStyles;
87 |
--------------------------------------------------------------------------------
/src/components/HomeOurValues/OurValues.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | Grid,
3 | Container,
4 | Text,
5 | Title,
6 | Paper,
7 | createStyles,
8 | } from '@mantine/core';
9 |
10 | const useStyles = createStyles(() => ({
11 | grid: {
12 | backgroundColor: 'red',
13 | },
14 | }));
15 |
16 | export function OurValues() {
17 | const { classes, cx } = useStyles();
18 |
19 | return (
20 |
21 |
22 | OUR VALUES
23 |
24 |
25 |
26 |
27 | Empowerment
28 |
29 | We prioritize empowering individuals and communities to take control of their own lives and work towards positive change.
30 |
31 |
32 |
33 | Collaboration
34 |
35 | Value of collaboration with other organizations and stakeholders to achieve shared goals and maximize impact is very important to us.
36 |
37 |
38 |
39 | Heading 2
40 |
41 | The most effective solutions to violence and exploitation will be
42 | crafted by a diverse and collaborative community, with those most
43 | affected by injustice at the head of the table.
44 |
45 |
46 |
47 | Community development
48 |
49 | Supporting the development of needy communities through education, training, and other initiatives is our utmost goal.
50 |
51 |
52 |
53 | Heading 3
54 |
55 | Everyone deserves the safety and opportunity to reach their full
56 | potential. In service to our mission, we call out and address
57 | structural violence and oppression within and outside of our
58 | organization.
59 |
60 |
61 |
62 |
63 |
64 | );
65 | }
66 |
--------------------------------------------------------------------------------
/src/components/HomeOurValues/OurValues1.tsx:
--------------------------------------------------------------------------------
1 | import './Values.css';
2 |
3 | function OurValues1() {
4 | return (
5 |
6 |
7 |
OUR VALUES
8 |
9 |
10 |
11 |
12 |
Empowerment
13 | {/*
*/}
14 |
15 | We prioritize empowering individuals and communities to take control of their own lives and work towards positive change.
16 |
17 |
18 |
19 |
20 |
Collaboration
21 | {/*
*/}
22 |
23 | Value of collaboration with other organizations and stakeholders to achieve shared goals and maximize impact is very important to us.
24 |
25 |
26 |
27 |
28 |
29 |
Growth
30 | {/*
*/}
31 |
32 | The most effective solutions to violence and exploitation will be
33 | crafted by a diverse and collaborative community, with those most
34 | affected by injustice at the head of the table.
35 |
36 |
37 |
38 |
39 |
40 | );
41 | }
42 |
43 | export default OurValues1;
44 |
--------------------------------------------------------------------------------
/src/components/ImageGallery/imagegallery.css:
--------------------------------------------------------------------------------
1 | .title{
2 | margin-bottom: 40px;
3 | font-size: 50px;
4 | margin-left: 30px;
5 | }
6 | .carousell{
7 | margin-left: 30px;
8 | }
9 |
10 | @media only screen and (max-width: 920px) {
11 | .carousell{
12 | margin-left: 0px;
13 | }
14 | .imgc{
15 | width: 200px;
16 | }
17 | }
18 |
19 | @media only screen and (max-width: 540px) {
20 | .carousell{
21 | margin-left: 0px;
22 | }
23 | .imgc{
24 | width: 350px;
25 | }
26 | .title{
27 | margin-bottom: 40px;
28 | font-size: 30px;
29 | margin-left: 0px;
30 | size: 80px;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/components/Impact/Impact.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | AspectRatio,
3 | Button,
4 | Card,
5 | Container,
6 | createStyles,
7 | Header,
8 | // Image,
9 | Paper,
10 | Text,
11 | Title,
12 | } from '@mantine/core';
13 | import Image from 'next/image';
14 | import { IconArrowLeft } from '@tabler/icons';
15 | import { useRouter, useParams } from 'next/navigation';
16 | import { data } from './impactContent';
17 | import './impact.css';
18 |
19 | const useStyles = createStyles((theme) => ({
20 | header: {
21 | display: 'flex',
22 | justifyContent: 'space-between',
23 | alignItems: 'center',
24 | height: '100%',
25 | },
26 | blog: {
27 | textAlign: 'left',
28 | width: '50%',
29 | },
30 | back: {
31 | display: 'flex',
32 | alignItems: 'center',
33 | },
34 | image: {
35 | border: '1px solid #a3a3a2',
36 | borderRadius: '10px',
37 | margin: ' 20px 0',
38 | },
39 | }));
40 |
41 | const Impact = () => {
42 | const { id }: any = useParams();
43 | const { classes } = useStyles();
44 | const router = useRouter();
45 | const impactData = data[id];
46 |
47 | return (
48 | <>
49 |
59 |
60 |
61 | {
65 | router.push('/');
66 | }}
67 | >
68 | {' '}
69 | Go Back
70 |
71 |
72 |
77 |
83 |
84 |
85 |
86 |
87 | >
88 | );
89 | };
90 |
91 | export default Impact;
92 |
--------------------------------------------------------------------------------
/src/components/Impact/ImpactCard.tsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 | import { Card, Text, createStyles, AspectRatio } from '@mantine/core';
3 | import { useRouter } from 'next/navigation';
4 | import Image from 'next/image';
5 |
6 | const useStyles = createStyles((theme) => ({
7 | card: {
8 | position: 'relative',
9 | width: '80%',
10 | // margin: '1%',
11 | cursor: 'pointer',
12 | ...theme.fn.hover({
13 | transition: 'transform 150ms ease, box-shadow 150ms ease',
14 | transform: 'scale(1.01)',
15 | boxShadow: theme.shadows.md,
16 | }),
17 | },
18 | innerCard: {
19 | margin: '3%',
20 | },
21 | rating: {
22 | position: 'absolute',
23 | top: theme.spacing.xs,
24 | right: ' 0.7rem',
25 | pointerEvents: 'none',
26 | },
27 |
28 | title: {
29 | display: 'block',
30 | marginTop: theme.spacing.md,
31 | marginBottom: '0.3rem',
32 | },
33 |
34 | action: {
35 | backgroundColor:
36 | theme.colorScheme === 'dark'
37 | ? theme.colors.dark[6]
38 | : theme.colors.gray[0],
39 | ...theme.fn.hover({
40 | backgroundColor:
41 | theme.colorScheme === 'dark'
42 | ? theme.colors.dark[5]
43 | : theme.colors.gray[1],
44 | }),
45 | },
46 |
47 | footer: {
48 | marginTop: theme.spacing.md,
49 | },
50 | }));
51 |
52 | interface ImpactType {
53 | image: string;
54 | index: number;
55 | data: string;
56 | }
57 |
58 | export function ImpactCard({ image, index, data }: ImpactType) {
59 | const router = useRouter();
60 | const { classes, cx } = useStyles();
61 | const linkProps = {
62 | target: '_blank',
63 | rel: 'noopener noreferrer',
64 | };
65 | const [impactTitle, setImpactTitle] = useState('');
66 |
67 | useEffect(() => {
68 | const element = document.createElement('div');
69 | element.innerHTML = data;
70 |
71 | const h1Tag = element.querySelector('div.blog__main h1') as HTMLElement;
72 | const extractedTitle = h1Tag?.innerText ?? '';
73 | setImpactTitle(extractedTitle);
74 | }, []);
75 |
76 | return (
77 | {
84 | router.push(`/impact/${index}`);
85 | }}
86 | >
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | {impactTitle}
96 |
97 |
98 | );
99 | }
100 |
--------------------------------------------------------------------------------
/src/components/Impact/impact.css:
--------------------------------------------------------------------------------
1 | .blog__main {
2 | font-family: 'Lato', sans-serif;
3 | }
4 |
5 | .blog__subHead {
6 | font-size: 22px;
7 | }
8 |
9 | .list {
10 | margin-left: 30px;
11 | }
12 |
13 | .blog__text {
14 | color: #40403f;
15 | font-size: 20px;
16 | padding: 10px 0;
17 | }
18 | .underline {
19 | margin: 10px 0;
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/components/MainBlogs/MainBlogs.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | createStyles,
3 | SimpleGrid,
4 | Card,
5 | // Image,
6 | Text,
7 | Container,
8 | AspectRatio,
9 | Box,
10 | Paper,
11 | Title,
12 | useMantineTheme,
13 | } from '@mantine/core';
14 | import Image from 'next/image';
15 | import { mockdata } from './blogData';
16 | import useStyles from './styles';
17 | import './blog.css';
18 | // import Logo from '../../assets/Images/samparklogotransparent.png';
19 | import { useRouter } from 'next/navigation';
20 |
21 | const MainBlogs = () => {
22 | const { classes } = useStyles();
23 | const theme = useMantineTheme();
24 | const router = useRouter();
25 |
26 | const cards = mockdata.map((article, index) => (
27 | {
37 | router.push(`/blogs/${index}`);
38 | }}
39 | >
40 |
41 |
42 |
43 |
44 | {article.date}
45 |
46 |
47 | {article.title}
48 |
49 |
50 | ));
51 |
52 | return (
53 |
54 |
55 | router.push('/blogs')}
67 | >
68 | Read more about our work through our blogs...
69 |
70 |
71 |
72 | {cards}
73 | {/*
82 |
83 |
90 |
91 |
92 | {' '}
93 | Read more articles...
94 |
95 | */}
96 |
97 |
98 | );
99 | };
100 |
101 | export default MainBlogs;
102 |
--------------------------------------------------------------------------------
/src/components/MainBlogs/blog.css:
--------------------------------------------------------------------------------
1 | .blogtitle{
2 | margin-top: 50px;
3 | }
--------------------------------------------------------------------------------
/src/components/MainBlogs/blogData.ts:
--------------------------------------------------------------------------------
1 | // import SamparkLogo from '../../assets/Images/samparklogotransparent.png';
2 | export const mockdata = [
3 | {
4 | title: 'How does Sampark work? See our in-depth values and principles',
5 | image: '/assets/Images/samparklogotransparent.png',
6 | date: 'August 18, 2022',
7 | },
8 | {
9 | title: 'Past Event: Cloth Distribution organised at IET Lucknow',
10 | image:
11 | 'https://drive.google.com/uc?export=download&id=1Lrgi5PCH0MKgY6LYyaa3oGkXGiCRyYiK',
12 |
13 | date: 'August 27, 2022',
14 | },
15 | ];
16 |
--------------------------------------------------------------------------------
/src/components/MainBlogs/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/styles';
2 |
3 | const useStyles = createStyles((theme) => ({
4 | card: {
5 | transition: 'transform 150ms ease, box-shadow 150ms ease',
6 |
7 | '&:hover': {
8 | transform: 'scale(1.01)',
9 | boxShadow: theme.shadows.md,
10 | },
11 | },
12 |
13 | title: {
14 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
15 | fontWeight: 600,
16 | },
17 | }));
18 |
19 | export default useStyles;
20 |
--------------------------------------------------------------------------------
/src/components/MainHeader/MainHeader.tsx:
--------------------------------------------------------------------------------
1 | import { Header, Container, Group, Burger, Avatar } from '@mantine/core';
2 | import { useDisclosure } from '@mantine/hooks';
3 | // import { NavLink } from 'react-router-dom';
4 | import useStyles from './styles';
5 |
6 | const MainHeader = () => {
7 | const [opened, { toggle }] = useDisclosure(false);
8 | const { classes } = useStyles();
9 |
10 | return (
11 |
12 |
13 |
14 | {/*
15 |
16 | */}
17 |
18 |
19 |
25 |
26 |
27 | );
28 | };
29 | export default MainHeader;
30 |
--------------------------------------------------------------------------------
/src/components/MainHeader/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/core';
2 |
3 | const useStyles = createStyles((theme) => ({
4 | header: {
5 | display: 'flex',
6 | justifyContent: 'space-between',
7 | alignItems: 'center',
8 | height: '100%',
9 | width:'100%'
10 | },
11 |
12 | links: {
13 | [theme.fn.smallerThan('xs')]: {
14 | display: 'none',
15 | },
16 | width: 92%,
17 | padding: 2rem,
18 | margin: 0 auto,
19 | border-radius: .5rem,
20 | top: 5.25rem
21 | },
22 |
23 | burger: {
24 | [theme.fn.largerThan('xs')]: {
25 | display: 'none',
26 | },
27 | background: white,
28 | padding: 1rem .7rem,
29 | width: unset,
30 | height: unset,
31 | },
32 |
33 | link: {
34 | color:
35 | theme.colorScheme === 'dark'
36 | ? theme.colors.dark[0]
37 | : theme.colors.gray[7],
38 | fontSize: theme.fontSizes.sm,
39 | fontWeight: 500,
40 | '&:hover': {
41 | cursor: 'pointer',
42 | backgroundColor:
43 | theme.colorScheme === 'dark'
44 | ? theme.colors.dark[6]
45 | : theme.colors.gray[0],
46 | },
47 | width: 100%
48 | },
49 |
50 | linkActive: {
51 | '&, &:hover': {
52 | backgroundColor: theme.fn.variant({
53 | variant: 'light',
54 | color: theme.primaryColor,
55 | }).background,
56 | color: theme.fn.variant({ variant: 'light', color: theme.primaryColor })
57 | .color,
58 | },
59 | },
60 | }));
61 |
62 | export default useStyles;
63 |
--------------------------------------------------------------------------------
/src/components/MapBox/map.css:
--------------------------------------------------------------------------------
1 |
2 | @media only screen and (max-width: 1537px) {
3 | .cardss{
4 | margin-top: -200px;
5 | }
6 | }
7 | @media only screen and (max-width: 1062px) {
8 | .cardss{
9 | margin-top: 0px;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/NavBar.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 |
3 | function NavBar() {
4 | return (
5 |
6 |
logo
7 |
8 | Home
9 | About Us
10 | Contact US
11 |
12 |
13 | );
14 | }
15 |
16 | export default NavBar;
17 |
--------------------------------------------------------------------------------
/src/components/Navbar/Navbar.tsx:
--------------------------------------------------------------------------------
1 | import { Container, Group, Navbar } from '@mantine/core';
2 | import {
3 | IconHome2,
4 | IconLogout,
5 | IconSettings,
6 | IconSwitchHorizontal,
7 | IconUserCheck,
8 | } from '@tabler/icons';
9 | import { useState } from 'react';
10 | import { useRouter } from 'next/navigation';
11 | // import { NavLink, useNavigate } from 'react-router-dom';
12 | import useStyles from './styles';
13 |
14 | const data = [
15 | { link: 'home', label: 'Home', icon: IconHome2 },
16 | { link: 'team', label: 'College Team', icon: IconUserCheck },
17 | { link: 'settings', label: 'Settings', icon: IconSettings },
18 | ];
19 |
20 | const HomeNavbar = () => {
21 | const router = useRouter();
22 | const { classes, cx } = useStyles();
23 | const [active, setActive] = useState('Home');
24 | const [expanded, setExpanded] = useState(false);
25 |
26 | const links = data.map((item) => {
27 | return (
28 | <>>
29 | // {
36 | // event.preventDefault();
37 | // setActive(item.label);
38 | // router.push(`/provider/${item.link}`);
39 | // setExpanded(false); // Close the mobile menu after clicking a link
40 | // }}
41 | // >
42 | //
43 | // {item.label}
44 | //
45 | );
46 | });
47 |
48 | const logOutHandler = () => {
49 | const response = window.confirm('Are you sure you want to Log Out?');
50 | if (response) {
51 | localStorage.clear();
52 | router.push('/login');
53 | }
54 | };
55 |
56 | return (
57 |
63 | // {links}
64 | //
65 | // }
66 | >
67 |
68 |
69 |
70 |
71 |
74 |
75 | {/* setExpanded(!expanded)}
77 | aria-label="Toggle Menu"
78 | /> */}
79 |
80 |
86 | {links}
87 |
88 |
89 |
94 | {
98 | event.preventDefault();
99 | setExpanded(false);
100 | }}
101 | >
102 |
107 | Change account
108 |
109 |
110 |
111 |
116 | Log Out
117 |
118 |
119 |
120 |
121 | );
122 | };
123 |
124 | export default HomeNavbar;
125 |
--------------------------------------------------------------------------------
/src/components/Navbar/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/core';
2 |
3 | const useStyles = createStyles((theme, _params, getRef) => {
4 | const icon: any = getRef('icon');
5 | return {
6 | header: {
7 | paddingBottom: theme.spacing.md,
8 | marginBottom: theme.spacing.md * 1.5,
9 | },
10 |
11 | footer: {
12 | paddingTop: theme.spacing.md,
13 | marginTop: theme.spacing.md,
14 | borderTop: `1px solid ${
15 | theme.colorScheme === 'dark'
16 | ? theme.colors.dark[4]
17 | : theme.colors.gray[2]
18 | }`,
19 | },
20 |
21 | link: {
22 | display: 'flex',
23 | alignItems: 'center',
24 | textDecoration: 'none',
25 | fontSize: theme.fontSizes.sm,
26 | color:
27 | theme.colorScheme === 'dark'
28 | ? theme.colors.dark[1]
29 | : theme.colors.gray[7],
30 | padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
31 | borderRadius: theme.radius.sm,
32 | fontWeight: 500,
33 | '&:hover': {
34 | backgroundColor:
35 | theme.colorScheme === 'dark'
36 | ? theme.colors.dark[6]
37 | : theme.colors.gray[0],
38 | color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[8],
39 |
40 | [`& .${icon}`]: {
41 | color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[8],
42 | },
43 | },
44 | '&:focus': {
45 | outline: 'none',
46 | boxShadow: `0 0 0 2px ${theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 6 : 0]}`,
47 | backgroundColor: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 6 : 0],
48 | color: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 0 : 8],
49 |
50 | [`& .${icon}`]: {
51 | color: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 0 : 8],
52 | },
53 | },
54 | },
55 |
56 | linkIcon: {
57 | ref: icon,
58 | color:
59 | theme.colorScheme === 'dark'
60 | ? theme.colors.dark[2]
61 | : theme.colors.gray[6],
62 | marginRight: theme.spacing.sm,
63 | },
64 |
65 | linkActive: {
66 | '&, &:hover': {
67 | backgroundColor: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 6 : 0],
68 | color: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 0 : 8],
69 | [`& .${icon}`]: {
70 | color: theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 0 : 8],
71 | },
72 | },
73 | },
74 |
75 | mobileMenuTrigger: {
76 | display: 'flex',
77 | alignItems: 'center',
78 | cursor: 'pointer',
79 | },
80 |
81 | mobileMenuContent: {
82 | paddingTop: theme.spacing.md,
83 | marginTop: theme.spacing.md,
84 | },
85 |
86 | desktopMenu: {
87 | '@media (max-width: 767px)': {
88 | display: 'none',
89 | },
90 | },
91 | };
92 | });
93 |
94 | export default useStyles;
95 |
--------------------------------------------------------------------------------
/src/components/Ngos/NgosCard.tsx:
--------------------------------------------------------------------------------
1 | import { createStyles, Card, Image, Group, Text, Avatar } from '@mantine/core';
2 | import React from 'react';
3 | import { useRouter } from 'next/navigation';
4 |
5 | const useStyles = createStyles((theme) => ({
6 | card: {
7 | backgroundColor: theme.white,
8 | },
9 |
10 | title: {
11 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
12 | },
13 | }));
14 |
15 | interface NgosType {
16 | slug: string;
17 | name: string;
18 | address: string;
19 | description: string;
20 | image: string;
21 | index: number;
22 | }
23 |
24 | export function NgoCard({ slug, name, address, description, image, index }: NgosType) {
25 | const router = useRouter();
26 | const { classes, theme } = useStyles();
27 |
28 | return (
29 | {
35 | router.push(`/ngos/${slug}`);
36 | }}
37 | >
38 |
39 |
46 |
53 |
54 |
55 |
56 |
62 | {name}
63 |
64 |
65 |
66 |
67 | {'Gaurav'}
68 |
69 |
70 |
71 | {description}
72 |
73 |
74 |
75 | );
76 | }
77 |
--------------------------------------------------------------------------------
/src/components/Orphanages/OrphanagesCard.tsx:
--------------------------------------------------------------------------------
1 | import { createStyles, Card, Image, Group, Text, Avatar } from '@mantine/core';
2 | import React from 'react';
3 | import { useState, useEffect } from 'react';
4 | import { useRouter } from 'next/navigation';
5 |
6 | const useStyles = createStyles((theme) => ({
7 | card: {
8 | backgroundColor: theme.white,
9 | },
10 |
11 | title: {
12 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
13 | },
14 | }));
15 |
16 | interface OrphanageCardType {
17 | slug: string;
18 | data: string;
19 | image: string;
20 | }
21 |
22 | export function OrphanageCard({ slug, data, image }: OrphanageCardType) {
23 | const router = useRouter();
24 | const { classes, theme } = useStyles();
25 | const [orphanageTitle, setOrphanageTitle] = useState('');
26 | const [orphanageDescription, setOrphanageDescription] = useState('');
27 |
28 | useEffect(() => {
29 | const element = document.createElement('div');
30 | element.innerHTML = data;
31 |
32 | const h1Tag = element.querySelector('div.blog__main h1') as HTMLElement;
33 | const extractedTitle = h1Tag?.innerText ?? '';
34 | const text = element.querySelector('div.blog__main p') as HTMLElement;
35 | const description = text?.innerText ?? '';
36 | setOrphanageDescription(description);
37 | setOrphanageTitle(extractedTitle);
38 | }, []);
39 |
40 | return (
41 | {
46 | router.push(`/orphanages/${slug}`);
47 | }}
48 | >
49 |
50 |
53 |
60 |
61 |
62 |
63 |
69 | {orphanageTitle}
70 |
71 |
72 |
73 |
74 | {'Gaurav'}
75 |
76 |
77 | {orphanageDescription}
78 |
79 |
80 |
81 |
82 | );
83 | }
84 |
--------------------------------------------------------------------------------
/src/components/ProviderCollegeTeam/ProviderCollegeTeam.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | Badge,
3 | Table,
4 | Group,
5 | Text,
6 | Anchor,
7 | ScrollArea,
8 | useMantineTheme,
9 | } from '@mantine/core';
10 | import { getDatabase, ref, child, get } from 'firebase/database';
11 | import { useEffect, useState } from 'react';
12 |
13 | const ProviderCollegeTeam = () => {
14 | const [teamData, setTeamData]: any = useState([
15 | { Name: '', 'Applying as?': '' },
16 | ]);
17 | const theme = useMantineTheme();
18 |
19 | const getResponses = async () => {
20 | const dbRef = ref(getDatabase());
21 | const response = await get(
22 | child(
23 | dbRef,
24 | `/1MN-kjuUq3k-jp6g-2L1maBkUsB9AggqbYUcgoB1GoH4/Form responses 1`,
25 | ),
26 | );
27 | const responseData = Object.values(response.val());
28 | const userMail: any = JSON.parse(localStorage.getItem('email') || '');
29 | const user: any = responseData.filter(
30 | (el: any) => el.Email === 'sample@gmail.com',
31 | );
32 | const collegeName = user[0]['College Name'];
33 | const allTeamUsers = responseData.filter(
34 | (el: any) => el['College Name'] === collegeName,
35 | );
36 | setTeamData(allTeamUsers);
37 | };
38 |
39 | useEffect(() => {
40 | getResponses();
41 | }, []);
42 |
43 | const rows = teamData.map((item: any) => (
44 |
45 |
46 |
47 |
48 | {item['Name']}
49 |
50 |
51 |
52 |
53 |
54 |
55 | {item['Applying as?']}
56 |
57 |
58 |
59 |
60 | size="sm"
61 | href="#"
62 | onClick={(event) => event.preventDefault()}
63 | >
64 | {item['Email']}
65 |
66 |
67 |
68 |
69 | {item['Whatsapp Number']}
70 |
71 |
72 |
73 | ));
74 |
75 | return (
76 |
77 |
78 |
79 |
80 | Name
81 | Designation
82 | Email Address
83 | Contact Number
84 |
85 |
86 |
87 | {rows}
88 |
89 |
90 | );
91 | };
92 |
93 | export default ProviderCollegeTeam;
94 |
--------------------------------------------------------------------------------
/src/components/ProviderMain/data.ts:
--------------------------------------------------------------------------------
1 | export const data: any = {
2 | image:
3 | 'https://images.unsplash.com/photo-1488590528505-98d2b5aba04b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=80',
4 | avatar:
5 | 'https://images.unsplash.com/photo-1623582854588-d60de57fa33f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=250&q=80',
6 | name: 'Bill Headbanger',
7 | job: 'Fullstack engineer',
8 | stats: [
9 | {
10 | value: '34K',
11 | label: 'Followers',
12 | },
13 | {
14 | value: '187',
15 | label: 'Follows',
16 | },
17 | {
18 | value: '1.6K',
19 | label: 'Posts',
20 | },
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/src/components/ProviderStats/ProviderStats.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | createStyles,
3 | ThemeIcon,
4 | Progress,
5 | Text,
6 | Group,
7 | Paper,
8 | } from '@mantine/core';
9 | import { IconArchive, IconStar } from '@tabler/icons';
10 |
11 | const ICON_SIZE = 60;
12 |
13 | const useStyles = createStyles((theme) => ({
14 | main: {
15 | display: 'flex',
16 | justifyContent: 'space-around',
17 | },
18 | card: {
19 | position: 'relative',
20 | overflow: 'visible',
21 | width: '30%',
22 | padding: theme.spacing.xl,
23 | paddingTop: theme.spacing.xl * 1.5 + ICON_SIZE / 3,
24 | display: 'flex',
25 | flexDirection: 'column',
26 | justifyContent: 'space-between',
27 | },
28 |
29 | icon: {
30 | position: 'absolute',
31 | top: -ICON_SIZE / 3,
32 | left: `calc(50% - ${ICON_SIZE / 2}px)`,
33 | },
34 |
35 | title: {
36 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
37 | lineHeight: 1,
38 | },
39 | }));
40 |
41 | const ProviderStats = () => {
42 | const { classes } = useStyles();
43 |
44 | return (
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Points Achieved
53 |
54 |
61 | Level 1
62 |
63 |
64 | 32 / 100
65 |
66 |
67 |
68 |
69 | Progress
70 |
71 |
72 | 32%
73 |
74 |
75 |
76 |
77 |
78 |
79 | Get 68 more points to reach Level 2
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | Supplies Provided
89 |
90 |
91 | 20 books and many more
92 |
93 |
94 |
95 |
96 |
97 | Get 68 more points to reach Level 2
98 |
99 |
100 |
101 | );
102 | };
103 |
104 | export default ProviderStats;
105 |
--------------------------------------------------------------------------------
/src/components/SeekerMain/data.ts:
--------------------------------------------------------------------------------
1 | export const data: any = {
2 | image:
3 | 'https://images.unsplash.com/photo-1488590528505-98d2b5aba04b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=80',
4 | avatar:
5 | 'https://images.unsplash.com/photo-1623582854588-d60de57fa33f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=250&q=80',
6 | name: 'Bill Headbanger',
7 | job: 'Fullstack engineer',
8 | stats: [
9 | {
10 | value: '34K',
11 | label: 'Followers',
12 | },
13 | {
14 | value: '187',
15 | label: 'Follows',
16 | },
17 | {
18 | value: '1.6K',
19 | label: 'Posts',
20 | },
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/src/components/SeekerNavbar/Navbar.tsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react';
2 |
3 | import { Navbar, Group, Code } from '@mantine/core';
4 | import {
5 | IconSettings,
6 | IconDatabaseImport,
7 | IconUserCheck,
8 | IconNotebook,
9 | IconSwitchHorizontal,
10 | IconLogout,
11 | IconCalendarStats,
12 | IconReceipt,
13 | IconIdBadge2,
14 | IconHome2,
15 | IconUserPlus,
16 | } from '@tabler/icons';
17 | import { useRouter } from 'next/navigation';
18 | // import { NavLink, useNavigate } from 'react-router-dom';
19 | import useStyles from './styles';
20 |
21 | const data = [
22 | { link: 'home', label: 'Home', icon: IconHome2 },
23 | { link: 'team', label: 'College Team', icon: IconUserCheck },
24 | { link: 'program', label: 'Program Section', icon: IconCalendarStats },
25 | { link: 'settings', label: 'Settings', icon: IconSettings },
26 | ];
27 |
28 | const HomeNavbar = () => {
29 | const router = useRouter();
30 | const { classes, cx } = useStyles();
31 | const [active, setActive] = useState('Billing');
32 |
33 | const links = data.map((item) => {
34 | return (
35 | <>>
36 | // {
43 | // event.preventDefault();
44 | // setActive(item.label);
45 | // router.push(`/seeker/${item.link}`);
46 | // }}
47 | // >
48 | //
49 | // {item.label}
50 | //
51 | );
52 | });
53 |
54 | const logOutHandler = () => {
55 | const response = confirm('Are you sure you want to LogOut?');
56 | if (response) {
57 | localStorage.clear();
58 | router.push('/login');
59 | }
60 | };
61 |
62 | return (
63 |
64 |
65 |
66 | {links}
67 |
68 |
69 |
70 | event.preventDefault()}
74 | >
75 |
76 | Change account
77 |
78 |
79 |
80 |
81 | Log Out
82 |
83 |
84 |
85 | );
86 | };
87 | export default HomeNavbar;
88 |
--------------------------------------------------------------------------------
/src/components/SeekerNavbar/styles.ts:
--------------------------------------------------------------------------------
1 | import { createStyles } from '@mantine/core';
2 |
3 | const useStyles = createStyles((theme, _params, getRef) => {
4 | const icon: any = getRef('icon');
5 | return {
6 | header: {
7 | paddingBottom: theme.spacing.md,
8 | marginBottom: theme.spacing.md * 1.5,
9 | },
10 |
11 | footer: {
12 | paddingTop: theme.spacing.md,
13 | marginTop: theme.spacing.md,
14 | borderTop: `1px solid ${
15 | theme.colorScheme === 'dark'
16 | ? theme.colors.dark[4]
17 | : theme.colors.gray[2]
18 | }`,
19 | },
20 |
21 | link: {
22 | ...theme.fn.focusStyles(),
23 | display: 'flex',
24 | alignItems: 'center',
25 | textDecoration: 'none',
26 | fontSize: theme.fontSizes.sm,
27 | color:
28 | theme.colorScheme === 'dark'
29 | ? theme.colors.dark[1]
30 | : theme.colors.gray[7],
31 | padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
32 | borderRadius: theme.radius.sm,
33 | fontWeight: 500,
34 |
35 | '&:hover': {
36 | backgroundColor:
37 | theme.colorScheme === 'dark'
38 | ? theme.colors.dark[6]
39 | : theme.colors.gray[0],
40 | color: theme.colorScheme === 'dark' ? theme.white : theme.black,
41 |
42 | [`& .${icon}`]: {
43 | color: theme.colorScheme === 'dark' ? theme.white : theme.black,
44 | },
45 | },
46 | },
47 |
48 | linkIcon: {
49 | ref: icon,
50 | color:
51 | theme.colorScheme === 'dark'
52 | ? theme.colors.dark[2]
53 | : theme.colors.gray[6],
54 | marginRight: theme.spacing.sm,
55 | },
56 |
57 | linkActive: {
58 | '&, &:hover': {
59 | backgroundColor: theme.fn.variant({
60 | variant: 'light',
61 | color: theme.primaryColor,
62 | }).background,
63 | color: theme.fn.variant({ variant: 'light', color: theme.primaryColor })
64 | .color,
65 | [`& .${icon}`]: {
66 | color: theme.fn.variant({
67 | variant: 'light',
68 | color: theme.primaryColor,
69 | }).color,
70 | },
71 | },
72 | },
73 | };
74 | });
75 |
76 | export default useStyles;
77 |
--------------------------------------------------------------------------------
/src/components/SeekerProgramSection/ProgramSection.tsx:
--------------------------------------------------------------------------------
1 | import { createStyles, Image, Card, Text, Group, Button } from '@mantine/core';
2 | import { Carousel } from '@mantine/carousel';
3 | import { IconStar } from '@tabler/icons';
4 |
5 | const useStyles = createStyles((theme) => ({
6 | price: {
7 | color: theme.colorScheme === 'dark' ? theme.white : theme.black,
8 | },
9 |
10 | carousel: {
11 | '&:hover': {
12 | // [`& .${getStylesRef('carouselControls')}`]: {
13 | // opacity: 1,
14 | // },
15 | },
16 | },
17 |
18 | carouselControls: {
19 | // ref: getStylesRef('carouselControls'),
20 | transition: 'opacity 150ms ease',
21 | opacity: 0,
22 | },
23 |
24 | carouselIndicator: {
25 | width: '4rem',
26 | height: '4rem',
27 | transition: 'width 250ms ease',
28 |
29 | '&[data-active]': {
30 | width: '10rem',
31 | },
32 | },
33 | }));
34 |
35 | const images = [
36 | 'https://images.unsplash.com/photo-1598928506311-c55ded91a20c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=720&q=80',
37 | 'https://images.unsplash.com/photo-1567767292278-a4f21aa2d36e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=720&q=80',
38 | 'https://images.unsplash.com/photo-1605774337664-7a846e9cdf17?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=720&q=80',
39 | 'https://images.unsplash.com/photo-1554995207-c18c203602cb?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=720&q=80',
40 | 'https://images.unsplash.com/photo-1616486029423-aaa4789e8c9a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=720&q=80',
41 | ];
42 |
43 | export default function ProgramSection() {
44 | const { classes } = useStyles();
45 |
46 | const slides = images.map((image) => (
47 |
48 |
49 |
50 | ));
51 |
52 | return (
53 |
54 |
55 |
64 | {slides}
65 |
66 |
67 |
68 |
69 |
70 | Forde, Norway
71 |
72 |
73 |
74 |
75 |
76 | 4.78
77 |
78 |
79 |
80 |
81 |
82 | Relax, rejuvenate and unplug in this unique contemporary Birdbox. Feel
83 | close to nature in ultimate comfort. Enjoy the view of the epic mountain
84 | range of Blegja and the Førdefjord.
85 |
86 |
87 |
88 |
89 |
90 | 397$
91 |
92 |
93 | {' '}
94 | / night
95 |
96 |
97 |
98 | Book now
99 |
100 |
101 | );
102 | }
103 |
--------------------------------------------------------------------------------
/src/components/SeekerStats/SeekerStats.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | createStyles,
3 | ThemeIcon,
4 | Progress,
5 | Text,
6 | Group,
7 | Paper,
8 | } from '@mantine/core';
9 | import { IconArchive, IconStar } from '@tabler/icons';
10 |
11 | const ICON_SIZE = 60;
12 |
13 | const useStyles = createStyles((theme) => ({
14 | main: {
15 | display: 'flex',
16 | justifyContent: 'space-around',
17 | },
18 | card: {
19 | position: 'relative',
20 | overflow: 'visible',
21 | width: '30%',
22 | padding: theme.spacing.xl,
23 | paddingTop: theme.spacing.xl * 1.5 + ICON_SIZE / 3,
24 | display: 'flex',
25 | flexDirection: 'column',
26 | justifyContent: 'space-between',
27 | },
28 |
29 | icon: {
30 | position: 'absolute',
31 | top: -ICON_SIZE / 3,
32 | left: `calc(50% - ${ICON_SIZE / 2}px)`,
33 | },
34 |
35 | title: {
36 | fontFamily: `Greycliff CF, ${theme.fontFamily}`,
37 | lineHeight: 1,
38 | },
39 | }));
40 |
41 | const SeekerStats = () => {
42 | const { classes } = useStyles();
43 |
44 | return (
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Points Achieved
53 |
54 |
61 | Level 1
62 |
63 |
64 | 32 / 100
65 |
66 |
67 |
68 |
69 | Progress
70 |
71 |
72 | 32%
73 |
74 |
75 |
76 |
77 |
78 |
79 | Get 68 more points to reach Level 2
80 |
81 | {/*
82 |
83 | 4 days left
84 | */}
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | Supplies Received
93 |
94 |
95 | 20 books and many more
96 |
97 |
98 | {/*
99 |
100 | Progress
101 |
102 |
103 | 32%
104 |
105 | */}
106 |
107 |
108 |
109 |
110 | Get 68 more points to reach Level 2
111 |
112 | {/*
113 |
114 | 4 days left
115 | */}
116 |
117 |
118 | );
119 | };
120 |
121 | export default SeekerStats;
122 |
--------------------------------------------------------------------------------
/src/utils/ApiRequests/firebaseAuth.ts:
--------------------------------------------------------------------------------
1 | import {
2 | createUserWithEmailAndPassword,
3 | signInWithEmailAndPassword,
4 | } from 'firebase/auth';
5 | import { auth } from '../firebase';
6 |
7 | export const registerUserHandler = (email: any, password: any) => {
8 | createUserWithEmailAndPassword(auth, email, password)
9 | .then((userCredential) => {
10 | const user = userCredential.user;
11 | })
12 | .catch((error) => {
13 | const errorMessage = error.message;
14 | alert(errorMessage);
15 | });
16 | };
17 |
18 | export const firebaseSignIn = (email: any, password: any) => {
19 | signInWithEmailAndPassword(auth, email, password)
20 | .then((userCredential) => {
21 | const user = userCredential.user;
22 | localStorage.setItem('user_uid', user.uid);
23 | return 1;
24 | })
25 | .catch((error) => {
26 | const errorMessage = error.message;
27 | alert(errorMessage);
28 | });
29 | };
30 |
--------------------------------------------------------------------------------
/src/utils/ApiRequests/firebaseGoogleAuth.ts:
--------------------------------------------------------------------------------
1 | import {
2 | // getAuth,
3 | getRedirectResult,
4 | GoogleAuthProvider,
5 | signInWithPopup,
6 | // signInWithRedirect,
7 | } from 'firebase/auth';
8 | import {
9 | // app,
10 | auth,
11 | } from '../firebase';
12 |
13 | const provider = new GoogleAuthProvider();
14 | provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
15 | auth.languageCode = 'it';
16 | export const firebaseGoogleAuth = () => {
17 | signInWithPopup(auth, provider)
18 | .then((result) => {
19 | const credential = GoogleAuthProvider.credentialFromResult(result);
20 | const token = credential?.accessToken;
21 | const user = result.user;
22 | })
23 | .catch((error) => {
24 | const errorCode = error.code;
25 | const errorMessage = error.message;
26 | const email = error.customData.email;
27 | const credential = GoogleAuthProvider.credentialFromError(error);
28 | });
29 | const data = getRedirectResult(auth)
30 | .then((result: any) => {
31 | const credential = GoogleAuthProvider.credentialFromResult(result);
32 | const token = credential?.accessToken;
33 |
34 | const user = result.user;
35 | })
36 | .catch((error) => {
37 | const errorCode = error.code;
38 | const errorMessage = error.message;
39 | const email = error.customData.email;
40 | const credential = GoogleAuthProvider.credentialFromError(error);
41 | });
42 | };
43 |
--------------------------------------------------------------------------------
/src/utils/ApiRequests/userProfile.ts:
--------------------------------------------------------------------------------
1 | import { child, get, getDatabase, ref, set } from 'firebase/database';
2 |
3 | export const writeUserData = (
4 | userId: any,
5 | name: any,
6 | email: any,
7 | role: any,
8 | ) => {
9 | const db = getDatabase();
10 | set(ref(db, 'users/' + userId), {
11 | username: name,
12 | email: email,
13 | role: role,
14 | });
15 | };
16 |
17 | export const getUserData = (userID: any) => {
18 | let userData;
19 | const dbRef = ref(getDatabase());
20 | get(child(dbRef, `users/${userID}`))
21 | .then((snapshot) => {
22 | if (snapshot.exists()) {
23 | userData = snapshot.val();
24 | return userData;
25 | }
26 | })
27 | .catch((error) => {
28 | console.error(error);
29 | });
30 | return userData;
31 | };
32 |
--------------------------------------------------------------------------------
/src/utils/firebase.ts:
--------------------------------------------------------------------------------
1 | import { initializeApp } from 'firebase/app';
2 | import { connectAuthEmulator, getAuth } from 'firebase/auth';
3 | import { connectDatabaseEmulator, getDatabase } from 'firebase/database';
4 | import { connectFirestoreEmulator, getFirestore } from 'firebase/firestore';
5 |
6 | const devConfig = {
7 | apiKey: 'demo-sampark-key',
8 | authDomain: 'demo-sampark.firebaseapp.com',
9 | databaseURL: 'https://demo-sampark.asia-southeast1.firebasedatabase.app',
10 | projectId: 'demo-sampark',
11 | storageBucket: '',
12 | messagingSenderId: '',
13 | appId: '',
14 | measurementId: '',
15 | };
16 |
17 | const firebaseConfig = {
18 | apiKey: process.env.NEXT_FIREBASE_API_KEY || 'demo-sampark-key',
19 | authDomain:
20 | process.env.NEXT_FIREBASE_AUTH_DOMAIN || 'demo-sampark.firebaseapp.com',
21 | databaseURL:
22 | process.env.NEXT_FIREBASE_DATABASE_URL ||
23 | 'https://demo-sampark.asia-southeast1.firebasedatabase.app',
24 | projectId: process.env.NEXT_FIREBASE_PROJECT_ID || 'demo-sampark',
25 | storageBucket: process.env.NEXT_FIREBASE_STORAGE_BUCKET || '',
26 | messagingSenderId: process.env.NEXT_FIREBASE_MEASUREMENT_SENDER_ID || '',
27 | appId: process.env.NEXT_FIREBASE_APP_ID || '',
28 | measurementId: process.env.NEXT_FIREBASE_MEASUREMENT_ID || '',
29 | };
30 |
31 | export const app = initializeApp(
32 | process.env.DEV ? devConfig : firebaseConfig,
33 | );
34 | export const auth = getAuth(app);
35 |
36 | if (process.env.DEV) {
37 | const db = getDatabase();
38 | const store = getFirestore();
39 |
40 | // -------
41 | connectAuthEmulator(auth, 'http://localhost:9099');
42 | connectDatabaseEmulator(db, 'localhost', 9000);
43 | connectFirestoreEmulator(store, 'localhost', 8000);
44 | }
45 |
--------------------------------------------------------------------------------
/src/utils/validation.ts:
--------------------------------------------------------------------------------
1 | interface ValidationObject {
2 | [key: string]: (value: string) => { [key: string]: boolean };
3 | }
4 |
5 | export interface ErrorState {
6 | email?: boolean;
7 | name?: boolean;
8 | message?: boolean;
9 | }
10 |
11 |
12 | const emailRegex =/^\w+([\\.-]?\w+)*@(gmail\.com|yahoo\.com|hotmail\.com|aol\.com|outlook\.com)$/;
13 | const validation:ValidationObject= {
14 | email: (value:string)=>{
15 | return (emailRegex.test(value.trim()))? {email: false} : {email: true}
16 | },
17 | name: (value:string)=>{
18 | return (value.trim().length < 6) ? {name: true} : {name: false};
19 | },
20 | message: (value:string)=>{
21 | const words = value.trim().split(/\s+/).length;
22 | return (words< 10 || words > 100) ? {message: true}: {message: false}
23 | }
24 | }
25 |
26 | export default validation;
27 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "lib": [
6 | "DOM",
7 | "DOM.Iterable",
8 | "ESNext"
9 | ],
10 | "allowJs": false,
11 | "skipLibCheck": true,
12 | "esModuleInterop": true,
13 | "allowSyntheticDefaultImports": true,
14 | "strict": true,
15 | "forceConsistentCasingInFileNames": true,
16 | "module": "ESNext",
17 | "moduleResolution": "Node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "preserve",
22 | "incremental": true,
23 | "plugins": [
24 | {
25 | "name": "next"
26 | }
27 | ]
28 | },
29 | "include": [
30 | "src",
31 | ".next/types/**/*.ts"
32 | ],
33 | "references": [
34 | {
35 | "path": "./tsconfig.node.json"
36 | }
37 | ],
38 | "exclude": [
39 | "node_modules"
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "jsx": "react",
4 | "composite": true,
5 | "module": "ESNext",
6 | "moduleResolution": "Node",
7 | "allowSyntheticDefaultImports": true
8 | }
9 | // "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "routes": [{ "src": "/[^.]+", "dest": "/", "status": 200 }]
3 | }
4 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-undef */
2 | /* eslint-disable @typescript-eslint/no-var-requires */
3 | const dotenv = require('dotenv').config({ path: __dirname + '/.env' });
4 | const isDevelopment = process.env.NODE_ENV !== 'production';
5 |
6 | export const plugins = [
7 | new webpack.DefinePlugin({
8 | 'process.env': JSON.stringify(dotenv.parsed),
9 | 'process.env.NODE_ENV': JSON.stringify(
10 | isDevelopment ? 'development' : 'production',
11 | ),
12 | }),
13 | ].filter(Boolean);
14 |
--------------------------------------------------------------------------------