diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 28817aa..bff1ac9 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/urls.py b/config/urls.py index bcfc074..7fe8561 100644 --- a/config/urls.py +++ b/config/urls.py @@ -18,10 +18,21 @@ from django.contrib import admin from django.urls import include, path from django.conf import settings from django.conf.urls.static import static +from django.contrib.auth import views as auth_views +from core.views import SignUpView urlpatterns = [ path("admin/", admin.site.urls), path("", include("core.urls")), + path('signup/', SignUpView.as_view(), name='signup'), + path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'), + path('logout/', auth_views.LogoutView.as_view(), name='logout'), + path('password_change/', auth_views.PasswordChangeView.as_view(template_name='registration/password_change.html'), name='password_change'), + path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(template_name='registration/password_change_done.html'), name='password_change_done'), + path('password_reset/', auth_views.PasswordResetView.as_view(template_name='registration/password_reset.html'), name='password_reset'), + path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='registration/password_reset_done.html'), name='password_reset_done'), + path('reset///', auth_views.PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html'), name='password_reset_confirm'), + path('reset/done/', auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html'), name='password_reset_complete'), ] if settings.DEBUG: diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index 4dda475..1988f9e 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/mail.cpython-311.pyc b/core/__pycache__/mail.cpython-311.pyc new file mode 100644 index 0000000..8b4651f Binary files /dev/null and b/core/__pycache__/mail.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 6055c0d..06a521c 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 648bd09..f020e6a 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index b7c676a..465fe3b 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/forms.py b/core/forms.py index 23cd219..a3fe62f 100644 --- a/core/forms.py +++ b/core/forms.py @@ -1,6 +1,19 @@ from django import forms +from django.contrib.auth.forms import UserCreationForm +from django.contrib.auth.models import User from .models import MoodEntry, Activity +class DateRangeFilterForm(forms.Form): + start_date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'})) + end_date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date', 'class': 'form-control'})) + +class SignUpForm(UserCreationForm): + email = forms.EmailField(max_length=254, help_text='Required. Inform a valid email address.') + + class Meta: + model = User + fields = ('username', 'email') + class MoodEntryForm(forms.ModelForm): activities = forms.ModelMultipleChoiceField( queryset=Activity.objects.all(), @@ -12,6 +25,11 @@ class MoodEntryForm(forms.ModelForm): model = MoodEntry fields = ['mood_score', 'note', 'activities'] widgets = { - 'mood_score': forms.NumberInput(attrs={'min': 1, 'max': 5}), - 'note': forms.Textarea(attrs={'rows': 4}), + 'mood_score': forms.NumberInput(attrs={'class': 'form-control', 'min': 1, 'max': 10}), + 'note': forms.Textarea(attrs={'class': 'form-control', 'rows': 4}), } + +class ContactForm(forms.Form): + name = forms.CharField(max_length=100, widget=forms.TextInput(attrs={'class': 'form-control'})) + email = forms.EmailField(widget=forms.EmailInput(attrs={'class': 'form-control'})) + message = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 5})) diff --git a/core/mail.py b/core/mail.py new file mode 100644 index 0000000..dfe626d --- /dev/null +++ b/core/mail.py @@ -0,0 +1,25 @@ +from django.core.mail import send_mail +from django.conf import settings + +def send_contact_message(name, email, message): + """Sends an email from the contact form.""" + try: + subject = f'Contact Form Message from {name}' + message_body = f'You have received a new message from your website contact form.\n\n' \ + f'Here are the details:\n\n' \ + f'Name: {name}\n' \ + f'Email: {email}\n\n' \ + f'Message:\n{message}\n' + + send_mail( + subject, + message_body, + settings.DEFAULT_FROM_EMAIL, # from + [settings.CONTACT_EMAIL_TO], # to + fail_silently=False, + ) + return True + except Exception as e: + # In a real app, you'd want to log this error + print(e) + return False diff --git a/core/migrations/0002_note.py b/core/migrations/0002_note.py new file mode 100644 index 0000000..0a8df15 --- /dev/null +++ b/core/migrations/0002_note.py @@ -0,0 +1,27 @@ +# Generated by Django 5.2.7 on 2025-12-22 19:21 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Note', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('content', models.TextField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0002_note.cpython-311.pyc b/core/migrations/__pycache__/0002_note.cpython-311.pyc new file mode 100644 index 0000000..8b75bf3 Binary files /dev/null and b/core/migrations/__pycache__/0002_note.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 16f0a31..26c79ca 100644 --- a/core/models.py +++ b/core/models.py @@ -35,4 +35,14 @@ class MoodEntry(models.Model): mission = models.ForeignKey(Mission, on_delete=models.SET_NULL, null=True, blank=True) def __str__(self): - return f'{self.user.username} - {self.date_time.strftime("%Y-%m-%d")}' \ No newline at end of file + return f'{self.user.username} - {self.date_time.strftime("%Y-%m-%d")}' + +class Note(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE) + title = models.CharField(max_length=255) + content = models.TextField() + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.title \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 9b2be9d..6fe0115 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,9 +1,9 @@ - + - {% block title %}Knowledge Base{% endblock %} + {% block title %}PixelMinds{% endblock %} {% if project_description %} @@ -13,28 +13,109 @@ {% endif %} + {% load static %} + + {% block head %}{% endblock %} - - - {% block content %}{% endblock %} + + + - + \ No newline at end of file diff --git a/core/templates/core/about.html b/core/templates/core/about.html new file mode 100644 index 0000000..f725703 --- /dev/null +++ b/core/templates/core/about.html @@ -0,0 +1,58 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}About Us - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+

About PixelMinds

+

We are a team of passionate developers, designers, and healthcare professionals dedicated to helping you live a healthier, happier life.

+
+
+
+
+ +
+
+
+
+

Our Mission

+

Our mission is to make mental and physical health tracking simple, accessible, and insightful for everyone. We believe that technology can empower individuals to take control of their well-being by providing them with the right tools and data-driven guidance.

+

We leverage cutting-edge AI to provide you with personalized insights and recommendations based on your mood and activity data. By understanding your patterns, you can make informed decisions to improve your well-being.

+
+
+ Health Innovation +
+
+
+
+ +
+
+
+

Meet the Team

+

A small group with a big vision.

+
+
+
+ Team Member +
Alex Vance
+

Lead Developer

+
+
+ Team Member +
Brenda Shaw
+

UX Designer

+
+
+ Team Member +
Dr. Carlin Day
+

Health Advisor

+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/contact.html b/core/templates/core/contact.html new file mode 100644 index 0000000..ae56f1f --- /dev/null +++ b/core/templates/core/contact.html @@ -0,0 +1,61 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Contact Us - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+

Get in Touch

+

We'd love to hear from you. Whether you have a question, feedback, or just want to say hello, please don't hesitate to reach out.

+
+
+
+
+ +
+
+
+
+ + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + +
+
+
+ {% csrf_token %} +
+ {{ form.name.label_tag }} + {{ form.name }} + {% if form.name.errors %}
{{ form.name.errors|striptags }}
{% endif %} +
+
+ {{ form.email.label_tag }} + {{ form.email }} + {% if form.email.errors %}
{{ form.email.errors|striptags }}
{% endif %} +
+
+ {{ form.message.label_tag }} + {{ form.message }} + {% if form.message.errors %}
{{ form.message.errors|striptags }}
{% endif %} +
+
+ +
+
+
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/dashboard.html b/core/templates/core/dashboard.html index 0accf32..5f64843 100644 --- a/core/templates/core/dashboard.html +++ b/core/templates/core/dashboard.html @@ -1,49 +1,113 @@ {% extends 'base.html' %} +{% load static %} + +{% block title %}Dashboard - PixelMinds{% endblock %} {% block head %} + {% endblock %} {% block content %} -
-

Mood Dashboard

- -
+
+
+
+
+

Your Dashboard

+

An overview of your mood entries.

+
+ +
+ +
+
+
Filter by Date
+
+
+ + {{ form.start_date }} +
+
+ + {{ form.end_date }} +
+
+ +
+
+
+
+ +
+
+
Mood Over Time
+ {% if chart_data != '[]' %} + + {% else %} +
+

No mood entries found for the selected period.

+

Try adjusting the filter or add a new entry.

+
+ {% endif %} +
+
+
+
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index 5a49aca..ecbc122 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,55 +1,84 @@ {% extends 'base.html' %} +{% load static %} -{% block title %}{{ project_name }}{% endblock %} +{% block title %}PixelMinds - Your Personal Health Companion{% endblock %} {% block content %} -
-
-
-

Welcome to {{ project_name }}

-

Your personal space to reflect and grow.

-
-
- {% if user.is_authenticated %} - + Log New Mood - {% else %} - Log In - {% endif %} -
-
- - {% if user.is_authenticated %} -

Your Recent Moods

- {% if mood_entries %} -
- {% for entry in mood_entries %} -
-
-
Mood Score: {{ entry.mood_score }}/5
- {{ entry.date_time|date:"Y-m-d H:i" }} -
-

{{ entry.note|truncatewords:30 }}

- {% if entry.activities.all %} - Activities: - {% for activity in entry.activities.all %} - {{ activity.name }} - {% endfor %} - - {% endif %} -
- {% endfor %} -
- {% else %} -

You haven't logged any moods yet. Get started!

- {% endif %} - {% else %} -
-
-

Track Your Mental Wellness

-

Gain insights into your moods and activities to better understand your mental health. Log in to begin your journey.

- Log In & Get Started -
-
- {% endif %} +
+
+ +{% include 'core/mood_modal.html' %} +{% endblock %} + +{% block extra_js %} + {% endblock %} diff --git a/core/templates/core/mood_entry_form.html b/core/templates/core/mood_entry_form.html index 8893d25..d4d6fdb 100644 --- a/core/templates/core/mood_entry_form.html +++ b/core/templates/core/mood_entry_form.html @@ -1,57 +1,64 @@ {% extends 'base.html' %} +{% load static %} + +{% block title %}New Mood Entry - PixelMinds{% endblock %} {% block content %} -
-
-
-
-

Track Your Mood

-
-
- {% csrf_token %} - -
- - {{ form.mood_score }} - {% if form.mood_score.errors %} -
- {{ form.mood_score.errors|striptags }} -
- {% endif %} -
+
+
+
+
+
+
+

How are you feeling?

+ + {% csrf_token %} -
- - {{ form.note }} - {% if form.note.errors %} -
- {{ form.note.errors|striptags }} -
- {% endif %} -
- -
- -
- {% for checkbox in form.activities %} -
- {{ checkbox.tag }} - -
- {% endfor %} +
+ + {{ form.mood_score }} + {% if form.mood_score.errors %} +
+ {{ form.mood_score.errors|striptags }} +
+ {% endif %}
- {% if form.activities.errors %} -
- {{ form.activities.errors|striptags }} -
- {% endif %} -
- - +
+ + {{ form.note }} + {% if form.note.errors %} +
+ {{ form.note.errors|striptags }} +
+ {% endif %} +
+ +
+ +
+ {% for checkbox in form.activities %} +
+ {{ checkbox.tag }} + +
+ {% endfor %} +
+ {% if form.activities.errors %} +
+ {{ form.activities.errors|striptags }} +
+ {% endif %} +
+ +
+ +
+ +
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/mood_modal.html b/core/templates/core/mood_modal.html new file mode 100644 index 0000000..387edb4 --- /dev/null +++ b/core/templates/core/mood_modal.html @@ -0,0 +1,21 @@ + diff --git a/core/templates/core/privacy_policy.html b/core/templates/core/privacy_policy.html new file mode 100644 index 0000000..8a04fd0 --- /dev/null +++ b/core/templates/core/privacy_policy.html @@ -0,0 +1,50 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Privacy Policy - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Privacy Policy

+

Your privacy is important to us. Last updated: December 22, 2025

+
+ +

It is PixelMinds's policy to respect your privacy regarding any information we may collect from you across our website. This Privacy Policy applies to all of our services.

+ +

1. Information We Collect

+

We only collect information about you if we have a reason to do so – for example, to provide our services, to communicate with you, or to make our services better. We collect this information from three sources: if and when you provide information to us, automatically through operating our services, and from outside sources.

+ +

Information You Provide to Us

+
    +
  • Account Information: We collect information from you when you create an account, such as your name, email address, and password.
  • +
  • Health Data: We collect the mood scores, notes, and activities you log through our service.
  • +
+ +

2. How We Use Information

+

We use the information we collect in various ways, including to:

+
    +
  • Provide, operate, and maintain our website and services.
  • +
  • Improve, personalize, and expand our services.
  • +
  • Understand and analyze how you use our services.
  • +
  • Develop new products, services, features, and functionality.
  • +
  • Communicate with you for customer service, updates, and marketing purposes.
  • +
+ +

3. Security

+

We take reasonable precautions and follow industry best practices to protect your personal information and ensure that it is not inappropriately lost, misused, accessed, disclosed, altered, or destroyed.

+ +

4. Changes to This Policy

+

We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page. You are advised to review this Privacy Policy periodically for any changes.

+ +
+

This is a generic, placeholder privacy policy. It is not legal advice. You must consult with a legal professional to create a policy that is compliant with all applicable laws and regulations for your business.

+ +
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/registration/login.html b/core/templates/registration/login.html new file mode 100644 index 0000000..5e69616 --- /dev/null +++ b/core/templates/registration/login.html @@ -0,0 +1,42 @@ +{% extends 'base.html' %} + +{% block title %}Login - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+
+

Welcome Back

+ + {% if form.errors %} + + {% endif %} + +
+ {% csrf_token %} +
+ + +
+
+ + +
+
+ +
+

Forgot password?

+
+
+
+

Don't have an account? Sign up

+
+
+
+
+{% endblock %} diff --git a/core/templates/registration/password_change.html b/core/templates/registration/password_change.html new file mode 100644 index 0000000..6460f72 --- /dev/null +++ b/core/templates/registration/password_change.html @@ -0,0 +1,48 @@ +{% extends 'base.html' %} + +{% block title %}Change Password - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Change Password

+
+
+ {% csrf_token %} + {% if form.non_field_errors %} + + {% endif %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} + {{ field.help_text|safe }} + {% endif %} + {% for error in field.errors %} +
+ {{ error }} +
+ {% endfor %} +
+ {% endfor %} + +
+ +
+
+
+
+
+
+
+
+{% endblock %} diff --git a/core/templates/registration/password_change_done.html b/core/templates/registration/password_change_done.html new file mode 100644 index 0000000..6d00fc8 --- /dev/null +++ b/core/templates/registration/password_change_done.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block title %}Password Change Complete - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Password Change Complete

