{ "version": 3, "sources": ["../../misc/rel_date.tsx", "../../card/card_synopsis.tsx"], "sourcesContent": ["import * as React from \"react\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {the_now} from \"@cling/lib.shared.utils/the_now\"\nimport {simple_tooltip_event_handlers} from \"@cling/lib.web.mdc/simple_tooltip\"\n\n/**\n * Display a relative date and refresh whenever the string representation of the date changes.\n */\nexport const RelDate = ({\n date,\n render,\n className,\n \"data-test-id\": data_test_id,\n}: {\n date: Date\n // Will be called whenever the displayed relative date is going to change.\n render?: (time_elm: React.ReactElement<HTMLTimeElement>) => React.ReactElement<any>\n className?: string\n \"data-test-id\"?: string\n}) => {\n const [rendered_rel_date, set_rendered_rel_date] = React.useState<string>()\n React.useEffect(() => {\n let timeout_id: any\n const update = () => {\n set_rendered_rel_date(i18n.format_rel_date(date))\n timeout_id = setTimeout(\n update,\n the_now() - date.getTime() < 60000\n ? 1000\n : Math.floor(Math.random() * 10000) + 30000,\n )\n }\n update()\n return () => clearTimeout(timeout_id)\n }, [date])\n const time_elm = (\n <time\n aria-label={i18n.datetime(date)}\n className={className}\n dateTime={date.toISOString()}\n data-test-id={data_test_id}\n data-test-ignore\n {...simple_tooltip_event_handlers}\n >\n {rendered_rel_date}\n </time>\n )\n return render ? render(time_elm) : time_elm\n}\n", "import React from \"react\"\nimport {\n Card,\n Link,\n Note,\n File,\n Inbox,\n Column,\n Root,\n extract_linked_board_and_card_uid,\n} from \"@cling/lib.shared.model\"\nimport {observer} from \"mobx-react\"\nimport {board_info_resource} from \"@cling/lib.web.resources\"\nimport {board_name} from \"../board/board_name\"\nimport {assert_never} from \"@cling/lib.shared.utils\"\nimport {classNames} from \"@cling/lib.web.utils\"\n\nexport const CardSynopsisOneLiner = observer(\n ({card, className}: {card: Card; className?: string}) => (\n <CardSynopsis card={card} className={classNames(className, \"card-synopsis--one-liner\")} />\n ),\n)\n\nexport const CardSynopsis = observer(({card, className}: {card: Card; className?: string}) => {\n className = classNames(className, \"card-synopsis\")\n if (card.kind instanceof Note) {\n if (card.kind.title) {\n return <div className={className}>{card.kind.title}</div>\n }\n if (card.kind.safe_html) {\n return (\n <div\n className={className}\n dangerouslySetInnerHTML={{__html: card.kind.safe_html}}\n />\n )\n }\n return null\n } else if (card.kind instanceof Link) {\n const linked_board_uid = extract_linked_board_and_card_uid(card.kind.url)?.board_uid\n if (linked_board_uid) {\n const board_info = board_info_resource.read(linked_board_uid)\n if (board_info) {\n return <div className={className}>{board_name(board_info)}</div>\n }\n }\n return <div className={className}>{card.kind.title || card.kind.url}</div>\n } else if (card.kind instanceof File) {\n return <div className={className}>{card.kind.title || card.kind.file_name}</div>\n } else if (card.kind instanceof Inbox) {\n return null\n } else if (card.kind instanceof Column) {\n return null\n } else if (card.kind instanceof Root) {\n return null\n } else {\n assert_never(card.kind)\n return null\n }\n})\n"], "mappings": "ggBAAAA,IAQO,IAAMC,EAAUC,EAAA,CAAC,CACpB,KAAAC,EACA,OAAAC,EACA,UAAAC,EACA,eAAgBC,CACpB,IAMM,CACF,GAAM,CAACC,EAAmBC,CAAqB,EAAUC,EAAiB,EACpEC,EAAU,IAAM,CAClB,IAAIC,EACEC,EAASV,EAAA,IAAM,CACjBM,EAAsBK,EAAK,gBAAgBV,CAAI,CAAC,EAChDQ,EAAa,WACTC,EACAE,EAAQ,EAAIX,EAAK,QAAQ,EAAI,IACvB,IACA,KAAK,MAAM,KAAK,OAAO,EAAI,GAAK,EAAI,GAC9C,CACJ,EARe,UASf,OAAAS,EAAO,EACA,IAAM,aAAaD,CAAU,CACxC,EAAG,CAACR,CAAI,CAAC,EACT,IAAMY,EACFC,EAAC,QACG,aAAYH,EAAK,SAASV,CAAI,EAC9B,UAAWE,EACX,SAAUF,EAAK,YAAY,EAC3B,eAAcG,EACd,mBAAgB,GACf,GAAGW,GAEHV,CACL,EAEJ,OAAOH,EAASA,EAAOW,CAAQ,EAAIA,CACvC,EAxCuB,WCRvBG,IAiBO,IAAMC,EAAuBC,EAChC,CAAC,CAAC,KAAAC,EAAM,UAAAC,CAAS,IACbC,EAAA,cAACC,EAAA,CAAa,KAAMH,EAAM,UAAWI,EAAWH,EAAW,0BAA0B,EAAG,CAEhG,EAEaE,EAAeJ,EAAS,CAAC,CAAC,KAAAC,EAAM,UAAAC,CAAS,IAAwC,CAE1F,GADAA,EAAYG,EAAWH,EAAW,eAAe,EAC7CD,EAAK,gBAAgBK,EACrB,OAAIL,EAAK,KAAK,MACHE,EAAA,cAAC,OAAI,UAAWD,GAAYD,EAAK,KAAK,KAAM,EAEnDA,EAAK,KAAK,UAENE,EAAA,cAAC,OACG,UAAWD,EACX,wBAAyB,CAAC,OAAQD,EAAK,KAAK,SAAS,EACzD,EAGD,KACJ,GAAIA,EAAK,gBAAgBM,EAAM,CAClC,IAAMC,EAAmBC,EAAkCR,EAAK,KAAK,GAAG,GAAG,UAC3E,GAAIO,EAAkB,CAClB,IAAME,EAAaC,EAAoB,KAAKH,CAAgB,EAC5D,GAAIE,EACA,OAAOP,EAAA,cAAC,OAAI,UAAWD,GAAYU,EAAWF,CAAU,CAAE,CAElE,CACA,OAAOP,EAAA,cAAC,OAAI,UAAWD,GAAYD,EAAK,KAAK,OAASA,EAAK,KAAK,GAAI,CACxE,KAAO,QAAIA,EAAK,gBAAgBY,EACrBV,EAAA,cAAC,OAAI,UAAWD,GAAYD,EAAK,KAAK,OAASA,EAAK,KAAK,SAAU,GACnEA,EAAK,gBAAgBa,GAErBb,EAAK,gBAAgBc,GAErBd,EAAK,gBAAgBe,GAG5BC,EAAahB,EAAK,IAAI,EACf,KAEf,CAAC", "names": ["init_compat_module", "RelDate", "__name", "date", "render", "className", "data_test_id", "rendered_rel_date", "set_rendered_rel_date", "d", "y", "timeout_id", "update", "i18n", "the_now", "time_elm", "_", "simple_tooltip_event_handlers", "init_compat_module", "CardSynopsisOneLiner", "observer", "card", "className", "Rn", "CardSynopsis", "classNames", "Note", "Link", "linked_board_uid", "extract_linked_board_and_card_uid", "board_info", "board_info_resource", "board_name", "File", "Inbox", "Column", "Root", "assert_never"] }