Compare commits
346 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ea77d8941 | |||
| 33f42a703a | |||
| 0db13e3178 | |||
| aeb28b0623 | |||
| 0ac733fa63 | |||
| e7f0855578 | |||
| 0f9a74826a | |||
| 67b8725f70 | |||
| b9e244cf03 | |||
| 4a5078cab3 | |||
| 29de0c85fe | |||
| 77c2bf9620 | |||
| 91735beb88 | |||
| f02e74bc3a | |||
| c3361e3141 | |||
| 0cf510e95c | |||
| 754442adfa | |||
| 833361255b | |||
| 7a231c4e39 | |||
| 08c88fb59c | |||
| 4b5454ddc2 | |||
| 623de2877e | |||
| ce6b23ec98 | |||
| a83f219c02 | |||
| 97325623fe | |||
| 19466dd98f | |||
| 577dddd785 | |||
| a58579e753 | |||
| f5f4706123 | |||
| 0886b85847 | |||
| 30a40bf6b1 | |||
| ae927dea0d | |||
| 69d2b98d50 | |||
| ceaabd3514 | |||
| 94513bb0d9 | |||
| cf2fc469fb | |||
| 49bf406795 | |||
| d75496adcc | |||
| acfae6b898 | |||
| 373ff372cb | |||
| 6c54d38efc | |||
| df60173b49 | |||
| 3be86e6196 | |||
| 3d85f9770e | |||
| 3af8e3bb6d | |||
| 6ad0f1ad55 | |||
| 6fb88acf44 | |||
| d98de59fcf | |||
| ca691d2203 | |||
| 31842373b8 | |||
| fcdc95505e | |||
| af55b7e58d | |||
| 094cdab65e | |||
| 059a90808a | |||
| ea6801fbb5 | |||
| 925c6f28fe | |||
| 75a3919eb2 | |||
| 803432db8e | |||
| b8a732eea5 | |||
| 294dd3a6b0 | |||
| de0c9e9785 | |||
| 45f9ec19d1 | |||
| f73cd7f07a | |||
| fb19f53d63 | |||
| f1e23ac056 | |||
| 50308ce43c | |||
| d7d47bae9e | |||
| e203a87a77 | |||
| 5f089341be | |||
| f2c9d55a20 | |||
| 04c0cb4cff | |||
| 32dda6fe8d | |||
| da7320255e | |||
| e8fad393f7 | |||
| 02a9eeaa36 | |||
| c4374da5ba | |||
| 2a33838b93 | |||
| 527dcd8660 | |||
| d1a9116b34 | |||
| 9ee81aa487 | |||
| de99e26ca2 | |||
| 2822152799 | |||
| baa754eeb8 | |||
| fe90a39983 | |||
| 5eb2002d8e | |||
| 3446ea47b4 | |||
| 32a5f5b057 | |||
| 8f00bade79 | |||
| c3d55c94d1 | |||
| 7c00b49870 | |||
| 5b161ad232 | |||
| 7954432add | |||
| 76f18d2b15 | |||
| a695a47d8b | |||
| 401cc4670c | |||
| 0668350eed | |||
| ad39b54f1d | |||
| 398725e7b7 | |||
| f726d6d40f | |||
| 1e3c0ce930 | |||
| 0eb766b2a0 | |||
| 6c9f4af2dd | |||
| ed6c1b427e | |||
| bc25b0e694 | |||
| 3e354800dd | |||
| c3c76b66c9 | |||
| ce5add2879 | |||
| 5629dc8836 | |||
| 0d4787ccfb | |||
| e9948c1f5c | |||
| 568628f0a2 | |||
| abf46c6885 | |||
| 01d8598f59 | |||
| 1095b781cd | |||
| 1569d3c7ce | |||
| 652b35f5bd | |||
| 57a8af7ef8 | |||
| e8be631182 | |||
| 1dda82790c | |||
| c47ea53b50 | |||
| d4d994fe26 | |||
| 2dc2f380ff | |||
| 2604fc2034 | |||
| 7db4b2a2ee | |||
| 3ec8263d15 | |||
| d0c14cf1ab | |||
| a078c9adec | |||
| 3caa4dcde7 | |||
| 860c6d1075 | |||
| cccfd98736 | |||
| c37d521d0e | |||
| 1de58de8de | |||
| fc1adb5662 | |||
| b5e36872b6 | |||
| 1c4183dd85 | |||
| 535302c893 | |||
| 3a28cc392a | |||
| 63321e0550 | |||
| 4789da2c43 | |||
| 1498e2615c | |||
| 3aad970fd6 | |||
| c5821737b2 | |||
| 75a79711aa | |||
| f4447fd2dc | |||
| 6be9999d44 | |||
| 5dd4bffdc5 | |||
|
14dfdf8735
|
|||
| 19eed3810d | |||
| d5e0f3ca79 | |||
|
b868d67cd1
|
|||
|
098a0f469d
|
|||
|
718c489042
|
|||
|
94c8b900a9
|
|||
| 830d7f75e1 | |||
| 3ec8386a04 | |||
|
a1e1f28137
|
|||
| f6873efcdd | |||
| c4be27dada | |||
| b319c0e6e4 | |||
| c63383ba89 | |||
| df62f8f846 | |||
| 17d895cab0 | |||
| 86cfdfb875 | |||
|
370c7c39f5
|
|||
|
5dd891c5b2
|
|||
|
7bf163d77c
|
|||
|
9feead28cd
|
|||
|
323b7b555a
|
|||
|
d09a527c9d
|
|||
| 25a112bc3f | |||
|
b7ec08f5ef
|
|||
|
8bca33a039
|
|||
|
6179f8d4c2
|
|||
|
e08f4591c6
|
|||
| bc04d35909 | |||
|
5d8a29d19c
|
|||
|
b52c17162d
|
|||
|
3a555a690c
|
|||
|
d81ba003e0
|
|||
| c4292fdd33 | |||
| 13d04ad364 | |||
| 525fe38b73 | |||
| e1e9fb877a | |||
| b826f1f6a4 | |||
| e2a8c75d46 | |||
| a4fc9bdce0 | |||
| 1a6700a983 | |||
| 2571b8cc73 | |||
| 88b7202069 | |||
| 456c8bc1af | |||
| c36b33402b | |||
| abdbe69fd9 | |||
| 81da8f5b2d | |||
| b05bebfd07 | |||
| 947041b62b | |||
|
e50062f615
|
|||
|
ced20c16c5
|
|||
|
a2ae2b2bea
|
|||
|
f82b04d36c
|
|||
|
fdb22a5307
|
|||
| f92bf2510a | |||
|
965db39ad0
|
|||
| 584510d0f3 | |||
| 981d17166e | |||
|
12cfc6f6a0
|
|||
|
2ec3b93190
|
|||
|
961e2b4587
|
|||
|
eaadade0ed
|
|||
|
564524772e
|
|||
|
b2c21d0782
|
|||
|
fa29041489
|
|||
|
296f21a082
|
|||
| ed3449a1f7 | |||
| 9f84ee233d | |||
| 1396d03b76 | |||
| ba0575f315 | |||
| 644206635f | |||
| 2b6bc641d4 | |||
| 0962df2187 | |||
|
7212a532f6
|
|||
| 85cd7c20f4 | |||
| 844bb14040 | |||
| 2e0ac0ba0f | |||
|
ea3647ecd3
|
|||
|
2796172d30
|
|||
|
0c8ca18326
|
|||
|
b1009b186e
|
|||
| 72ae128975 | |||
|
9802ea8096
|
|||
|
aa49341937
|
|||
|
29d6833e42
|
|||
|
d26e7d4290
|
|||
|
1f22895904
|
|||
|
319f066edf
|
|||
|
c77f16d3fc
|
|||
| c8d7e40203 | |||
| e1572cd84a | |||
| 1e5f462abd | |||
| 973096d480 | |||
| 5aa1c888e1 | |||
| 594c09ba65 | |||
| a883e3112e | |||
| b87c6ee600 | |||
| 94b8591643 | |||
| b7a30c3d6d | |||
| daa9de4142 | |||
| 08b57dc2b2 | |||
| e179e8cdef | |||
| 57e61e362a | |||
|
0042244b80
|
|||
| e8dfc7bf88 | |||
| 72bcccfe2f | |||
| 2c457ab531 | |||
| 1120f5eb6e | |||
| f16b77c94b | |||
| 62a813d0ad | |||
| 151de4ebfd | |||
| 199c283b0e | |||
|
60bdf36274
|
|||
|
a7eb9b942b
|
|||
|
7cd1e9b5da
|
|||
|
afd5dbaa9f
|
|||
|
eeb6b856e6
|
|||
|
9ee8bf3376
|
|||
|
848d588bf4
|
|||
| 7ca4b62848 | |||
| 8cd5fd8783 | |||
| afd72ec72b | |||
| 0895e93f6c | |||
| 67ec566728 | |||
|
8737d10a1e
|
|||
|
d9bca7f1ff
|
|||
|
4b9b46f10d
|
|||
|
bafcd88fa1
|
|||
| ac7317a0b7 | |||
| 034b217916 | |||
| ef3f7fa174 | |||
|
17d2ce436a
|
|||
|
6dbc0a2e8e
|
|||
|
43e9045b0a
|
|||
|
5ca9c4222c
|
|||
|
5e8a5c89b3
|
|||
| dc5469fc70 | |||
|
ac19919c51
|
|||
| 7d2b653953 | |||
| 6dea6cc168 | |||
| 75e3476d48 | |||
| c73f85a411 | |||
| 5aba1549d4 | |||
| 3f68e43efd | |||
| b24a2b5254 | |||
| b38f12a6ab | |||
| b07a333459 | |||
| 13e5f319c7 | |||
| 4391a072cc | |||
| 66c9de922d | |||
| 245ae616b1 | |||
| 3afbe17a21 | |||
| 8d3283ef04 | |||
| 8862f7b94c | |||
| 6e5af78586 | |||
| ca731147f2 | |||
| a8dc4d8460 | |||
| 6a0d3f3834 | |||
| 04cdc500b2 | |||
| 8cd7cafdb5 | |||
| ec2fc15a3f | |||
| d7a2382cb5 | |||
| 69d5bfe9a9 | |||
| c555a59cf8 | |||
| d20aecdbe8 | |||
| 57a8415e52 | |||
|
f19b09c5fd
|
|||
|
c6056c385b
|
|||
|
7420cc63fb
|
|||
|
c528c6bacf
|
|||
|
daedd0b068
|
|||
| f83612634d | |||
| b7138e5df8 | |||
| 5f63e59b24 | |||
| a8254095d7 | |||
| dde81c6f9f | |||
| 2e5340e775 | |||
| 92764da0da | |||
|
cbae67c36b
|
|||
|
01f37ac46b
|
|||
|
f39b47b790
|
|||
|
c10d496c57
|
|||
|
cec4fac22f
|
|||
|
a316c92ff9
|
|||
|
c86d9275e7
|
|||
|
fd82639658
|
|||
|
9da1b6c78c
|
|||
|
c5ba2fbcf8
|
|||
|
f49c18f712
|
|||
| c3befbcebd | |||
| 8d25628947 | |||
|
cbaf8cae3a
|
|||
| d05153ce68 | |||
|
9beb3135fb
|
|||
| e251cd7481 | |||
| 0147d683ec | |||
| 3067f2f4ef | |||
| 4db45ad718 | |||
| 849da09805 | |||
| de00f99b8b |
@@ -0,0 +1,140 @@
|
||||
# Android Build
|
||||
/frontend-next/android
|
||||
|
||||
# Firebase Stuff
|
||||
firebase-admin-key.json
|
||||
firebase*.json
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Am I the only mac user
|
||||
**/.DS_Store
|
||||
@@ -1,2 +1,35 @@
|
||||
# COS420-Project
|
||||
Main repo for COS420 Project Group 4
|
||||

