{ "version": 3, "sources": ["../../board/board_name.ts"], "sourcesContent": ["import {BoardType, AccountUID, BoardUID} from \"@cling/lib.shared.model\"\nimport {current_user} from \"../state/index\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {assert_never, full_name} from \"@cling/lib.shared.utils\"\nimport {account_resource} from \"@cling/lib.web.resources\"\n\ntype MinBoardProps = {\n uid: BoardUID\n name: string\n board_type: BoardType\n people_board_shared_with: (account_uid: AccountUID) => AccountUID\n}\n\nexport const board_name = (\n board: MinBoardProps,\n opts: {mark_archived?: boolean} = {mark_archived: true},\n) => {\n const is_archived = current_user.account_settings.board_setting(board.uid)?.archived\n if (board.board_type === BoardType.dashboard) {\n return \"Cling\"\n } else if (board.board_type === BoardType.trashcan) {\n return i18n.trashcan\n } else if (board.board_type === BoardType.clipboard) {\n return i18n.clipboard\n } else if (board.board_type === BoardType.regular) {\n if (is_archived && opts.mark_archived) {\n return `[${i18n.archived}] ${board.name}`\n }\n return board.name\n } else if (board.board_type === BoardType.people) {\n const account = account_resource.read(\n board.people_board_shared_with(current_user.account.uid),\n )\n const name = full_name(account)\n if (is_archived && opts.mark_archived) {\n return `[${i18n.archived}] ${name}`\n }\n return name\n } else {\n throw assert_never(board.board_type)\n }\n}\n"], "mappings": "+MAaO,IAAMA,EAAaC,EAAA,CACtBC,EACAC,EAAkC,CAAC,cAAe,EAAI,IACrD,CACD,IAAMC,EAAcC,EAAa,iBAAiB,cAAcH,EAAM,GAAG,GAAG,SAC5E,GAAIA,EAAM,aAAe,EACrB,MAAO,QACJ,GAAIA,EAAM,aAAe,EAC5B,OAAOI,EAAK,SACT,GAAIJ,EAAM,aAAe,EAC5B,OAAOI,EAAK,UACT,GAAIJ,EAAM,aAAe,EAC5B,OAAIE,GAAeD,EAAK,cACb,IAAIG,EAAK,QAAQ,KAAKJ,EAAM,IAAI,GAEpCA,EAAM,KACV,GAAIA,EAAM,aAAe,EAAkB,CAC9C,IAAMK,EAAUC,EAAiB,KAC7BN,EAAM,yBAAyBG,EAAa,QAAQ,GAAG,CAC3D,EACMI,EAAOC,EAAUH,CAAO,EAC9B,OAAIH,GAAeD,EAAK,cACb,IAAIG,EAAK,QAAQ,KAAKG,CAAI,GAE9BA,CACX,KACI,OAAME,EAAaT,EAAM,UAAU,CAE3C,EA5B0B", "names": ["board_name", "__name", "board", "opts", "is_archived", "current_user", "i18n", "account", "account_resource", "name", "full_name", "assert_never"] }