mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 22:57:11 -04:00
Added vite react admin ui.
This commit is contained in:
parent
d34b964cc2
commit
6f440a13cd
27 changed files with 969 additions and 11 deletions
48
admin/src/pages/HomePage.tsx
Normal file
48
admin/src/pages/HomePage.tsx
Normal file
|
@ -0,0 +1,48 @@
|
|||
import {useStore} from "../store/store.ts";
|
||||
import {useEffect, useState} from "react";
|
||||
import {PluginDef} from "./Plugin.ts";
|
||||
|
||||
export const HomePage = () => {
|
||||
const pluginsSocket = useStore(state=>state.pluginsSocket)
|
||||
const [limit, setLimit] = useState(20)
|
||||
const [offset, setOffset] = useState(0)
|
||||
const [plugins,setPlugins] = useState<PluginDef[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
pluginsSocket?.emit('search', {
|
||||
searchTerm: '',
|
||||
offset: offset,
|
||||
limit: limit,
|
||||
sortBy: 'name',
|
||||
sortDir: 'asc'
|
||||
})
|
||||
setOffset(offset+limit)
|
||||
|
||||
pluginsSocket!.on('results:search', (data) => {
|
||||
setPlugins(data.results)
|
||||
})
|
||||
}, []);
|
||||
|
||||
return <div>
|
||||
<h1>Home Page</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{plugins.map((plugin, index) => {
|
||||
return <tr key={index}>
|
||||
<td>{plugin.name}</td>
|
||||
<td>{plugin.description}</td>
|
||||
<td>test</td>
|
||||
</tr>
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue