Skip to content

Proposal: DailyDive (Ansel Chang, Sharon Wu, and Kristine Guan) #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 124 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
2fb99d5
proposal
AnselChang Sep 27, 2023
795ff60
server setup basic
AnselChang Sep 29, 2023
cc258d5
try to add react
AnselChang Sep 29, 2023
e1a332b
vite react express
AnselChang Sep 29, 2023
622d194
working mongoose+react+express
AnselChang Sep 29, 2023
40acdc0
start db models
AnselChang Sep 29, 2023
e8529e2
color scheme
AnselChang Sep 29, 2023
1d7f5a3
top bar
AnselChang Sep 29, 2023
85549c4
basic background
AnselChang Sep 29, 2023
fb3b4ff
udpate
AnselChang Oct 2, 2023
fbc3316
delete node mudles
AnselChang Oct 2, 2023
49e5acd
pages
AnselChang Oct 3, 2023
f4d7f84
react routing
AnselChang Oct 3, 2023
afa8d9d
more server code
AnselChang Oct 3, 2023
f955399
server skeleton
AnselChang Oct 3, 2023
f2f43d5
finish server skeleton
AnselChang Oct 3, 2023
0aa99b4
add habit outcome logic
AnselChang Oct 3, 2023
8bf0b80
start parsing user info, store userID instead in session
AnselChang Oct 3, 2023
cead624
infrastructure for three pages
AnselChang Oct 3, 2023
e877152
merge
AnselChang Oct 3, 2023
53d7a72
bugfix
AnselChang Oct 3, 2023
6e9c8bc
working login page
AnselChang Oct 3, 2023
a83bc8b
working login page
AnselChang Oct 3, 2023
d668118
login
AnselChang Oct 3, 2023
d9920b3
working routing
AnselChang Oct 5, 2023
1bec596
bugfix
AnselChang Oct 5, 2023
6dd63c0
Merge pull request #4 from AnselChang/dev
AnselChang Oct 5, 2023
e1333b0
working server client communication
AnselChang Oct 6, 2023
b11370d
display raw info in home page
AnselChang Oct 6, 2023
4a1d8b3
Merge pull request #5 from AnselChang/dev
AnselChang Oct 6, 2023
92dfe5c
working habit creation
AnselChang Oct 6, 2023
002558b
Merge pull request #6 from AnselChang/dev
AnselChang Oct 6, 2023
bc5a459
fix invalid usrename or password positioning
AnselChang Oct 6, 2023
9547787
Merge pull request #7 from AnselChang/dev
AnselChang Oct 6, 2023
b0cec52
border radius 10 button
AnselChang Oct 6, 2023
3551c91
untested habit page fetch
AnselChang Oct 6, 2023
92c550a
server fetch database habit by id not wokring
AnselChang Oct 6, 2023
afa5218
habit redirect working clientside but not serverside
AnselChang Oct 6, 2023
6152173
WORKING habit fetch from server
AnselChang Oct 6, 2023
5facb29
Merge pull request #8 from AnselChang/dev
AnselChang Oct 6, 2023
f5cbba7
ui buttons
Oct 6, 2023
4a971fe
merge
Oct 6, 2023
5a0db81
Merge pull request #9 from AnselChang/habit-page
AnselChang Oct 6, 2023
26a51b8
habit list widget for home page
kristine-guan Oct 6, 2023
b949f35
Merge remote-tracking branch 'origin/habit-page' into home-page
kristine-guan Oct 6, 2023
9ded092
not working logout button
AnselChang Oct 6, 2023
cf42296
fix top bar formatting
AnselChang Oct 6, 2023
57a759e
Merge pull request #10 from AnselChang/dev
AnselChang Oct 6, 2023
5ef81af
top bar username hops
AnselChang Oct 6, 2023
7c26278
working logout
AnselChang Oct 6, 2023
f4d5c99
widget styling and create habit button
kristine-guan Oct 6, 2023
433c93e
functional logout button
AnselChang Oct 6, 2023
e48580f
fix topbar (again)
AnselChang Oct 6, 2023
6be8f28
Merge pull request #11 from AnselChang/dev
AnselChang Oct 6, 2023
125fea3
create habit button
kristine-guan Oct 6, 2023
fc43cb1
not working calendar
AnselChang Oct 6, 2023
e2fe311
working calendar frontend with no styling
AnselChang Oct 6, 2023
cd97132
Merge pull request #12 from AnselChang/dev
AnselChang Oct 6, 2023
8eae122
streak done
Oct 6, 2023
e83487b
merge
Oct 6, 2023
1331c5e
kind of working outcomes
AnselChang Oct 8, 2023
3ee689f
fix some database consistency issues
AnselChang Oct 8, 2023
90fed2e
working outcomes and logged ays
AnselChang Oct 8, 2023
07391ff
bugfixes for user stats
AnselChang Oct 8, 2023
28009b6
Merge pull request #13 from AnselChang/dev
AnselChang Oct 8, 2023
c12d9f3
fix reactivity issue
AnselChang Oct 8, 2023
b4049bb
Merge branch 'main' into habit-page
Oct 8, 2023
7fd7d06
habit streak and week stats
AnselChang Oct 8, 2023
1b3934b
Merge pull request #14 from AnselChang/dev
AnselChang Oct 8, 2023
eac8c78
merge
Oct 8, 2023
dfe48a3
Merge branch 'main' into habit-page
Oct 8, 2023
6a39721
habit widget
kristine-guan Oct 8, 2023
e024e5c
Merge branch 'main' into home-page
kristine-guan Oct 8, 2023
8418bc1
finished backend and home page has all info now
AnselChang Oct 8, 2023
2b92544
Merge pull request #15 from AnselChang/dev
AnselChang Oct 8, 2023
fcac0a5
habit widget & flexbox
kristine-guan Oct 8, 2023
d025760
Merge branch 'main' into home-page
kristine-guan Oct 8, 2023
2a1b8f1
percent component
AnselChang Oct 8, 2023
020f16d
Merge pull request #16 from AnselChang/dev
AnselChang Oct 8, 2023
9ec16e8
merge
Oct 8, 2023
1c8bea9
merge
Oct 8, 2023
707c641
Update main.ts
Oct 8, 2023
546c403
fix logged days being wrong in haibt
AnselChang Oct 8, 2023
c136cd1
Merge pull request #18 from AnselChang/dev
AnselChang Oct 8, 2023
ac8c976
Merge pull request #17 from AnselChang/habit-page
AnselChang Oct 8, 2023
31e94ec
set description sends request to server and persists
AnselChang Oct 8, 2023
763205b
Merge pull request #19 from AnselChang/dev
AnselChang Oct 8, 2023
87b8780
populating widget list functional
kristine-guan Oct 9, 2023
e15612a
Merge branch 'main' into home-page
kristine-guan Oct 9, 2023
b734908
habit button function
kristine-guan Oct 9, 2023
8805c21
merge
Oct 9, 2023
c1334c6
Merge branch 'main' into habit-page
Oct 9, 2023
63833e3
habit page mostly done
Oct 9, 2023
84a0931
Merge pull request #21 from AnselChang/habit-page
AnselChang Oct 9, 2023
8b539d8
Merge pull request #20 from AnselChang/home-page
AnselChang Oct 9, 2023
fbd179a
bugfixes
AnselChang Oct 9, 2023
4198356
Merge pull request #22 from AnselChang/dev
AnselChang Oct 9, 2023
12f7ff4
Habit Page Done
Oct 10, 2023
151d6d1
Merge pull request #23 from AnselChang/habit-page
AnselChang Oct 10, 2023
67285b4
Home Page Edits
Oct 10, 2023
a63be1e
Merge pull request #24 from AnselChang/habit-page
sl-wu Oct 10, 2023
b7acd6b
Update user-widgets.tsx
Oct 10, 2023
dbc66e6
Merge pull request #25 from AnselChang/habit-page
kristine-guan Oct 10, 2023
0bc7b83
3 widgets on individual habits
kristine-guan Oct 11, 2023
ee83716
Merge pull request #26 from AnselChang/home-page
sl-wu Oct 11, 2023
e47d12b
Finished Home Page UI
Oct 11, 2023
3bc73c2
Merge pull request #27 from AnselChang/habit-page
AnselChang Oct 11, 2023
4e2c5d5
sort habits by streak
AnselChang Oct 11, 2023
262b876
Merge pull request #28 from AnselChang/dev
AnselChang Oct 11, 2023
a083f89
responsive delete
AnselChang Oct 11, 2023
290d3ec
responsive create habit button
AnselChang Oct 11, 2023
efa78d9
server correctly updates
AnselChang Oct 11, 2023
ac542bf
Merge pull request #29 from AnselChang/dev
AnselChang Oct 11, 2023
3cc71fb
sort by num logged days instead
AnselChang Oct 11, 2023
39cf3a7
Merge pull request #30 from AnselChang/dev
AnselChang Oct 11, 2023
6393422
Update habit-widget.tsx
Oct 12, 2023
3dc7a11
partial readme
AnselChang Oct 12, 2023
8d9f5af
Merge pull request #32 from AnselChang/dev
AnselChang Oct 12, 2023
14884c5
Merge pull request #31 from AnselChang/habit-page
AnselChang Oct 12, 2023
f0eba48
include morgan types
AnselChang Oct 12, 2023
93fdf6a
remove morgan
AnselChang Oct 12, 2023
80da75b
Delete morgan packagejosn
AnselChang Oct 12, 2023
a6a569d
change port
AnselChang Oct 12, 2023
d7042d4
video
AnselChang Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
49 changes: 11 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,22 @@
# Final Project
*Due October 13th (final day of the term)*
DailyDive
=========

