Skip to content

Commit c6cc21e

Browse files
authored
Merge pull request #43 from binafy/add-color-for-action-type
[1.x] Add color for action type
2 parents e7dd850 + dcfb5e2 commit c6cc21e

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

art/actions-monitoring/preview.png

25.2 KB
Loading

resources/views/actions-monitoring/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
3131
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75" />
3232
</svg>
33-
<p class="text-sm leading-none text-gray-600 ml-2">
33+
<span class="inline-flex items-center rounded-md bg-{{ $action->getTypeColor() }}-50 px-2 py-1 text-xs font-medium text-{{ $action->getTypeColor() }}-700 ring-1 ring-inset ring-{{ $action->getTypeColor() }}-600/10 ml-1">
3434
{{ $action->action_type }}
35-
</p>
35+
</span>
3636
</div>
3737
</td>
3838
<td class="pl-5">

resources/views/layouts/master.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class="focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600 mt-4 sm:mt-0
5454
inline-flex items-start justify-start px-6 py-3 bg-indigo-700 hover:bg-indigo-600
5555
focus:outline-none rounded items-center">
5656
<p class="text-sm font-medium leading-none text-white mr-2">
57-
Github
57+
GitHub
5858
</p>
5959
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 24 24" style="fill:#FFFFFF;">
6060
<path d="M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.5,4.7,2.2,8.9,6.3,10.5C8.7,21.4,9,21.2,9,20.8v-1.6c0,0-0.4,0.1-0.9,0.1 c-1.4,0-2-1.2-2.1-1.9c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1 c0.4,0,0.7-0.1,0.9-0.2c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6C7,7.2,7,6.6,7.3,6 c0,0,1.4,0,2.8,1.3C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3C15.3,6,16.8,6,16.8,6C17,6.6,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4 c0.7,0.8,1.2,1.8,1.2,3c0,2.2-1.7,3.5-4,4c0.6,0.5,1,1.4,1,2.3v2.6c0,0.3,0.3,0.6,0.7,0.5c3.7-1.5,6.3-5.1,6.3-9.3 C22,6.1,16.9,1.4,10.9,2.1z"></path>

src/Models/ActionMonitoring.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ class ActionMonitoring extends Model
2020
*/
2121
protected $guarded = ['id'];
2222

23+
# Methods
24+
25+
public function getTypeColor(): string
26+
{
27+
return match ($this->action_type) {
28+
'read' => 'blue',
29+
'store' => 'green',
30+
'update' => 'purple',
31+
'delete' => 'red',
32+
'restore' => 'yellow',
33+
'replicate' => 'pink',
34+
default => 'gray',
35+
};
36+
}
37+
2338
# Relations
2439

2540
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo

0 commit comments

Comments
 (0)