import React from 'react';
import { Grid, Flex, H5 } from 'indigo-react';
import { Just, Nothing } from 'folktale/maybe';
import { formatDotsWithTime } from 'lib/dateFormat';
import { segmentNetworkKey, CURVE_ZERO_ADDR } from 'lib/keys';
import { usePointCache } from 'store/pointCache';
const chainKeyProp = name => d =>
d[name] === CURVE_ZERO_ADDR ? Nothing() : Just(d[name]);
const renderNetworkKey = key => {
const segments = segmentNetworkKey(key);
if (!segments) {
return 'Unset';
}
return segments.join('\n');
};
export default function NetworkingKeys({ point }) {
const { getDetails, getRekeyDate } = usePointCache();
const details = getDetails(point);
const hasKeys = details.matchWith({
Nothing: () => false,
Just: ({ value: details }) => parseInt(details.keyRevisionNumber, 10) > 0,
// we actually don't mind the default NaN behavior of parseInt here,
// since NaN > 0 === false and that's a reasonable result
});
const renderNetworkKeySection = (title, key) => (
<>