Skip to content

Commit

Permalink
Update server-card.blade.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dsbilling committed Aug 7, 2023
1 parent 21de032 commit 448d02d
Showing 1 changed file with 53 additions and 47 deletions.
100 changes: 53 additions & 47 deletions resources/views/livewire/server/server-card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,39 @@
@if($this->server->active)
<div class="max-w-lg">
<div class="relative p-4 bg-white rounded-lg shadow-lg dark:bg-black">
@if(auth()->user()->id == $this->server->user_id)
<div x-data="{ dropdownOpen: false }" class="absolute top-2 right-2" x-cloak>
<button @click="dropdownOpen = !dropdownOpen" class="relative z-10 block p-1 text-black focus:outline-none dark:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" />
</svg>
</button>
<div x-show="dropdownOpen" @click.away="dropdownOpen = false" class="absolute right-0 z-40 w-48 py-2 mt-2 bg-white border border-gray-200 rounded-md shadow-md dark:bg-gray-900 dark:border-gray-800">
@if(!$this->server->active)
<button wire:click.defer="reactivate" wire:loading.attr="disabled" class="block w-full px-4 py-2 text-sm text-left text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white disabled:text-gray-300 disabled:bg-gray-400">
@auth
@if(auth()->user()->id == $this->server->user_id)
<div x-data="{ dropdownOpen: false }" class="absolute top-2 right-2" x-cloak>
<button @click="dropdownOpen = !dropdownOpen" class="relative z-10 block p-1 text-black focus:outline-none dark:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" />
</svg>
</button>
<div x-show="dropdownOpen" @click.away="dropdownOpen = false" class="absolute right-0 z-40 w-48 py-2 mt-2 bg-white border border-gray-200 rounded-md shadow-md dark:bg-gray-900 dark:border-gray-800">
@if(!$this->server->active)
<button wire:click.defer="reactivate" wire:loading.attr="disabled" class="block w-full px-4 py-2 text-sm text-left text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white disabled:text-gray-300 disabled:bg-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
@lang('Reactivate')
</button>
@endif
<a href="{{ route('server.edit', $this->server->uuid) }}" class="block px-4 py-2 text-sm text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
</svg>
@lang('Edit')
</a>
<button wire:click.defer="destroy" class="block w-full px-4 py-2 text-sm text-left text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
@lang('Reactivate')
@lang('Delete')
</button>
@endif
<a href="{{ route('server.edit', $this->server->uuid) }}" class="block px-4 py-2 text-sm text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
</svg>
@lang('Edit')
</a>
<button wire:click.defer="destroy" class="block w-full px-4 py-2 text-sm text-left text-gray-700 capitalize dark:text-gray-300 hover:bg-green-700 hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
@lang('Delete')
</button>
</div>
</div>
</div>
@endif
@endif
@endauth
<div class="relative inline-block">
<span class="absolute top-0 left-0 w-3 h-3">
<span class="animate-ping absolute mt-1 inline-flex h-full w-full rounded-full opacity-75 {{ ($this->server->ping && $this->server->last_check_at > now()->subHours(1)) ? 'bg-green-600' : 'bg-red-600' }}"></span>
Expand Down Expand Up @@ -91,31 +93,35 @@
</div>
</div>
@endif
@if(!$this->server->active && $this->server->user_id == auth()->user()->id)
<div x-data="{ tooltip: false }" class="relative z-30 inline-flex">
<span x-on:mouseover="tooltip = true" x-on:mouseleave="tooltip = false" class="inline-flex items-center justify-center px-2 py-1 text-sm font-bold leading-none text-red-100 uppercase bg-red-600 rounded dark:bg-red-900"><svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" /></svg>Deactivated</span>
<div class="relative" x-cloak x-show.transition.origin.bottom="tooltip">
<div class="absolute top-0 z-10 w-16 p-2 -mt-1 text-xs leading-tight text-white transform -translate-x-1/2 -translate-y-full bg-red-600 rounded shadow-lg min-w-max">
{{ __('Deactivated because of downtime for the past 24 hours') }}
@auth
@if(!$this->server->active && $this->server->user_id == auth()->user()->id)
<div x-data="{ tooltip: false }" class="relative z-30 inline-flex">
<span x-on:mouseover="tooltip = true" x-on:mouseleave="tooltip = false" class="inline-flex items-center justify-center px-2 py-1 text-sm font-bold leading-none text-red-100 uppercase bg-red-600 rounded dark:bg-red-900"><svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" /></svg>Deactivated</span>
<div class="relative" x-cloak x-show.transition.origin.bottom="tooltip">
<div class="absolute top-0 z-10 w-16 p-2 -mt-1 text-xs leading-tight text-white transform -translate-x-1/2 -translate-y-full bg-red-600 rounded shadow-lg min-w-max">
{{ __('Deactivated because of downtime for the past 24 hours') }}
</div>
<svg class="absolute z-10 w-6 h-6 text-red-600 transform -translate-x-12 -translate-y-3 fill-current stroke-current" width="8" height="8">
<rect x="12" y="-10" width="8" height="8" transform="rotate(45)" />
</svg>
</div>
<svg class="absolute z-10 w-6 h-6 text-red-600 transform -translate-x-12 -translate-y-3 fill-current stroke-current" width="8" height="8">
<rect x="12" y="-10" width="8" height="8" transform="rotate(45)" />
</svg>
</div>
</div>
@endif
@endif
@endauth
</div>
<p class="text-gray-600">{{ $this->server->description }}</p>
<p class="font-semibold text-green-600 dark:text-green-300">{{ $this->server->host }}:{{ $this->server->port }}</p>
@if (!$this->server->active && $this->server->user_id == auth()->user()->id)
<div class="px-4 py-3 my-3 text-sm leading-normal text-blue-600 bg-blue-100 rounded-lg" role="alert">
<p>
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>{{ __('This server has been deactivated from the list because of downtime for the past 24 hours. Only you can see this server now. If it is online again try reactivating it from the dotted-menu.') }}
</p>
</div>
@endif
@auth
@if (!$this->server->active && $this->server->user_id == auth()->user()->id)
<div class="px-4 py-3 my-3 text-sm leading-normal text-blue-600 bg-blue-100 rounded-lg" role="alert">
<p>
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>{{ __('This server has been deactivated from the list because of downtime for the past 24 hours. Only you can see this server now. If it is online again try reactivating it from the dotted-menu.') }}
</p>
</div>
@endif
@endauth
@if($this->server->official)
<div class="flex items-center mt-2">
<div class="relative inline-block">
Expand Down

0 comments on commit 448d02d

Please sign in to comment.