Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
22206ce
Setting up GitHub Classroom Feedback
github-classroom[bot] Mar 1, 2025
4e0f7a2
add deadline
github-classroom[bot] Mar 1, 2025
40f761d
contributions backend and hook
jessicayzhao Mar 12, 2025
7427d65
contributions visual
khushikhan0 Mar 14, 2025
98ec697
tests and connect backend
jessicayzhao Mar 14, 2025
4dbfcdc
removed timeframe logic and linked backend
jessicayzhao Mar 14, 2025
1c8ec22
accurate months and colored grids by contributions
jessicayzhao Mar 14, 2025
817a2bd
tooltip description
jessicayzhao Mar 14, 2025
4a435f8
color key change
jessicayzhao Mar 14, 2025
66f77a3
total contributions bug fix
jessicayzhao Mar 15, 2025
6ba6481
communities backend and test
jessicayzhao Mar 15, 2025
c4a76c5
changed routes
jessicayzhao Mar 15, 2025
4907be6
removed a console log debug
jessicayzhao Mar 16, 2025
8bce34d
tooltip cut off bug fix
jessicayzhao Mar 17, 2025
74b3cdd
Merge pull request #2 from neu-cs4530/contributions_visual
jessicayzhao Mar 17, 2025
5bff05e
merge conflict
jessicayzhao Mar 17, 2025
e9bc6ca
add name, description, questions list to community backend
jessicayzhao Mar 18, 2025
e3b6c9c
can only become moderator if already member
jessicayzhao Mar 18, 2025
cdd8765
Update README.md
jessicayzhao Mar 18, 2025
c34c031
merge
jessicayzhao Mar 18, 2025
6d530c5
very simple starter code for leaderboard
khushikhan0 Mar 20, 2025
958575a
gamer types, schema, and model
khushikhan0 Mar 20, 2025
23c608e
allcommunity hook, components, client service
saanvi-vutukur Mar 23, 2025
9be3670
fixed tsx files
saanvi-vutukur Mar 23, 2025
bb0c229
community frontend services
jessicayzhao Mar 23, 2025
64ef588
remove
jessicayzhao Mar 23, 2025
00b4fdb
add communities to sidebar
jessicayzhao Mar 23, 2025
0f51294
addcommunity hook
jessicayzhao Mar 23, 2025
49c81fe
addCommunityForm
saanvi-vutukur Mar 23, 2025
cb7dad4
addCommunity in allCommunities
saanvi-vutukur Mar 23, 2025
6c42c19
community privacy checkbox
saanvi-vutukur Mar 23, 2025
9eeb859
Merge branch 'main' of github.com:neu-cs4530/spring25-team-project-sp…
khushikhan0 Mar 24, 2025
2ca127e
communityView not showing on frontend
saanvi-vutukur Mar 25, 2025
2d32e22
communityView
saanvi-vutukur Mar 25, 2025
7b528d2
controller
g-collab4 Mar 26, 2025
d06a23a
controller p2
g-collab4 Mar 26, 2025
99b7457
form, grid, some backend, lots
saanvi-vutukur Mar 27, 2025
02a49db
fixed typo
saanvi-vutukur Mar 27, 2025
f23de8e
prettier
jessicayzhao Mar 27, 2025
bf7443b
lint
jessicayzhao Mar 27, 2025
4a63b6a
p3
g-collab4 Mar 27, 2025
30cbd53
fixed duplicate rendeing error
saanvi-vutukur Mar 27, 2025
fa58e84
add question to community
jessicayzhao Mar 27, 2025
c9a2016
form
saanvi-vutukur Mar 27, 2025
6679a27
gamer controller and services files
khushikhan0 Mar 27, 2025
c8bd54a
private comm works
saanvi-vutukur Mar 27, 2025
9013e66
private icon
saanvi-vutukur Mar 27, 2025
3326ce7
service + controller tests passing??
g-collab4 Mar 27, 2025
9af9f43
fixed updateGamer functions mistake to make sure it takes in any kind…
khushikhan0 Mar 27, 2025
1bcb3e9
get community questions
jessicayzhao Mar 27, 2025
f63ae4b
frontend hook + services
g-collab4 Mar 27, 2025
3b15a3e
findbyid bug
jessicayzhao Mar 27, 2025
4bcd69d
possible leaderboard changes (buggy)
khushikhan0 Mar 27, 2025
7c2aa1e
fixed controller and service issue, added more tests and reran everyt…
khushikhan0 Mar 28, 2025
db3d63b
fixed prettier problems
khushikhan0 Mar 28, 2025
389d280
fixing prettier problems
khushikhan0 Mar 28, 2025
f188e60
frontend
g-collab4 Mar 29, 2025
a77b95b
star location fix
g-collab4 Mar 29, 2025
9e277ed
prettier fix
g-collab4 Mar 29, 2025
cd21262
joined button
saanvi-vutukur Mar 29, 2025
cb2f445
communityPage header
saanvi-vutukur Mar 29, 2025
731e924
lint
jessicayzhao Mar 29, 2025
9ce7af6
Merge pull request #3 from neu-cs4530/communities
jessicayzhao Mar 29, 2025
a2eb26d
Merge branch 'main' into starred_posts
jessicayzhao Mar 30, 2025
15d4a00
Merge branch 'main' into wip-leaderboard
jessicayzhao Mar 30, 2025
9866dae
Merge pull request #5 from neu-cs4530/wip-leaderboard
khushikhan0 Mar 30, 2025
9d506db
Merge branch 'main' into starred_posts
g-collab4 Mar 30, 2025
c75c57f
aggregate notification posts
jessicayzhao Mar 30, 2025
9884cc5
user/mod list comm page
saanvi-vutukur Mar 30, 2025
1e626ab
im confused
jessicayzhao Mar 30, 2025
83bc1cc
findOne by communityId instead of findById
jessicayzhao Mar 30, 2025
39a0a92
communityId in question service
jessicayzhao Mar 30, 2025
3d63ed8
revert to _id
jessicayzhao Mar 31, 2025
18c97ef
request to join
saanvi-vutukur Mar 31, 2025
01416e8
Update index.tsx
g-collab4 Mar 31, 2025
8254080
Update starButton.tsx
g-collab4 Mar 31, 2025
43a0367
form fixed
saanvi-vutukur Mar 31, 2025
8fd6c82
promote mod
saanvi-vutukur Mar 31, 2025
702cc6d
community question feed
jessicayzhao Mar 31, 2025
9734689
merge
jessicayzhao Mar 31, 2025
34b68c9
better promotemod
saanvi-vutukur Mar 31, 2025
96cc1fb
prettier
saanvi-vutukur Mar 31, 2025
bb67c38
schema code added
khushikhan0 Mar 31, 2025
e782046
changed the schema and made the model and types
khushikhan0 Mar 31, 2025
f058417
member request hook
jessicayzhao Mar 31, 2025
b9f7582
setCommunity in hook
jessicayzhao Mar 31, 2025
ff9a6b9
pending member request
jessicayzhao Mar 31, 2025
f90e814
rerender button
jessicayzhao Mar 31, 2025
474d835
communities finishedgit add .
saanvi-vutukur Mar 31, 2025
63e80fe
lint
jessicayzhao Mar 31, 2025
44b1d03
rerender join
jessicayzhao Mar 31, 2025
31e73f8
Most of the service functions are done, types are defined, model and …
khushikhan0 Mar 31, 2025
53ea9d5
Merge pull request #6 from neu-cs4530/starred_posts
g-collab4 Mar 31, 2025
64cb084
Merge pull request #7 from neu-cs4530/community-pages
jessicayzhao Mar 31, 2025
ca1097f
lint
jessicayzhao Mar 31, 2025
770cb2b
finished service files
khushikhan0 Apr 1, 2025
b68811d
completed controller file
khushikhan0 Apr 1, 2025
9907bb1
changed controller file
khushikhan0 Apr 1, 2025
98e1d3a
merge
jessicayzhao Apr 1, 2025
0eeb0aa
my community page
saanvi-vutukur Apr 1, 2025
a90a9af
sidebar for commpage
saanvi-vutukur Apr 1, 2025
d026432
my community page
saanvi-vutukur Apr 1, 2025
888c570
sidebar for commpage
saanvi-vutukur Apr 1, 2025
df7f500
working on backend tests
khushikhan0 Apr 1, 2025
473f638
shortcut frontend service files, shortcut component design in profile…
khushikhan0 Apr 2, 2025
a5b785a
KEYBOARD SHORTCUTS WORK!!!!!!!!!!!!!!!!!
khushikhan0 Apr 2, 2025
0fcfb29
removed some files that were no longer needed
khushikhan0 Apr 2, 2025
e687052
cleaning up files
khushikhan0 Apr 2, 2025
404ee66
Merge branch 'main' into keeb-shortcuts
khushikhan0 Apr 2, 2025
5f4bd7a
backend + tests
jessicayzhao Apr 3, 2025
1fb9405
Merge pull request #9 from neu-cs4530/keeb-shortcuts
khushikhan0 Apr 3, 2025
f5c8af9
Merge branch 'main' into notifications_backend
jessicayzhao Apr 3, 2025
5b8c392
added markdown functionality to questions
khushikhan0 Apr 3, 2025
ef9dbec
pushing all changes
khushikhan0 Apr 3, 2025
6ea8516
Merge pull request #8 from neu-cs4530/notifications_backend
jessicayzhao Apr 6, 2025
318642b
merge with main
jessicayzhao Apr 6, 2025
c615167
icon + cleaner nav
saanvi-vutukur Apr 6, 2025
e21cf48
strikethrough, tables, inline code, block code, and quotes all work now
khushikhan0 Apr 6, 2025
f6b6976
Merge branch 'markdown' of github.com:neu-cs4530/spring25-team-projec…
khushikhan0 Apr 6, 2025
c73e43e
Merge pull request #10 from neu-cs4530/markdown
khushikhan0 Apr 6, 2025
87be3b0
navbar and icon
saanvi-vutukur Apr 6, 2025
0ec061a
my community page
saanvi-vutukur Apr 1, 2025
7aefd6a
sidebar for commpage
saanvi-vutukur Apr 1, 2025
2d92d02
icon + cleaner nav
saanvi-vutukur Apr 6, 2025
c72ea21
janky toggle
saanvi-vutukur Apr 7, 2025
06ad102
cleaner nav
saanvi-vutukur Apr 7, 2025
81f8d74
Merge pull request #11 from neu-cs4530/community-pages
saanvi-vutukur Apr 7, 2025
84102b7
controller tests
jessicayzhao Apr 7, 2025
6b5c72d
toggle and styling
saanvi-vutukur Apr 7, 2025
b18fc95
toggle mostly worksgit add . and logo
saanvi-vutukur Apr 7, 2025
4e381b1
Merge branch 'main' into dark_mode
saanvi-vutukur Apr 7, 2025
557062b
Merge pull request #13 from neu-cs4530/dark_mode
saanvi-vutukur Apr 7, 2025
170e974
automated search bar + service test
saanvi-vutukur Apr 7, 2025
2864940
community service tests
jessicayzhao Apr 7, 2025
32202c9
get community question controller tests
jessicayzhao Apr 7, 2025
467ad23
community question service test
jessicayzhao Apr 7, 2025
a628ad1
Merge pull request #12 from neu-cs4530/communities_tests
jessicayzhao Apr 7, 2025
ec7a58b
prettier
saanvi-vutukur Apr 7, 2025
d0f6d9a
Merge pull request #14 from neu-cs4530/search_suggestions
saanvi-vutukur Apr 7, 2025
f6c2578
cleaner darkmode
saanvi-vutukur Apr 8, 2025
582bfa2
Merge branch 'main' into ui_fixes
saanvi-vutukur Apr 8, 2025
267f774
Merge pull request #15 from neu-cs4530/ui_fixes
saanvi-vutukur Apr 8, 2025
09663a7
nim daily steak
jessicayzhao Apr 8, 2025
812728f
visual fix
jessicayzhao Apr 8, 2025
cfa039c
tests
jessicayzhao Apr 8, 2025
cade377
Merge pull request #16 from neu-cs4530/nim_streak
jessicayzhao Apr 8, 2025
21ac8ee
aggregate leaderboard
jessicayzhao Apr 8, 2025
b357454
shortcut fix for all/my communities
jessicayzhao Apr 8, 2025
8446b6e
home page **index.tsx file being rewritten now
g-collab4 Apr 8, 2025
aa4fdfe
final darkmode ui
saanvi-vutukur Apr 8, 2025
6b8e37f
Merge pull request #19 from neu-cs4530/ui-fixes2
saanvi-vutukur Apr 8, 2025
e6f1353
index.tsx still being fixed
g-collab4 Apr 8, 2025
0f8e1f7
DONE
g-collab4 Apr 8, 2025
8a1ed5a
Merge pull request #18 from neu-cs4530/shortcuts-community
jessicayzhao Apr 8, 2025
fc50227
Merge pull request #17 from neu-cs4530/nim_leaderboard
jessicayzhao Apr 8, 2025
54c7260
fixed routes at least https://x.com/acervomanga/status/15179483663653…
g-collab4 Apr 8, 2025
ef184ad
nim popup + ui fixes
saanvi-vutukur Apr 8, 2025
c0dca08
tag ui and bug fix
jessicayzhao Apr 9, 2025
232960b
Merge pull request #20 from neu-cs4530/tag_bug
jessicayzhao Apr 9, 2025
0d732f1
again
g-collab4 Apr 9, 2025
250f911
Merge branch 'main' into homepage
jessicayzhao Apr 9, 2025
0ecece9
renaming route
g-collab4 Apr 9, 2025
24fb93b
notification backend bug fixes
jessicayzhao Apr 9, 2025
006bc8c
notification in homepage
jessicayzhao Apr 9, 2025
ccded8f
patch
jessicayzhao Apr 9, 2025
1647e62
Update README.md
jessicayzhao Apr 9, 2025
004ce9f
star issues
g-collab4 Apr 9, 2025
5ea1939
Merge pull request #22 from neu-cs4530/nimgame_popup
saanvi-vutukur Apr 9, 2025
13a8dfd
starred posts
jessicayzhao Apr 9, 2025
416355a
Merge branch 'main' into homepage
jessicayzhao Apr 9, 2025
fc0c675
test fix
jessicayzhao Apr 9, 2025
ae4f509
lint
jessicayzhao Apr 9, 2025
6a65d5e
Merge pull request #21 from neu-cs4530/homepage
jessicayzhao Apr 9, 2025
ac93885
homepage ui
jessicayzhao Apr 9, 2025
07e9cae
colors
jessicayzhao Apr 9, 2025
3e8096e
Merge pull request #23 from neu-cs4530/homepage_ui
jessicayzhao Apr 9, 2025
f7875b9
Update README.md
jessicayzhao Apr 9, 2025
e5819a0
Add files via upload
jessicayzhao Apr 9, 2025
f9b9f6e
fixed settings ............
khushikhan0 Apr 9, 2025
619554c
fixed lint
khushikhan0 Apr 9, 2025
9225b56
set notifications'
jessicayzhao Apr 9, 2025
c25bc1e
merge
jessicayzhao Apr 9, 2025
d910dc5
toggle text
jessicayzhao Apr 9, 2025
7c30e16
Merge pull request #24 from neu-cs4530/final-profile-settings
jessicayzhao Apr 9, 2025
82f4949
voice stuff
g-collab4 Apr 9, 2025
35dc7ca
route error
jessicayzhao Apr 9, 2025
51de2bc
voice stuff
g-collab4 Apr 9, 2025
ce83b05
Merge pull request #25 from neu-cs4530/voice_input
g-collab4 Apr 9, 2025
1cfdcd9
settings in profile
jessicayzhao Apr 9, 2025
fbca32d
Update README.md
khushikhan0 Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 64 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/fE-a_qEp)
The individual and team project for this class are designed to mirror the experiences of a software engineer joining a new development team: you will be “onboarded” to our codebase, make several individual contributions, and then form a team to propose, develop and implement new features. The codebase that we’ll be developing on is a Fake Stack Overflow project (let’s call it HuskyFlow). You will get an opportunity to work with the starter code which provides basic skeleton for the app and then additional features will be proposed and implemented by you! All implementation will take place in the TypeScript programming language, using React for the user interface.