+
+

Your password has been successfully changed.

+ Return to Home +
+
+
+
+
+
+{% endblock %} diff --git a/core/templates/registration/password_reset.html b/core/templates/registration/password_reset.html new file mode 100644 index 0000000..4c54855 --- /dev/null +++ b/core/templates/registration/password_reset.html @@ -0,0 +1,53 @@ +{% extends 'base.html' %} + +{% block title %}Forgot Your Password? - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Password Recovery

+
+
Enter your email address and we will send you a link to reset your password.
+
+ {% csrf_token %} + {% if form.non_field_errors %} + + {% endif %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} + {{ field.help_text }} + {% endif %} + {% for error in field.errors %} +
+ {{ error }} +
+ {% endfor %} +
+ {% endfor %} + +
+ Return to login + +
+
+
+ +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/registration/password_reset_complete.html b/core/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..4690178 --- /dev/null +++ b/core/templates/registration/password_reset_complete.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block title %}Password Reset Complete - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Password Reset Complete

+
+

Your password has been set. You may go ahead and log in now.

+ Return to Login +
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/registration/password_reset_confirm.html b/core/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..492c3f4 --- /dev/null +++ b/core/templates/registration/password_reset_confirm.html @@ -0,0 +1,58 @@ +{% extends 'base.html' %} + +{% block title %}Enter New Password - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+ {% if validlink %} +

