overviewCards
A card of the plugin in Server › Overview, the server's dashboard. It shows a number or a chart of the plugin over the period the admin chose.
Where in Hodi
Server › Overview is the server's dashboard. At the top of this page, the server admin picks a period: 7 days, 30 days… Each card of the page shows a number or a chart over this period. The plugins' cards come after Hodi's Online and Profiles cards, in the order of the plugins.
Example
This card shows how many hellos the plugin said during the chosen period:
import { OverviewCard, definePlugin, usePluginServerApi } from 'hodi:sdk'
const SaidCard = ({ from, to }) => {
const count = useSaidCount(from, to)
return <OverviewCard title="Hellos" count={count} />
}
definePlugin({
overviewCards: [
{
id: 'said',
size: 'narrow',
component: SaidCard
}
]
})A card's fields
overviewCards is a list. Each card of the list has three fields:
idstringLowercase letters, digits and dashes, once per plugin.
size'narrow' | 'wide' | 'full'The card's width, see below.
componentComponentType<{ from, to }>The card's content, drawn with OverviewCard.
Props
Hodi gives the component the period the admin picked:
fromstringThe first day of the period, included, as YYYY-MM-DD.
tostringThe last day of the period, included, in the same format.
Card width
narrowA third of the width on a computer, half on a tablet, the whole width on a phone.
wideTwo thirds of the width on a computer, half on a tablet, the whole width on a phone.
fullThe whole width, on a computer, a tablet and a phone.
Good to know
- Who sees the cards: the server admin only.
- A card's data: a
serverRoute, called withfromandto. - If a card crashes: Hodi shows a message in place of this card.