Add a basic react view with html component

pull/81/head
d_yanis 1 year ago
parent a472a4d0b7
commit eb154aaec0

@ -0,0 +1,38 @@
{
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
// Pointez pour afficher la description des attributs existants.
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch built-in server and debug",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-S",
"localhost:8080",
"-t",
"./public"
],
"port": 8080,
"serverReadyAction": {
"action": "openExternally"
}
},
{
"name": "Debug current script in console",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"externalConsole": false,
"port": 9003
},
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}

@ -10,7 +10,6 @@ const SUPPORTS_FAST_REFRESH = _SUPPORTS_FAST_REFRESH;
/**
* Maps the given relative source uri (relative to the `/front` folder) to its actual location depending on imported profile.
* @param string $assetURI relative uri path from `/front` folder
* @return string valid url that points to the given uri
*/
function asset(string $assetURI): string {
return _asset($assetURI);

@ -0,0 +1,7 @@
export default function Home(){
return (
<div>
<h1>Home</h1>
</div>
)
}

@ -1,6 +1,5 @@
<?php
require "../vendor/autoload.php";
require "../config.php";
require "../sql/database.php";
@ -122,7 +121,6 @@ function runMatch($match, MutableSessionHandle $session): HttpResponse {
return App::runAction($basePath . '/login', $match['target'], $match['params'], $session);
}
//this is a global variable
$basePath = get_public_path(__DIR__);

@ -23,9 +23,7 @@ class UserController {
* @return ViewHttpResponse the home page view
*/
public function home(SessionHandle $session): ViewHttpResponse {
//TODO use session's account to get the last 5 tactics of the logged-in account
$listTactic = $this->tactics->getLast(5);
return ViewHttpResponse::twig("home.twig", ["recentTactic" => $listTactic]);
return ViewHttpResponse::react("views/Home.tsx", []);
}
/**

Loading…
Cancel
Save