2024-03-06 09:56:59 -05:00
|
|
|
<%# locals: (progress:, radius: 7, stroke: 2, text_class: "text-green-500") %>
|
2024-12-10 17:41:20 -05:00
|
|
|
|
2024-12-12 08:56:52 -05:00
|
|
|
<%
|
|
|
|
circumference = Math::PI * 2 * radius
|
2024-12-10 17:41:20 -05:00
|
|
|
progress_percent = progress.clamp(0, 100)
|
|
|
|
stroke_dashoffset = ((100 - progress_percent) * circumference) / 100
|
|
|
|
center = radius + stroke / 2
|
|
|
|
%>
|
|
|
|
|
2024-03-06 09:56:59 -05:00
|
|
|
<svg width="<%= radius * 2 + stroke %>" height="<%= radius * 2 + stroke %>">
|
|
|
|
<!-- Background Circle -->
|
2024-12-12 08:56:52 -05:00
|
|
|
<circle
|
2024-12-10 17:41:20 -05:00
|
|
|
class="fill-transparent stroke-current text-gray-300"
|
|
|
|
r="<%= radius %>"
|
|
|
|
cx="<%= center %>"
|
|
|
|
cy="<%= center %>"
|
2024-12-12 08:56:52 -05:00
|
|
|
stroke-width="<%= stroke %>"></circle>
|
2024-12-10 17:41:20 -05:00
|
|
|
|
2024-03-06 09:56:59 -05:00
|
|
|
<!-- Foreground Circle -->
|
2024-12-12 08:56:52 -05:00
|
|
|
<circle
|
2024-12-10 17:41:20 -05:00
|
|
|
class="fill-transparent stroke-current <%= text_class %>"
|
|
|
|
r="<%= radius %>"
|
|
|
|
cx="<%= center %>"
|
|
|
|
cy="<%= center %>"
|
|
|
|
stroke-width="<%= stroke %>"
|
|
|
|
stroke-dasharray="<%= circumference %>"
|
|
|
|
stroke-dashoffset="<%= stroke_dashoffset %>"
|
2024-12-12 08:56:52 -05:00
|
|
|
transform="rotate(-90, <%= center %>, <%= center %>)"></circle>
|
2024-12-10 17:41:20 -05:00
|
|
|
</svg>
|