Constants
Shared constants exported by @mdk/core and @mdk/foundation
This page documents constants exported by the MDK packages. Constants live in two distinct domains:
@mdk/coreships UI primitives: colors, units, currency symbols, chart defaults@mdk/foundationships mining-domain values: permissions, roles, header preferences, error codes
@mdk/core constants
Prerequisites
- Complete the @mdk/core installation and add the dependency
Import
@mdk/core
import {
COLOR,
UNITS,
CURRENCY,
CHART_COLORS,
TABLE_COLORS,
HASHRATE_LABEL_DIVISOR,
} from '@mdk/core'Color constants
COLOR
@mdk/core
Comprehensive color palette with 80+ named colors.
import { COLOR } from '@mdk/core'
COLOR.GREEN // '#72F59E'
COLOR.RED // '#EF4444'
COLOR.COLD_ORANGE // '#F7931A'Base colors
| Constant | Value | Description |
|---|---|---|
WHITE | #FFFFFF | Pure white |
BLACK | #17130F | Standard black |
DARK_BACK | #1A1815 | Dark background |
EBONY | #0f0f0f | Chart background |
TRANSPARENT | transparent | Transparent |
Status colors
| Constant | Value | Description |
|---|---|---|
GREEN | #72F59E | Success/online |
RED | #EF4444 | Error/danger |
YELLOW | #FFC107 | Warning |
BRIGHT_YELLOW | #EAB308 | Bright warning |
LIGHT_BLUE | #22AFFF | Info |
SLEEP_BLUE | #3B82F6 | Sleep/standby |
Brand colors
| Constant | Value | Description |
|---|---|---|
COLD_ORANGE | #F7931A | Bitcoin orange |
ORANGE | #FF6A00 | Primary orange |
EMERALD | #009393 | Teal accent |
INDIGO | #5B5FFB | Purple accent |
TABLE_COLORS
@mdk/core
Colors for table styling.
import { TABLE_COLORS } from '@mdk/core'
TABLE_COLORS.HEADER_BG
TABLE_COLORS.ROW_HOVERHEATMAP
@mdk/core
HEATMAP color scale for temperature and intensity displays.
import { HEATMAP } from '@mdk/core'CHART_COLORS
@mdk/core
Default chart color palette.
import { CHART_COLORS } from '@mdk/core'PIE_CHART_COLORS
@mdk/core
Color palette for pie and doughnut charts.
import { PIE_CHART_COLORS } from '@mdk/core'CATEGORICAL_COLORS
@mdk/core
25-color categorical palette for multi-series charts.
import { CATEGORICAL_COLORS } from '@mdk/core'
CATEGORICAL_COLORS[0] // First color
CATEGORICAL_COLORS[24] // Last colorTEMPERATURE_COLORS
@mdk/core
Color scale for temperature displays.
import { TEMPERATURE_COLORS } from '@mdk/core'SOCKET_BORDER_COLOR
@mdk/core
Colors for socket status indicators.
import { SOCKET_BORDER_COLOR } from '@mdk/core'Unit constants
UNITS
@mdk/core
Physical and measurement units.
import { UNITS } from '@mdk/core'
UNITS.POWER_W // 'W'
UNITS.POWER_KW // 'kW'
UNITS.ENERGY_MWH // 'MWh'
UNITS.TEMPERATURE_C // '°C'
UNITS.HASHRATE_TH_S // 'TH/s'| Constant | Value | Description |
|---|---|---|
POWER_W | W | Watts |
POWER_KW | kW | Kilowatts |
ENERGY_WH | Wh | Watt-hours |
ENERGY_KWH | kWh | Kilowatt-hours |
ENERGY_MW | MW | Megawatts |
ENERGY_MWH | MWh | Megawatt-hours |
ENERGY_GWH | GWh | Gigawatt-hours |
TEMPERATURE_C | °C | Celsius |
VOLTAGE_V | V | Volts |
AMPERE | A | Amperes |
PERCENT | % | Percentage |
PRESSURE_BAR | bar | Pressure (bar) |
HASHRATE_MH_S | MH/s | Megahash/second |
HASHRATE_TH_S | TH/s | Terahash/second |
HASHRATE_PH_S | PH/s | Petahash/second |
HASHRATE_EH_S | EH/s | Exahash/second |
FREQUENCY_MHZ | MHz | Megahertz |
FREQUENCY_HERTZ | Hz | Hertz |
HUMIDITY_PERCENT | %RH | Relative humidity |
EFFICIENCY_W_PER_TH | W/TH | Watts per terahash |
FLOW_M3H | m3/h | Flow rate |
SATS | Sats | Satoshis |
VBYTE | vByte | Virtual bytes |
CURRENCY
@mdk/core
Currency symbols and labels.
import { CURRENCY } from '@mdk/core'
CURRENCY.BTC // '₿'
CURRENCY.USD // '$'
CURRENCY.EUR // '€'
CURRENCY.SATS // 'Sats'
CURRENCY.BTC_LABEL // 'BTC'
CURRENCY.USD_LABEL // 'USD'MAX_UNIT_VALUE
@mdk/core
Maximum values for certain units.
import { MAX_UNIT_VALUE } from '@mdk/core'
MAX_UNIT_VALUE.HUMIDITY_PERCENT // 100
MAX_UNIT_VALUE.TEMPERATURE_PERCENT // 100HASHRATE_LABEL_DIVISOR
@mdk/core
Divisors for converting hashrate units.
import { HASHRATE_LABEL_DIVISOR } from '@mdk/core'
HASHRATE_LABEL_DIVISOR['TH/s'] // 1e6
HASHRATE_LABEL_DIVISOR['PH/s'] // 1e9
HASHRATE_LABEL_DIVISOR['EH/s'] // 1e12Chart constants
defaultChartColors
@mdk/core
Default color array for chart datasets.
import { defaultChartColors } from '@mdk/core'defaultChartOptions
@mdk/core
Default Chart.js options.
import { defaultChartOptions } from '@mdk/core'CHART_LEGEND_OPACITY
@mdk/core
Opacity values for chart legends.
import { CHART_LEGEND_OPACITY } from '@mdk/core'CHART_PERFORMANCE
@mdk/core
Performance threshold constants for charts.
import { CHART_PERFORMANCE } from '@mdk/core'getChartAnimationConfig
@mdk/core
Get animation configuration based on data count.
import { getChartAnimationConfig } from '@mdk/core'
const animConfig = getChartAnimationConfig(dataPointCount)getDataDecimationConfig
@mdk/core
Get data decimation configuration for large datasets.
import { getDataDecimationConfig } from '@mdk/core'
const decimationConfig = getDataDecimationConfig(dataPointCount)Type exports
The constants module also exports TypeScript types:
import type {
UnitKey,
UnitValue,
CurrencyKey,
CurrencyValue,
} from '@mdk/core'@mdk/foundation constants
Prerequisites
- Complete the @mdk/foundation installation and add the dependency
Import
@mdk/foundation
import {
POSITION_CHANGE_DIALOG_FLOWS,
HEADER_ITEMS,
DEFAULT_HEADER_PREFERENCES,
AUTH_PERMISSIONS,
AUTH_LEVELS,
USER_ROLE,
USER_ROLES,
PERM_LEVEL_LABELS,
getRoleBadgeColors,
} from '@mdk/foundation'Dialog flows
POSITION_CHANGE_DIALOG_FLOWS
@mdk/foundation
Flow keys consumed by PositionChangeDialog and its sibling dialogs to route between step-specific surfaces.
import { POSITION_CHANGE_DIALOG_FLOWS } from '@mdk/foundation'
POSITION_CHANGE_DIALOG_FLOWS.MAINTENANCE // 'maintenance'
POSITION_CHANGE_DIALOG_FLOWS.REPLACE_MINER // 'replaceMiner'| Constant | Value | Description |
|---|---|---|
CONFIRM_REMOVE | remove | Render the remove-miner confirmation surface |
CHANGE_INFO | changeInfo | Edit info for an existing miner |
MAINTENANCE | maintenance | Move a miner to (or back from) the maintenance container |
REPLACE_MINER | replaceMiner | Replace the miner currently occupying a socket |
CONFIRM_CHANGE_POSITION | confirmChange | Confirm a position change between sockets |
CONTAINER_SELECTION | containerSelection | Pick a destination container and socket |
PositionChangeDialogFlowKey type
@mdk/foundation
import type { PositionChangeDialogFlowKey } from '@mdk/foundation'
type PositionChangeDialogFlowKey = keyof typeof POSITION_CHANGE_DIALOG_FLOWSPositionChangeDialogFlowValue type
@mdk/foundation
import type { PositionChangeDialogFlowValue } from '@mdk/foundation'
type PositionChangeDialogFlowValue =
(typeof POSITION_CHANGE_DIALOG_FLOWS)[PositionChangeDialogFlowKey]Header controls
HEADER_ITEMS
@mdk/foundation
Array of header metric options for the HeaderControlsSettings component.
import { HEADER_ITEMS } from '@mdk/foundation'| Key | Label |
|---|---|
poolMiners | Pool Miners |
mosMiners | MOS Miners |
poolHashrate | Pool Hashrate |
mosHashrate | MOS Hashrate |
consumption | Consumption |
efficiency | Efficiency |
DEFAULT_HEADER_PREFERENCES
@mdk/foundation
Default visibility state for all header items (all true).
import { DEFAULT_HEADER_PREFERENCES } from '@mdk/foundation'
DEFAULT_HEADER_PREFERENCES.poolMiners // true
DEFAULT_HEADER_PREFERENCES.consumption // trueHeaderPreferences type
@mdk/foundation
import type { HeaderPreferences } from '@mdk/foundation'
type HeaderPreferences = {
poolMiners: boolean
mosMiners: boolean
poolHashrate: boolean
mosHashrate: boolean
consumption: boolean
efficiency: boolean
}Permissions
AUTH_PERMISSIONS
@mdk/foundation
Permission resource identifiers.
import { AUTH_PERMISSIONS } from '@mdk/foundation'
AUTH_PERMISSIONS.USERS // 'users'
AUTH_PERMISSIONS.SETTINGS // 'settings'
AUTH_PERMISSIONS.MINER // 'miner'| Constant | Value | Description |
|---|---|---|
USERS | users | User management |
SETTINGS | settings | Application settings |
MINER | miner | Miner operations |
ALERTS | alerts | Alert management |
ACTIONS | actions | Action execution |
EXPLORER | explorer | Device explorer |
INVENTORY | inventory | Inventory management |
CONTAINER | container | Container management |
PRODUCTION | production | Production data |
REPORTING | reporting | Reports |
AUTH_LEVELS
@mdk/foundation
Permission access levels.
import { AUTH_LEVELS } from '@mdk/foundation'
AUTH_LEVELS.READ // 'r'
AUTH_LEVELS.WRITE // 'w'USER_ROLE
@mdk/foundation
User role identifiers.
import { USER_ROLE } from '@mdk/foundation'
USER_ROLE.ADMIN // 'admin'
USER_ROLE.SITE_MANAGER // 'site_manager'
USER_ROLE.READ_ONLY // 'read_only_user'| Constant | Value |
|---|---|
ADMIN | admin |
SITE_MANAGER | site_manager |
SITE_OPERATOR | site_operator |
FIELD_OPERATOR | field_operator |
REPAIR_TECHNICIAN | repair_technician |
REPORTING_TOOL_MANAGER | reporting_tool_manager |
READ_ONLY | read_only_user |
Settings
USER_ROLES
@mdk/foundation
Array of role options for select dropdowns.
import { USER_ROLES } from '@mdk/foundation'
// [{ label: 'Admin', value: 'admin' }, ...]PERM_LEVEL_LABELS
@mdk/foundation
Human-readable labels for permission levels.
import { PERM_LEVEL_LABELS } from '@mdk/foundation'
PERM_LEVEL_LABELS.rw // 'Read & Write'
PERM_LEVEL_LABELS.r // 'Read Only'
PERM_LEVEL_LABELS.none // 'No Access'SETTINGS_ERROR_CODES
@mdk/foundation
Error code to message mapping.
import { SETTINGS_ERROR_CODES } from '@mdk/foundation'
SETTINGS_ERROR_CODES.ERR_USER_EXISTS // 'User already exists'
SETTINGS_ERROR_CODES.DEFAULT // 'An error occurred'Role styling
getRoleBadgeColors
@mdk/foundation
Get badge colors for a role.
import { getRoleBadgeColors } from '@mdk/foundation'
const { color, bgColor } = getRoleBadgeColors('admin')
// { color: '#e8833a', bgColor: 'rgba(232, 131, 58, 0.1)' }| Role | Color | Background |
|---|---|---|
admin | #e8833a | Orange tint |
site_manager | #52c41a | Green tint |
site_operator | #faad14 | Yellow tint |
read_only_user | #8c8c8c | Gray tint |

