feat(global-search): enhance resource creation functionality in search modal
- Introduced a new create mode in the global search component, allowing users to initiate the creation of resources directly from the search input. - Implemented logic to detect specific resource types based on user input, enabling quick access to creation modals for projects, servers, teams, storage, private keys, and GitHub apps. - Updated the UI to display a list of creatable items when in create mode, improving user experience and accessibility for resource management. - Added necessary modals for each resource type to facilitate the creation process seamlessly.
This commit is contained in:
parent
fc7e31799c
commit
d7bee48735
2 changed files with 467 additions and 5 deletions
|
|
@ -28,12 +28,21 @@ class GlobalSearch extends Component
|
|||
|
||||
public $allSearchableItems = [];
|
||||
|
||||
public $isCreateMode = false;
|
||||
|
||||
public $creatableItems = [];
|
||||
|
||||
public $autoOpenResource = null;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->searchQuery = '';
|
||||
$this->isModalOpen = false;
|
||||
$this->searchResults = [];
|
||||
$this->allSearchableItems = [];
|
||||
$this->isCreateMode = false;
|
||||
$this->creatableItems = [];
|
||||
$this->autoOpenResource = null;
|
||||
}
|
||||
|
||||
public function openSearchModal()
|
||||
|
|
@ -62,7 +71,63 @@ public static function clearTeamCache($teamId)
|
|||
|
||||
public function updatedSearchQuery()
|
||||
{
|
||||
$this->search();
|
||||
$query = strtolower(trim($this->searchQuery));
|
||||
|
||||
if (str_starts_with($query, 'new')) {
|
||||
$this->isCreateMode = true;
|
||||
$this->loadCreatableItems();
|
||||
$this->searchResults = [];
|
||||
|
||||
// Check for sub-commands like "new project", "new server", etc.
|
||||
// Use original query (not trimmed) to ensure exact match without trailing spaces
|
||||
$this->autoOpenResource = $this->detectSpecificResource(strtolower($this->searchQuery));
|
||||
} else {
|
||||
$this->isCreateMode = false;
|
||||
$this->creatableItems = [];
|
||||
$this->autoOpenResource = null;
|
||||
$this->search();
|
||||
}
|
||||
}
|
||||
|
||||
private function detectSpecificResource(string $query): ?string
|
||||
{
|
||||
// Map of keywords to resource types - order matters for multi-word matches
|
||||
$resourceMap = [
|
||||
'new project' => 'project',
|
||||
'new server' => 'server',
|
||||
'new team' => 'team',
|
||||
'new storage' => 'storage',
|
||||
'new s3' => 'storage',
|
||||
'new private key' => 'private-key',
|
||||
'new privatekey' => 'private-key',
|
||||
'new key' => 'private-key',
|
||||
'new github' => 'source',
|
||||
'new source' => 'source',
|
||||
'new git' => 'source',
|
||||
];
|
||||
|
||||
foreach ($resourceMap as $command => $type) {
|
||||
if ($query === $command) {
|
||||
// Check if user has permission for this resource type
|
||||
if ($this->canCreateResource($type)) {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function canCreateResource(string $type): bool
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return match ($type) {
|
||||
'project', 'source' => $user->can('createAnyResource'),
|
||||
'server', 'storage', 'private-key' => $user->isAdmin() || $user->isOwner(),
|
||||
'team' => true,
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
|
||||
private function loadSearchableItems()
|
||||
|
|
@ -437,6 +502,72 @@ private function search()
|
|||
->toArray();
|
||||
}
|
||||
|
||||
private function loadCreatableItems()
|
||||
{
|
||||
$items = collect();
|
||||
$user = auth()->user();
|
||||
|
||||
// Project - can be created if user has createAnyResource permission
|
||||
if ($user->can('createAnyResource')) {
|
||||
$items->push([
|
||||
'name' => 'Project',
|
||||
'description' => 'Create a new project to organize your resources',
|
||||
'type' => 'project',
|
||||
'component' => 'project.add-empty',
|
||||
]);
|
||||
}
|
||||
|
||||
// Server - can be created if user is admin or owner
|
||||
if ($user->isAdmin() || $user->isOwner()) {
|
||||
$items->push([
|
||||
'name' => 'Server',
|
||||
'description' => 'Add a new server to deploy your applications',
|
||||
'type' => 'server',
|
||||
'component' => 'server.create',
|
||||
]);
|
||||
}
|
||||
|
||||
// Team - can be created by anyone (they become owner of new team)
|
||||
$items->push([
|
||||
'name' => 'Team',
|
||||
'description' => 'Create a new team to collaborate with others',
|
||||
'type' => 'team',
|
||||
'component' => 'team.create',
|
||||
]);
|
||||
|
||||
// Storage - can be created if user is admin or owner
|
||||
if ($user->isAdmin() || $user->isOwner()) {
|
||||
$items->push([
|
||||
'name' => 'S3 Storage',
|
||||
'description' => 'Add S3 storage for backups and file uploads',
|
||||
'type' => 'storage',
|
||||
'component' => 'storage.create',
|
||||
]);
|
||||
}
|
||||
|
||||
// Private Key - can be created if user is admin or owner
|
||||
if ($user->isAdmin() || $user->isOwner()) {
|
||||
$items->push([
|
||||
'name' => 'Private Key',
|
||||
'description' => 'Add an SSH private key for server access',
|
||||
'type' => 'private-key',
|
||||
'component' => 'security.private-key.create',
|
||||
]);
|
||||
}
|
||||
|
||||
// GitHub Source - can be created if user has createAnyResource permission
|
||||
if ($user->can('createAnyResource')) {
|
||||
$items->push([
|
||||
'name' => 'GitHub App',
|
||||
'description' => 'Connect a GitHub app for source control',
|
||||
'type' => 'source',
|
||||
'component' => 'source.github.create',
|
||||
]);
|
||||
}
|
||||
|
||||
$this->creatableItems = $items->toArray();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.global-search');
|
||||
|
|
|
|||
|
|
@ -80,6 +80,20 @@
|
|||
document.removeEventListener('keydown', escapeKeyHandler);
|
||||
document.removeEventListener('keydown', arrowKeyHandler);
|
||||
});
|
||||
|
||||
// Watch for auto-open resource
|
||||
this.$watch('$wire.autoOpenResource', value => {
|
||||
if (value) {
|
||||
// Close search modal first
|
||||
this.closeModal();
|
||||
// Open the specific resource modal after a short delay
|
||||
setTimeout(() => {
|
||||
this.$dispatch('open-create-modal-' + value);
|
||||
// Reset the value so it can trigger again
|
||||
@this.set('autoOpenResource', null);
|
||||
}, 150);
|
||||
}
|
||||
});
|
||||
}
|
||||
}">
|
||||
|
||||
|
|
@ -106,8 +120,8 @@ class="fixed top-0 left-0 z-99 flex items-start justify-center w-screen h-screen
|
|||
</svg>
|
||||
</div>
|
||||
<input type="text" wire:model.live.debounce.500ms="searchQuery"
|
||||
placeholder="Search for resources, servers, projects, and environments" x-ref="searchInput"
|
||||
x-init="$watch('modalOpen', value => { if (value) setTimeout(() => $refs.searchInput.focus(), 100) })"
|
||||
placeholder="Search for resources... (Type 'new' to create, or 'new project' to add directly)"
|
||||
x-ref="searchInput" x-init="$watch('modalOpen', value => { if (value) setTimeout(() => $refs.searchInput.focus(), 100) })"
|
||||
class="w-full pl-12 pr-12 py-4 text-base bg-white dark:bg-coolgray-100 border-none rounded-lg shadow-xl ring-1 ring-neutral-200 dark:ring-coolgray-300 focus:ring-2 focus:ring-neutral-400 dark:focus:ring-coolgray-300 dark:text-white placeholder-neutral-400 dark:placeholder-neutral-500" />
|
||||
<button @click="closeModal()"
|
||||
class="absolute inset-y-0 right-2 flex items-center justify-center px-2 text-xs font-medium text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 rounded">
|
||||
|
|
@ -140,7 +154,71 @@ class="min-h-[200px] items-center justify-center p-8">
|
|||
<!-- Results content - hidden while loading -->
|
||||
<div wire:loading.remove wire:target="searchQuery"
|
||||
class="max-h-[60vh] overflow-y-auto scrollbar">
|
||||
@if (strlen($searchQuery) >= 2 && count($searchResults) > 0)
|
||||
@if ($isCreateMode && count($creatableItems) > 0 && !$autoOpenResource)
|
||||
<!-- Create new resources section -->
|
||||
<div class="py-2" x-data="{
|
||||
openModal(type) {
|
||||
// Close the parent search modal properly
|
||||
const parentModal = this.$root.closest('[x-data]');
|
||||
if (parentModal && parentModal.__x) {
|
||||
parentModal.__x.$data.closeModal();
|
||||
}
|
||||
// Dispatch event to open creation modal after a short delay
|
||||
setTimeout(() => {
|
||||
this.$dispatch('open-create-modal-' + type);
|
||||
}, 150);
|
||||
}
|
||||
}">
|
||||
<div
|
||||
class="px-4 py-2 bg-yellow-50 dark:bg-yellow-900/20 border-b border-yellow-100 dark:border-yellow-800">
|
||||
<h3 class="text-sm font-semibold text-yellow-900 dark:text-yellow-100">
|
||||
Create New Resources
|
||||
</h3>
|
||||
<p class="text-xs text-yellow-700 dark:text-yellow-300 mt-0.5">
|
||||
Click on any item below to create a new resource
|
||||
</p>
|
||||
</div>
|
||||
@foreach ($creatableItems as $item)
|
||||
<button type="button" @click="openModal('{{ $item['type'] }}')"
|
||||
class="search-result-item w-full text-left block px-4 py-3 hover:bg-yellow-50 dark:hover:bg-yellow-900/20 transition-colors focus:outline-none focus:bg-yellow-100 dark:focus:bg-yellow-900/30 border-transparent hover:border-yellow-500 focus:border-yellow-500">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-3 flex-1 min-w-0">
|
||||
<div
|
||||
class="flex-shrink-0 w-10 h-10 rounded-lg bg-yellow-100 dark:bg-yellow-900/40 flex items-center justify-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-5 w-5 text-yellow-600 dark:text-yellow-400"
|
||||
fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<span
|
||||
class="font-medium text-neutral-900 dark:text-white truncate">
|
||||
{{ $item['name'] }}
|
||||
</span>
|
||||
<span
|
||||
class="px-2 py-0.5 text-xs rounded-full bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300 shrink-0">
|
||||
New
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-sm text-neutral-600 dark:text-neutral-400">
|
||||
{{ $item['description'] }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
class="shrink-0 h-5 w-5 text-yellow-500 dark:text-yellow-400 self-center"
|
||||
fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif (strlen($searchQuery) >= 2 && count($searchResults) > 0)
|
||||
<div class="py-2">
|
||||
@foreach ($searchResults as $index => $result)
|
||||
<a href="{{ $result['link'] ?? '#' }}"
|
||||
|
|
@ -191,7 +269,7 @@ class="shrink-0 h-5 w-5 text-neutral-300 dark:text-neutral-600 self-center"
|
|||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif (strlen($searchQuery) >= 2 && count($searchResults) === 0)
|
||||
@elseif (strlen($searchQuery) >= 2 && count($searchResults) === 0 && !$autoOpenResource)
|
||||
<div class="flex items-center justify-center py-12 px-4">
|
||||
<div class="text-center">
|
||||
<p class="mt-4 text-sm font-medium text-neutral-900 dark:text-white">
|
||||
|
|
@ -217,4 +295,257 @@ class="shrink-0 h-5 w-5 text-neutral-300 dark:text-neutral-600 self-center"
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Create Resource Modals - Always rendered so they're available when triggered -->
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-project.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New Project</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:project.add-empty key="create-modal-project" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-server.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New Server</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:server.create key="create-modal-server" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-team.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New Team</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:team.create key="create-modal-team" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-storage.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New S3 Storage</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:storage.create key="create-modal-storage" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-private-key.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New Private Key</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:security.private-key.create key="create-modal-private-key" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div x-data="{ modalOpen: false }" @open-create-modal-source.window="modalOpen = true"
|
||||
@keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
|
||||
<template x-teleport="body">
|
||||
<div x-show="modalOpen" x-init="$watch('modalOpen', value => {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
const firstInput = $el.querySelector('input, textarea, select');
|
||||
if (firstInput) firstInput.focus();
|
||||
}, 200);
|
||||
}
|
||||
})"
|
||||
class="fixed top-0 left-0 lg:px-0 px-4 z-99 flex items-center justify-center w-screen h-screen">
|
||||
<div x-show="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0" @click="modalOpen=false"
|
||||
class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"></div>
|
||||
<div x-show="modalOpen" x-trap.inert.noscroll="modalOpen" x-transition:enter="ease-out duration-100"
|
||||
x-transition:enter-start="opacity-0 -translate-y-2 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-100"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95"
|
||||
class="relative w-full py-6 border rounded-sm drop-shadow-sm min-w-full lg:min-w-[36rem] max-w-fit bg-white border-neutral-200 dark:bg-base px-6 dark:border-coolgray-300">
|
||||
<div class="flex items-center justify-between pb-3">
|
||||
<h3 class="text-2xl font-bold">New GitHub App</h3>
|
||||
<button @click="modalOpen=false"
|
||||
class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 rounded-full dark:text-white hover:bg-neutral-100 dark:hover:bg-coolgray-300 outline-0 focus-visible:ring-2 focus-visible:ring-coollabs dark:focus-visible:ring-warning">
|
||||
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative flex items-center justify-center w-auto">
|
||||
<livewire:source.github.create key="create-modal-source" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue