mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-28 06:26:00 +08:00
updated react app and API backend
1. Added API backend for settings 2. Added React components for the settings page 3. Added JS lint using @wordpress/scripts 4. Lint fixes for PHP
This commit is contained in:
parent
38067e490a
commit
e80316be89
36 changed files with 45313 additions and 1736 deletions
50
src/App.jsx
50
src/App.jsx
|
@ -1,17 +1,49 @@
|
|||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
||||
import Dashboard from './pages/Dashboard';
|
||||
import Settings from './pages/Settings';
|
||||
import TwoFA from './pages/TwoFA';
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/settings" element={<Settings />} />
|
||||
<Route path="/2fa" element={<TwoFA />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
);
|
||||
return (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path="/" element={ <Dashboard /> } />
|
||||
<Route path="/settings" element={ <Settings /> } />
|
||||
<Route path="/2fa" element={ <TwoFA /> } />
|
||||
</Routes>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
// Mount components based on container element
|
||||
document.addEventListener( 'DOMContentLoaded', function () {
|
||||
// Main Helix app
|
||||
const helixRoot = document.getElementById( 'helix-root' );
|
||||
if ( helixRoot ) {
|
||||
const root = createRoot( helixRoot );
|
||||
root.render( <App /> );
|
||||
}
|
||||
|
||||
// Settings page
|
||||
const settingsRoot = document.getElementById( 'helix-settings-root' );
|
||||
if ( settingsRoot ) {
|
||||
const root = createRoot( settingsRoot );
|
||||
root.render( <Settings /> );
|
||||
}
|
||||
|
||||
// Posts page
|
||||
const postsRoot = document.getElementById( 'helix-posts-root' );
|
||||
if ( postsRoot ) {
|
||||
const root = createRoot( postsRoot );
|
||||
root.render( <Dashboard /> ); // For now, render Dashboard
|
||||
}
|
||||
|
||||
// Users page
|
||||
const usersRoot = document.getElementById( 'helix-users-root' );
|
||||
if ( usersRoot ) {
|
||||
const root = createRoot( usersRoot );
|
||||
root.render( <Dashboard /> ); // For now, render Dashboard
|
||||
}
|
||||
} );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue