Skip to content

Commit

Permalink
Merge pull request #879 from ga-devfront/feat/connect-new-ui
Browse files Browse the repository at this point in the history
Feat: connect new UI
  • Loading branch information
ga-devfront authored Sep 16, 2024
2 parents 6c2e37c + ae49d30 commit 3501884
Show file tree
Hide file tree
Showing 18 changed files with 940 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:
jobs:
js-linter:
name: JS linter syntax check
runs-on: unbuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions _dev/vite.dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default defineConfig({
build: {
rollupOptions: {
input: {
main: './scripts/main.ts',
theme: './styles/main.scss'
main: './src/ts/main.ts',
theme: './src/scss/main.scss'
},
output: {
dir: 'public'
Expand Down
41 changes: 41 additions & 0 deletions classes/Router/Router.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace PrestaShop\Module\AutoUpgrade\Router;

use PrestaShop\Module\AutoUpgrade\Controller\WelcomeController;
use PrestaShop\Module\AutoUpgrade\UpgradeContainer;
use Symfony\Component\HttpFoundation\Request;

class Router
{
/**
* @var UpgradeContainer
*/
protected $upgradeContainer;

public function __construct(UpgradeContainer $upgradeContainer)
{
$this->upgradeContainer = $upgradeContainer;
}

const ROUTES = [
'welcome' => [
'controller' => WelcomeController::class,
'method' => 'index',
'params' => [],
],
];

public function handle(Request $request): string
{
$route = $request->query->get('route');

if (empty(self::ROUTES[$route])) {
throw new \InvalidArgumentException('Oh no! The route does not exist');
}
$route = self::ROUTES[$route];
$method = $route['method'];

return (new $route['controller']($this->upgradeContainer))->$method($request);
}
}
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"symfony/filesystem": "^3.0",
"doctrine/collections": "~1.3.0",
"segmentio/analytics-php": "^1.8",
"symfony/dotenv": "^4.4"
"symfony/dotenv": "^4.4",
"symfony/http-foundation": "^4.4"
},
"require-dev": {
"phpunit/phpunit": "^5",
Expand All @@ -35,7 +36,8 @@
"type": "prestashop-module",
"autoload": {
"psr-4": {
"PrestaShop\\Module\\AutoUpgrade\\": "classes/"
"PrestaShop\\Module\\AutoUpgrade\\": "classes/",
"PrestaShop\\Module\\AutoUpgrade\\Controller\\": "controllers/admin/self-managed"
}
},
"author": "PrestaShop"
Expand Down
Loading

0 comments on commit 3501884

Please sign in to comment.