MDK Logo

Inventory

Device inventory management — movement history and details modal

@tetherto/mdk-react-devkit/foundation

Inventory components display historical device movement details. Pair with the Operations centre for full device-management context.

Prerequisites

Components

MovementDetailsModal

Modal showing the details of a historical device movement — the device summary plus the origin → destination transition of location and status. All three props are optional (the component renders null when movement is absent), so you can gate the modal on a selection without separate conditional rendering:

  1. Device details (movement.device): code, type, site, container, serial number, MAC address.
  2. Movement preview: side-by-side origin and destination panels showing location and status with colour-coded badges.
  3. Comments (movement.comments): optional free-text or node rendered below the movement panels.

The component does no data fetching — the parent is responsible for passing the selected movement.

Import

import { MovementDetailsModal } from '@tetherto/mdk-react-devkit/foundation'
import type {
  MovementDetailsModalProps,
  MovementData,
  MovementDevice,
} from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
isOpenOptionalbooleanfalseWhen true, the modal is visible
onCloseOptionalfunctionnoneCalled when the user dismisses the modal
movementOptionalMovementDatanoneMovement record to display; modal renders null when absent

MovementData type

type MovementData = {
  origin: string
  destination: string
  previousStatus: string
  newStatus: string
  device?: MovementDevice
  comments?: ReactNode
}

MovementDevice type

type MovementDevice = Partial<{
  code: string
  tags: string[]
  type: string
  info: Partial<{
    subType: string
    site: string
    container: string
    serialNum: string
    macAddress: string
  }>
}>

Basic usage

import { useState } from 'react'
import { MovementDetailsModal } from '@tetherto/mdk-react-devkit/foundation'
import type { MovementData } from '@tetherto/mdk-react-devkit/foundation'

function InventoryTable({ movements }) {
  const [selected, setSelected] = useState<MovementData | null>(null)

  return (
    <>
      {/* … table that calls setSelected(row.movement) on row click … */}

      <MovementDetailsModal
        isOpen={selected !== null}
        movement={selected ?? undefined}
        onClose={() => setSelected(null)}
      />
    </>
  )
}

Behavior notes

  • movement is the primary gate: when it is absent the component returns null and nothing is mounted, regardless of isOpen. isOpen only controls visibility once a movement is provided
  • Location and status badge colours come from the MDK design-token maps (MINER_LOCATION_*, MINER_STATUS_*)
  • The modal title is fixed: "Historical Device Update"

Next steps

On this page