For your final project, you'll implement a web application that exhibits understanding of the course materials.
This project should provide an opportunity to both be creative and to pursue individual research and learning goals.
https://dailydive-80188849a5ca.herokuapp.com/
Video: https://www.youtube.com/watch?v=vdfbnKZRWn4&ab_channel=Ansel

## General description
Your project should consist of a complete Web application, exhibiting facets of the three main sections of the course material:
By Ansel Chang, Sharon Wu, Kristine Guan

- Static web page content and design. You should have a project that is accessible, easily navigable, and features significant content.
- Dynamic behavior implemented with JavaScript (TypeScript is also allowed if your group wants to explore it).
- Server-side programming *using Node.js*. Typically this will take the form of some sort of persistent data (database), authentication, and possibly server-side computation.
- A video (less than five minutes) where each group member explains some aspect of the project. An easy way to produce this video is for you all the groups members to join a Zoom call that is recorded; each member can share their screen when they discuss the project or one member can "drive" the interface while other members narrate (this second option will probably work better.) The video should be posted on YouTube or some other accessible video hosting service. Make sure your video is less than five minutes, but long enough to successfully explain your project and show it in action. There is no minimum video length.
Do you struggle in finding motivation to succeed at your goals? *DailyDive* gamifies building habits by tracking your daily successes and failures in achieving your daily habit goal. Users can create and manage an unlimited number of Habits, where red and green color-coded calendars show how well you’re doing! The satisfying click to turn the day’s square green breaks down impossible goals into daily progress, while progress bars and statistics remind you how far you’ve come since creating your Habit.