Reset Password

+
+

Please enter your new password twice so we can verify you typed it in correctly.

+
+ {% csrf_token %} + {% if form.non_field_errors %} + + {% endif %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} + {{ field.help_text|safe }} + {% endif %} + {% for error in field.errors %} +
+ {{ error }} +
+ {% endfor %} +
+ {% endfor %} + +
+ +
+
+
+ {% else %} +

Password Reset Failed

+
+

The password reset link was invalid, possibly because it has already been used.

+

Please request a new password reset.

+ Request a New Password Reset +
+ {% endif %} +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/registration/password_reset_done.html b/core/templates/registration/password_reset_done.html new file mode 100644 index 0000000..83ff84b --- /dev/null +++ b/core/templates/registration/password_reset_done.html @@ -0,0 +1,22 @@ +{% extends 'base.html' %} + +{% block title %}Password Reset Sent - PixelMinds{% endblock %} + +{% block content %} +
+
+
+
+
+

Password Reset Sent

+
+

We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.

+

If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.

+ Return to Login +
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/templates/registration/signup.html b/core/templates/registration/signup.html new file mode 100644 index 0000000..ae29338 --- /dev/null +++ b/core/templates/registration/signup.html @@ -0,0 +1,50 @@ +{% extends 'base.html' %} +{% load static %} + +{% block content %} +
+
+
+
+
+

