Skip to content

Commit

Permalink
Merge pull request #8 from headerx/main
Browse files Browse the repository at this point in the history
new component path
  • Loading branch information
inmanturbo authored Jan 30, 2024
2 parents ed33a2b + 040e44e commit 9d63c81
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 81 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"php": "^8.1",
"illuminate/contracts": "^10.0|^11.0",
"laravel/jetstream": "^4.2|^5.0",
"laravel/passport": "*",
"livewire/livewire": "^3.4",
"spatie/laravel-package-tools": "^1.16.2"
},
Expand Down
64 changes: 32 additions & 32 deletions resources/views/api-token-manager.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<!-- Generate API Token -->
<x-jet-form-section submit="createApiToken">
<x-form-section submit="createApiToken">
<x-slot name="title">
{{ __('Create API Token') }}
</x-slot>
Expand All @@ -12,23 +12,23 @@
<x-slot name="form">
<!-- Token Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Token Name') }}" />
<x-jet-input id="name" type="text" class="block w-full mt-1" wire:model.defer="createApiTokenForm.name"
<x-label for="name" value="{{ __('Token Name') }}" />
<x-input id="name" type="text" class="block w-full mt-1" wire:model.defer="createApiTokenForm.name"
autofocus />
<x-jet-input-error for="name" class="mt-2" />
<x-input-error for="name" class="mt-2" />
<x-jetpass-form-help-text class="mt-2" value="{{ __('Something to remember the token by.') }}" />
</div>

<!-- Token Permissions -->
@if (Laravel\Jetstream\Jetstream::hasPermissions())
<div class="col-span-6">
<x-jet-label for="permissions" value="{{ __('Permissions') }}" />
<x-label for="permissions" value="{{ __('Permissions') }}" />

<div class="grid grid-cols-1 gap-4 mt-2 md:grid-cols-2">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="createApiTokenForm.scopes" :value="$permission" />
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
<x-checkbox wire:model.defer="createApiTokenForm.scopes" :value="$permission" />
<span class="ml-2 text-sm text-gray-600 dark:text-gray-400">{{ $permission }}</span>
</label>
@endforeach
</div>
Expand All @@ -37,22 +37,22 @@
</x-slot>

<x-slot name="actions">
<x-jet-action-message class="mr-3" on="created">
<x-action-message class="mr-3" on="created">
{{ __('Created.') }}
</x-jet-action-message>
</x-action-message>

