Reporting tool
Operational and financial reporting components for the MDK foundation UI kit
@tetherto/mdk-react-devkit/foundation
Reporting-tool components cover financial and operational analytics. Host apps supply API or tail-log data; components handle layout, charts, and tab navigation. Every report shares one date-range model through TimeframeControls, ReportTimeFrameSelector, and useFinancialDateRange.
Prerequisites
Component groups
- Financial reporting: revenue, cost, EBITDA, energy balance, hash balance, and subsidy fee reports
- Operational reporting: operational dashboard, energy consumption, and hashrate reports
- Operational efficiency: three-tab efficiency dashboard (
OperationsEfficiency) - Multi-site reporting: portfolio-level
SiteReportscomposite
Reporting components
Reporting tool
| Component | Description |
|---|---|
OperationsEfficiency | Three-tab operational efficiency reporting shell |
Cost | Cost summary reporting page with chart and metric tiles |
Ebitda | EBITDA reporting view with charts and metrics |
EnergyBalance | Energy balance reporting view with cost and revenue tabs |
HashBalance | Hash balance reporting view |
SubsidyFee | Subsidy fee bar chart with single-stat metric |
EnergyReport | Operational energy consumption reporting view |
Hashrate | Operational hashrate reporting view |
SiteReports | Multi-site reporting aggregation view |
TimeframeControls | Preset and custom time range picker for reporting views |
MetricCard | Single-metric card tile for reporting dashboards |
RevenueChart | Stacked bar chart of monthly revenue per site |
OperationalDashboard | 2×2 grid of site-operations charts (hashrate, power, efficiency, miners status) |
ReportTimeFrameSelector | Preset-window picker (1D / 7D / 30D / custom) for operational reporting bar views |
TimeframeControls
Year/month preset selector with custom date range override, shared across financial and operational reporting surfaces.
Date-range picker for financial reporting pages. Supports year, month, and optional week granularity via connected selects. Drives the date range for the cost, EBITDA, energy balance, and other financial reports.
Import
import { TimeframeControls } from '@tetherto/mdk-react-devkit/foundation'
import type { TimeframeControlsProps } from '@tetherto/mdk-react-devkit/foundation'Props
All props are optional.
| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
dateRange | Optional | { start, end } | none | Controlled date range in ms epoch; when omitted the control manages its own state |
onRangeChange | Optional | function | none | Called with ([start, end], { year, month, period }) when the user changes the selection |
isMonthSelectVisible | Optional | boolean | true | Show or hide the month select |
isWeekSelectVisible | Optional | boolean | true | Show or hide the week select |
showResetButton | Optional | boolean | false | Show a Reset button at the end of the toolbar |
onReset | Optional | function | none | Called when the user clicks Reset |
layout | Optional | 'horizontal' | 'stacked' | 'horizontal' | Selects row layout |
hint | Optional | string | none | Hint text shown above the toolbar in a banded strip |
timeframeType | Optional | TimeframeTypeValue | null | none | Controlled timeframe type (year / month / week) |
onTimeframeTypeChange | Optional | function | none | Called when the resolved timeframe type changes |
Basic usage
import { TimeframeControls } from '@tetherto/mdk-react-devkit/foundation'
import type { FinancialDateRange } from '@tetherto/mdk-react-devkit/foundation'
function ReportPage() {
const [dateRange, setDateRange] = useState<FinancialDateRange>()
return (
<TimeframeControls
isMonthSelectVisible
isWeekSelectVisible={false}
showResetButton
dateRange={dateRange}
onRangeChange={(range, opts) =>
setDateRange({ start: range[0].getTime(), end: range[1].getTime(), period: opts.period })
}
onReset={() => setDateRange(undefined)}
/>
)
}For the backing state machine see useTimeframeControls.
ReportTimeFrameSelector
Compact preset-window and custom date range control used inside efficiency and hashrate bar views. Pair with useReportTimeFrameSelectorState for controlled state.
Compact preset-window picker (1D / 7D / 30D / custom range) used inside the Miner Type and Mining Unit bar views of the operational efficiency and hashrate reports. Pair it with useReportTimeFrameSelectorState for the full controlled state.
Import
import { ReportTimeFrameSelector } from '@tetherto/mdk-react-devkit/foundation'
import type { ReportTimeFrameSelectorProps } from '@tetherto/mdk-react-devkit/foundation'Props
Props come directly from the useReportTimeFrameSelectorState return value; spread them onto the component:
| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
presetTimeFrame | Required | number | null | none | Required. Active preset window in days (1, 7, 30) or null when the custom range is active |
dateRange | Required | { start, end } | null | none | Required. Controlled date range; null while a preset is active |
setPresetTimeFrame | Required | function | none | Required. Setter called when the user selects a preset |
setDateRange | Required | function | none | Required. Setter called when the user picks a custom date range |
Basic usage
import {
ReportTimeFrameSelector,
useReportTimeFrameSelectorState,
} from '@tetherto/mdk-react-devkit/foundation'
function EfficiencyBarPanel() {
const { presetTimeFrame, dateRange, setPresetTimeFrame, setDateRange } =
useReportTimeFrameSelectorState()
return (
<ReportTimeFrameSelector
presetTimeFrame={presetTimeFrame}
dateRange={dateRange}
setPresetTimeFrame={setPresetTimeFrame}
setDateRange={setDateRange}
/>
)
}Styling
.mdk-report-time-frame-selector: Root element
MetricCard
Compact card displaying a metric label, formatted value, unit, and optional trend indicator for reporting composite layouts.
Compact card displaying a labelled metric value with an optional unit, highlight state, and transparency. Used across financial and operational reporting composites for cost, EBITDA, hash, and energy metric tiles.
Import
import { MetricCard } from '@tetherto/mdk-react-devkit/foundation'
import type { MetricCardProps } from '@tetherto/mdk-react-devkit/foundation'Props
| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
label | Required | string | none | Required. Metric label text |
value | Required | number | string | null | none | Required. Metric value; null renders a fallback dash |
unit | Required | string | none | Required. Unit suffix appended after the value when value is not null |
bgColor | Optional | string | rgba(0,0,0,0.05) | Background color CSS value |
isHighlighted | Optional | boolean | false | Apply highlight text color to the value |
isTransparentColor | Optional | boolean | false | Render the value text in a muted / transparent color |
isValueMedium | Optional | boolean | false | Render the value at medium font weight |
showDashForZero | Optional | boolean | false | When true, render a dash instead of 0 |
noMinWidth | Optional | boolean | false | Remove the default minimum card width |
className | Optional | string | none | Root class name from the host app |
Basic usage
import { MetricCard } from '@tetherto/mdk-react-devkit/foundation'
<MetricCard label="Total Cost" value={42500} unit="USD" />Styling
.mdk-metric-card: Root element.mdk-metric-card--no-min-width: Modifier removing the min-width constraint.mdk-metric-card__label: Label text.mdk-metric-card__value: Value text.mdk-metric-card__value--medium: Medium-weight value modifier