Skip to content

Commit

Permalink
Create new feature to enable creation of new activities (#539)
Browse files Browse the repository at this point in the history
* Create activity reducer with initial state for all activities

* Create activity actions file with setActivities function

* Update configureStore to include activityReducer

* Created a generic activities objects to use meanwhile creating backend for activities

* Create Activities component and add button in header to render it

* Connect activities component to activities store

* Create action types constants

* Remove unused files

* Create activities video carousel

* Create activities video carousel

* Create activity card

* Add projects count icon and activity tags to the card

* Add creator to activity card

* Create creator component to handle multipe activity creator case and display them in activity card

* Show full creator image on hover

* Ajust activity cards and handle display of more than 3 tags

* Create activity creation form container

* Create form steps components and form progressBar

* Add translation for BROWS ACTIVITIES Button

* Create reusable dynamic progress bar

* Create activity creation step1 form

* Create create activity step 2 form inputs

* Create separate component for react quill text fields

* Create AddMore and MaterialsUsed component

* Add handleOnChange an on blur for materials used inputs

* Create formLabel and UploadFile components

* Add validation to step1 fields

* Create step3 input blocks

* Add form steps verification

* Add defaultValue to input and inputText to display values entered when checking back previous steps

* Add handleImageChange to handle all fileUpload instances and fix form responsiveness issues

* Add validation to fields accepting images and Create upload image functionality

* Add at least one material required validation for materialsUsed array field

* Fix inspiringExemplesImages append files issue

* Try to fix appending multiple inspiringExemplesImages images to newActivity state by adding keys to uploadFiles component instances and add promise to set state

* Create separate states for step verifiedStep and newActivity and use name instead of label in IputText and send only required props as parameter

* Update InputText and Input components and according script functions to accept only needed props

* Update materialsUsed and all other fields using Input and InputText components and make them update form state correctly

* Update UploadFiles and uploadFile scripts to accept the new states and handle multiple inputs feeding same field in the state issue

* Upload images to local and setNewActivityObject with urls

* Handle video change on uploadFile

* Fix inspiringExemplesImages files_to_upload issue to upload correctly

* updateState with formik file values on form submit

* Add hided submitButton with ref and click on setState from refactorNewActivityObject to upload files after state is updated

* Create activities app backend

* Create activities app

* Add materials_udes_image field to activity model

* Add category and add order to making steps

* Add inspiring artists

* started updating handleFileFieldChange

* Add inspired_from_activity field to Project model and run migrations

* Create UploadMedia and FileField classes to handle file input changes

* Add inputLabel to display label in inputs not having FormLabel and Add artist full name input to artist section

* Move upload media to uploadFileScript and Change it to return promise and create appendFile to field for file field accepting multiple files

* Create activity serializers and ListAPIView

* Create activity serializers create method and combine fields data for nested objects in createActivityScripts

* Add creator to created activity

* Fixing input value undefined

* Fix styled-components package import issue

* Refactor activity object returned from backend to fit form fields for edit and Add redirection and routes for activity edit

* Fix Input and InputText display value from state issue

* Create map of field names and activity object attribute to help deserialize and display data in the form for edit

* Successfully Update activity and all related fields

* Fix delete activity issue and add loading to activities veiw

* Remove commented code from activities view

* Fix refresh activities list after delete and update issue by using useSelector hook instead of reading reducer state from props

* Fix Display InputText errors issue

* Remove prev selected files if new files have errors and display error

* Add preview image feature to UploadFile component

* Add preview image to UploadFile component

* Preview image delete works, add validation for activity images on update when deleting all urls

* Fix activity without unrequired fields creation issue by removing field keys from api object instead of sending empty objects

* Changed all form state to be handled by formik including array of objects fields and updated create activity

* Update step verification to verify step when required field provided with no error and let user see msgs

* Add function to fill form from activity object and call update activity

* User stats enhancement (#505)

* Use same border radius for next and prev buttons

* refactor button border radius code

* reverted master

* user's profile header refactor

* Revert "User stats enhancement (#505)" (#527)

This reverts commit 4aa7cc1.

* User stats redesign (#526)

* Use same border radius for next and prev buttons

* refactor button border radius code

* reverted master

* user stats restructure

* patch to handle longusernames

Co-authored-by: Deepanshu039 <[email protected]>

* update and create working with no issues after refactor

* Activitylog feature (#523)

* Use same border radius for next and prev buttons

* refactor button border radius code

* reverted master

* activitylog feature to keep the track of user's activity

* patch after #1st review

* migration files of activity-log

* react-icons package used in activity-log

* package-lock file with minimal changes

Co-authored-by: Deepanshu039 <[email protected]>

* add --max_old_space_size=4096 to react-script options in package.json (#529)

Co-authored-by: Ndibe Raymond Olisaemeka <[email protected]>

* add GENERATE_SOURCEMAP=false to .env file to solve (#530)

the heap out of memory problem

Co-authored-by: Ndibe Raymond Olisaemeka <[email protected]>

* Revert "add --max_old_space_size=4096 to react-script options in package.json (#529)" (#531)

This reverts commit 9444c3f.

* Use formik field Array to display making steps and inspiring examples and fix all update issues now creation and update working correctly

* Badge titles on user's profile (#524)

* Use same border radius for next and prev buttons

* refactor button border radius code

* reverted master

* automated and custom badges on user's profile

* initially populate badges table

* #1 patch after review

* feature: change original badge title from admin panel

* migration file of badge table

Co-authored-by: Deepanshu039 <[email protected]>

* Add  empty object validation and file compression

* Handle video validation Upload and preview by UploadFile component

* Add save activity functionality and first section of activity details view

* Add verification on clicking next button

* Fix video url preview and empty url issues

* Add regex to validate video urls

* Use iframe for video url previews and to read videos in activity details view

* Add pdf creation component

* Add generate pdf of activity and style activity detail view

* commit pdfStyle and scripts

* merged remote master

* Add build project based on activity functionality

* Add breadCrumb nav

* Fix styling issues

* Redirect user to activity_details after creation or edit

* handle error comming from server and add permission restrictions

* restyle pdf

* Restrict activity creation to educators staff and moderators

* Display inspired_projects count in activity cards

* Add toggle publish functionality and fix activity details style issues

* Fix making steps empty object validation

* Add hindi missing transaltion to activity form

* Restyle linked projects count in activity card

* Fix activity details quill editor styling

* Add footer to pdf

* Add visited links to breadCrumb

* Change breadCrumb separators

* Fix validation max values and updated translation properties accordingly

* Display only published activities to non staff or moderator users

* Add condition before displaying store variables to fix oppening on firefox issue

* Update breadCrumb to handle all links creators projects and activities

* Add Create Activity link and Update href to react router Links in humbergerMenu

* Add my activities and unpublished activities links to profile menu

* Remove unbreakable from making steps block on pdf and put activity_id in params instead of url in project create

* Fix empty height space generated by react quill on firefox

* Fix images preview stretch issue

* Add upload progress

* Fix breadCrumbs default redirection to projects issue

* Increase activity form title weight

* Capitalize breadCumbs Links

* Decrease breadCrumbs Links font weigth

* Change activity cards LinkedProjects pill text color and make count number bolder

* Create api endpoints and dispatchers to fetch published unPublished and userActivities

* Add making steps order and list dots to materials required

* Add link to activity from pdf

* Remove prints and console logs

* Capitalize input labels of activity creation form

* Make breadCrumbs navBar stick to top when scrolling down

* Change activity text and titles color to black to follow projects style

* Add link to activity creator profile from created on date in activity details view

* Render error page if activity list is empty

* Move breadCrumbs navbar into header to have fixed position

* Update breadCrumbs navBar to properly display routes

* Update activities view to fetch data from api and display loading meanwhile

* merge remote master

* Add changes

* update pdfmake

* Add linked_projects component

* Add activity linked projects view and link

* Call upload file to DO

* updated upload to DO and upload video to cloudinary but still need review and test from Raymond

---------

Co-authored-by: Deepanshu Gautam <[email protected]>
Co-authored-by: Suchakra Sharma <[email protected]>
Co-authored-by: Deepanshu039 <[email protected]>
Co-authored-by: Ndibe Raymond Olisaemeka <[email protected]>
Co-authored-by: Ndibe Raymond Olisaemeka <[email protected]>
  • Loading branch information
6 people authored Feb 4, 2023
1 parent f92ea9c commit 1505dd9
Show file tree
Hide file tree
Showing 141 changed files with 18,462 additions and 5,098 deletions.
2 changes: 1 addition & 1 deletion zubhub_backend/compose/celery/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ django-js-asset>=1.2.2
django-mptt>=0.11.0
django-rest-auth>=0.9.5
django-rest-swagger>=2.2.0
django-summernote>=0.8.11.6
django-summernote==0.8.11.6
django-treebeard>=4.5.1
djangorestframework>=3.11.2
factory-boy>=2.12.0
Expand Down
2 changes: 1 addition & 1 deletion zubhub_backend/compose/flower/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ django-js-asset>=1.2.2
django-mptt>=0.11.0
django-rest-auth>=0.9.5
django-rest-swagger>=2.2.0
django-summernote>=0.8.11.6
django-summernote==0.8.11.6
django-treebeard>=4.5.1
djangorestframework>=3.11.2
factory-boy>=2.12.0
Expand Down
1 change: 1 addition & 0 deletions zubhub_backend/compose/web/dev/start
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ python /zubhub_backend/zubhub/manage.py createcachetable
python /zubhub_backend/zubhub/manage.py populate_countries
python /zubhub_backend/zubhub/manage.py populate_categories
python /zubhub_backend/zubhub/manage.py populate_initial_creator_tags
python /zubhub_backend/zubhub/manage.py populate_initial_badges

exec /usr/local/bin/gunicorn zubhub.wsgi --reload --threads=3 --timeout 155 --bind 0.0.0.0:8000 \
--access-logfile - --error-logfile - --chdir /zubhub_backend/zubhub
1 change: 1 addition & 0 deletions zubhub_backend/compose/web/prod/start
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python /zubhub_backend/zubhub/manage.py createcachetable
python /zubhub_backend/zubhub/manage.py populate_countries
python /zubhub_backend/zubhub/manage.py populate_initial_creator_tags
python /zubhub_backend/zubhub/manage.py populate_categories
python /zubhub_backend/zubhub/manage.py populate_initial_badges

exec /usr/local/bin/gunicorn zubhub.wsgi --threads=3 --timeout 155 --bind 0.0.0.0:8000 \
--access-logfile - --error-logfile - --chdir /zubhub_backend/zubhub
2 changes: 1 addition & 1 deletion zubhub_backend/compose/web/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ django-js-asset>=1.2.2
django-mptt>=0.11.0
django-rest-auth>=0.9.5
django-rest-swagger>=2.2.0
django-summernote>=0.8.11.6
django-summernote==0.8.11.6
django-treebeard>=4.5.1
djangorestframework>=3.11.2
factory-boy>=2.12.0
Expand Down
7 changes: 6 additions & 1 deletion zubhub_backend/zubhub/APIS/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from django.urls import path, include
from zubhub.views import (UploadFileAPIView, DeleteFileAPIView,
HeroAPIView, HelpAPIView, PrivacyAPIView, FAQAPIView, SigGenAPIView, UploadFileToLocalAPIView)
HeroAPIView, HelpAPIView, ChallengeAPIView, PrivacyAPIView, FAQAPIView, AmbassadorsAPIView,
SigGenAPIView, UploadFileToLocalAPIView)


urlpatterns = [
path('rest-auth/', include('rest_auth.urls')),
path('rest-auth/registration/', include('rest_auth.registration.urls')),
path('creators/', include('creators.urls', namespace="creators")),
path('projects/', include('projects.urls', namespace="projects")),
path('activitylog/', include('activitylog.urls', namespace="activitylog")),
path('activities/', include('activities.urls', namespace="activities")),
path('notifications/', include('notifications.urls', namespace="notifications")),
path('upload-file/', UploadFileAPIView, name="upload_file"),
path('delete-file/', DeleteFileAPIView, name="delete_file"),
Expand All @@ -17,6 +20,8 @@
path('help/', HelpAPIView.as_view(), name="help"),
path('privacy/', PrivacyAPIView.as_view(), name="privacy"),
path('faqs/', FAQAPIView.as_view(), name="faqs"),
path('ambassadors/', AmbassadorsAPIView.as_view(), name="ambassadors"),
path('challenge/', ChallengeAPIView.as_view(), name="challenge"),
path('signature/', SigGenAPIView,
name="signature_generator_api")
]
Empty file.
3 changes: 3 additions & 0 deletions zubhub_backend/zubhub/activities/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions zubhub_backend/zubhub/activities/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ActivitiesConfig(AppConfig):
name = 'activities'
103 changes: 103 additions & 0 deletions zubhub_backend/zubhub/activities/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Generated by Django 3.2 on 2022-08-11 11:17

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

initial = True

dependencies = [
('projects', '0007_tag_tag_name_gin_idx'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Activity',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('title', models.CharField(max_length=1000)),
('learning_goals', models.TextField(blank=True, max_length=10000)),
('facilitation_tips', models.TextField(blank=True, max_length=10000)),
('motivation', models.TextField(blank=True, max_length=10000)),
('video', models.URLField(blank=True, max_length=1000, null=True)),
('materials_used', models.CharField(max_length=5000)),
('views_count', models.IntegerField(blank=True, default=0)),
('saved_count', models.IntegerField(blank=True, default=0)),
('created_on', models.DateTimeField(default=django.utils.timezone.now)),
('publish', models.BooleanField(default=False)),
('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activities', to='projects.category')),
('creators', models.ManyToManyField(related_name='activities_created', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image_url', models.URLField(max_length=1000)),
('public_id', models.CharField(blank=True, max_length=1000)),
],
),
migrations.CreateModel(
name='InspiringExamples',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(blank=True, max_length=10000)),
('credit', models.CharField(blank=True, max_length=1000)),
('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='inspiring_examples', to='activities.activity')),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activities.image')),
],
),
migrations.CreateModel(
name='InspiringArtist',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('short_biography', models.TextField(blank=True, max_length=10000)),
('name', models.CharField(max_length=100)),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activities.image')),
],
),
migrations.CreateModel(
name='ActivityMakingSteps',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(blank=True, max_length=10000)),
('order', models.IntegerField()),
('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='making_steps', to='activities.activity')),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activities.image')),
],
),
migrations.CreateModel(
name='ActivityImages',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activity_images', to='activities.activity')),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activities.image')),
],
),
migrations.AddField(
model_name='activity',
name='inspiring_artist',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='inspiring_artist_activities', to='activities.inspiringartist'),
),
migrations.AddField(
model_name='activity',
name='materials_used_image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activities.image'),
),
migrations.AddField(
model_name='activity',
name='saved_by',
field=models.ManyToManyField(blank=True, related_name='activities_saved', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='activity',
name='views',
field=models.ManyToManyField(blank=True, related_name='activities_viewed', to=settings.AUTH_USER_MODEL),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated by Django 3.2 on 2022-08-14 07:38

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('activities', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='activity',
name='created_on',
field=models.DateTimeField(default=django.utils.timezone.now, null=True),
),
migrations.AlterField(
model_name='activity',
name='materials_used',
field=models.TextField(max_length=5000),
),
migrations.AlterField(
model_name='activity',
name='publish',
field=models.BooleanField(default=False, null=True),
),
migrations.AlterField(
model_name='activity',
name='title',
field=models.CharField(max_length=500),
),
migrations.AlterField(
model_name='image',
name='public_id',
field=models.TextField(blank=True, max_length=1000),
),
migrations.AlterField(
model_name='inspiringexamples',
name='credit',
field=models.TextField(blank=True, max_length=1000),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2 on 2022-08-14 17:03

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('activities', '0002_auto_20220814_0738'),
]

operations = [
migrations.RenameModel(
old_name='ActivityImages',
new_name='ActivityImage',
),
migrations.RenameModel(
old_name='ActivityMakingSteps',
new_name='ActivityMakingStep',
),
migrations.RenameModel(
old_name='InspiringExamples',
new_name='InspiringExample',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2 on 2022-08-14 19:37

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('activities', '0003_auto_20220814_1703'),
]

operations = [
migrations.RenameField(
model_name='activitymakingstep',
old_name='order',
new_name='step_order',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2 on 2022-08-16 09:58

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('activities', '0004_rename_order_activitymakingstep_step_order'),
]

operations = [
migrations.RenameField(
model_name='image',
old_name='image_url',
new_name='file_url',
),
]
19 changes: 19 additions & 0 deletions zubhub_backend/zubhub/activities/migrations/0006_activity_slug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2 on 2022-08-16 13:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('activities', '0005_rename_image_url_image_file_url'),
]

operations = [
migrations.AddField(
model_name='activity',
name='slug',
field=models.SlugField(default='first_activity_slug', max_length=1000, unique=True),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.2 on 2022-08-19 16:40

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('activities', '0006_activity_slug'),
]

operations = [
migrations.AlterField(
model_name='activity',
name='inspiring_artist',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='inspiring_artist_activities', to='activities.inspiringartist'),
),
migrations.AlterField(
model_name='activity',
name='materials_used_image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='activities.image'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2 on 2022-08-29 15:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('activities', '0007_auto_20220819_1640'),
]

operations = [
migrations.AlterField(
model_name='inspiringartist',
name='name',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='inspiringartist',
name='short_biography',
field=models.TextField(blank=True, max_length=10000, null=True),
),
]
Empty file.
Loading

0 comments on commit 1505dd9

Please sign in to comment.