Skip to content

Commit

Permalink
🚧 DEV-Tool UI
Browse files Browse the repository at this point in the history
  • Loading branch information
juzaweb committed Aug 6, 2023
1 parent b237237 commit f8e7f64
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
18 changes: 17 additions & 1 deletion modules/DevTool/Http/Controllers/DevToolController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,30 @@

use Illuminate\Contracts\View\View;
use Inertia\Response;
use Juzaweb\CMS\Contracts\LocalPluginRepositoryContract;
use Juzaweb\CMS\Contracts\LocalThemeRepositoryContract;
use Juzaweb\CMS\Http\Controllers\BackendController;

class DevToolController extends BackendController
{
protected string $template = 'inertia';

public function __construct(
protected LocalPluginRepositoryContract $pluginRepository,
protected LocalThemeRepositoryContract $themeRepository
) {
//
}

public function index(): View|Response
{
return $this->view('dev-tool/index');
$title = __('Dev Tool');
$themes = $this->themeRepository->all(true)->values();
$plugins = $this->pluginRepository->all(true)->values();

return $this->view(
'dev-tool/index',
compact('title', 'themes', 'plugins')
);
}
}
2 changes: 2 additions & 0 deletions modules/DevTool/Providers/DevToolServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public function register(): void
$this->setupStubPath();

$this->app->register(ConsoleServiceProvider::class);

$this->mergeConfigFrom(__DIR__ . '/../config/dev-tool.php', 'dev-tool');
}

/**
Expand Down
15 changes: 15 additions & 0 deletions modules/DevTool/config/dev-tool.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
'themes' => [
'options' => [
'title' => __('Themes'),
]
],

'plugins' => [
'options' => [

]
]
];
36 changes: 34 additions & 2 deletions resources/js/pages/dev-tool/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
export default function Index() {
return null;
import {__} from "@/helpers/functions";

export interface IndexProps {
title: string
themes: Array<any>
plugins: Array<any>
}

export default function Index({ themes, plugins }: IndexProps) {

return (
<div className={'row'}>
<div className={'col-md-4'}>
<select name="" className={'form-control'}>
<option value="">{__('Select Module')}</option>
<optgroup label={__('Themes')}></optgroup>
{themes.map((theme: any) => (
<option value={theme.name} key={theme.name}>{theme.title}</option>
))}
<optgroup label={__('Plugins')}></optgroup>
{plugins.map((plugin: any) => (
<option value={plugin.name} key={plugin.name}>{plugin.extra?.juzaweb?.name || plugin.name}</option>
))}
</select>
</div>

<div className="col-md-4">
<select name="" className={'form-control'}>
<option value="">{__('Options')}</option>

</select>
</div>
</div>
);
}

0 comments on commit f8e7f64

Please sign in to comment.