Create Account

+
+
+ {% csrf_token %} + {% if form.non_field_errors %} + + {% endif %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} + {{ field.help_text }} + {% endif %} + {% for error in field.errors %} +
+ {{ error }} +
+ {% endfor %} +
+ {% endfor %} + +
+ +
+
+
+ +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/core/urls.py b/core/urls.py index 8b96229..605eb4f 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,11 +1,16 @@ from django.urls import path -from .views import home, create_mood_entry, dashboard +from .views import home, create_mood_entry, dashboard, AboutView, ContactView, PrivacyPolicyView, SignUpView, save_mood_entry app_name = 'core' urlpatterns = [ path("", home, name="index"), + path('signup/', SignUpView.as_view(), name='signup'), path('mood/new/', create_mood_entry, name='create_mood_entry'), + path('mood/save/', save_mood_entry, name='save_mood_entry'), path('dashboard/', dashboard, name='dashboard'), + path('about/', AboutView.as_view(), name='about'), + path('contact/', ContactView.as_view(), name='contact'), + path('privacy-policy/', PrivacyPolicyView.as_view(), name='privacy_policy'), ] \ No newline at end of file diff --git a/core/views.py b/core/views.py index 4108665..c7eb742 100644 --- a/core/views.py +++ b/core/views.py @@ -1,14 +1,55 @@ import os import platform +import json from django import get_version as django_version from django.shortcuts import render, redirect +from django.urls import reverse_lazy from django.utils import timezone from django.contrib.auth.decorators import login_required from django.http import JsonResponse -from .forms import MoodEntryForm -from .models import MoodEntry +from django.views.generic import TemplateView, FormView, CreateView from django_pandas.io import read_frame +from django.contrib import messages + +from .forms import MoodEntryForm, ContactForm, SignUpForm, DateRangeFilterForm +from .models import MoodEntry, Activity +from .mail import send_contact_message + + +class SignUpView(CreateView): + form_class = SignUpForm + success_url = reverse_lazy('login') + template_name = 'registration/signup.html' + + +class AboutView(TemplateView): + template_name = "core/about.html" + + +class ContactView(FormView): + template_name = "core/contact.html" + form_class = ContactForm + success_url = reverse_lazy('core:contact') + + def form_valid(self, form): + name = form.cleaned_data['name'] + email = form.cleaned_data['email'] + message = form.cleaned_data['message'] + + # Send email + email_sent = send_contact_message(name, email, message) + + if email_sent: + messages.success(self.request, 'Thank you for your message! We will get back to you shortly.') + else: + messages.error(self.request, 'Sorry, there was an error sending your message. Please try again later.') + + return super().form_valid(form) + + +class PrivacyPolicyView(TemplateView): + template_name = "core/privacy_policy.html" def home(request): @@ -19,6 +60,8 @@ def home(request): if request.user.is_authenticated: mood_entries = MoodEntry.objects.filter(user=request.user).order_by('-date_time')[:7] context['mood_entries'] = mood_entries + activities = Activity.objects.all() + context['activities'] = activities return render(request, "core/index.html", context) @@ -26,10 +69,20 @@ def home(request): @login_required def dashboard(request): mood_entries = MoodEntry.objects.filter(user=request.user).order_by('date_time') + form = DateRangeFilterForm(request.GET) + if form.is_valid(): + start_date = form.cleaned_data.get('start_date') + end_date = form.cleaned_data.get('end_date') + if start_date: + mood_entries = mood_entries.filter(date_time__gte=start_date) + if end_date: + mood_entries = mood_entries.filter(date_time__lte=end_date) + df = read_frame(mood_entries, fieldnames=['date_time', 'mood_score']) - df['date_time'] = df['date_time'].dt.strftime('%Y-%m-%d') + if not df.empty: + df['date_time'] = df['date_time'].dt.strftime('%Y-%m-%d') chart_data = df.to_json(orient='records') - return render(request, 'core/dashboard.html', {'chart_data': chart_data}) + return render(request, 'core/dashboard.html', {'chart_data': chart_data, 'form': form}) @login_required @@ -60,3 +113,23 @@ def create_mood_entry(request): form = MoodEntryForm() return render(request, 'core/mood_entry_form.html', {'form': form}) + +@login_required +def save_mood_entry(request): + if request.method == 'POST': + data = json.loads(request.body) + mood_score = data.get('mood_score') + activity_ids = data.get('activity_ids') + + mood_entry = MoodEntry.objects.create( + user=request.user, + mood_score=mood_score + ) + + if activity_ids: + activities = Activity.objects.filter(id__in=activity_ids) + mood_entry.activities.set(activities) + + return JsonResponse({'status': 'success'}) + return JsonResponse({'status': 'error'}, status=400) + diff --git a/static/css/custom.css b/static/css/custom.css index 925f6ed..0ad6952 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,4 +1,232 @@ -/* Custom styles for the application */ -body { - font-family: system-ui, -apple-system, sans-serif; + +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Lexend+Deca:wght@600;700&display=swap'); + +:root { + --primary-color: #8a2be2; /* Deep purple */ + --secondary-color: #4b0082; /* Indigo */ + --light-gray: #f8f9fa; + --dark-gray: #1f2937; + --text-color: #e0e0e0; /* Lighter text for dark background */ } + +body { + font-family: 'Inter', sans-serif; + color: var(--text-color); + background: linear-gradient(45deg, var(--primary-color), var(--secondary-color)); + background-size: 400% 400%; + animation: gradient 15s ease infinite; + height: 100vh; + overflow: hidden; /* Prevent scrollbars */ +} + +@keyframes gradient { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + +.breathing-canvas { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + position: relative; +} + +.pulsing-circle { + width: 80px; + height: 80px; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 50%; + cursor: pointer; + animation: pulse 2s infinite; + box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); + position: absolute; + bottom: 50px; +} + +@keyframes pulse { + 0% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); + } + 70% { + transform: scale(1); + box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); + } + 100% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); + } +} + +.fw-medium { + font-weight: 500; +} + +.fw-semibold { + font-weight: 600; +} + +.fw-bold { + font-weight: 700; +} + +.navbar { + background-color: transparent !important; + position: absolute; + width: 100%; + top: 0; + z-index: 10; +} + +.navbar-brand { + font-family: 'Lexend Deca', sans-serif; + font-weight: 700; + color: var(--text-color) !important; +} + +.nav-link { + color: var(--text-color) !important; +} + +.btn-primary { + background-color: transparent; + border-color: var(--text-color); + padding: 0.75rem 1.5rem; + font-weight: 500; + transition: all 0.2s ease-in-out; + color: var(--text-color); +} + +.btn-primary:hover { + background-color: rgba(255, 255, 255, 0.1); + border-color: var(--text-color); +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + background-color: transparent; +} + +/* Modal styles */ +.modal { + display: none; + position: fixed; + z-index: 100; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0, 0, 0, 0.4); +} + +.modal-content { + background-color: #1f2937; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 80%; + max-width: 500px; + border-radius: 20px; + animation: bloom 0.5s ease-out; +} + +@keyframes bloom { + from { + transform: scale(0); + } + to { + transform: scale(1); + } +} + +.close-button { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close-button:hover, +.close-button:focus { + color: white; + text-decoration: none; + cursor: pointer; +} + +/* Mood slider */ +.mood-slider-container { + margin: 20px 0; +} + +.mood-slider { + -webkit-appearance: none; + width: 100%; + height: 15px; + border-radius: 5px; + background: #ddd; + outline: none; + opacity: 0.7; + -webkit-transition: .2s; + transition: opacity .2s; +} + +.mood-slider:hover { + opacity: 1; +} + +.mood-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 25px; + height: 25px; + border-radius: 50%; + background: var(--primary-color); + cursor: pointer; +} + +.mood-slider::-moz-range-thumb { + width: 25px; + height: 25px; + border-radius: 50%; + background: var(--primary-color); + cursor: pointer; +} + +.mood-labels { + display: flex; + justify-content: space-between; + margin-top: 10px; +} + +/* Activity bubbles */ +.activity-bubbles { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 15px; + margin: 20px 0; +} + +.activity-bubble { + padding: 10px 20px; + border-radius: 20px; + background-color: #4b5563; + cursor: pointer; + transition: background-color 0.3s; +} + +.activity-bubble.selected { + background-color: var(--primary-color); +} + diff --git a/staticfiles/css/custom.css b/staticfiles/css/custom.css index 108056f..0ad6952 100644 --- a/staticfiles/css/custom.css +++ b/staticfiles/css/custom.css @@ -1,21 +1,232 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Lexend+Deca:wght@600;700&display=swap'); + :root { - --bg-color-start: #6a11cb; - --bg-color-end: #2575fc; - --text-color: #ffffff; - --card-bg-color: rgba(255, 255, 255, 0.01); - --card-border-color: rgba(255, 255, 255, 0.1); + --primary-color: #8a2be2; /* Deep purple */ + --secondary-color: #4b0082; /* Indigo */ + --light-gray: #f8f9fa; + --dark-gray: #1f2937; + --text-color: #e0e0e0; /* Lighter text for dark background */ } + body { - margin: 0; font-family: 'Inter', sans-serif; - background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); color: var(--text-color); + background: linear-gradient(45deg, var(--primary-color), var(--secondary-color)); + background-size: 400% 400%; + animation: gradient 15s ease infinite; + height: 100vh; + overflow: hidden; /* Prevent scrollbars */ +} + +@keyframes gradient { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + +.breathing-canvas { display: flex; justify-content: center; align-items: center; - min-height: 100vh; - text-align: center; - overflow: hidden; + height: 100%; position: relative; } + +.pulsing-circle { + width: 80px; + height: 80px; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 50%; + cursor: pointer; + animation: pulse 2s infinite; + box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); + position: absolute; + bottom: 50px; +} + +@keyframes pulse { + 0% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); + } + 70% { + transform: scale(1); + box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); + } + 100% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); + } +} + +.fw-medium { + font-weight: 500; +} + +.fw-semibold { + font-weight: 600; +} + +.fw-bold { + font-weight: 700; +} + +.navbar { + background-color: transparent !important; + position: absolute; + width: 100%; + top: 0; + z-index: 10; +} + +.navbar-brand { + font-family: 'Lexend Deca', sans-serif; + font-weight: 700; + color: var(--text-color) !important; +} + +.nav-link { + color: var(--text-color) !important; +} + +.btn-primary { + background-color: transparent; + border-color: var(--text-color); + padding: 0.75rem 1.5rem; + font-weight: 500; + transition: all 0.2s ease-in-out; + color: var(--text-color); +} + +.btn-primary:hover { + background-color: rgba(255, 255, 255, 0.1); + border-color: var(--text-color); +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + background-color: transparent; +} + +/* Modal styles */ +.modal { + display: none; + position: fixed; + z-index: 100; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0, 0, 0, 0.4); +} + +.modal-content { + background-color: #1f2937; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 80%; + max-width: 500px; + border-radius: 20px; + animation: bloom 0.5s ease-out; +} + +@keyframes bloom { + from { + transform: scale(0); + } + to { + transform: scale(1); + } +} + +.close-button { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close-button:hover, +.close-button:focus { + color: white; + text-decoration: none; + cursor: pointer; +} + +/* Mood slider */ +.mood-slider-container { + margin: 20px 0; +} + +.mood-slider { + -webkit-appearance: none; + width: 100%; + height: 15px; + border-radius: 5px; + background: #ddd; + outline: none; + opacity: 0.7; + -webkit-transition: .2s; + transition: opacity .2s; +} + +.mood-slider:hover { + opacity: 1; +} + +.mood-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 25px; + height: 25px; + border-radius: 50%; + background: var(--primary-color); + cursor: pointer; +} + +.mood-slider::-moz-range-thumb { + width: 25px; + height: 25px; + border-radius: 50%; + background: var(--primary-color); + cursor: pointer; +} + +.mood-labels { + display: flex; + justify-content: space-between; + margin-top: 10px; +} + +/* Activity bubbles */ +.activity-bubbles { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 15px; + margin: 20px 0; +} + +.activity-bubble { + padding: 10px 20px; + border-radius: 20px; + background-color: #4b5563; + cursor: pointer; + transition: background-color 0.3s; +} + +.activity-bubble.selected { + background-color: var(--primary-color); +} +