Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified .DS_Store
Binary file not shown.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.vscode
website/__pycache__
website/database.db
website/database.db
instance/


21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
# Flask Web App Tutorial
## Welcome To StudyCCC

## Setup & Installation

Make sure you have the latest version of Python installed.

```bash
git clone <repo-url>
```
Have the latest version of Python installed.

```bash
pip install -r requirements.txt
pip3 install flask
pip3 install flask_cors
pip3 install Flask-SQLAlchemy
pip3 install flask-login
pip3 install werkzeug
pip3 install flask-oauthlib google-auth

To Run:

Open Terminal and enter the following:
python3 main.py


```

## Running The App
Expand Down
Binary file removed instance/database.db
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/uploads/default-profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions website/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ def create_app():
from .views import views
from .auth import auth
from .threads import thread


from .welcome import welcome
from .xp import xp
app.register_blueprint(views, url_prefix='/')
app.register_blueprint(auth, url_prefix='/')
app.register_blueprint(thread, url_prefix='/')
app.register_blueprint(xp, url_prefix='/')
app.register_blueprint(welcome, url_prefix='/')



def time_ago(timestamp):
"""Calculate how long ago a timestamp occurred."""
Expand Down
17 changes: 13 additions & 4 deletions website/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS

# Ensure the uploads directory exists
UPLOAD_FOLDER = os.path.join('static', 'uploads')
UPLOAD_FOLDER = os.path.join('website', 'static', 'images')
if not os.path.exists(UPLOAD_FOLDER):
os.makedirs(UPLOAD_FOLDER)

Expand Down Expand Up @@ -157,14 +157,23 @@ def login():
def sign_up():

if request.method == 'POST':

email = request.form.get('email').lower()
first_name = request.form.get('firstName')
school_name = request.form.get('schoolId')
school_name = request.form.get('schoolId') # Fetch selected school
password1 = request.form.get('password1')
password2 = request.form.get('password2')
profile_picture = request.files.get('profilePicture') # Handle uploaded file
profile_picture = request.files.get('profilePicture')

# Check if the school exists in the database
print(f"Selected school: {school_name}") # Debugging


if not school_name or school_name not in schools:
flash('Invalid school selected.', category='error')
return render_template("sign_up.html", user=current_user, schools=schools)


# Check if school exists
school = School.query.filter_by(name=school_name).first()
if not school:
school = School(name=school_name)
Expand Down
17 changes: 11 additions & 6 deletions website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ class Note(db.Model):

class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(150), unique=True)
password = db.Column(db.String(150))
first_name = db.Column(db.String(150))
schoolId = db.Column(db.Integer, db.ForeignKey('school.id'))
notes = db.relationship('Note')
profile_picture = db.Column(db.String(150), nullable=True) # New field
email = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(150), nullable=False)
first_name = db.Column(db.String(150), nullable=False)
profile_picture = db.Column(db.String(200), default='/static/images/default-profile.png')
xp = db.Column(db.Integer, default=0) # Field for XP
level = db.Column(db.Integer, default=0) # Field for Level
schoolId = db.Column(db.Integer, db.ForeignKey('school.id'), nullable=True)

# The UserMixin provides is_authenticated, is_active, and is_anonymous
# You only need to implement get_id if you need customization


class School(db.Model):
id = db.Column(db.Integer, primary_key=True)
Expand Down
Binary file modified website/static/.DS_Store
Binary file not shown.
Binary file modified website/static/audio/.DS_Store
Binary file not shown.
Binary file added website/static/images/SHACHARRR.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 79 additions & 54 deletions website/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,69 +49,56 @@ html, body {
background-color: #ffffff; /* Solid white header */
}


/* Flash Message Overlay */
.flash-message {
position: fixed; /* Stick to the viewport */
top: 10; /* Center vertically */
position: fixed; /* Fix the flash message in place */
top: 20px; /* Adjust the vertical position */
left: 50%; /* Center horizontally */
transform: translate(-50%, -50%); /* Center using transform */
z-index: 1050; /* Ensure it appears above other elements */
width: 50%; /* Make it half the screen width */
min-width: 300px; /* Ensure a minimum width */
padding: 20px; /* Padding for internal spacing */
background-color: #f8d7da; /* Example: red for error */
color: #721c24;
border: 1px solid #f5c6cb;
border-radius: 10px; /* More rounded edges */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
animation: fadeOut 4s forwards; /* Smooth fade-out effect */
text-align: center; /* Center the text inside */
font-size: 16px; /* Adjust font size for better readability */
}

.flash-message.success {
background-color: #d4edda; /* Green for success */
transform: translateX(-50%); /* Ensure proper centering */
z-index: 1050; /* Make sure it appears above other elements */
width: 90%; /* Optional: Adjust width for responsiveness */
max-width: 400px; /* Limit the width */
opacity: 0; /* Start with invisible state */
animation: fade-in-out 4s ease forwards; /* Control the appearance */
}

.flash-message.alert {
padding: 10px 15px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Add shadow for emphasis */
}

.flash-message.alert-success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}

.flash-message.info {
background-color: #d1ecf1; /* Blue for info */
color: #0c5460;
border: 1px solid #bee5eb;
}

.flash-message .close {
background: none;
border: none;
font-size: 16px;
line-height: 1;
color: #000;
opacity: 0.5;
cursor: pointer;
position: absolute;
top: 10px;
right: 10px; /* Place close button at the top-right corner */
}

.flash-message .close:hover {
opacity: 1;
}

/* Fade-out animation */
@keyframes fadeOut {
}

.flash-message.alert-danger {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}

/* Keyframes for fade-in and fade-out */
@keyframes fade-in-out {
0% {
opacity: 1;
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
10% {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
80% {
opacity: 1;
90% {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
100% {
opacity: 0;
pointer-events: none;
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
}
}



/* Login Frame Specific */
Expand Down Expand Up @@ -364,3 +351,41 @@ html, body {
font-size: 14px;
margin-bottom: 8px;
}


/* Style for the popup close button */
.popup-close-button {
position: absolute;
top: 10px; /* Position the button 10px from the top */
right: 10px; /* Position the button 10px from the right */
background: none; /* No background for the button */
border: none; /* Remove default border */
font-size: 20px; /* Make the button size readable */
font-weight: bold;
color: #333; /* Dark color for visibility */
cursor: pointer; /* Add a pointer cursor for better UX */
z-index: 1001; /* Ensure it's above other popup content */
}

.popup-close-button:hover {
color: #8d49fd; /* Change color on hover for feedback */
transform: scale(1.1); /* Slightly enlarge for hover effect */
transition: transform 0.2s, color 0.2s; /* Smooth transition */
}

.popup-container {
position: relative; /* Relative position to align close button */
width: 100%;
max-width: 600px;
background-color: #ffffff; /* Popup background */
border: 1px solid #ddd;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
padding: 20px; /* Add padding for internal content */
margin: 0 auto; /* Center the popup */
z-index: 1000; /* Ensure it's above other elements */
}




Loading