Skip to content

Commit

Permalink
Rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Aug 26, 2021
1 parent ae845fa commit d567a93
Show file tree
Hide file tree
Showing 24 changed files with 152 additions and 142 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/spatie/laravel-support-form/discussions/new?category=q-a
url: https://github.com/spatie/laravel-support-bubble/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/spatie/laravel-support-form/discussions/new?category=ideas
url: https://github.com/spatie/laravel-support-bubble/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a bug
url: https://github.com/spatie/laravel-support-form/issues/new
url: https://github.com/spatie/laravel-support-bubble/issues/new
about: Report a reproducable bug
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `laravel-support-form` will be documented in this file.
All notable changes to `laravel-support-bubble` will be documented in this file.

## 1.0.0 - 202X-XX-XX

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
**DO NOT USE YET, PACKAGE IN DEVELOPMENT**

# A non-intrusive support form that can be displayed on any page
# A non-intrusive support bubble that can be displayed on any page

[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-support-form.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-support-form)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-support-form/run-tests?label=tests)](https://github.com/spatie/laravel-support-form/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-support-form/Check%20&%20fix%20styling?label=code%20style)](https://github.com/spatie/laravel-support-form/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-support-form.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-support-form)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-support-bubble.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-support-bubble)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-support-bubble/run-tests?label=tests)](https://github.com/spatie/laravel-support-bubble/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-support-bubble/Check%20&%20fix%20styling?label=code%20style)](https://github.com/spatie/laravel-support-bubble/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-support-bubble.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-support-bubble)

Using this package you can quickly add a button that will show a support form on any page.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/laravel-support-form.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/laravel-support-form)
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/laravel-support-bubble.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/laravel-support-bubble)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

Expand All @@ -22,12 +22,12 @@ We highly appreciate you sending us a postcard from your hometown, mentioning wh
You can install the package via composer:

```bash
composer require spatie/laravel-support-form
composer require spatie/laravel-support-bubble
```

You can publish the config file with:
```bash
php artisan vendor:publish --provider="Spatie\LaravelSupportForm\LaravelSupportFormServiceProvider" --tag="support-form-config"
php artisan vendor:publish --provider="Spatie\LaravelSupportBubble\LaravelSupportBubbleServiceProvider" --tag="support-bubble-config"
```