## Project ideation
Excellent projects typically serve someone/some group; for this assignment you need to define your users and stakeholders. I encourage you to identify projects that will have impact, either artistically, politically, or in terms of productivity.
This project was developed with the MERN stack: MongoDB for storing users and habits, Vite+React for the frontend, and Express with Node JS to handle requests between MongoDB and the frontend. We use Typescript for more maintainable code and Bootstrap for better CSS styling. DailyDive features a login/signup page where new users can create a (username, password) pair, and once logged in, users can create an unlimited number of habits, each with daily logging functionality.

### Deliverables
We faced quite a few issues in development. The first was the limited time forcing us to simplify our scope - original vision had pages for in-depth statistics and competition with other users. In addition, making a reactive calendar was a challenge, and we realized we should update the outcome color when a user clicks on a calendar day immediately on the client side, even before sending and recieving a response from the server, for better responsiveness. We faced tougher challenges along that vein, like long loading times for the user page due to lots of database polling, and learned that for a more responsive website, we'd want to do a lot of redundant calculations client-side as well to avoid the latency dealing with the server.

#### Form Team (due 9/25)
Students are will work in teams of 3-5 students for the project; teams of two can be approved with the permission of the instructor. Working in teams should help enable you to build a good project in a limited amount of time. Use the `#project-logistics` channel in Discord to pitch ideas for final projects and/or find fellow team members as needed.
Ansel created the Figma designs for the front end, wrote the Express NodeJS server code, and wrote boilerplate react code to send and recieve requests from the server. He also did the frontend for login/signup page and the calendar component.

Teams must be in place by end of day on Sunday, September 25th. If you have not identified a team at this point, you will be assigned a team. You will be given some class time on Monday to work on your proposal, but please plan on reserving additional time outside of class as needed.
Sharon did the frontend for the Habit page, as well as parts of the User page. She reworked parts of the original design sketches to improve UX, and created flexible and reusable React components that were reused in different parts of DailyDive. She enforced consistent Bootstrap stylings and maintained high quality UI for a responsive user experience throughout the webapp.

