Skip to content

Commit

Permalink
Fix colours and orders on admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar committed Oct 25, 2024
1 parent 12e9e4d commit 582ec88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions causes_service/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def dashboard_callback(request, context):
))
)\
.order_by('completed_count')\
.reverse()\
.filter(completed_count__gt=0)\
[:10]

Expand All @@ -48,6 +49,7 @@ def dashboard_callback(request, context):
))
)\
.order_by('completed_count')\
.reverse()\
.filter(completed_count__gt=0)\
[:10]

Expand Down Expand Up @@ -115,10 +117,10 @@ def compute_completion_data(model: Type[TimeStampedMixin], now: datetime) -> Com

def get_footer_color(percentage_increase: float | None):
if percentage_increase is None:
return 'white'
return ''
if percentage_increase > 0:
return 'text-green-700'
return 'text-red-700'
return 'text-green-700 dark:text-green-400'
return 'text-red-700 dark:text-red-400'

def get_footer_text_value(percentage_increase: float | None):
if percentage_increase is None:
Expand All @@ -131,4 +133,4 @@ def build_footer(percentage_increase: float | None):
text_color = get_footer_color(percentage_increase)
text_value = get_footer_text_value(percentage_increase)

return mark_safe(f'<strong class="{text_color} font-semibold dark:text-green-400">{text_value}</strong>&nbsp;progress from last week')
return mark_safe(f'<strong class="{text_color} font-semibold">{text_value}</strong>&nbsp;progress from last week')

0 comments on commit 582ec88

Please sign in to comment.