From 56978c82795ce87ea76cc12d37e997eec6abd4ae Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Date: Mon, 20 Mar 2023 15:45:11 +0530 Subject: [PATCH] Add Tailwind + Django Web Component (#3277) Fixes #ISSUEID Introduce tailwindcss[1] utilities and django-web-component[2] for frontend design isolation and reusability. Notes: - Saas rules take preference over the tailwind (we might want to change it) - In the future, the saas should be depreciated, and reusable classes should be updated to use tailwindcss [1] https://tailwindcss.com/ [2] https://github.com/Xzya/django-web-components --------- Co-authored-by: Fredrik Jonsson --- .../dashboard/community_dashboard.html | 16 +- .../templates/dashboard/dashboard.html | 24 +- .../submissions-waiting-for-review.html | 8 +- .../dashboard/partner_dashboard.html | 16 +- .../funds/grouped_application_list.html | 16 +- .../templates/funds/reviewer_leaderboard.html | 30 +- .../funds/reviewer_leaderboard_detail.html | 26 +- hypha/apply/funds/templates/funds/rounds.html | 13 +- .../templates/funds/staff_assignments.html | 38 +- .../funds/templates/funds/submissions.html | 14 +- .../funds/submissions_awaiting_review.html | 22 +- .../templates/funds/submissions_by_round.html | 23 +- .../templates/funds/submissions_overview.html | 93 ++-- .../templates/funds/submissions_result.html | 31 +- .../application_projects/invoice_list.html | 14 +- .../application_projects/overview.html | 16 +- .../application_projects/project_list.html | 14 +- .../application_projects/report_list.html | 12 +- hypha/core/apps.py | 11 + hypha/core/components.py | 6 + .../core/templates/components/admin_bar.html | 12 + hypha/settings/base.py | 3 + hypha/settings/django.py | 3 +- .../static_src/src/sass/apply/base/_base.scss | 1 - .../src/sass/apply/components/_heading.scss | 17 +- .../sass/apply/components/_stat-block.scss | 1 - .../src/sass/apply/components/_wrapper.scss | 2 +- hypha/static_src/src/tailwind-entry.css | 3 + hypha/templates/base-apply.html | 3 +- package-lock.json | 509 +++++++++++++++++- package.json | 19 +- requirements.txt | 1 + tailwind.config.js | 8 + 33 files changed, 760 insertions(+), 265 deletions(-) create mode 100644 hypha/core/apps.py create mode 100644 hypha/core/components.py create mode 100644 hypha/core/templates/components/admin_bar.html create mode 100644 hypha/static_src/src/tailwind-entry.css create mode 100644 tailwind.config.js diff --git a/hypha/apply/dashboard/templates/dashboard/community_dashboard.html b/hypha/apply/dashboard/templates/dashboard/community_dashboard.html index f2e013dd2a..56296aca20 100644 --- a/hypha/apply/dashboard/templates/dashboard/community_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/community_dashboard.html @@ -5,25 +5,23 @@ {% block title %}{% trans "Dashboard" %}{% endblock %} {% block content %} -
-
-
-

{% trans "Dashboard" %}

-
{% trans "An overview of active and past submissions" %}
-
+ + {% adminbar %} + {% slot header %}{% trans "Dashboard" %}{% endslot %} + {% slot sub_heading %}{% trans "An overview of active and past submissions" %}{% endslot %} +

{% trans "Submit a new application" %}

{% trans "Apply now for our open rounds" %}
{% trans "Apply" %}
-
-
+ {% endadminbar %}

- {% trans "Community review submissions" %} {{ my_community_review_count }} + {% trans "Community review submissions" %} {{ my_community_review_count }}

{% if my_community_review.data %} diff --git a/hypha/apply/dashboard/templates/dashboard/dashboard.html b/hypha/apply/dashboard/templates/dashboard/dashboard.html index 45badad03e..1cda540e09 100644 --- a/hypha/apply/dashboard/templates/dashboard/dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/dashboard.html @@ -9,32 +9,30 @@ {% block title %}{% trans "Dashboard" %}{% endblock %} {% block content %} -
-
- {% block page_header %} -

{% trans "Dashboard" %}

- {% endblock %} + + {% adminbar %} + {% slot header %}{% trans "Dashboard" %}{% endslot %} + {% slot sub_heading %}{% trans "Welcome" %}, {{ request.user }}!{% endslot %} + {% if perms.wagtailadmin.access_admin %} {% trans "Apply admin" %} {% endif %} -
-
-
- + {% endadminbar %} +
- +

{{ awaiting_reviews.count }}

{% trans "Submissions waiting for your review" %}

{% if awaiting_reviews.count %}
{% trans "View" %}
{% endif %}
- +

{{ projects.count }}

{% trans "Live projects under your management" %}

{% if projects.count %} @@ -42,7 +40,7 @@

{% trans "Dashboard" {% endif %} {% if not paf_waiting_for_approval.count is None%} - +

{{ paf_waiting_for_approval.count }}

{% trans "Projects awaiting approval" %}

{% if paf_waiting_for_approval.count %} @@ -50,7 +48,7 @@

{% trans "Dashboard" {% endif %} {% endif %} - +

{{ active_invoices.count }}

{% trans "Requests for invoices requiring your attention" %}

{% if active_invoices.count %} diff --git a/hypha/apply/dashboard/templates/dashboard/includes/submissions-waiting-for-review.html b/hypha/apply/dashboard/templates/dashboard/includes/submissions-waiting-for-review.html index 294f2a71b1..416a634090 100644 --- a/hypha/apply/dashboard/templates/dashboard/includes/submissions-waiting-for-review.html +++ b/hypha/apply/dashboard/templates/dashboard/includes/submissions-waiting-for-review.html @@ -1,8 +1,8 @@ {% load render_table from django_tables2 %} {% load i18n %} -

- {% trans "Submissions waiting for your review" %} {{ in_review_count }} +

+ {% trans "Submissions waiting for your review" %} {{ in_review_count }}

{% if my_review.data %} @@ -15,8 +15,8 @@

{% endif %} {% else %} -
-
{% trans "Nice! You're all caught up." %}
+
{# TODO Fill in data and update styles in future ticket #} diff --git a/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html b/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html index 38a6514bba..ff466c71f6 100644 --- a/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/partner_dashboard.html @@ -5,19 +5,19 @@ {% block title %}{% trans "Dashboard" %}{% endblock %} {% block content %} -
-
- {% block page_header %} -

{% trans "Dashboard" %}

- {% endblock %} -
-
+ + {% adminbar %} + + {% slot header %}{% trans "Dashboard" %}{% endslot %} + {% slot sub_heading %}{% trans "Welcome" %}, {{ request.user }}!{% endslot %} + + {% endadminbar %}

- {% trans "You are the partner of these submissions" %} {{ partner_submissions_count }} + {% trans "You are the partner of these submissions" %} {{ partner_submissions_count }}

{% if partner_submissions.data %} diff --git a/hypha/apply/funds/templates/funds/grouped_application_list.html b/hypha/apply/funds/templates/funds/grouped_application_list.html index 1d5dc04634..03bc7b1b3b 100644 --- a/hypha/apply/funds/templates/funds/grouped_application_list.html +++ b/hypha/apply/funds/templates/funds/grouped_application_list.html @@ -6,16 +6,12 @@ {{ filter.form.media.css }} {% endblock %} -{% block content%} -
- -
+{% block content %} + + {% adminbar %} + {% slot header %}{% trans "List of Submissions summary" %}{% endslot %} + {% endadminbar %} +
{% endblock %} diff --git a/hypha/apply/funds/templates/funds/reviewer_leaderboard.html b/hypha/apply/funds/templates/funds/reviewer_leaderboard.html index d83233db7c..b66e81eb1f 100644 --- a/hypha/apply/funds/templates/funds/reviewer_leaderboard.html +++ b/hypha/apply/funds/templates/funds/reviewer_leaderboard.html @@ -5,19 +5,25 @@ {% block title %}{% trans "Reviews" %}{% endblock %} {% block content %} -
- + {% endif %} + {% endadminbar %}
{% block table %} diff --git a/hypha/apply/funds/templates/funds/reviewer_leaderboard_detail.html b/hypha/apply/funds/templates/funds/reviewer_leaderboard_detail.html index b9eb1e1036..ab2dba3293 100644 --- a/hypha/apply/funds/templates/funds/reviewer_leaderboard_detail.html +++ b/hypha/apply/funds/templates/funds/reviewer_leaderboard_detail.html @@ -5,23 +5,15 @@ {% block title %}{% trans "Reviews" %}{% endblock %} {% block content %} -
- - -
- {% block table %} - {% render_table table %} - {% endblock %} -
{% endblock %} diff --git a/hypha/apply/funds/templates/funds/rounds.html b/hypha/apply/funds/templates/funds/rounds.html index bf65d8b83a..2037d39cf3 100644 --- a/hypha/apply/funds/templates/funds/rounds.html +++ b/hypha/apply/funds/templates/funds/rounds.html @@ -10,14 +10,11 @@ {% block content %} -
-
-
-

{% trans "Rounds" %}

-
{% trans "Explore current and past rounds" %}
-
-
-
+ + {% adminbar %} + {% slot header %}{% trans "Rounds" %}{% endslot %} + {% slot sub_heading %}{% trans "Explore current and past rounds" %}{% endslot %} + {% endadminbar %}
{% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_batch_actions=False %} diff --git a/hypha/apply/funds/templates/funds/staff_assignments.html b/hypha/apply/funds/templates/funds/staff_assignments.html index c7c3d29483..c8ebeec6d4 100644 --- a/hypha/apply/funds/templates/funds/staff_assignments.html +++ b/hypha/apply/funds/templates/funds/staff_assignments.html @@ -5,23 +5,29 @@ {% block title %}{% trans "Staff assignments" %}{% endblock %} {% block content %} -
-