Skip to content

Commit

Permalink
Activity tweak icons and messages
Browse files Browse the repository at this point in the history
  • Loading branch information
theskumar committed Aug 26, 2024
1 parent 119bb7a commit 3c98f74
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 54 deletions.
45 changes: 19 additions & 26 deletions hypha/apply/activity/adapters/activity_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class ActivityAdapter(AdapterBase):
MESSAGES.NEW_SUBMISSION: _(
"Submitted {source.title_text_display} for {source.page.title}"
),
MESSAGES.EDIT_SUBMISSION: _("Edited"),
MESSAGES.APPLICANT_EDIT: _("Edited"),
MESSAGES.UPDATE_LEAD: _("Lead changed from {old_lead} to {source.lead}"),
MESSAGES.BATCH_UPDATE_LEAD: _("Batch Lead changed to {new_lead}"),
MESSAGES.EDIT_SUBMISSION: _("edited the submission"),
MESSAGES.APPLICANT_EDIT: _("edited the submission"),
MESSAGES.UPDATE_LEAD: _("updated Lead from {old_lead} to {source.lead}"),
MESSAGES.BATCH_UPDATE_LEAD: _("batch updated Lead to {new_lead}"),
MESSAGES.DETERMINATION_OUTCOME: _(
"Sent a determination. Outcome: {determination.clean_outcome}"
"sent a determination. Outcome: {determination.clean_outcome}"
),
MESSAGES.BATCH_DETERMINATION_OUTCOME: "batch_determination",
MESSAGES.INVITED_TO_PROPOSAL: _("Invited to submit a proposal"),
Expand All @@ -42,24 +42,22 @@ class ActivityAdapter(AdapterBase):
MESSAGES.OPENED_SEALED: _("Opened the submission while still sealed"),
MESSAGES.SCREENING: "handle_screening_statuses",
MESSAGES.REVIEW_OPINION: _(
"{user} {opinion.opinion_display}s with {opinion.review.author}s review of {source}"
"{opinion.opinion_display}s with {opinion.review.author}s review of {source}"
),
MESSAGES.DELETE_REVIEW_OPINION: _(
"{user} deleted the opinion for review: {review_opinion.review}"
"deleted the opinion for review: {review_opinion.review}"
),
MESSAGES.CREATED_PROJECT: _("Created project"),
MESSAGES.PROJECT_TRANSITION: "handle_project_transition",
MESSAGES.UPDATE_PROJECT_TITLE: _(
"{user} has updated the project title from {old_title} to {source.title}"
),
MESSAGES.UPDATE_PROJECT_LEAD: _(
"Lead changed from {old_lead} to {source.lead}"
"updated the project title from {old_title} to {source.title}"
),
MESSAGES.UPDATE_PROJECT_LEAD: _("update Lead from {old_lead} to {source.lead}"),
MESSAGES.SEND_FOR_APPROVAL: _("Requested approval"),
MESSAGES.APPROVE_PAF: "handle_paf_assignment",
MESSAGES.APPROVE_PROJECT: _("Approved"),
MESSAGES.REQUEST_PROJECT_CHANGE: _(
'Requested changes for acceptance: "{comment}"'
'requested changes for acceptance: "{comment}"'
),
MESSAGES.SUBMIT_CONTRACT_DOCUMENTS: _("Submitted Contract Documents"),
MESSAGES.UPLOAD_CONTRACT: _("Uploaded a {contract.state} contract"),
Expand All @@ -69,17 +67,13 @@ class ActivityAdapter(AdapterBase):
MESSAGES.SUBMIT_REPORT: _("Submitted a report"),
MESSAGES.SKIPPED_REPORT: "handle_skipped_report",
MESSAGES.REPORT_FREQUENCY_CHANGED: "handle_report_frequency",
MESSAGES.DISABLED_REPORTING: _("Reporting disabled"),
MESSAGES.DISABLED_REPORTING: _("disabled reporting"),
MESSAGES.BATCH_DELETE_SUBMISSION: "handle_batch_delete_submission",
MESSAGES.BATCH_ARCHIVE_SUBMISSION: "handle_batch_archive_submission",
MESSAGES.BATCH_UPDATE_INVOICE_STATUS: "handle_batch_update_invoice_status",
MESSAGES.ARCHIVE_SUBMISSION: _(
"{user} has archived the submission: {source.title_text_display}"
),
MESSAGES.UNARCHIVE_SUBMISSION: _(
"{user} has unarchived the submission: {source.title_text_display}"
),
MESSAGES.DELETE_INVOICE: _("Deleted an invoice"),
MESSAGES.ARCHIVE_SUBMISSION: _("archived this submission"),
MESSAGES.UNARCHIVE_SUBMISSION: _("un-archived this submission"),
MESSAGES.DELETE_INVOICE: _("deleted an invoice"),
MESSAGES.REMOVE_TASK: "handle_task_removal",
}

