From ade0d4fee4ec41565e3788d357ab706417cdb879 Mon Sep 17 00:00:00 2001
From: Saurabh Kumar <theskumar@users.noreply.github.com>
Date: Wed, 22 May 2024 20:30:17 +0530
Subject: [PATCH] Update "Admin", "feed's related item" & "Goto Dashboard"
 button icons (#3922)

- Rename "Apply Admin" to "Admin"
- Adds "Admin" icon to the user's profile page along with the
"Dashboard" link, makes it easier to goto admin without going to
dashboard everytime first.
- Update icons for "dashboard" and "Admin" to use heroicons.
- Update activity feed related link icon + it's visuals
- Remove `arrow-head-pixels--solid` icon from the sprite as it's no
longer in use anywhere.


Co-authored-by: Fredrik Jonsson <frjo@xdeb.org>
---
 .../activity/include/listing_base.html        | 17 ++++----
 .../dashboard/contracting_dashboard.html      | 12 +++---
 .../templates/dashboard/dashboard.html        |  9 ++---
 .../dashboard/finance_dashboard.html          | 14 ++++---
 .../users/templates/two_factor/_base.html     |  6 +--
 .../apply/users/templates/users/account.html  | 40 +++++++++++--------
 hypha/templates/includes/sprites.html         |  8 ----
 7 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/hypha/apply/activity/templates/activity/include/listing_base.html b/hypha/apply/activity/templates/activity/include/listing_base.html
index af43a912d..0179a6d8f 100644
--- a/hypha/apply/activity/templates/activity/include/listing_base.html
+++ b/hypha/apply/activity/templates/activity/include/listing_base.html
@@ -66,15 +66,14 @@
 
 
             {% if not submission_title and activity|user_can_see_related:request.user %}
-                <div class="px-3">
-                    {% with url=activity.related_object.get_absolute_url %}
-                        {% if url %}
-                            <a href="{{ url }}" target="_blank" class="feed__related-item">
-                                {% trans "View " %}{{ activity.related_object|model_verbose_name }} <svg class="icon inline"><use xlink:href="#arrow-head-pixels--solid"></use></svg>
-                            </a>
-                        {% endif %}
-                    {% endwith %}
-                </div>
+                {% with url=activity.related_object.get_absolute_url %}
+                    {% if url %}
+                        <a href="{{ url }}" class="p-1 ms-2 mt-2 text-sm inline-flex items-center hover:opacity-70 transition-opacity font-bold">
+                            <span class="uppercase">{% trans "View " %}{{ activity.related_object|model_verbose_name }}</span>
+                            {% heroicon_micro "chevron-double-right" class="inline w-4 h-4 ms-1" aria_hidden=true %}
+                        </a>
+                    {% endif %}
+                {% endwith %}
             {% endif %}
 
         </div>
diff --git a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
index 203b254c7..b6299cbac 100644
--- a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
@@ -1,6 +1,6 @@
 {% extends "base-apply.html" %}
 {% load render_table from django_tables2 %}
-{% load i18n static markdown_tags nh3_tags %}
+{% load i18n static markdown_tags nh3_tags heroicons %}
 
 {% block title %}{% trans "Dashboard" %}{% endblock %}
 
@@ -8,10 +8,12 @@
     {% adminbar %}
         {% slot header %}{% trans "Dashboard" %}{% endslot %}
 
-        <a href="{% url 'wagtailadmin_home' %}" class="button button--primary button--arrow-pixels-white">
-            {% trans "Apply admin" %}
-            <svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
-        </a>
+        {% if perms.wagtailadmin.access_admin %}
+            <a href="{% url 'wagtailadmin_home' %}" class="button button--primary">
+                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
+                {% trans "Admin" %}
+            </a>
+        {% endif %}
     {% endadminbar %}
 
     <div class="wrapper wrapper--large wrapper--inner-space-medium">
diff --git a/hypha/apply/dashboard/templates/dashboard/dashboard.html b/hypha/apply/dashboard/templates/dashboard/dashboard.html
index eaccf5f2a..f7dcbbdeb 100644
--- a/hypha/apply/dashboard/templates/dashboard/dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/dashboard.html
@@ -1,6 +1,6 @@
 {% extends "base-apply.html" %}
 {% load render_table from django_tables2 %}
-{% load i18n static nh3_tags markdown_tags %}
+{% load i18n static nh3_tags markdown_tags heroicons %}
 
 {% block extra_css %}
     {{ my_reviewed.filterset.form.media.css }}
@@ -9,15 +9,14 @@
 {% block title %}{% trans "Dashboard" %}{% endblock %}
 
 {% block content %}
-
     {% adminbar %}
         {% slot header %}{% trans "Dashboard" %}{% endslot %}
         {% slot sub_heading %}{% trans "Welcome" %}, {{ request.user }}!{% endslot %}
 
         {% if perms.wagtailadmin.access_admin %}
-            <a href="{% url 'wagtailadmin_home' %}" id="wagtail-admin-button" class="button button--primary button--arrow-pixels-white">
-                {% trans "Apply admin" %}
-                <svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
+            <a href="{% url 'wagtailadmin_home' %}" id="wagtail-admin-button" class="button button--primary">
+                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
+                {% trans "Admin" %}
             </a>
         {% endif %}
     {% endadminbar %}
diff --git a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
index 2b6b93834..68f49e594 100644
--- a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
@@ -1,17 +1,19 @@
 {% extends "base-apply.html" %}
 {% load render_table from django_tables2 %}
-{% load i18n static markdown_tags nh3_tags %}
+{% load i18n static markdown_tags nh3_tags heroicons %}
 
 {% block title %}{% trans "Dashboard" %}{% endblock %}
 
 {% block content %}
-
     {% adminbar %}
         {% slot header %}{% trans "Dashboard" %}{% endslot %}
-        <a href="{% url 'wagtailadmin_home' %}" class="button button--primary button--arrow-pixels-white">
-            {% trans "Apply admin" %}
-            <svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
-        </a>
+
+        {% if perms.wagtailadmin.access_admin %}
+            <a href="{% url 'wagtailadmin_home' %}" class="button button--primary">
+                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
+                {% trans "Admin" %}
+            </a>
+        {% endif %}
     {% endadminbar %}
 
     <div class="wrapper wrapper--large wrapper--inner-space-medium">
diff --git a/hypha/apply/users/templates/two_factor/_base.html b/hypha/apply/users/templates/two_factor/_base.html
index bb66f2ca7..5b7e207bc 100644
--- a/hypha/apply/users/templates/two_factor/_base.html
+++ b/hypha/apply/users/templates/two_factor/_base.html
@@ -1,5 +1,5 @@
 {% extends 'base-apply.html' %}
-{% load i18n static %}
+{% load i18n static heroicons %}
 
 {% block content %}
     {% adminbar %}
@@ -14,9 +14,9 @@
         {% comment %} {% slot sub_heading %}{% trans "All submissions ready for discussion." %}{% endslot %} {% endcomment %}
 
         {% if user.can_access_dashboard %}
-            <a href="{% url 'dashboard:dashboard' %}" class="button button--primary button--arrow-pixels-white" hx-boost='true'>
+            <a href="{% url 'dashboard:dashboard' %}" class="button button--primary" hx-boost='true'>
+                {% heroicon_mini "squares-2x2" size=20 class="mr-1 inline align-text-bottom" %}
                 {% trans "Go to my dashboard" %}
-                <svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
             </a>
         {% endif %}
     {% endadminbar %}
diff --git a/hypha/apply/users/templates/users/account.html b/hypha/apply/users/templates/users/account.html
index 89f6c92a9..b331d32e1 100644
--- a/hypha/apply/users/templates/users/account.html
+++ b/hypha/apply/users/templates/users/account.html
@@ -1,5 +1,5 @@
 {% extends 'base-apply.html' %}
-{% load i18n users_tags wagtailcore_tags %}
+{% load i18n users_tags wagtailcore_tags heroicons %}
 
 {% block title %}{% trans "Account" %}{% endblock %}
 
@@ -8,23 +8,31 @@
         {% slot header %}{% trans "Welcome" %} {{ user }}{% endslot %}
         {% slot sub_heading %}{% trans "Manage your account details and security." %}{% endslot %}
 
-        {% if user.can_access_dashboard %}
-            <a href="{% url 'dashboard:dashboard' %}" class="button button--primary button--arrow-pixels-white" hx-boost='true'>
-                {% trans "Go to my dashboard" %}
-                <svg><use xlink:href="#arrow-head-pixels--solid"></use></svg>
-            </a>
-        {% else %}
-            <div class="wrapper wrapper--cta-box flex items-center">
-                <div class="flex-1">
-                    <h3 class="heading heading--no-margin font-bold">{% trans "Submit a new application" %}</h3>
-                    <p class="text-base m-0">{% trans "Apply now for our open rounds" %}</p>
+        <span class="flex gap-4">
+            {% if user.can_access_dashboard %}
+                <a href="{% url 'dashboard:dashboard' %}" class="button button--primary">
+                    {% heroicon_mini "squares-2x2" size=20 class="mr-1 inline align-text-bottom" %}
+                    {% trans "Go to my dashboard" %}
+                </a>
+            {% else %}
+                <div class="wrapper wrapper--cta-box flex items-center">
+                    <div class="flex-1">
+                        <h3 class="heading heading--no-margin font-bold">{% trans "Submit a new application" %}</h3>
+                        <p class="text-base m-0">{% trans "Apply now for our open rounds" %}</p>
+                    </div>
+                    <div>
+                        <a class="button button--blue-white" href="{% pageurl APPLY_SITE.root_page %}" class="button">{% trans "Apply" %}</a>
+                    </div>
                 </div>
-                <div>
-                    <a class="button button--blue-white" href="{% pageurl APPLY_SITE.root_page %}" class="button">{% trans "Apply" %}</a>
-                </div>
-            </div>
 
-        {% endif %}
+            {% endif %}
+            {% if perms.wagtailadmin.access_admin %}
+                <a href="{% url 'wagtailadmin_home' %}" id="wagtail-admin-button" class="button button--primary">
+                    {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
+                    {% trans "Admin" %}
+                </a>
+            {% endif %}
+        </span>
     {% endadminbar %}
 
     <div class="profile">
diff --git a/hypha/templates/includes/sprites.html b/hypha/templates/includes/sprites.html
index ba718828e..4d610aa3e 100644
--- a/hypha/templates/includes/sprites.html
+++ b/hypha/templates/includes/sprites.html
@@ -20,14 +20,6 @@
         <path d="M4 19V17.5H13.65V19H4ZM4 14.825V13.325H20V14.825H4ZM4 10.675V9.175H20V10.675H4ZM4 6.5V5H20V6.5H4Z" fill="black"/>
     </symbol>
 
-    <symbol id="arrow-head-pixels--solid" viewBox="0 0 50 75">
-        <g fill-rule="evenodd">
-            <path d="M0 50h25v25H0z" />
-            <path d="M25 25h25v25H25z" />
-            <path d="M0 0h25v25H0z" />
-        </g>
-    </symbol>
-
     <symbol id="request-changes" viewBox="0 0 16 16" fill="none">
         <path d="M8 15.2875C11.9764 15.2875 15.2 12.064 15.2 8.08751C15.2 4.11106 11.9764 0.887512 8 0.887512C4.02355 0.887512 0.799999 4.11106 0.799999 8.08751C0.799999 12.064 4.02355 15.2875 8 15.2875Z" stroke="#F05E54"/>
         <path d="M7.54625 9.5375L7.54625 4.11249L8.47594 4.11249L8.47594 9.5375L7.54625 9.5375ZM8.64 11.4937C8.64 11.6354 8.58531 11.7542 8.47594 11.85C8.36135 11.95 8.2051 12 8.00719 12C7.80927 12 7.65302 11.95 7.53844 11.85C7.41865 11.7542 7.35875 11.6354 7.35875 11.4937C7.35875 11.3562 7.41865 11.2375 7.53844 11.1375C7.65302 11.0417 7.80927 10.9937 8.00719 10.9937C8.2051 10.9937 8.36135 11.0417 8.47594 11.1375C8.58531 11.2375 8.64 11.3562 8.64 11.4937Z" fill="#F05E54"/>
-- 
GitLab