Skip to content

Commit

Permalink
Adding final touches to wave version with updated theme provider
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed Oct 3, 2024
1 parent e447daf commit 677f888
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ yarn-error.log

# Wave ignores.
/public/.well-known
/public/demo
/.vagrant
/wave-pro
Homestead.json
Expand Down
4 changes: 0 additions & 4 deletions app/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('author.name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('title')
->searchable(),
Tables\Columns\ImageColumn::make('image'),
Tables\Columns\TextColumn::make('slug')
->searchable(),
Tables\Columns\TextColumn::make('status'),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class EncryptCookies extends Middleware
* @var array<int, string>
*/
protected $except = [
//
'theme'
];
}
1 change: 0 additions & 1 deletion public/build/assets/app-BTJ8dSUm.css

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/app-CaUPGaqM.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/theme-CgejNvRn.css

This file was deleted.

10 changes: 5 additions & 5 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"src": "resources/css/filament/admin/theme.css",
"isEntry": true
},
"resources/themes/anchor/assets/css/app.css": {
"file": "assets/app-BTJ8dSUm.css",
"src": "resources/themes/anchor/assets/css/app.css",
"resources/themes/fusion/assets/css/app.css": {
"file": "assets/app-D5J7c9EC.css",
"src": "resources/themes/fusion/assets/css/app.css",
"isEntry": true
},
"resources/themes/anchor/assets/js/app.js": {
"resources/themes/fusion/assets/js/app.js": {
"file": "assets/app-CaUPGaqM.js",
"name": "app",
"src": "resources/themes/anchor/assets/js/app.js",
"src": "resources/themes/fusion/assets/js/app.js",
"isEntry": true
}
}
24 changes: 24 additions & 0 deletions wave/src/Http/Middleware/ThemeDemoMiddleware.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Wave\Http\Middleware;

use Closure;

class ThemeDemoMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if(isset($request->theme)){
return redirect()->back()->withCookie(cookie('theme', $request->theme, 60, null, null, false, false));
}

return $next($request);
}
}
13 changes: 13 additions & 0 deletions wave/src/Overrides/Vite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Wave\Overrides;

use Illuminate\Foundation\Vite as BaseVite;

class Vite extends BaseVite
{
public function __invoke($entrypoints, $buildDirectory = null)
{
return parent::__invoke($entrypoints, 'demo');
}
}
10 changes: 10 additions & 0 deletions wave/src/WaveServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Wave\TokenGuard;
use Livewire\Livewire;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Vite as BaseVite;
use Wave\Overrides\Vite;
use Filament\Support\Colors\Color;
use Illuminate\Support\Facades\Gate;
use Wave\Facades\Wave as WaveFacade;
Expand Down Expand Up @@ -40,6 +42,14 @@ public function register(){
$this->app->router->aliasMiddleware('token_api', \Wave\Http\Middleware\TokenMiddleware::class);
$this->app->router->pushMiddlewareToGroup('web', \Wave\Http\Middleware\InstallMiddleware::class);

if(config('wave.demo')){
$this->app->router->pushMiddlewareToGroup('web', \Wave\Http\Middleware\ThemeDemoMiddleware::class);
// Overwrite the Vite asset helper so we can use the demo folder as opposed to the build folder
$this->app->singleton(BaseVite::class, function ($app) {
// Replace the default Vite instance with the custom one
return new Vite();
});
}

}

Expand Down

0 comments on commit 677f888

Please sign in to comment.