## Getting Started

Visit our deployed project here: https://cs4530-s25-607.onrender.com/

To run this project locally:
Run `npm install` in the root directory to install all dependencies for the `client`, `server`, and `shared` folders.

{ : .note } Refer to [IP1](https://neu-se.github.io/CS4530-Spring-2025/assignments/ip1) and [IP2](https://neu-se.github.io/CS4530-Spring-2025/assignments/ip2) for further instructions related to setting up MongoDB, setting environment variables, and running the client and server.
Expand All @@ -17,7 +21,7 @@ Run `npm install` in the root directory to install all dependencies for the `cli
The schemas for the database are documented in the directory `server/models/schema`.
A class diagram for the schema definition is shown below:

![Class Diagram](class-diagram.png)
![Class Diagram](new-class-diagram.png)

## API Routes

Expand All @@ -42,13 +46,14 @@ A class diagram for the schema definition is shown below:

### `/question`

| Endpoint | Method | Description |
| ----------------- | ------ | ------------------------------- |
| /getQuestion | GET | Fetch questions by filter |
| /getQuestionById/ | GET | Fetch a specific question by ID |
| /addQuestion | POST | Add a new question |
| /upvoteQuestion | POST | Upvote a question |
| /downvoteQuestion | POST | Downvote a question |
| Endpoint | Method | Description |
| ----------------------- | ------ | --------------------------------- |
| /getQuestion | GET | Fetch questions by filter |
| /getQuestionById/ | GET | Fetch a specific question by ID |
| /addQuestion | POST | Add a new question |
| /upvoteQuestion | POST | Upvote a question |
| /downvoteQuestion | POST | Downvote a question |
| /getCommunityQuestions/ | GET | Fetchs questions from a community |

### `/tag`

Expand Down Expand Up @@ -88,6 +93,57 @@ A class diagram for the schema definition is shown below:
| /leave | POST | Leave a game |
| /games | GET | Retrieve all games |

### `/contributions`

| Endpoint | Method | Description |
| ------------------ | ------ | -------------------------------- |
| /getContributions | GET | Fetch a user's contributions |

### `/community`

| Endpoint | Method | Description |
| ---------------------- | ------ | ------------------------------------ |
| /addCommunity | POST | Create a new community |
| /getCommunity/ | GET | Fetch community by communityId |
| /getAllCommunities | GET | Fetch all communities |
| /getCommunitiesByUser/ | GET | Fetch all community by userId |
| /addMember/ | POST | Add a member to community |
| /addModerator/ | POST | Add a moderator to community |
| /addMemberRequest/ | POST | Add a member request to community |
| /removeMember/ | DELETE | Remove a member to community |
| /removeModerator/ | DELETE | Remove a moderator to community |
| /rejectMemberRequest/ | DELETE | Reject a member request to community |
| /updateName/ | PATCH | Update community name |
| /updateDescription/ | PATCH | Update community description |

### `/notifications`

| Endpoint | Method | Description |
| ---------------------- | ------ | --------------------------------- |
| /getNotifications | GET | Gets a users notifications |
| /viewNotification | PUT | Marks a notification as viewed |
| /clearAllNotifications | PUT | Marks all notifications as viewed |

### `/gamer`

| Endpoint | Method | Description |
| ----------------- | ------ | ------------------------------ |
| /createGamer | POST | Create a new gamer |
| /getGamer/ | GET | Gets a gamer by username |
| /getGamers | GET | Gets all gamers |
| /deleteGamer/ | DELETE | Deletes a gamer |
| /updateGamerInfo | PATCH | Updates gamer information |
| /getLeaderboard | GET | Gets gamer leaderboard |

### `/star`

| Endpoint | Method | Description |
| ----------- | ------- | ----------------------------- |
| /getStars | GET | Get a user's stars |
| /addStar | POST | Add a star to a question |
| /removeStar | DELETE | Remove a star from a question |


## Running Stryker Mutation Testing

Mutation testing helps you measure the effectiveness of your tests by introducing small changes (mutations) to your code and checking if your tests catch them. To run mutation testing with Stryker, use the following command in `server/`:
Expand Down
8 changes: 7 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ module.exports = {
'@typescript-eslint/no-throw-literal': 0,
'@typescript-eslint/lines-between-class-members': 0,
'@typescript-eslint/no-unused-vars': [1, { args: 'none' }],
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.spec.ts'] }],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/*.spec.ts'],
packageDir: [__dirname, './client'],
},
],
'@typescript-eslint/naming-convention': [
'error',
{
Expand Down
13 changes: 13 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
"@cypress/instrument-cra": "^1.4.0",
"@fake-stack-overflow/shared": "^1.0.0",
"axios": "^1.7.9",
"highlight.js": "^11.11.1",
"katex": "^0.16.21",
"lucide-react": "^0.487.0",
"mongodb": "6.12.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hotkeys-hook": "^4.6.1",
"react-icons": "^5.5.0",
"react-markdown": "^10.1.0",
"react-router-dom": "^6.28.1",
"react-scripts": "5.0.1",
"react-speech-recognition": "^4.0.0",
"rehype-highlight": "^7.0.2",
"rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"socket.io-client": "^4.8.1"
},
"scripts": {
Expand Down
Binary file added client/public/stackOverflowLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions client/src/components/auth/login/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
padding: 20px;
}

.login-logo {
width: 100px;
height: auto;
margin-bottom: 20px;
}

/* Heading styles */
.container h2 {
font-size: 2rem;
Expand Down Expand Up @@ -102,3 +108,7 @@ form {
margin-top: 20px;
text-align: center;
}

.show-password label {
color: black;
}
3 changes: 2 additions & 1 deletion client/src/components/auth/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const Login = () => {

return (
<div className='container'>
<h2>Welcome to FakeStackOverflow!</h2>
<img src='/stackOverflowLogo.png' alt='StackViolet Logo' className='login-logo' />
<h2>Welcome to StackViolet!</h2>
<h3>Please login to continue.</h3>
<form onSubmit={handleSubmit}>
<h4>Please enter your username.</h4>
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/auth/signup/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
padding: 20px;
}

.signup-logo {
width: 100px;
height: auto;
margin-bottom: 20px;
}

/* Heading styles */
.container h2 {
font-size: 2rem;
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/auth/signup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const Signup = () => {

return (
<div className='container'>
<h2>Sign up for FakeStackOverflow!</h2>
<img src='/stackOverflowLogo.png' alt='StackViolet Logo' className='signup-logo' />
<h2>Sign up for StackViolet!</h2>
<form onSubmit={handleSubmit}>
<h4>Please enter your username.</h4>
<input
Expand Down
23 changes: 20 additions & 3 deletions client/src/components/fakestackoverflow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';
import Layout from './layout';
import Login from './auth/login';
Expand All @@ -17,6 +17,12 @@ import UsersListPage from './main/usersListPage';
import ProfileSettings from './profileSettings';
import AllGamesPage from './main/games/allGamesPage';
import GamePage from './main/games/gamePage';
import AllCommunitiesPage from './main/communities/allCommunitiesPage';
import MyCommunitiesPage from './main/communities/myCommunitesPage';
import CommunityPage from './main/communities/communityPage';
import useKeyPressDetection from '../hooks/useKeyPressDetection';
import HomePage from './main/homePage';
import { keepTheme } from '../tool';

const ProtectedRoute = ({
user,
Expand All @@ -41,6 +47,13 @@ const ProtectedRoute = ({
const FakeStackOverflow = ({ socket }: { socket: FakeSOSocket | null }) => {
const [user, setUser] = useState<SafeDatabaseUser | null>(null);

useKeyPressDetection(user?.username);

// apply theme
useEffect(() => {
keepTheme();
}, []);

return (
<LoginContext.Provider value={{ setUser }}>
<Routes>
Expand All @@ -55,8 +68,9 @@ const FakeStackOverflow = ({ socket }: { socket: FakeSOSocket | null }) => {
<Layout />
</ProtectedRoute>
}>
<Route path='/home' element={<QuestionPage />} />
<Route path='tags' element={<TagPage />} />
<Route path='/home' element={<HomePage />} />
<Route path='/questionPage' element={<QuestionPage />} />
<Route path='/tags' element={<TagPage />} />
<Route path='/messaging' element={<MessagingPage />} />
<Route path='/messaging/direct-message' element={<DirectMessage />} />
<Route path='/question/:qid' element={<AnswerPage />} />
Expand All @@ -66,6 +80,9 @@ const FakeStackOverflow = ({ socket }: { socket: FakeSOSocket | null }) => {
<Route path='/user/:username' element={<ProfileSettings />} />
<Route path='/games' element={<AllGamesPage />} />
<Route path='/games/:gameID' element={<GamePage />} />
<Route path='/communities/all' element={<AllCommunitiesPage />} />
<Route path='/communities/my' element={<MyCommunitiesPage />} />
<Route path='/communities/:communityId' element={<CommunityPage />} />
</Route>
}
</Routes>
Expand Down
60 changes: 52 additions & 8 deletions client/src/components/header/index.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,74 @@
.header {
display: flex;
align-items: center;
justify-content: space-around;
justify-content: space-between;
height: 10%;
width: 100%;
background: #dddddd;
background: var(--header);
color: var(--text);
padding: 0 20px;
}

.header-left {
display: flex;
align-items: center;
}

.title {
font-size: 32px;
font-size: 50px;
font-weight: 800;
margin-left: 5px;
font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}

.logo {
height: 80px;
width: auto;
margin-right: 15px;
}

.search-container {
flex-grow: 1;
max-width: 500px; /* You can adjust this based on your needs */
display: flex;
justify-content: center;
padding: 10px;
}

.search-input {
width: 100%;
padding: 12px 20px;
font-size: 16px;
border-radius: 25px;
border: 1px solid #ccc;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
border-color: var(--button);
outline: none;
box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
}


.logout-button {
padding: 12px;
font-size: 16px;
background-color: #007bff;
background-color: var(--button);
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}

.logout-button:hover {
background-color: var(--button-hover);
}

.view-profile-button {
background-color: #007bff;
background-color: var(--button);
color: white;
border: none;
padding: 10px 15px;
Expand All @@ -34,9 +78,9 @@
}

.view-profile-button:hover {
background-color: #0056b3;
background-color: var(--button-hover);
}

.view-profile-button:active {
background-color: #003f7f;
}
background-color: var(--button-hover);
}
30 changes: 19 additions & 11 deletions client/src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ import useUserContext from '../../hooks/useUserContext';
* when they press Enter.
*/
const Header = () => {
const { val, handleInputChange, handleKeyDown, handleSignOut } = useHeader();
const { val, handleInputChange, handleSignOut } = useHeader();
const { user: currentUser } = useUserContext();
const navigate = useNavigate();

return (
<div id='header' className='header'>
<div></div>
<div className='title'>Fake Stack Overflow</div>
<input
id='searchBar'
placeholder='Search ...'
type='text'
value={val}
onChange={handleInputChange}
onKeyDown={handleKeyDown}
/>
{/* Wrap logo and title together */}
<div className='header-left'>
<img src='/stackOverflowLogo.png' alt='Logo' className='logo' />
<div className='title'>StackViolet</div>
</div>

<div className='search-container'>
<input
id='searchBar'
placeholder='Search Questions...'
type='text'
value={val}
onChange={handleInputChange}
className='search-input'
/>
</div>

<button onClick={handleSignOut} className='logout-button'>
Log out
</button>
Expand Down
Loading