Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade for Laravel 11 and Tailwind #5

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build
composer.lock
docs
vendor
coverage
coverage
.DS_Store
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Latest Version on Packagist](https://img.shields.io/packagist/v/tapp/slack-inviter.svg?style=flat-square)](https://packagist.org/packages/tapp/slack-inviter)
[![Quality Score](https://img.shields.io/scrutinizer/g/tapp/slack-inviter.svg?style=flat-square)](https://scrutinizer-ci.com/g/tapp/slack-inviter)
[![Total Downloads](https://img.shields.io/packagist/dt/tapp/slack-inviter.svg?style=flat-square)](https://packagist.org/packages/tapp/slack-inviter)
![Screenshot](https://user-images.githubusercontent.com/10762368/73688571-526cee80-469a-11ea-8d41-e60d528f3150.gif)

## Installation

Expand All @@ -13,12 +12,32 @@ You can install the package via composer:
composer require tapp/slack-inviter
```

## Appearance

![Slack Inviter Form](https://raw.githubusercontent.com/TappNetwork/slack-inviter/master/docs/form.png)

## Usage

``` php
// Usage description here
Add the Slack env vars on your `.env` file:

```php
SLACK_COMMUNITY_NAME=
SLACK_TEAM_URL=
SLACK_LEGACY_TOKEN=
```

Add the inviter form on your blade file:

```php
<div>
@include('slack-inviter::invite-form', [
'email' => auth()->user()->email
])
</div>
```

You're all set!

### Testing

``` bash
Expand All @@ -39,7 +58,7 @@ If you discover any security related issues, please email security@tappnetwork.c

## Credits

- [Jacob Zlogar](https://github.com/jacobzlogar)
- [Tapp Network](https://github.com/TappNetwork)
- [All Contributors](../../contributors)

## License
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Tapp Network",
"email": "steve@tappnetwork.com",
"role": "Developer"
},
{
"name": "Jacob Zlogar",
"email": "jacob.zlogar@gmail.com",
Expand All @@ -17,11 +22,11 @@
],
"require": {
"php": "^7.1 || ^7.3 || ^8.0",
"illuminate/support": "5.7.* || 5.8.* ||^6.0 || ^7.0 || ^8.0"
"illuminate/support": "5.7.* || 5.8.* ||^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0"
},
"require-dev": {
"orchestra/testbench": "^3.8 || ^5.0 || ^6.0",
"phpunit/phpunit": "^7.0 || ^8.4 || ^9.3.3"
"orchestra/testbench": "^3.8 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^7.0 || ^8.4 || ^9.3.3 || ^10.0"
},
"autoload": {
"psr-4": {
Expand Down
Binary file added docs/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 29 additions & 10 deletions resources/views/invite-form.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
<p>
Join {{config('slack-inviter.community_name')}} on slack
<p class="text-base font-semibold leading-7 text-gray-900">
Join {{config('slack-inviter.community_name')}} on Slack
</p>
<form method="post" action="#" id="slackInviterForm">
@csrf
<div class="form-group">
<input value="{{isset($email) ? $email : null}}" class="form-control" required name="email" type="email" placeholder="address@email.com" id="slackInviterEmail"/>
</div>
<button class="form-control btn btn-block btn-primary" type="submit" id="slackInviterBtn">
<span class="spinner-border spinner-border-sm" role="status" id="slackInviterSpinner" hidden></span>
Join
</button>
@csrf
<div class="mt-2 pb-4">
<input value="{{isset($email) ? $email : null}}" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-gray-950/10 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 placeholder:text-gray-400 dark:bg-white/5 dark:ring-white/20 dark:text-white dark:placeholder:text-gray-500 dark:disabled:text-gray-400" required name="email" type="email" placeholder="address@email.com" id="slackInviterEmail"/>
</div>
<button class="rounded-md relative grid-flow-col items-center justify-center font-semibold outline-none transition duration-75 focus-visible:ring-2 rounded-lg bg-gray-200 w-full px-3 py-2 text-sm hidden sm:inline-grid shadow-sm bg-white text-gray-950 hover:bg-gray-50 dark:bg-white/5 dark:text-white dark:hover:bg-white/10 ring-1 ring-gray-950/10 dark:ring-white/20 [input:checked+&]:bg-gray-400 [input:checked+&]:text-white [input:checked+&]:ring-0 [input:checked+&]:hover:bg-gray-300 dark:[input:checked+&]:bg-gray-600 dark:[input:checked+&]:hover:bg-gray-500" type="submit" id="slackInviterBtn">
<span class="text-gray-600" role="status" id="slackInviterSpinner" hidden>
<svg
fill="none"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
class="animate-spin h-5 w-5"
>
<path
clip-rule="evenodd"
d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
fill-rule="evenodd"
fill="currentColor"
opacity="0.2"
></path>
<path
d="M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z"
fill="currentColor"
></path>
</svg>
</span>
Join
</button>
</form>

@include('slack-inviter::partials.scripts')
12 changes: 6 additions & 6 deletions resources/views/partials/scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
formData.append('email', email);
xhr.onload = function () {
spinner.removeAttribute('hidden');
button.classList.remove('btn-primary');
button.classList.add('btn-outline-primary');
button.classList.remove('bg-gray-300');
button.classList.add('border-primary-600');
window.setTimeout(function () {
if (xhr.status == 200) {
button.classList.remove('btn-outline-primary');
button.classList.add('btn-success');
button.classList.remove('border-primary-600');
button.classList.add('bg-primary-400');
} else {
button.classList.remove('btn-outine-primary');
button.classList.add('btn-danger');
button.classList.remove('border-primary-600');
button.classList.add('bg-rose-400');
}
spinner.setAttribute('hidden', true);
button.innerHTML = "Invitation Sent."
Expand Down
2 changes: 1 addition & 1 deletion src/Api/SlackInviterApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function invite($email)
{
$response = $this->client->request('POST', "users.admin.invite?email={$email}", [
'headers' => [
'Content-Type' => "application/json; charset=utf-8",
'Content-Type' => "application/json; charset=utf-8",
],
]);

Expand Down
Loading