MDK Logo

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

Reporting components

Reporting tool

ComponentDescription
OperationsEfficiencyThree-tab operational efficiency reporting shell
CostCost summary reporting page with chart and metric tiles
EbitdaEBITDA reporting view with charts and metrics
EnergyBalanceEnergy balance reporting view with cost and revenue tabs
HashBalanceHash balance reporting view
SubsidyFeeSubsidy fee bar chart with single-stat metric
EnergyReportOperational energy consumption reporting view
HashrateOperational hashrate reporting view
SiteReportsMulti-site reporting aggregation view
TimeframeControlsPreset and custom time range picker for reporting views
MetricCardSingle-metric card tile for reporting dashboards
RevenueChartStacked bar chart of monthly revenue per site
OperationalDashboard2×2 grid of site-operations charts (hashrate, power, efficiency, miners status)
ReportTimeFrameSelectorPreset-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.

PropStatusTypeDefaultDescription
dateRangeOptional{ start, end }noneControlled date range in ms epoch; when omitted the control manages its own state
onRangeChangeOptionalfunctionnoneCalled with ([start, end], { year, month, period }) when the user changes the selection
isMonthSelectVisibleOptionalbooleantrueShow or hide the month select
isWeekSelectVisibleOptionalbooleantrueShow or hide the week select
showResetButtonOptionalbooleanfalseShow a Reset button at the end of the toolbar
onResetOptionalfunctionnoneCalled when the user clicks Reset
layoutOptional'horizontal' | 'stacked''horizontal'Selects row layout
hintOptionalstringnoneHint text shown above the toolbar in a banded strip
timeframeTypeOptionalTimeframeTypeValue | nullnoneControlled timeframe type (year / month / week)
onTimeframeTypeChangeOptionalfunctionnoneCalled 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:

PropStatusTypeDefaultDescription
presetTimeFrameRequirednumber | nullnoneRequired. Active preset window in days (1, 7, 30) or null when the custom range is active
dateRangeRequired{ start, end } | nullnoneRequired. Controlled date range; null while a preset is active
setPresetTimeFrameRequiredfunctionnoneRequired. Setter called when the user selects a preset
setDateRangeRequiredfunctionnoneRequired. 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

PropStatusTypeDefaultDescription
labelRequiredstringnoneRequired. Metric label text
valueRequirednumber | string | nullnoneRequired. Metric value; null renders a fallback dash
unitRequiredstringnoneRequired. Unit suffix appended after the value when value is not null
bgColorOptionalstringrgba(0,0,0,0.05)Background color CSS value
isHighlightedOptionalbooleanfalseApply highlight text color to the value
isTransparentColorOptionalbooleanfalseRender the value text in a muted / transparent color
isValueMediumOptionalbooleanfalseRender the value at medium font weight
showDashForZeroOptionalbooleanfalseWhen true, render a dash instead of 0
noMinWidthOptionalbooleanfalseRemove the default minimum card width
classNameOptionalstringnoneRoot 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

On this page