<x-jet-button>
<x-button>
{{ __('Create') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-form-section>
</x-form-section>

@if ($this->user->tokens->isNotEmpty())
<x-jet-section-border />
<x-section-border />

<!-- Manage API Tokens -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-action-section>
<x-slot name="title">
{{ __('Manage API Tokens') }}
</x-slot>
Expand Down Expand Up @@ -100,12 +100,12 @@
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</x-action-section>
</div>
@endif

<!-- Token Value Modal -->
<x-jet-dialog-modal wire:model="displayingToken">
<x-dialog-modal wire:model="displayingToken">
<x-slot name="title">
{{ __('API Token') }}
</x-slot>
Expand All @@ -122,14 +122,14 @@ class="w-full px-4 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('displayingToken', false)" wire:loading.attr="disabled">
<x-secondary-button wire:click="$set('displayingToken', false)" wire:loading.attr="disabled">
{{ __('Close') }}
</x-jet-secondary-button>
</x-secondary-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- API Token Permissions Modal -->
<x-jet-dialog-modal wire:model="managingApiTokenPermissions">
<x-dialog-modal wire:model="managingApiTokenPermissions">
<x-slot name="title">
{{ __('API Token Permissions') }}
</x-slot>
Expand All @@ -138,27 +138,27 @@ class="w-full px-4 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="updateApiTokenForm.scopes" :value="$permission" />
<x-checkbox wire:model.defer="updateApiTokenForm.scopes" :value="$permission" />
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
</label>
@endforeach
</div>
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('managingApiTokenPermissions', false)"
<x-secondary-button wire:click="$set('managingApiTokenPermissions', false)"
wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-button class="ml-2" wire:click="updateApiToken" wire:loading.attr="disabled">
<x-button class="ml-2" wire:click="updateApiToken" wire:loading.attr="disabled">
{{ __('Save') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- Delete Token Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingApiTokenDeletion">
<x-confirmation-modal wire:model="confirmingApiTokenDeletion">
<x-slot name="title">
{{ __('Delete API Token') }}
</x-slot>
Expand All @@ -168,13 +168,13 @@ class="w-full px-4 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingApiTokenDeletion')" wire:loading.attr="disabled">
<x-secondary-button wire:click="$toggle('confirmingApiTokenDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-danger-button class="ml-2" wire:click="deleteApiToken" wire:loading.attr="disabled">
<x-danger-button class="ml-2" wire:click="deleteApiToken" wire:loading.attr="disabled">
{{ __('Delete') }}
</x-jet-danger-button>
</x-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</x-confirmation-modal>
</div>
2 changes: 1 addition & 1 deletion resources/views/components/form-help-text.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p {{ $attributes->merge(['class' => 'text-xs text-gray-700']) }}>{{ $value ?? '' }}</p>
<p {{ $attributes->merge(['class' => 'text-xs text-gray-700 dark:text-gray-400']) }}>{{ $value ?? '' }}</p>
2 changes: 1 addition & 1 deletion resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
</div>

<x-jet-section-border />
<x-section-border />

<div>
<div class="py-10 mx-auto max-w-7xl sm:px-6 lg:px-8">
Expand Down
84 changes: 42 additions & 42 deletions resources/views/oauth-client-manager.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
<x-jet-form-section submit="createClient">
<x-form-section submit="createClient">
<x-slot name="title">
{{ __('Create a new OAuth2 Application') }}
</x-slot>
Expand All @@ -11,39 +11,39 @@
<x-slot name="form">
<!-- Client Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="clientName" value="{{ __('Name') }}" />
<x-jet-input id="clientName" type="text" class="block w-full mt-1" wire:model.defer="createForm.name"
<x-label for="clientName" value="{{ __('Name') }}" />
<x-input id="clientName" type="text" class="block w-full mt-1" wire:model.defer="createForm.name"
autofocus />
<x-jet-input-error for="clientName" class="mt-2" />
<x-input-error for="clientName" class="mt-2" />
<x-jetpass-form-help-text class="mt-2" value="{{ __('Something your users will recognize and trust.') }}" />
</div>
<!-- Redirect Url -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="redirect" value="{{ __('Redirect URL') }}" />
<x-jet-input id="redirect" type="text" class="block w-full mt-1" wire:model.defer="createForm.redirect"
<x-label for="redirect" value="{{ __('Redirect URL') }}" />
<x-input id="redirect" type="text" class="block w-full mt-1" wire:model.defer="createForm.redirect"
autofocus />
<x-jet-input-error for="redirect" class="mt-2" />
<x-input-error for="redirect" class="mt-2" />
<x-jetpass-form-help-text class="mt-2" value="Your application's authorization callback url." />
</div>
</x-slot>
<x-slot name="actions">
<x-jet-action-message class="mr-3" on="created">
<x-action-message class="mr-3" on="created">
{{ __('Created.') }}
</x-jet-action-message>
</x-action-message>

<x-jet-button>
<x-button>
{{ __('Create') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-form-section>
</x-form-section>

@if ($this->user->clients->where('revoked', 0)->count() > 0)

<x-jet-section-border />
<x-section-border />

<!-- Manage Clients -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-action-section>
<x-slot name="title">
{{ __('Authorized OAuth2 Applications') }}
</x-slot>
Expand All @@ -58,7 +58,7 @@
@foreach ($this->user->clients->sortBy('name') as $client)
@if (!$client->revoked)
<div class="flex items-center justify-between">
<div class="text-sm">
<div class="text-sm text-gray-400">
{{ $client->name }}
</div>

Expand Down Expand Up @@ -89,12 +89,12 @@
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</x-action-section>
</div>
@endif

<!-- Token Value Modal -->
<x-jet-dialog-modal wire:model="displayingSecret">
<x-dialog-modal wire:model="displayingSecret">
<x-slot name="title">
{{ __('Manage Client') }}
</x-slot>
Expand All @@ -104,12 +104,12 @@
{{ __('Please copy your new secret. For your security, it won\'t be shown again.') }}
</div>

<x-jet-input class="mt-2" id="newClientId" type="text" readonly :value="$newClientId"
<x-input class="mt-2" id="newClientId" type="text" readonly :value="$newClientId"
class="w-full px-6 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded" autofocus
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
<x-jetpass-form-help-text value="{{ __('Client Id') }}" />

<x-jet-input class="mt-2" id="newClientSecret" x-ref="clientSecret" type="text" readonly :value="$clientSecret"
<x-input class="mt-2" id="newClientSecret" x-ref="clientSecret" type="text" readonly :value="$clientSecret"
class="w-full px-6 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded" autofocus
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
@showing-secret-modal.window="setTimeout(() => $refs.clientSecret.select(), 250)" />
Expand All @@ -118,14 +118,14 @@ class="w-full px-6 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('displayingSecret', false)" wire:loading.attr="disabled">
<x-secondary-button wire:click="$set('displayingSecret', false)" wire:loading.attr="disabled">
{{ __('Close') }}
</x-jet-secondary-button>
</x-secondary-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- Client edit Modal -->
<x-jet-dialog-modal wire:model="managingClient">
<x-dialog-modal wire:model="managingClient">
<x-slot name="title">
{{ __('Client Details') }}
</x-slot>
Expand All @@ -135,43 +135,43 @@ class="w-full px-6 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded

<!-- Client Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="updatingClientName" value="{{ __('Name') }}" />
<x-jet-input id="updatingClientName" type="text" class="block w-full mt-1"
<x-label for="updatingClientName" value="{{ __('Name') }}" />
<x-input id="updatingClientName" type="text" class="block w-full mt-1"
wire:model.defer="updateForm.name" autofocus />
<x-jet-input-error for="updatingClientName" class="mt-2" />
<x-input-error for="updatingClientName" class="mt-2" />
<x-jetpass-form-help-text class="mt-2" value="{{ __('Something your users will recognize and trust.') }}" />
</div>
<!-- Cient ID -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="managingClientId" value="{{ __('Client ID') }}" />
<x-jet-input id="managingClientId" x-ref="managingClientId" type="text" class="block w-full text-xs"
<x-label for="managingClientId" value="{{ __('Client ID') }}" />
<x-input id="managingClientId" x-ref="managingClientId" type="text" class="block w-full text-xs"
value="{{$managingClientId}}" readonly
@showing-manage-client-modal.window="setTimeout(() => $refs.managingClientId.select(), 250)" />
</div>
<!-- Redirect Url -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="updatingClientRedirect" value="{{ __('Redirect URL') }}" />
<x-jet-input id="updatingClientRedirect" type="text" class="block w-full mt-1"
<x-label for="updatingClientRedirect" value="{{ __('Redirect URL') }}" />
<x-input id="updatingClientRedirect" type="text" class="block w-full mt-1"
wire:model.defer="updateForm.redirect" autofocus />
<x-jet-input-error for="updatingClientRedirect" class="mt-2" />
<x-input-error for="updatingClientRedirect" class="mt-2" />
<x-jetpass-form-help-text class="mt-2" value="Your application's authorization callback url." />
</div>

</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('managingClient', false)" wire:loading.attr="disabled">
<x-secondary-button wire:click="$set('managingClient', false)" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-button class="ml-2" wire:click="updateClient" wire:loading.attr="disabled">
<x-button class="ml-2" wire:click="updateClient" wire:loading.attr="disabled">
{{ __('Save') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- Delete Token Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingDeletion">
<x-confirmation-modal wire:model="confirmingDeletion">
<x-slot name="title">
{{ __('Revoke OAuth2 Client') }}
</x-slot>
Expand All @@ -181,15 +181,15 @@ class="w-full px-6 py-2 mt-4 font-mono text-sm text-gray-500 bg-gray-100 rounded
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingDeletion')" wire:loading.attr="disabled">
<x-secondary-button wire:click="$toggle('confirmingDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-danger-button class="ml-2" wire:click="deleteClient" wire:loading.attr="disabled">
<x-danger-button class="ml-2" wire:click="deleteClient" wire:loading.attr="disabled">
{{ __('Delete') }}
</x-jet-danger-button>
</x-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</x-confirmation-modal>


</div>
4 changes: 2 additions & 2 deletions src/Http/Livewire/ApiTokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function createApiToken()
$this->createApiTokenForm['name'] = '';
$this->createApiTokenForm['scopes'] = Jetstream::$defaultPermissions;

$this->emit('created');
$this->dispatch('created');
}

/**
Expand All @@ -118,7 +118,7 @@ protected function displayTokenValue($token)

$this->plainTextToken = $token;

$this->dispatchBrowserEvent('showing-token-modal');
$this->dispatch('showing-token-modal');
}

/**
Expand Down
Loading

0 comments on commit 9d63c81

Please sign in to comment.