Skip to content

Commit

Permalink
(FIX) [Tour/Highlights] Fixed major issue on opening tours and highli…
Browse files Browse the repository at this point in the history
…ghts
  • Loading branch information
JibayMcs committed Aug 6, 2024
1 parent e707673 commit ab04e60
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.1|^8.2",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.15.0",
"illuminate/contracts": "^10.0|^11.0"
Expand Down
2 changes: 1 addition & 1 deletion resources/dist/filament-tour.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions resources/dist/filament-tour.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions resources/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ document.addEventListener('livewire:initialized', async function () {

const id = parseId(params);

console.log(highlights)

let highlight = highlights.find(element => element.id === id);

if (highlight) {
Expand Down Expand Up @@ -133,7 +135,7 @@ document.addEventListener('livewire:initialized', async function () {

const id = parseId(params);

let tour = tours.find(element => element.id === id);
let tour = tours.find(element => element.id === `tour_${id}`);

if (tour) {
openTour(tour);
Expand Down Expand Up @@ -274,5 +276,4 @@ document.addEventListener('livewire:initialized', async function () {
driverObj.drive();
}
}
})
;
});
5 changes: 3 additions & 2 deletions src/Highlight/Highlight.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use Illuminate\View\View;

class Highlight
Expand Down Expand Up @@ -38,11 +39,11 @@ public function __construct(string $id, array $colors, string $parent)
* <br>
* Define a **$parent** to be able to view this highlight button next to it
*/
public static function make(string $id, string $parent): static
public static function make(string $parent): static
{
return app(static::class,
[
'id' => $id,
'id' => Str::slug($parent),
'colors' => [
'dark' => '#fff',
'light' => 'rgb(0,0,0)',
Expand Down
5 changes: 3 additions & 2 deletions src/Tour/HasTour.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace JibayMcs\FilamentTour\Tour;

use Filament\Facades\Filament;
use JibayMcs\FilamentTour\Tour\Traits\CanConstructRoute;

trait HasTour
Expand All @@ -18,7 +19,7 @@ public function constructTours($class): array

if ($tour instanceof Tour) {

if ($tour->getRoute()) {
if ($tour->getRoute() && Filament::auth()->user()) {
$this->setRoute($tour->getRoute());
}

Expand All @@ -42,7 +43,7 @@ public function constructTours($class): array
],
];

if (! $tour->hasDisabledEvents()) {
if (!$tour->hasDisabledEvents()) {
$data[$item]['events'] = [
'redirectOnNext' => $step->getRedirectOnNext(),
'clickOnNext' => $step->getClickOnNext(),
Expand Down

0 comments on commit ab04e60

Please sign in to comment.