Expand Down Expand Up @@ -214,13 +208,12 @@ def handle_paf_assignment(self, source, paf_approvals, **kwargs):
def handle_task_removal(self, source, task, **kwargs):
if task.user:
return _(
"{user} has removed the task {task.code} for {source} from the task list".format(
user=kwargs.get("user"), task=task, source=source
"removed the task {task.code} for {source} from the task list".format(
task=task, source=source
)
)
return _(
"{user} has removed the task {task.code} for {source} from whole team's{user_groups} task list.".format(
user=kwargs.get("user"),
"removed the task {task.code} for {source} from whole team's{user_groups} task list.".format(
task=task,
source=source,
user_groups=list(task.user_group.all().values_list("name", flat=True)),
Expand Down Expand Up @@ -363,10 +356,10 @@ def handle_screening_statuses(self, source, old_status, **kwargs):

if new_status and old_status != "-":
return _(
'Updated screening decision from "{old_status}" to "{new_status}".'
'Updated screening decision from "{old_status}" to "{new_status}"'
).format(old_status=old_status, new_status=new_status)
elif new_status:
return _('Added screening decision to "{new_status}".').format(
return _('Added screening decision to "{new_status}"').format(
new_status=new_status
)
elif old_status != "-":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
{% load i18n activity_tags heroicons %}

<div class="timeline-item relative" id="communications#{{ activity.id }}">
<div
class="flex py-2 -ml-3 items-center before:block before:-z-10 before:absolute before:top-0 before:bottom-0 before:left-0 before:w-0.5 before:bg-slate-300"
>
<div class="relative inline-flex justify-center me-2 items-start">
<div class="relative rounded-full inline-flex items-center justify-center border-white border-2 -ms-0.5 {% if activity.user.is_staff %}bg-slate-200 {% else %}bg-gray-100{% endif %}">
<div class="inline-flex items-center justify-center w-6 h-6">
{% heroicon_micro "eye" class="fill-gray-400 inline" aria_hidden=true %}
{% with activity|display_for:request.user as activity_text %}
<div class="timeline-item relative" id="communications#{{ activity.id }}">
<div
class="flex py-2 -ml-3 items-center before:block before:-z-10 before:absolute before:top-0 before:bottom-0 before:left-0 before:w-0.5 before:bg-slate-300"
>
<div class="relative inline-flex justify-center me-2 items-start">
<div class="relative rounded-full inline-flex items-center justify-center border-white border-2 -ms-0.5 {% if activity.user.is_staff %}bg-slate-200 {% else %}bg-gray-200{% endif %}">
<div class="inline-flex items-center justify-center w-6 h-6 text-fg-muted">
{% if 'edit' in activity_text.lower %}
{% heroicon_micro "pencil-square" class="inline" aria_hidden=true size=14 %}
{% elif 'progressed' in activity_text.lower %}
{% heroicon_micro "arrow-trending-up" class="inline" aria_hidden=true size=14 %}
{% elif 'sent a determination' in activity_text.lower %}
{% heroicon_micro "rocket-launch" class="inline" aria_hidden=true size=14 %}
{% elif 'submitted a review' in activity_text.lower %}
{% heroicon_micro "chat-bubble-left-ellipsis" class="inline" aria_hidden=true size=14 %}
{% elif 'un-archived' in activity_text.lower %}
{% heroicon_micro "lock-open" class="inline" aria_hidden=true size=14 %}
{% elif 'archived' in activity_text.lower %}
{% heroicon_micro "lock-closed" class="inline" aria_hidden=true size=14 %}
{% else %}
{% heroicon_micro "eye" class="inline" aria_hidden=true size=15 %}
{% endif %}
</div>
</div>
</div>
</div>

<div class="text-sm">
<strong class="font-medium">
{{ activity|display_activity_author:request.user }}
</strong>
<span class="text-fg-muted">
{{ activity|display_for:request.user|striptags|lowerfirst }}
<relative-time datetime="{{ activity.timestamp|date:'c' }}">
{{ activity.timestamp|date:'SHORT_DATETIME_FORMAT' }}
</relative-time>
</span>
<div class="text-sm">
<strong class="font-medium">
{{ activity|display_activity_author:request.user }}
</strong>
<span class="text-fg-muted">
{{ activity_text|striptags|lowerfirst }}
<relative-time datetime="{{ activity.timestamp|date:'c' }}">
{{ activity.timestamp|date:'SHORT_DATETIME_FORMAT' }}
</relative-time>
</span>
</div>
</div>
</div>
</div>
{% endwith %}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% load i18n activity_tags nh3_tags markdown_tags submission_tags apply_tags heroicons users_tags %}

<div class="timeline-item relative" id="communications#{{ activity.id }}">
<article class="timeline-item relative" id="communications#{{ activity.id }}">
<div
class="flex py-3 -ms-8 md:-ms-20 before:block before:-z-10 before:absolute before:top-0 before:bottom-0 before:left-0 before:w-0.5 before:bg-slate-300"
>
{% with activity|display_activity_author:request.user as author_name %}
<div class="me-4 relative inline-flex items-start justify-center">
<div class="relative inline-flex justify-center me-4 items-start">
<div class="relative rounded-full inline-flex items-center justify-center border-white border-2 -ms-0.5 {% if activity.user.is_staff %}bg-slate-200 {% else %}bg-gray-100{% endif %}">
<div class="md:block hidden p-2">
{% user_image author_name size=25 %}
</div>
</div>
</div>

<div class="border-slate-200 flex-1 pb-2 bg-white border rounded shadow-sm">
<div class="bg-slate-100 flex flex-wrap items-center justify-between gap-2 px-3 py-2 rounded-t">
<div class="{% if activity.user == request.user %}border-cyan-300{% else %}border-gray-300{% endif %} flex-1 pb-2 bg-white border rounded">
<header class="{% if activity.user == request.user %}bg-fuchsia-100{% else %}bg-slate-100{% endif %} flex flex-wrap items-center justify-between gap-2 px-3 py-2 rounded-t">
<div>
<span>
<strong class="font-semibold">{{ author_name }}</strong>
Expand Down Expand Up @@ -43,9 +43,15 @@
</span>
{% endif %}
</div>
<div class="align-middle">
<div class="flex items-center gap-1">
{% if not request.user.is_applicant %}
<span class="text-fg-muted text-xs">({{ activity.visibility|visibility_display:request.user }})</span>
{% with activity.visibility|visibility_display:request.user as visibility_text %}
<span class="text-fg-muted text-xs flex items-center gap-1 uppercase border rounded-xl border-gray-300 py-0.5 px-1"
data-tippy-content="This is visible to {{ visibility_text }}">
{% heroicon_outline "eye" size=14 class="inline" aria_hidden=true %}
{{ visibility_text }}
</span>
{% endwith %}
{% endif %}

{% if editable and activity.user == request.user %}
Expand All @@ -60,7 +66,7 @@
</a>
{% endif %}
</div>
</div>
</header>

<div class="">
{% if submission_title %}
Expand All @@ -86,4 +92,4 @@
</div>
{% endwith %}
</div>
</div>
</article>

0 comments on commit 3c98f74

Please sign in to comment.