1import React from 'react';
2import cn from 'classnames';
3import { Just, Nothing } from 'folktale/maybe';
4import * as ob from 'urbit-ob';
5import { Grid, Flex, Text } from 'indigo-react';
6import { times } from 'lodash';
8import usePointBirthday from 'lib/usePointBirthday';
12 INTERSTITIAL_CHARACTER,
15import MaybeSigil from './MaybeSigil';
17const TICKET_CHAR_LENGTH = 30;
18const TICKET = times(TICKET_CHAR_LENGTH, i =>
19 i % 2 === 0 ? LOADING_CHARACTER : INTERSTITIAL_CHARACTER
21const PENDING_TICKET = TICKET;
22const VALID_TICKET = `${TICKET} ◆`;
24const VISIBLE_ADDRESS_CHAR_COUNT = 20;
25const EMPTY_ADDRESS = times(VISIBLE_ADDRESS_CHAR_COUNT, () => '<').join('');
26const ADDRESS_BUFFER_CHARS = times(40, () => '<').join('');
29 * point is Maybe<number>
30 * ticket is null | boolean
31 * address is null | Maybe<string>
33export default function Passport({
40 const birthday = usePointBirthday(point.getOrElse(null));
41 const visualBirthday = matchBlinkyDate(birthday);
43 const name = point.matchWith({
44 Nothing: () => Nothing(),
45 Just: p => Just(ob.patp(p.value)),
47 const visualName = name.matchWith({
52 const showTicket = ticket !== null;
53 const isValidTiket = !!ticket;
54 const visibleTicket = isValidTiket ? VALID_TICKET : PENDING_TICKET;
55 const visibleAddress = `${address.matchWith({
56 Nothing: () => EMPTY_ADDRESS,
57 Just: p => p.value.slice(0, VISIBLE_ADDRESS_CHAR_COUNT),
58 })}${ADDRESS_BUFFER_CHARS}`;
61 <Grid gap={4} className={cn('bg-black r8 p7', className)}>
62 <Grid.Item cols={[1, 4]} className="bg-green">
63 <MaybeSigil patp={name} size={64} margin={0} />
65 <Grid.Item as={Flex} cols={[4, 13]} col justify="between">
66 <Flex.Item className="mono white f5">{visualName}</Flex.Item>
67 <Flex.Item as={Flex} col>
68 <Flex.Item as={Text} className="mono f6 f5-ns gray4 uppercase">
71 <Flex.Item as={Text} className="mono f6 f5-ns gray4 ">
76 {!mini && showTicket && (
77 <Grid.Item full className="mv3" as={Flex} col>
78 <Flex.Item as={Text} className="mono f6 f5-ns gray4 uppercase">
83 className={cn('mono f6 f5-ns wrap', {
89 <Flex.Item as={Text} className="mono f6 f5-ns gray4 wrap">
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list