serverSections
A group of sections in the Server space, under the plugin's name. It is for what only the server admin should see and manage: a list of accounts, pending sign-ups, statistics…
Where in Hodi
The Server space has its own sidebar, with Hodi's groups: General, Plugins… The plugin adds a group named after the plugin to this sidebar, under Hodi's groups. Each section of this group is an entry of the sidebar, which opens the section's page.
Each section has its own address: #/server/plugin/<plugin id>/<section id>.
Example
import { SectionPage, definePlugin } from 'hodi:sdk'
import { Hand } from 'lucide-react'
const SaidPage = ({ layout }) => (
<SectionPage title="Hellos" layout={layout}>
…
</SectionPage>
)
definePlugin({
serverSections: [
{
id: 'said',
label: 'server.said',
icon: Hand,
page: SaidPage
}
]
})A section's fields
serverSections is a list. Each section of the list has these fields:
idstringThe section's name in the address: lowercase, digits and dashes, once per plugin.
labelstringThe section's name in the sidebar, a key of the locales, such as server.said.
pageComponentType<{ layout }>The section's page, drawn with SectionPage.
icon?ComponentTypeA Lucide icon. Without an icon, Hodi shows a puzzle piece.
hint?ComponentTypeThe line under the section's name, on a phone, such as 12 people.
Good to know
- Who sees the sections: the server admin only.
- The sections' routes: the
serverRoutes, called withusePluginServerApi(). - An invalid section: without a valid
id, or with anidalready taken, Hodi doesn't show it.
The serverRoutes refuse anyone other than the server admin.