#### Proposal (due 9/27)
Provide an outline of your project direction and the names of associated team members.
The outline should have enough detail so that staff can determine if it meets the minimum expectations, or if it goes too far to be reasonable by the deadline. Please include a general description of a project, and list of key technologies/libraries you plan on using (e.g. React, Three.js, Svelte, TypeScript etc.). Two to four paragraps should provide enough level of detail. Name the file proposal.md and submit a pull request by Tuesday, September 27th at 11:59 PM (end of day). Only one pull request is required per team.
Kristine did the front end for parts of the User page, and provided careful feedback to improve the visual quality of the webpages.

There are no other scheduled checkpoints for your project.

#### Turning in Your Project
Submit a second PR on the final project repo to turn in your app and code. Again, only one pull request per team.

Deploy your app, in the form of a webpage, to Glitch/Heroku/Digital Ocean or some other service; it is critical that the application functions correctly wherever you post it.

The README for your second pull request doesn’t need to be a formal report, but it should contain:

1. A brief description of what you created, and a link to the project itself (two paragraphs of text)
2. Any additional instructions that might be needed to fully use your project (login information etc.)
3. An outline of the technologies you used and how you used them.
4. What challenges you faced in completing the project.
5. What each group member was responsible for designing / developing.
6. A link to your project video.

Think of 1,3, and 4 in particular in a similar vein to the design / tech achievements for A1—A4… make a case for why what you did was challenging and why your implementation deserves a grade of 100%.

## FAQs

- **Can I use XYZ framework?** You can use any web-based frameworks or tools available, but for your server programming you need to use Node.js. Your client-side scripting language should be either JavaScript or TypeScript.
20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DailyDive</title>
</head>
<body>
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> -->
<link href='https://fonts.googleapis.com/css?family=Road Rage' rel='stylesheet'></link>
<link href='https://fonts.googleapis.com/css?family=Kavoon' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Skranji' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Salsa' rel='stylesheet'>


<div id="root"></div>
<script type="module" src="/src/client/main.tsx"></script>
</body>
</html>
86 changes: 86 additions & 0 deletions models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
export enum Outcome {
SUCCESS = "SUCCESS",
FAIL = "FAIL",
NONE = "NONE"
}

export class HabitOutcome {
year: number = -1;
month: number = -1;
day: number = -1;
outcome: Outcome = Outcome.NONE;

constructor(year: number, month: number, day: number, outcome: Outcome) {
this.year = year;
this.month = month;
this.day = day;
this.outcome = outcome;
}

}

export class UserHabit {
userID: string;
habitID: string;
name: string;
description: string;
currentStreak: number;
numLoggedDays: number;
numSuccessesWeek: number;
percentSuccessLifetime: number;
numLoggedDaysWeek: number;

constructor(userID: string, habitID: string, name: string = "", description: string = "", currentStreak: number = -1, numLoggedDays: number = -1, numSuccessesWeek: number = -1, percentSuccessLifetime: number = -1, numLoggedDaysWeek: number = -1) {
this.userID = userID;
this.habitID = habitID;
this.name = name;
this.description = description;
this.currentStreak = currentStreak;
this.numLoggedDays = numLoggedDays;
this.numSuccessesWeek = numSuccessesWeek;
this.percentSuccessLifetime = percentSuccessLifetime;
this.numLoggedDaysWeek = numLoggedDaysWeek;
}

get percentSuccessWeek(): number {
return (this.numLoggedDaysWeek === 0) ? 0 : +(((this.numSuccessesWeek / this.numLoggedDaysWeek) * 100).toFixed(2));
}

}

export class UserInfo {
username: string;
numLoggedDays: number;
percentSuccessWeek: number;
// percentSuccessLifetime?: number;
percentSuccessLifetime: number;
habits: UserHabit[];

constructor(username: string = "", numLoggedDays: number = -1, percentSuccessWeek: number = -1, percentSuccessLifetime: number = -1, habits: UserHabit[] = []) {
this.username = username;
this.numLoggedDays = numLoggedDays;
this.percentSuccessWeek = percentSuccessWeek;
this.percentSuccessLifetime = percentSuccessLifetime;
this.habits = habits;
}

}

export class Day {
year: number = -1;
month: number = -1;
day: number = -1;

constructor(year: number, month: number, day: number) {
this.year = year;
this.month = month;
this.day = day;
}

previous(): Day {
let date = new Date(this.year, this.month, this.day);
date.setDate(date.getDate() - 1);
return new Day(date.getFullYear(), date.getMonth(), date.getDate());
}

}
Loading