Skip to content

Commit aced159

Browse files
authored
Merge pull request #6 from DanielRTRD/master
Improved styling of views + locale for datetime
2 parents 06a9737 + 1448ccc commit aced159

File tree

3 files changed

+51
-51
lines changed

3 files changed

+51
-51
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ In your dashboard view you can use the `livewire:forge-server-tile` and `livewir
5656
<livewire:forge-recent-events-tile position="b1"/>
5757
...
5858
</x-dashboard>
59+
```
60+
61+
## Customizing the view
5962

63+
If you want to customize the view used to render this tile, run this command:
64+
65+
```bash
66+
php artisan vendor:publish --provider="aglipanci\ForgeTile\ForgeTileServiceProvider" --tag="dashboard-forge-tile-views"
6067
```
6168

6269
## Testing

resources/views/recent-events.blade.php

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
<x-dashboard-tile :position="$position">
22
<div class="grid grid-rows-auto-1 gap-2 h-full">
33
<div class="flex items-center justify-center">
4-
<h1 class="text-xl leading-none mt-1">{{$title ?? 'Forge Recent Events'}}</h1>
4+
<h1 class="text-xl leading-none mt-1">{{ $title ?? 'Forge Recent Events' }}</h1>
55
</div>
6-
<div class="h-full overflow-scroll">
6+
<div class="h-full overflow-auto">
77
<ul wire:poll.{{ $refreshIntervalInSeconds }}s class="self-center divide-y-2 divide-canvas">
8-
@if(count($events))
9-
@foreach($events as $event)
10-
<li class="py-1">
11-
<div class="my-2">
12-
<div class="font-medium text-sm">
13-
{{ \Carbon\Carbon::parse($event['createdAt'])->format('F j, g:m:i A') }}
14-
</div>
15-
<div class="text-xs text-gray-600 mb-1">
16-
{{ $event['serverName'] }}
17-
</div>
18-
<div class="text-xs">
19-
{{ $event['description'] }}
20-
</div>
21-
</div>
22-
</li>
23-
@endforeach
24-
@else
25-
<div class="bg-yellow-300 pl-2 p-2 rounded-md">
26-
<span class="inline-block">
27-
<div class="rounded-full h-4 w-4 flex items-center justify-center bg-yellow-900 text-white text-xs inline-block">!</div>
28-
</span>
29-
<span class="text-xs text-yellow-900 leading-none break-words">Currently there are no events. Make sure you have configured the background command.</span>
8+
@forelse($events as $event)
9+
<li class="py-2 my-2">
10+
<div class="font-medium text-sm">
11+
{{ \Carbon\Carbon::parse($event['createdAt'])->isoFormat('LLL') }}
12+
</div>
13+
<div class="text-xs text-gray-600">
14+
{{ $event['serverName'] }}
15+
</div>
16+
<div class="text-xs">
17+
{{ $event['description'] }}
18+
</div>
19+
</li>
20+
@empty
21+
<div class="bg-yellow-300 pl-2 p-2 rounded-md text-yellow-900">
22+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 inline-block" viewBox="0 0 20 20" fill="currentColor">
23+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
24+
</svg>
25+
<span class="text-xs leading-none break-words">Currently there are no events. Make sure you have configured the background command.</span>
3026
</div>
31-
@endif
27+
@endforelse
3228
</ul>
3329
</div>
3430
</div>

resources/views/servers.blade.php

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
<x-dashboard-tile :position="$position">
22
<div class="grid grid-rows-auto-1 gap-2 h-full">
33
<div class="flex items-center justify-center">
4-
<h1 class="text-xl leading-none mt-1">{{$title ?? 'Forge Servers'}}</h1>
4+
<h1 class="text-xl leading-none mt-1">{{ $title ?? 'Forge Servers' }}</h1>
55
</div>
66

7-
<div class="h-full overflow-scroll">
7+
<div class="h-full overflow-auto">
88
<ul wire:poll.{{ $refreshIntervalInSeconds }}s class="self-center divide-y-2 divide-canvas">
9-
@if(count($servers))
10-
@foreach($servers as $server)
11-
<li class="py-1">
12-
<div class="my-2">
13-
<div class="font-medium">
14-
<span class="rounded-full h-3 w-3 inline-block mr-1 @if($server['isReady']) bg-green-200 @else bg-gray-200 @endif"></span>
15-
{{ $server['name'] }}
16-
</div>
17-
<div class="text-gray-700 text-sm">{{ $server['provider'] }}</div>
18-
<div class="text-gray-700 text-sm">{{ $server['ipAddress'] }}</div>
19-
<div class="mt-1">
20-
@foreach($server['tags'] as $tag)
21-
<span class="bg-gray-200 rounded p-1 text-xs text-gray-600 mb-1 inline-block">{{ $tag['name'] }}</span>
22-
@endforeach
23-
</div>
9+
@forelse($servers as $server)
10+
<li class="my-2 py-2">
11+
<div class="font-medium">
12+
<span class="rounded-full h-3 w-3 inline-block mr-1 @if($server['isReady']) bg-green-300 @else bg-gray-200 @endif"></span>
13+
{{ $server['name'] }}
14+
</div>
15+
<div class="text-gray-700 text-sm">{{ $server['provider'] }} &middot; {{ $server['ipAddress'] }}</div>
16+
@if($server['tags'])
17+
<div class="mt-1">
18+
@foreach($server['tags'] as $tag)
19+
<span class="bg-gray-200 rounded p-1 text-xs text-gray-600 mb-1 inline-block">{{ $tag['name'] }}</span>
20+
@endforeach
2421
</div>
25-
</li>
26-
@endforeach
27-
@else
28-
<div class="bg-yellow-300 pl-2 p-2 rounded-md">
29-
<span class="inline-block">
30-
<div class="rounded-full h-4 w-4 flex items-center justify-center bg-yellow-900 text-white text-xs inline-block">!</div>
31-
</span>
32-
<span class="text-xs text-yellow-900 leading-none break-words">Currently there are no servers. Make sure you have configured the background command.</span>
22+
@endif
23+
</li>
24+
@empty
25+
<div class="bg-yellow-300 pl-2 p-2 text-yellow-900 rounded-md">
26+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 inline-block" viewBox="0 0 20 20" fill="currentColor">
27+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
28+
</svg>
29+
<span class="text-xs leading-none break-words">Currently there are no servers. Make sure you have configured the background command.</span>
3330
</div>
34-
@endif
31+
@endforelse
3532
</ul>
3633
</div>
3734
</div>

0 commit comments

Comments
 (0)