This is the contents of the published config file:
Expand Down Expand Up @@ -61,6 +61,7 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [Alex Vanderbist](https://github.com/alexvanderbist)
- [Freek Van der Herten](https://github.com/freekmurze)
- [Ruben Van Assche](https://github.com/rubenvanassche)
- [All Contributors](../../contributors)
Expand Down
21 changes: 13 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "spatie/laravel-support-form",
"description": "A non-intrusive support form that can be displayed on any page",
"name": "spatie/laravel-support-bubble",
"description": "A non-intrusive support chat bubble that can be displayed on any page",
"keywords": [
"spatie",
"laravel",
"laravel-support-form"
"laravel-support-bubble"
],
"homepage": "https://github.com/spatie/laravel-support-form",
"homepage": "https://github.com/spatie/laravel-support-bubble",
"license": "MIT",
"authors": [
{
"name": "Alex Vanderbist",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "Freek Van der Herten",
"email": "[email protected]",
Expand Down Expand Up @@ -37,13 +42,13 @@
},
"autoload": {
"psr-4": {
"Spatie\\SupportForm\\": "src",
"Spatie\\SupportForm\\Database\\Factories\\": "database/factories"
"Spatie\\SupportBubble\\": "src",
"Spatie\\SupportBubble\\Database\\Factories\\": "database/factories"
}
},
"autoload-dev": {
"psr-4": {
"Spatie\\SupportForm\\Tests\\": "tests"
"Spatie\\SupportBubble\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -56,7 +61,7 @@
"extra": {
"laravel": {
"providers": [
"Spatie\\SupportForm\\SupportFormServiceProvider"
"Spatie\\SupportBubble\\SupportBubbleServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/support-form.php → config/support-bubble.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/*
* Route name
*/
'form_action_route' => 'supportForm.submit',
'form_action_route' => 'SupportBubble.submit',

/*
* Form submission rules
Expand Down
2 changes: 1 addition & 1 deletion database/factories/ModelFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Spatie\SupportForm\Database\Factories;
namespace Spatie\SupportBubble\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

Expand Down
2 changes: 1 addition & 1 deletion database/migrations/create_support-form_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ return new class extends Migration
{
public function up()
{
Schema::create('laravel-support-form_table', function (Blueprint $table) {
Schema::create('laravel-support-bubble_table', function (Blueprint $table) {
$table->id();

// add fields
Expand Down
16 changes: 8 additions & 8 deletions resources/views/components/support-bubble.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
$position .= $positionX === 'right' ? 'right-0 items-end ' : 'left-0';
@endphp

<div class="spatie-support-form fixed {{$position}} z-10 flex-col m-4 gap-3 w-64" style="display: none;">
<div class="spatie-support-form__container bg-white shadow-xl border border-gray-300 rounded p-4" style="display: none">
<div class="spatie-support-form__form">
@include('support-form::includes.form', compact('email'))
<div class="spatie-support-bubble fixed {{$position}} z-10 flex-col m-4 gap-3 w-64" style="display: none;">
<div class="spatie-support-bubble__container bg-white shadow-xl border border-gray-300 rounded p-4" style="display: none">
<div class="spatie-support-bubble__form">
@include('support-bubble::includes.form', compact('email'))
</div>

<div class="spatie-support-form__response" style="display: none">
<div class="spatie-support-bubble__response" style="display: none">
</div>
</div>

<div class="spatie-support-form__button">
@include('support-form::includes.button')
<div class="spatie-support-bubble__button">
@include('support-bubble::includes.button')
</div>
</div>

@include('support-form::includes.script')
@include('support-bubble::includes.script')
2 changes: 1 addition & 1 deletion resources/views/includes/button.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<button type="button" class="bg-purple-400 rounded-full shadow-lg w-14 h-14 text-white p-4">
@include('support-form::includes.chat-icon')
@include('support-bubble::includes.chat-icon')
</button>
10 changes: 7 additions & 3 deletions resources/views/includes/form.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<div class="support-form-inner">
<p class="spatie-support-form__error pb-4 text-red-600" style="display: none"></p>
<div class="support-bubble-inner">
<p class="pb-4">

<form method="post" action="{{ route(config('support-form.form_action_route')) }}" class="flex flex-col gap-2">
</p>

<p class="spatie-support-bubble__error pb-4 text-red-600" style="display: none"></p>

<form method="post" action="{{ route(config('support-bubble.form_action_route')) }}" class="flex flex-col gap-2">
<label for="name" class="{{ $name ? 'hidden' : '' }}">
<input type="text" name="name" required placeholder="Your name" value="{{ $name }}" class="input">
</label>
Expand Down
18 changes: 9 additions & 9 deletions resources/views/includes/script.blade.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script>
function bootstrapSupportForm(element) {
function bootstrapSupportBubble(element) {
element.style.display = 'flex';
const container = element.querySelector('.spatie-support-form__container');
const formContainer = element.querySelector('.spatie-support-form__form');
const responseContainer = element.querySelector('.spatie-support-form__response');
const errorMessage = element.querySelector('.spatie-support-form__error');
const container = element.querySelector('.spatie-support-bubble__container');
const formContainer = element.querySelector('.spatie-support-bubble__form');
const responseContainer = element.querySelector('.spatie-support-bubble__response');
const errorMessage = element.querySelector('.spatie-support-bubble__error');
element.querySelector('.spatie-support-form__button button')
element.querySelector('.spatie-support-bubble__button button')
.addEventListener('click', () => {
responseContainer.style.display = 'none';
formContainer.style.display = 'flex';
container.style.display = container.style.display === 'flex' ? 'none' : 'flex';
});
element.querySelector('.spatie-support-form__form form')
element.querySelector('.spatie-support-bubble__form form')
.addEventListener('submit', (event) => {
event.preventDefault();
const formData = new FormData(event.target)
Expand Down Expand Up @@ -51,7 +51,7 @@ function bootstrapSupportForm(element) {
window.addEventListener('load', () => {
document
.querySelectorAll('.spatie-support-form')
.forEach(form => bootstrapSupportForm(form));
.querySelectorAll('.spatie-support-bubble')
.forEach(form => bootstrapSupportBubble(form));
});
</script>
10 changes: 5 additions & 5 deletions src/Components/SupportBubble.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Spatie\SupportForm\Components;
namespace Spatie\SupportBubble\Components;

use Illuminate\View\Component;
use Str;
Expand All @@ -21,9 +21,9 @@ public function __construct(string $position)
{
$this->positionY = Str::contains($position, 'top') ? 'top' : 'bottom';
$this->positionX = Str::contains($position, 'left') ? 'left' : 'right';
$this->formAction = route(config('support-form.form_action_route'));
$this->email = config('support-form.prefill_logged_in_user') ? (optional(request()->user())->email ?? '') : '';
$this->name = config('support-form.prefill_logged_in_user') ? (optional(request()->user())->name ?? '') : '';
$this->formAction = route(config('support-bubble.form_action_route'));
$this->email = config('support-bubble.prefill_logged_in_user') ? (optional(request()->user())->email ?? '') : '';
$this->name = config('support-bubble.prefill_logged_in_user') ? (optional(request()->user())->name ?? '') : '';
}

/**
Expand All @@ -33,6 +33,6 @@ public function __construct(string $position)
*/
public function render()
{
return view("support-form::components.support-bubble");
return view("support-bubble::components.support-bubble");
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Spatie\SupportForm\Events;
namespace Spatie\SupportBubble\Events;

use Spatie\SupportForm\Http\Requests\SupportFormRequest;
use Spatie\SupportBubble\Http\Requests\SupportBubbleRequest;

class SupportFormSubmittedEvent
class SupportBubbleSubmittedEvent
{
public function __construct(
public string $subject,
Expand All @@ -14,7 +14,7 @@ public function __construct(
) {
}

public static function fromRequest(SupportFormRequest $request): self
public static function fromRequest(SupportBubbleRequest $request): self
{
return new static(
$request->subject,
Expand Down
16 changes: 16 additions & 0 deletions src/Http/Controllers/HandleSupportBubbleSubmissionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Spatie\SupportBubble\Http\Controllers;

use Spatie\SupportBubble\Events\SupportBubbleSubmittedEvent;
use Spatie\SupportBubble\Http\Requests\SupportBubbleRequest;

class HandleSupportBubbleSubmissionController
{
public function __invoke(SupportBubbleRequest $request)
{
event(SupportBubbleSubmittedEvent::fromRequest($request));

return view('support-bubble::success');
}
}
16 changes: 0 additions & 16 deletions src/Http/Controllers/HandleSupportFormSubmissionController.php

This file was deleted.

13 changes: 13 additions & 0 deletions src/Http/Requests/SupportBubbleRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Spatie\SupportBubble\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SupportBubbleRequest extends FormRequest
{
public function rules()
{
return config('support-bubble.rules');
}
}
13 changes: 0 additions & 13 deletions src/Http/Requests/SupportFormRequest.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Notifications/BubbleResponseNotification.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Spatie\SupportForm\Notifications;
namespace Spatie\SupportBubble\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Spatie\SupportForm\Events\SupportFormSubmittedEvent;
use Spatie\SupportBubble\Events\SupportBubbleSubmittedEvent;

class BubbleResponseNotification extends Notification implements ShouldQueue
{
Expand All @@ -20,7 +20,7 @@ public function __construct(
) {
}

public static function fromEvent(SupportFormSubmittedEvent $event): self
public static function fromEvent(SupportBubbleSubmittedEvent $event): self
{
return new self(
$event->subject,
Expand Down
Loading

0 comments on commit d567a93

Please sign in to comment.