|
||||
Main repo for ChatMaps, our COS420 Project.
|
||||
|
||||
ChatMaps is a web-based social networking service that allows users to connect to others in their local geographic area. It implements an interactable mapping utility to show general user locations relative to others, as well as a chat room feature that allows users to start public conversations based on any given topic. ChatMaps is primarily intended for use in densely populated areas, such as college campuses or metropolitan areas, so people of similar interests can start new conversations. The goal of this project is to create a web app that plots locations, gives a radius of the local area, and connects users into different topic-based chat rooms.
|
||||
|
||||
This service implements user login and profiles, allowing users to add each other as friends and start private conversations. There are several default chat rooms of varying topics, but users also have the ability to create their own rooms that will be visible to other users. For example, a user at the University of Maine could create a joinable chat room titled “COS420”, which would be joinable by others near this campus.
|
||||
|
||||
This app shares some similarities to other social networks that implement location-based content. ChatMaps’ novel approach is to utilize user location to facilitate real-time communication with others within a given radius.
|
||||
|
||||
The live version of this app can be found at:
|
||||
|
||||
https://chatma.ps/
|
||||
|
||||
Demo Login:<br/>
|
||||
Email: demo@chatma.ps<br/>
|
||||
Password: demoapp<br/>
|
||||
|
||||
Please note. The demo is restricted to sending messages, and creating rooms. This is intented to ensure the demo remains an adequate example of the functionalities of this application. If you would like to test the full set of features, please make an account.
|
||||
|
||||
|
||||
|
||||
A local version can be run (assuming you have Node installed) with:
|
||||
|
||||
cd frontend-next/
|
||||
|
||||
npm install
|
||||
|
||||
npm run dev
|
||||
|
||||
then navigating to:
|
||||
|
||||
http://localhost:3000
|
||||
|
||||
NOTICE: Access to firebase from localhost has been disabled due to security considerations. To demo our app, please go to https://chatma.ps!
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 5.5 MiB |
|
After Width: | Height: | Size: 4.5 MiB |
|
After Width: | Height: | Size: 4.7 MiB |
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": ["next/core-web-vitals"],
|
||||
"rules": {
|
||||
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
|
||||
"jsx-a11y/alt-text": "off",
|
||||
"@next/next/no-img-element": "off",
|
||||
"no-console": 1,
|
||||
"react-hooks/exhaustive-deps": "off"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Chat } from "../src/components/app/datatypes";
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
var exampleChatObj = {
|
||||
body: "Hello, World!",
|
||||
isSystem: false,
|
||||
timestamp: 1710527946340,
|
||||
user: "TestUser"
|
||||
}
|
||||
|
||||
var exampleUser = {
|
||||
uid: "123456",
|
||||
username: "TestUser",
|
||||
lastOnline: true
|
||||
}
|
||||
|
||||
it('Chat Renders Correctly', () => {
|
||||
const tree = renderer
|
||||
.create((<Chat chatObj={exampleChatObj} user={exampleUser} />))
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ChatRoomSidebar } from "../src/components/app/datatypes";
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
var exampleRoom = {
|
||||
name: "TestRoom",
|
||||
description: "This is a test room.",
|
||||
}
|
||||
|
||||
it('ChatRoomSidebar Renders Correctly', () => {
|
||||
const tree = renderer
|
||||
.create((<ChatRoomSidebar roomObj={exampleRoom} />))
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { DM } from "../src/components/app/friends/dm";
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
var message = "Hello, World! This is a test message. https://www.google.com"
|
||||
|
||||
var exampleUser = {
|
||||
uid: "123456",
|
||||
username: "TestUser",
|
||||
firstName: "Test",
|
||||
lastName: "User",
|
||||
lastOnline: true,
|
||||
pfp: "https://th.bing.com/th/id/OIP.K5VoTfw97JiEc1OBODAjmQHaHO?rs=1&pid=ImgDetMain"
|
||||
}
|
||||
|
||||
var friendObj = {
|
||||
uid: "123456",
|
||||
username: "TestUser",
|
||||
firstName: "Test",
|
||||
lastName: "Friend",
|
||||
lastOnline: true,
|
||||
pfp: "https://th.bing.com/th/id/OIP.K5VoTfw97JiEc1OBODAjmQHaHO?rs=1&pid=ImgDetMain"
|
||||
|
||||
}
|
||||
|
||||
it('RMF Renders Correctly', () => {
|
||||
const tree = renderer
|
||||
.create(<DM user={exampleUser} friendObj={friendObj} />)
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { FirstPage } from "@mui/icons-material";
|
||||
import { Member } from "../src/components/app/datatypes";
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
var exampleChatObj = {
|
||||
body: "Hello, World!",
|
||||
isSystem: false,
|
||||
timestamp: 1710527946340,
|
||||
user: "TestUser"
|
||||
}
|
||||
|
||||
var exampleUser = {
|
||||
uid: "123456",
|
||||
username: "TestUser",
|
||||
firstName: "Test",
|
||||
lastName: "User",
|
||||
lastOnline: true
|
||||
}
|
||||
|
||||
it('Member Renders Correctly', () => {
|
||||
const tree = renderer
|
||||
.create((<Member memberObj={exampleUser} />))
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import { RMF } from "../src/components/app/datatypes";
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
var message = "Hello, World! This is a test message. https://www.google.com"
|
||||
|
||||
it('RMF Renders Correctly', () => {
|
||||
const tree = renderer
|
||||
.create((RMF(message)))
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Chat Renders Correctly 1`] = `
|
||||
<div
|
||||
className="width-[100%] bg-white rounded-lg mt-1 text-left p-1 grid grid-cols-2 mr-2"
|
||||
>
|
||||
<div>
|
||||
<span
|
||||
className="mr-[5px]"
|
||||
style={
|
||||
{
|
||||
"color": "#133337",
|
||||
}
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="hover:font-bold cursor-pointer"
|
||||
href="/user?uid=undefined"
|
||||
onClick={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
>
|
||||
TestUser
|
||||
</a>
|
||||
</span>
|
||||
Hello, World!
|
||||
</div>
|
||||
<div
|
||||
className="text-right text-[#d1d1d1]"
|
||||
>
|
||||
3/15/2024, 2:39:06 PM
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,54 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ChatRoomSidebar Renders Correctly 1`] = `
|
||||
<div
|
||||
className="border-[black] border-1 shadow-lg p-2 m-2 rounded-lg cursor-pointer"
|
||||
>
|
||||
<a
|
||||
href="/chat?room=undefined/TestRoom-undefined"
|
||||
onClick={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
>
|
||||
<div
|
||||
className="grid grid-cols-3"
|
||||
>
|
||||
<div
|
||||
onMouseEnter={[Function]}
|
||||
onMouseLeave={[Function]}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
|
||||
data-testid="PersonIcon"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"
|
||||
/>
|
||||
</svg>
|
||||
<div>
|
||||
0
|
||||
/
|
||||
0
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="col-span-2"
|
||||
>
|
||||
<div
|
||||
className="font-bold"
|
||||
>
|
||||
TestRoom
|
||||
</div>
|
||||
<div
|
||||
className="italic"
|
||||
>
|
||||
This is a test room.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,76 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RMF Renders Correctly 1`] = `
|
||||
<div
|
||||
className="border-[black] border-1 shadow-lg m-2 rounded-lg"
|
||||
>
|
||||
<div
|
||||
className="grid grid-cols-4"
|
||||
>
|
||||
<div
|
||||
className="place-content-center"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium cursor-pointer css-i4bv87-MuiSvgIcon-root"
|
||||
data-testid="ChatIcon"
|
||||
focusable="false"
|
||||
onClick={[Function]}
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M6 9h12v2H6zm8 5H6v-2h8zm4-6H6V6h12z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
className="col-span-3 cursor-pointer"
|
||||
>
|
||||
<div
|
||||
onClick={[Function]}
|
||||
>
|
||||
<div
|
||||
className="grid grid-cols-2 justify-items-center"
|
||||
>
|
||||
<div
|
||||
className="mr-8"
|
||||
>
|
||||
<img
|
||||
className="w-[50px] h-[50px]"
|
||||
src="https://th.bing.com/th/id/OIP.K5VoTfw97JiEc1OBODAjmQHaHO?rs=1&pid=ImgDetMain"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className=""
|
||||
>
|
||||
<div
|
||||
className="font-bold"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="MuiSvgIcon-root MuiSvgIcon-fontSize20px text-lime-600 mr-1 relative top-[-2px] css-821wyw-MuiSvgIcon-root"
|
||||
data-testid="CircleIcon"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"
|
||||
/>
|
||||
</svg>
|
||||
Test
|
||||
|
||||
Friend
|
||||
</div>
|
||||
<div
|
||||
className=""
|
||||
>
|
||||
@
|
||||
TestUser
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,27 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Member Renders Correctly 1`] = `
|
||||
<a
|
||||
href="/user?uid=123456"
|
||||
onClick={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
>
|
||||
<div
|
||||
className="cursor-pointer g-[aliceblue] rounded-lg m-3 shadow-xl p-2"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="MuiSvgIcon-root MuiSvgIcon-fontSize20px text-lime-600 mr-1 relative top-[-1px] css-821wyw-MuiSvgIcon-root"
|
||||
data-testid="CircleIcon"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"
|
||||
/>
|
||||
</svg>
|
||||
TestUser
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RMF Renders Correctly 1`] = `
|
||||
<span
|
||||
className="mr-2"
|
||||
>
|
||||
Hello, World! This is a test message.
|
||||
<img
|
||||
className="max-w-[100%]"
|
||||
src="https://www.google.com"
|
||||
/>
|
||||
</span>
|
||||
`;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.jacsn.chatmaps',
|
||||
appName: 'ChatMaps',
|
||||
webDir: 'out',
|
||||
server: {
|
||||
androidScheme: 'https'
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1,21 @@
|
||||
import { initializeApp, getApps, getApp } from "firebase/app";
|
||||
import { getAuth } from "firebase/auth";
|
||||
import { getDatabase} from "firebase/database"
|
||||
import {getStorage} from "firebase/storage"
|
||||
|
||||
var config = {
|
||||
apiKey: "AIzaSyDbDPjQGt-lIjNPeTG-Q5AECM1m0vtOr2c",
|
||||
authDomain: "chatmaps-3e7fa.firebaseapp.com",
|
||||
projectId: "chatmaps-3e7fa",
|
||||
storageBucket: "chatmaps-3e7fa.appspot.com",
|
||||
messagingSenderId: "771010649524",
|
||||
appId: "1:771010649524:web:b6e66d3457820c817b26e1",
|
||||
databaseURL: "https://chatmaps-3e7fa-default-rtdb.firebaseio.com/",
|
||||
}
|
||||
|
||||
var app = getApps().length > 0 ? getApp() : initializeApp(config);
|
||||
var auth = getAuth(app);
|
||||
var storage = getStorage(app);
|
||||
var database = getDatabase(app);
|
||||
|
||||
export { auth, app, database, storage };
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,204 @@
|
||||
const nextJest = require('next/jest')
|
||||
/**
|
||||
* For a detailed explanation regarding each configuration property, visit:
|
||||
* https://jestjs.io/docs/configuration
|
||||
*/
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
const createJestConfig = nextJest({
|
||||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
|
||||
dir: './',
|
||||
})
|
||||
const config = {
|
||||
testEnvironment: 'jsdom',
|
||||
// All imported modules in your tests should be mocked automatically
|
||||
// automock: false,
|
||||
|
||||
// Stop running tests after `n` failures
|
||||
// bail: 0,
|
||||
|
||||
// The directory where Jest should store its cached dependency information
|
||||
// cacheDirectory: "C:\\Users\\Nick\\AppData\\Local\\Temp\\jest",
|
||||
|
||||
// Automatically clear mock calls, instances, contexts and results before every test
|
||||
clearMocks: true,
|
||||
|
||||
// Indicates whether the coverage information should be collected while executing the test
|
||||
collectCoverage: true,
|
||||
|
||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||
// collectCoverageFrom: undefined,
|
||||
|
||||
// The directory where Jest should output its coverage files
|
||||
coverageDirectory: "coverage",
|
||||
|
||||
// An array of regexp pattern strings used to skip coverage collection
|
||||
// coveragePathIgnorePatterns: [
|
||||
// "\\\\node_modules\\\\"
|
||||
// ],
|
||||
|
||||
// Indicates which provider should be used to instrument code for coverage
|
||||
coverageProvider: "v8",
|
||||
|
||||
// A list of reporter names that Jest uses when writing coverage reports
|
||||
// coverageReporters: [
|
||||
// "json",
|
||||
// "text",
|
||||
// "lcov",
|
||||
// "clover"
|
||||
// ],
|
||||
|
||||
// An object that configures minimum threshold enforcement for coverage results
|
||||
// coverageThreshold: undefined,
|
||||
|
||||
// A path to a custom dependency extractor
|
||||
// dependencyExtractor: undefined,
|
||||
|
||||
// Make calling deprecated APIs throw helpful error messages
|
||||
// errorOnDeprecated: false,
|
||||
|
||||
// The default configuration for fake timers
|
||||
// fakeTimers: {
|
||||
// "enableGlobally": false
|
||||
// },
|
||||
|
||||
// Force coverage collection from ignored files using an array of glob patterns
|
||||
// forceCoverageMatch: [],
|
||||
|
||||
// A path to a module which exports an async function that is triggered once before all test suites
|
||||
// globalSetup: undefined,
|
||||
|
||||
// A path to a module which exports an async function that is triggered once after all test suites
|
||||
// globalTeardown: undefined,
|
||||
|
||||
// A set of global variables that need to be available in all test environments
|
||||
// globals: {},
|
||||
|
||||
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
||||
// maxWorkers: "50%",
|
||||
|
||||
// An array of directory names to be searched recursively up from the requiring module's location
|
||||
// moduleDirectories: [
|
||||
// "node_modules"
|
||||
// ],
|
||||
|
||||
// An array of file extensions your modules use
|
||||
// moduleFileExtensions: [
|
||||
// "js",
|
||||
// "mjs",
|
||||
// "cjs",
|
||||
// "jsx",
|
||||
// "ts",
|
||||
// "tsx",
|
||||
// "json",
|
||||
// "node"
|
||||
// ],
|
||||
|
||||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||
// moduleNameMapper: {},
|
||||
|
||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||
// modulePathIgnorePatterns: [],
|
||||
|
||||
// Activates notifications for test results
|
||||
// notify: false,
|
||||
|
||||
// An enum that specifies notification mode. Requires { notify: true }
|
||||
// notifyMode: "failure-change",
|
||||
|
||||
// A preset that is used as a base for Jest's configuration
|
||||
// preset: undefined,
|
||||
|
||||
// Run tests from one or more projects
|
||||
// projects: undefined,
|
||||
|
||||
// Use this configuration option to add custom reporters to Jest
|
||||
// reporters: undefined,
|
||||
|
||||
// Automatically reset mock state before every test
|
||||
// resetMocks: false,
|
||||
|
||||
// Reset the module registry before running each individual test
|
||||
// resetModules: false,
|
||||
|
||||
// A path to a custom resolver
|
||||
// resolver: undefined,
|
||||
|
||||
// Automatically restore mock state and implementation before every test
|
||||
// restoreMocks: false,
|
||||
|
||||
// The root directory that Jest should scan for tests and modules within
|
||||
// rootDir: undefined,
|
||||
|
||||
// A list of paths to directories that Jest should use to search for files in
|
||||
// roots: [
|
||||
// "<rootDir>"
|
||||
// ],
|
||||
|
||||
// Allows you to use a custom runner instead of Jest's default test runner
|
||||
// runner: "jest-runner",
|
||||
|
||||
// The paths to modules that run some code to configure or set up the testing environment before each test
|
||||
// setupFiles: [],
|
||||
|
||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||
// setupFilesAfterEnv: [],
|
||||
|
||||
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
||||
// slowTestThreshold: 5,
|
||||
|
||||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||
// snapshotSerializers: [],
|
||||
|
||||
// The test environment that will be used for testing
|
||||
// testEnvironment: "jest-environment-node",
|
||||
|
||||
// Options that will be passed to the testEnvironment
|
||||
// testEnvironmentOptions: {},
|
||||
|
||||
// Adds a location field to test results
|
||||
// testLocationInResults: false,
|
||||
|
||||
// The glob patterns Jest uses to detect test files
|
||||
// testMatch: [
|
||||
// "**/__tests__/**/*.[jt]s?(x)",
|
||||
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
||||
// ],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||
// testPathIgnorePatterns: [
|
||||
// "\\\\node_modules\\\\"
|
||||
// ],
|
||||
|
||||
// The regexp pattern or array of patterns that Jest uses to detect test files
|
||||
// testRegex: [],
|
||||
|
||||
// This option allows the use of a custom results processor
|
||||
// testResultsProcessor: undefined,
|
||||
|
||||
// This option allows use of a custom test runner
|
||||
// testRunner: "jest-circus/runner",
|
||||
|
||||
// A map from regular expressions to paths to transformers
|
||||
// transform: undefined,
|
||||
|
||||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||
// transformIgnorePatterns: [
|
||||
// "\\\\node_modules\\\\",
|
||||
// "\\.pnp\\.[^\\\\]+$"
|
||||
// ],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||
// unmockedModulePathPatterns: undefined,
|
||||
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
// verbose: undefined,
|
||||
|
||||
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
||||
// watchPathIgnorePatterns: [],
|
||||
|
||||
// Whether to use watchman for file crawling
|
||||
// watchman: true,
|
||||
};
|
||||
|
||||
module.exports = createJestConfig(config)
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {output: 'export'};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "chatmaps",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "npx serve@latest out",
|
||||
"lint": "next lint",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.24.4",
|
||||
"@babel/preset-env": "^7.24.4",
|
||||
"@babel/preset-react": "^7.24.1",
|
||||
"@capacitor/android": "^5.7.4",
|
||||
"@capacitor/core": "^5.7.4",
|
||||
"@capacitor/geolocation": "^5.0.7",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/styled": "^11.11.5",
|
||||
"@headlessui/react": "^1.7.18",
|
||||
"@mui/icons-material": "^5.15.14",
|
||||
"@mui/material": "^5.15.14",
|
||||
"bad-words": "^3.0.4",
|
||||
"firebase": "^10.6.0",
|
||||
"next": "^14.1.0",
|
||||
"pigeon-maps": "^0.21.3",
|
||||
"react": "^18.2.0",
|
||||
"react-beforeunload": "^2.6.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-firebase-hooks": "^5.1.1",
|
||||
"react-hook-form": "^7.50.1",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"tts-react": "^3.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/assets": "^3.0.5",
|
||||
"@capacitor/cli": "^5.7.4",
|
||||
"@testing-library/jest-dom": "^6.4.2",
|
||||
"@testing-library/react": "^15.0.2",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>User Data Deletion Request</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>User Data Deletion Request</h1>
|
||||
<p>
|
||||
To request the deletion of your user data from our system, please follow the steps below:
|
||||
</p>
|
||||
<ol>
|
||||
<li>Compose an email to <a href="mailto:deletion@chatma.ps">deletion@chatma.ps</a>.</li>
|
||||
<li>In the email subject, write "User Data Deletion Request".</li>
|
||||
<li>In the body of the email, provide the following information:</li>
|
||||
<ul>
|
||||
<li>Your username: [Insert your username here]</li>
|
||||
<li>Your email address associated with the account: [Insert your email address here]</li>
|
||||
</ul>
|
||||
<li>Send the email.</li>
|
||||
</ol>
|
||||
<p>
|
||||
Our team will process your request as soon as possible. Please note that the deletion of your user data may take some time, and we will notify you once it has been completed.
|
||||
</p>
|
||||
<p>
|
||||
If you have any further questions or concerns, please don't hesitate to contact us at <a href="mailto:support@chatma.ps">support@chatma.ps</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 964 B |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"icons": [
|
||||
{
|
||||
"src": "../icons/icon-48.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "48x48",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-72.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "72x72",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-96.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "96x96",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-128.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "128x128",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-192.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-256.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "256x256",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "../icons/icon-512.webp",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
],
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ChatMaps Privacy Policy</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ChatMaps Privacy Policy</h1>
|
||||
|
||||
<p>At ChatMaps, we are committed to protecting your privacy and ensuring the security of your personal information. This privacy policy explains how we collect, use, and safeguard your data when you use our application.</p>
|
||||
|
||||
<h2>Collection of Personal Information</h2>
|
||||
|
||||
<p>ChatMaps requires access to your location in order to provide you with location-based services. However, we do not share, sell, or disclose your personal data to any third party.</p>
|
||||
|
||||
<h2>Child Safety</h2>
|
||||
|
||||
<p>ChatMaps is fully compliant with online child safety laws. We do not knowingly collect personal information from children under the age of 13. If you believe that we have inadvertently collected personal information from a child, please contact us immediately so that we can take appropriate action.</p>
|
||||
|
||||
<h2>Data Security</h2>
|
||||
|
||||
<p>We take the security of your personal information seriously. We implement industry-standard security measures to protect your data from unauthorized access, alteration, or disclosure.</p>
|
||||
|
||||
<h2>Changes to this Privacy Policy</h2>
|
||||
|
||||
<p>We reserve the right to update or modify this privacy policy at any time. Any changes will be effective immediately upon posting the updated policy on our website.</p>
|
||||
|
||||
<h2>Contact Us</h2>
|
||||
|
||||
<p>If you have any questions or concerns about our privacy policy, please contact us at privacy@chatma.ps .</p>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 173 KiB |
@@ -0,0 +1,17 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "../globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata = {
|
||||
title: "ChatMaps: Home",
|
||||
description: "ChatMaps: Social Media for College Students",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<main className={inter.className}>
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
"use client";
|
||||
// System Imports
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
// Dependencies
|
||||
import Drawer from '@mui/material/Drawer';
|
||||
|
||||
// Firebase Imports
|
||||
import { auth, database } from "../../../firebase-config";
|
||||
import { ref, onValue, set } from "firebase/database";
|
||||
import { useAuthState } from "react-firebase-hooks/auth"
|
||||
|
||||
// Component Imports
|
||||
import { Header } from "../../components/app/header";
|
||||
import { HomePage } from "../../components/app/page/home";
|
||||
import { Sidebar } from "../../components/app/sidebar/home";
|
||||
import {useWindowSize} from "../../components/app/datatypes";
|
||||
|
||||
// Capacitor Import
|
||||
import { Geolocation } from '@capacitor/geolocation';
|
||||
|
||||
/**
|
||||
* Contains most everything for the app homepage
|
||||
* @returns {Object} Home Page
|
||||
*/
|
||||
function Home() {
|
||||
// State variables for app page
|
||||
const [user, setUser] = useState(null); // user data
|
||||
const [loadingLoc, setLoadingLoc] = useState(true); // location variable loading, true = loading, false = finished loading
|
||||
const [authUser, authLoading] = useAuthState(auth) // auth user object (used to obtain other user object)
|
||||
const [drawerOpen, setDrawerOpen] = useState(true); // drawer open state
|
||||
const [coords, setCoords] = useState(null)
|
||||
|
||||
var windowSize = useWindowSize()
|
||||
useEffect(() => {
|
||||
if (windowSize.width < 767) {
|
||||
setDrawerOpen(false)
|
||||
} else {
|
||||
setDrawerOpen(true)
|
||||
}
|
||||
}, [windowSize])
|
||||
|
||||
// Authentication Verification / Redirection if Profile Data not Filled out
|
||||
useEffect(() => {
|
||||
if (authUser && authLoading === false) {
|
||||
onValue(ref(database, `users/${authUser.uid}`), (userData) => {
|
||||
userData = userData.val();
|
||||
if (userData) {
|
||||
setUser(userData);
|
||||
} else {
|
||||
window.location.href = "/onboarding";
|
||||
}
|
||||
});
|
||||
} else if (authLoading === false) {
|
||||
window.location.href = "/login";
|
||||
}
|
||||
}, [authLoading])
|
||||
|
||||
useEffect(() => {
|
||||
Geolocation.getCurrentPosition().then((position) => {
|
||||
setCoords(position.coords);
|
||||
setLoadingLoc(false);
|
||||
});
|
||||
}, [])
|
||||
|
||||
// Saves users last loc to profile for friends map
|
||||
useEffect(() => {
|
||||
if (coords && user) {
|
||||
set(ref(database,`users/${user.uid}/location`), {
|
||||
latitude: coords.latitude,
|
||||
longitude: coords.longitude
|
||||
})
|
||||
}
|
||||
}, [coords, user])
|
||||
|
||||
return (
|
||||
<div className="overflow-hidden h-dvh">
|
||||
{user && (
|
||||
<div className="overflow-hidden h-dvh">
|
||||
{/* Left Side of Page */}
|
||||
<div className="overflow-hidden h-dvh md:mr-[405px]">
|
||||
{/* Header */}
|
||||
<Header
|
||||
mainTab={"home"}
|
||||
user={user}
|
||||
sidebarControl={() => {setDrawerOpen(!drawerOpen)}}
|
||||
/>
|
||||
{/* Main Page Section */}
|
||||
<div className="mr-2 h-[calc(100%-110px)]">
|
||||
{!loadingLoc && (
|
||||
<HomePage loc={coords} user={user} />
|
||||
)}
|
||||
{loadingLoc && (
|
||||
<HomePage loc={null} user={user} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* Sidebar (Right Side of Page) */}
|
||||
<Drawer open={drawerOpen} anchor={"right"} variant={windowSize.width > 767? "persistent": "temporary"} onClose={() => {setDrawerOpen(false)}} sx={{
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
marginTop: 10,
|
||||
flexShrink: 0,
|
||||
'& .MuiDrawer-paper': {
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
borderLeft: 0,
|
||||
},
|
||||
}}>
|
||||
<div className="shadow-2xl">
|
||||
<Sidebar user={user} location={coords} loadingLoc={loadingLoc}/>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "../globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata = {
|
||||
title: "ChatMaps: Chat",
|
||||
description: "ChatMaps: Social Media for College Students",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<main className={inter.className}>
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
"use client";
|
||||
// System Imports
|
||||
import Drawer from '@mui/material/Drawer';
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
// Firebase Imports
|
||||
import { auth, database } from "../../../firebase-config";
|
||||
import { ref, onValue, set, onDisconnect} from "firebase/database";
|
||||
import { useAuthState } from "react-firebase-hooks/auth"
|
||||
|
||||
// Component Imports
|
||||
import { Header } from "../../components/app/header";
|
||||
import { ChatRoom } from "../../components/app/page/chat";
|
||||
import { Sidebar } from "../../components/app/sidebar/chat";
|
||||
import {useWindowSize} from "../../components/app/datatypes";
|
||||
|
||||
|
||||
/**
|
||||
* Chat Page
|
||||
* @returns {Object} Chat Page
|
||||
*/
|
||||
function Chat() {
|
||||
// State variables for chat page
|
||||
const [user, setUser] = useState(null); // user data
|
||||
const [chatRoomObj, setChatRoomObj] = useState(null); // Current chatroom object
|
||||
const [doneLoading, setDoneLoading] = useState(false) // is the page done loading or not
|
||||
const [authUser, authLoading] = useAuthState(auth) // auth user object (used to obtain other user object)
|
||||
const [drawerOpen, setDrawerOpen] = useState(true); // drawer open state
|
||||
|
||||
var windowSize = useWindowSize()
|
||||
useEffect(() => {
|
||||
if (windowSize.width < 767) {
|
||||
setDrawerOpen(false)
|
||||
} else {
|
||||
setDrawerOpen(true)
|
||||
}
|
||||
}, [windowSize])
|
||||
|
||||
// Authentication Verification / Redirection if Profile Data not Filled out
|
||||
useEffect(() => {
|
||||
if (authUser && authLoading === false && !user) {
|
||||
onValue(ref(database, `users/${authUser.uid}`),(userData) => {
|
||||
userData = userData.val();
|
||||
if (userData) {
|
||||
setUser(userData);
|
||||
} else {
|
||||
window.location.href = "/onboarding";
|
||||
}
|
||||
});
|
||||
} else if (authLoading === false) {
|
||||
window.location.href = "/login";
|
||||
}
|
||||
}, [authLoading])
|
||||
|
||||
// Users URL params to load proper chatroom, then logs the user into that room
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
const searchParams = new URLSearchParams(document.location.search);
|
||||
var path = searchParams.get("room")
|
||||
|
||||
/*// Send entered message
|
||||
var payload = {
|
||||
body: "entered",
|
||||
user: user.username,
|
||||
isSystem: true,
|
||||
timestamp: new Date().getTime(),
|
||||
uid: user.uid,
|
||||
};
|
||||
set(
|
||||
ref(
|
||||
database,
|
||||
`/rooms/${path}/chats/${new Date().getTime()}-${user.username}`
|
||||
),
|
||||
payload
|
||||
);*/
|
||||
|
||||
// Add user to online for room
|
||||
set(ref(database, `/rooms/${path}/users/online/${user.uid}`), user)
|
||||
|
||||
// Removes user from room on disconnect (reload, window close, internet lost)
|
||||
onDisconnect(ref(database, `/rooms/${path}/users/online/${user.uid}`)).remove()
|
||||
|
||||
// Sends leaving message on disconnect (Timestamp function used due to new onDisconnect stuff)
|
||||
/*someRef = ref(database, `/rooms/${path}/chats/${new Date().getTime()}-${user.username}`)
|
||||
onDisconnect(someRef).set({
|
||||
body: "left",
|
||||
user: user.username,
|
||||
isSystem: true,
|
||||
timestamp: serverTimestamp(),
|
||||
uid: user.uid,
|
||||
})*/
|
||||
|
||||
// Room Object Load
|
||||
onValue(ref(database, `/rooms/${path}`), (roomData) => {
|
||||
roomData = roomData.val();
|
||||
setChatRoomObj(roomData)
|
||||
if (!doneLoading) {
|
||||
setDoneLoading(true)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{(authUser && doneLoading) && (
|
||||
<div className="overflow-hidden h-dvh">
|
||||
{/* Left Side of Page */}
|
||||
<div className="overflow-hidden h-dvh md:mr-[400px]">
|
||||
{/* Header */}
|
||||
<Header
|
||||
mainTab={"chat"}
|
||||
chatRoomObj={chatRoomObj}
|
||||
user={user}
|
||||
sidebarControl={() => {setDrawerOpen(!drawerOpen)}}
|
||||
/>
|
||||
{/* Main Page Section */}
|
||||
<div className="mr-2 h-[calc(100%-110px)]">
|
||||
<ChatRoom roomObj={chatRoomObj} user={user} />
|
||||
</div>
|
||||
</div>
|
||||
{/* Sidebar (Right Side of Page) */}
|
||||
<Drawer open={drawerOpen} anchor={"right"} variant={windowSize.width > 767? "persistent": "temporary"} onClose={() => {setDrawerOpen(false)}} sx={{
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
marginTop: 10,
|
||||
flexShrink: 0,
|
||||
'& .MuiDrawer-paper': {
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
borderLeft: 0,
|
||||
},
|
||||
}}>
|
||||
<div className="shadow-2xl">
|
||||
<Sidebar chatRoomObj={chatRoomObj}/>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Chat;
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "../globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata = {
|
||||
title: "ChatMaps: DM",
|
||||
description: "ChatMaps: Social Media for College Students",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<main className={inter.className}>
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
"use client";
|
||||
// System Imports
|
||||
import Drawer from '@mui/material/Drawer';
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
// Firebase Imports
|
||||
import { auth, database } from "../../../firebase-config";
|
||||
import { ref, onValue, set, onDisconnect} from "firebase/database";
|
||||
import { useAuthState } from "react-firebase-hooks/auth"
|
||||
|
||||
// Component Imports
|
||||
import { Header } from "../../components/app/header";
|
||||
import { DMRoom } from "../../components/app/friends/page";
|
||||
import { Sidebar } from "../../components/app/sidebar/dm";
|
||||
import {useWindowSize} from "../../components/app/datatypes";
|
||||
|
||||
|
||||
/**
|
||||
* DM Page
|
||||
* @returns {Object} Chat Page
|
||||
*/
|
||||
function Chat() {
|
||||
// State variables for chat page
|
||||
const [user, setUser] = useState(null); // user data
|
||||
const [chatRoomObj, setChatRoomObj] = useState(null); // Current chatroom object
|
||||
const [doneLoading, setDoneLoading] = useState(false) // is the page done loading or not
|
||||
const [authUser, authLoading] = useAuthState(auth) // auth user object (used to obtain other user object)
|
||||
const [drawerOpen, setDrawerOpen] = useState(true); // drawer open state
|
||||
const [isUserAuthed, setIsUserAuthed] = useState(false); // is the user authenticated or not
|
||||
|
||||
var windowSize = useWindowSize()
|
||||
useEffect(() => {
|
||||
if (windowSize.width < 767) {
|
||||
setDrawerOpen(false)
|
||||
} else {
|
||||
setDrawerOpen(true)
|
||||
}
|
||||
}, [windowSize])
|
||||
|
||||
// Authentication Verification / Redirection if Profile Data not Filled out
|
||||
useEffect(() => {
|
||||
if (authUser && authLoading === false) {
|
||||
onValue(ref(database, `users/${authUser.uid}`), (userData) => {
|
||||
userData = userData.val();
|
||||
if (userData) {
|
||||
setUser(userData);
|
||||
} else {
|
||||
window.location.href = "/onboarding";
|
||||
}
|
||||
});
|
||||
} else if (authLoading === false) {
|
||||
window.location.href = "/login";
|
||||
}
|
||||
}, [authLoading])
|
||||
|
||||
// Users URL params to load proper chatroom, then logs the user into that room
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
const searchParams = new URLSearchParams(document.location.search);
|
||||
var path = searchParams.get("dm")
|
||||
if (path.includes(user.uid)) {
|
||||
setIsUserAuthed(true)
|
||||
} else {
|
||||
location.href = "/app"
|
||||
}
|
||||
/*// Send entered message
|
||||
var payload = {
|
||||
body: "entered",
|
||||
user: user.username,
|
||||
isSystem: true,
|
||||
timestamp: new Date().getTime(),
|
||||
uid: user.uid,
|
||||
};
|
||||
set(
|
||||
ref(
|
||||
database,
|
||||
`/rooms/${path}/chats/${new Date().getTime()}-${user.username}`
|
||||
),
|
||||
payload
|
||||
);*/
|
||||
|
||||
// Add user to online for room
|
||||
set(ref(database, `/dms/${path}/users/online/${user.uid}`), user)
|
||||
|
||||
// Removes user from room on disconnect (reload, window close, internet lost)
|
||||
onDisconnect(ref(database, `/dms/${path}/users/online/${user.uid}`)).remove()
|
||||
|
||||
// Sends leaving message on disconnect (Timestamp function used due to new onDisconnect stuff)
|
||||
/*someRef = ref(database, `/rooms/${path}/chats/${new Date().getTime()}-${user.username}`)
|
||||
onDisconnect(someRef).set({
|
||||
body: "left",
|
||||
user: user.username,
|
||||
isSystem: true,
|
||||
timestamp: serverTimestamp(),
|
||||
uid: user.uid,
|
||||
})*/
|
||||
|
||||
// Room Object Load
|
||||
onValue(ref(database, `/dms/${path}`), (roomData) => {
|
||||
roomData = roomData.val();
|
||||
setChatRoomObj(roomData)
|
||||
if (!doneLoading) {
|
||||
setDoneLoading(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{(authUser && doneLoading && isUserAuthed) && (
|
||||
<div className="overflow-hidden h-dvh">
|
||||
{/* Left Side of Page */}
|
||||
<div className="overflow-hidden h-dvh md:mr-[400px]">
|
||||
{/* Header */}
|
||||
<Header
|
||||
mainTab={"dm"}
|
||||
chatRoomObj={chatRoomObj}
|
||||
user={user}
|
||||
sidebarControl={() => {setDrawerOpen(!drawerOpen)}}
|
||||
/>
|
||||
{/* Main Page Section */}
|
||||
<div className="mr-2 h-[calc(100%-110px)]">
|
||||
<DMRoom roomObj={chatRoomObj} user={user} />
|
||||
</div>
|
||||
</div>
|
||||
{/* Sidebar (Right Side of Page) */}
|
||||
<Drawer open={drawerOpen} anchor={"right"} variant={windowSize.width > 767? "persistent": "temporary"} onClose={() => {setDrawerOpen(false)}} sx={{
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
marginTop: 10,
|
||||
flexShrink: 0,
|
||||
'& .MuiDrawer-paper': {
|
||||
width: windowSize.width > 767? 400: "80%",
|
||||
borderLeft: 0,
|
||||
},
|
||||
}}>
|
||||
<div className="shadow-2xl">
|
||||
<Sidebar chatRoomObj={chatRoomObj} user={user}/>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Chat;
|
||||
@@ -0,0 +1,36 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
body {
|
||||
background-color: aliceblue;
|
||||
text-align: center;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #dee0e0;
|
||||
border-color: black;
|
||||
border: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: rgb(166, 166, 166);
|
||||
}
|
||||
|
||||
input {
|
||||
border: 1px solid black;
|
||||
border-radius: 4px;
|
||||
padding: 10px 10px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
input.err {
|
||||
border: 2px solid red;
|
||||
border-radius: 4px;
|
||||
padding: 10px 10px;
|
||||
margin: 5px;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata = {
|
||||
title: "ChatMaps",
|
||||
description: "ChatMaps: Social Media for College Students",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "../globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata = {
|
||||
title: "ChatMaps: Login",
|
||||
description: "ChatMaps: Social Media for College Students",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<main className={inter.className}>
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
"use client";
|
||||
// System Imports
|
||||
import "../globals.css";
|
||||
import { useForm, Form } from "react-hook-form";
|
||||
import Link from "next/link"
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
// Firebase Imports
|
||||
import { auth } from "../../../firebase-config";
|
||||
import {setPersistence,signInWithEmailAndPassword,indexedDBLocalPersistence } from "firebase/auth";
|
||||
|
||||
/**
|
||||
* Login Page
|
||||
* @returns {Object} Login Page
|
||||
*/
|
||||
function Login() {
|
||||
var router = useRouter();
|
||||
var {register,control,setError,reset,formState: { errors, isSubmitting, isSubmitted },} = useForm();
|
||||
|
||||
/**
|
||||
* Logs into Firebase authentication
|
||||
* @param {JSON} data - User Login Data (data.email, data.password)
|
||||
* @returns {void}
|
||||
*/
|
||||
function authenticate({data}) {
|
||||
setPersistence(auth, indexedDBLocalPersistence).then(() => {
|
||||
signInWithEmailAndPassword(auth, data.email, data.password).then(
|
||||
(userCredential) => {
|
||||
if (userCredential.user) {
|
||||
router.push("/app");
|
||||
}
|
||||
}
|
||||
).catch((error) => {
|
||||
if (error == "auth/invalid-credential") {
|
||||
const formError = {
|
||||
type: "server",
|
||||
message: "Username or Password Incorrect",
|
||||
};
|
||||
// set same error in both:
|
||||
setError("password", formError);
|
||||
setError("email", formError);
|
||||
reset(data,{keepErrors: true})
|
||||
} else {
|
||||
const formError = {
|
||||
type: "server",
|
||||
message: "Server Error, Please try again later.",
|
||||
};
|
||||
// set same error in both:
|
||||
setError("password", formError);
|
||||
setError("email", formError);
|
||||
reset(data,{keepErrors: true})
|
||||
}
|
||||
// ..
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="grid h-screen place-items-center">
|
||||
<div>
|
||||
<Link href="/">
|
||||
<img src="logos/logo_transparent_inverse.png" />
|
||||
</Link>
|
||||
<span className="text-[36px]">Chat with friends!</span>
|
||||
<div>
|
||||
<h3 className="text-[24px] mt-[25px] mb-2">Login</h3>
|
||||
{errors.email && errors.password && (
|
||||
<div className="text-[red] mb-2 text-[18px] text-bold">
|
||||
Invalid Email or Password.
|
||||
</div>
|
||||
)}
|
||||
<Form
|
||||
onSubmit={authenticate}
|
||||
encType={"application/json"}
|
||||
control={control}
|
||||
>
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
className={errors.email && errors.password && "err"}
|
||||
{...register("email", { required: true })}
|
||||
placeholder="Enter Email Address"
|
||||
/>
|
||||
<br />
|
||||
<input
|
||||
type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
className={errors.email && errors.password && "err"}
|
||||
{...register("password", { required: true })}
|
||||
placeholder="Enter Password"
|
||||
/>
|
||||
<br />
|
||||
<button
|
||||
type="submit"
|
||||
className="inline-flex items-center transition ease-in-out duration-150 m-5 bg-cyan-500 text-white font-bold py-2 px-4 rounded-full"
|
||||
>
|
||||
{(isSubmitting || isSubmitted) && (
|
||||
<span className="inline-block">
|
||||
<svg
|
||||
className="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<circle
|
||||
className="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
strokeWidth="4"
|
||||
></circle>
|
||||
<path
|
||||
className="opacity-75"
|
||||
fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||
></path>
|
||||
</svg>
|
||||
</span>
|
||||
)}
|
||||
Log In
|
||||
</button>
|
||||
<br />
|
||||
Need an account? <Link href="/register">Sign Up</Link>
|
||||
<br />
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Login;
|
||||