@droppii-org/chat-mobile 0.2.51 → 0.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/lib/module/assets/images/index.js +2 -1
  2. package/lib/module/assets/images/index.js.map +1 -1
  3. package/lib/module/assets/images/resource-center-empty-box.png +0 -0
  4. package/lib/module/components/MediaViewerModal.js +2 -1
  5. package/lib/module/components/MediaViewerModal.js.map +1 -1
  6. package/lib/module/components/MergedImageGrid.js +1 -0
  7. package/lib/module/components/MergedImageGrid.js.map +1 -1
  8. package/lib/module/config/api-endpoints.js +2 -1
  9. package/lib/module/config/api-endpoints.js.map +1 -1
  10. package/lib/module/core/notification/pushToken.js +7 -7
  11. package/lib/module/core/notification/pushToken.js.map +1 -1
  12. package/lib/module/hooks/query-keys.js +4 -0
  13. package/lib/module/hooks/query-keys.js.map +1 -1
  14. package/lib/module/hooks/resourceCenter/useThreadResources.js +116 -0
  15. package/lib/module/hooks/resourceCenter/useThreadResources.js.map +1 -0
  16. package/lib/module/hooks/useImageAttachment.js +0 -2
  17. package/lib/module/hooks/useImageAttachment.js.map +1 -1
  18. package/lib/module/hooks/useMediaViewer.js +4 -1
  19. package/lib/module/hooks/useMediaViewer.js.map +1 -1
  20. package/lib/module/hooks/useSendAttachment.js +4 -1
  21. package/lib/module/hooks/useSendAttachment.js.map +1 -1
  22. package/lib/module/index.js +1 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/screens/MediaView/index.js +104 -42
  25. package/lib/module/screens/MediaView/index.js.map +1 -1
  26. package/lib/module/screens/ResourceCenter/FileResourceRow.js +80 -0
  27. package/lib/module/screens/ResourceCenter/FileResourceRow.js.map +1 -0
  28. package/lib/module/screens/ResourceCenter/GridRenderer.js +83 -0
  29. package/lib/module/screens/ResourceCenter/GridRenderer.js.map +1 -0
  30. package/lib/module/screens/ResourceCenter/GridThumbnail.js +97 -0
  31. package/lib/module/screens/ResourceCenter/GridThumbnail.js.map +1 -0
  32. package/lib/module/screens/ResourceCenter/LinkResourceRow.js +81 -0
  33. package/lib/module/screens/ResourceCenter/LinkResourceRow.js.map +1 -0
  34. package/lib/module/screens/ResourceCenter/ListRenderer.js +60 -0
  35. package/lib/module/screens/ResourceCenter/ListRenderer.js.map +1 -0
  36. package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js +75 -0
  37. package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js.map +1 -0
  38. package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js +122 -0
  39. package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js.map +1 -0
  40. package/lib/module/screens/ResourceCenter/ResourceEmptyState.js +36 -0
  41. package/lib/module/screens/ResourceCenter/ResourceEmptyState.js.map +1 -0
  42. package/lib/module/screens/ResourceCenter/index.js +104 -0
  43. package/lib/module/screens/ResourceCenter/index.js.map +1 -0
  44. package/lib/module/screens/ResourceCenter/types.js +25 -0
  45. package/lib/module/screens/ResourceCenter/types.js.map +1 -0
  46. package/lib/module/services/attachmentOrchestrator.js +19 -4
  47. package/lib/module/services/attachmentOrchestrator.js.map +1 -1
  48. package/lib/module/services/resourceCenter.js +102 -0
  49. package/lib/module/services/resourceCenter.js.map +1 -0
  50. package/lib/module/translation/resources/i18n.js +8 -1
  51. package/lib/module/translation/resources/i18n.js.map +1 -1
  52. package/lib/module/types/attachment.js +2 -0
  53. package/lib/module/types/chat.js +20 -0
  54. package/lib/module/types/chat.js.map +1 -1
  55. package/lib/module/utils/url.js +11 -0
  56. package/lib/module/utils/url.js.map +1 -1
  57. package/lib/typescript/src/assets/images/index.d.ts +1 -0
  58. package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
  59. package/lib/typescript/src/components/MediaViewerModal.d.ts +3 -1
  60. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
  61. package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -1
  62. package/lib/typescript/src/config/api-endpoints.d.ts +1 -0
  63. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
  64. package/lib/typescript/src/hooks/query-keys.d.ts +4 -0
  65. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  66. package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts +21 -0
  67. package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts.map +1 -0
  68. package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -1
  69. package/lib/typescript/src/hooks/useMediaViewer.d.ts +5 -1
  70. package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -1
  71. package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -1
  72. package/lib/typescript/src/index.d.ts +2 -0
  73. package/lib/typescript/src/index.d.ts.map +1 -1
  74. package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -1
  75. package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts +7 -0
  76. package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts.map +1 -0
  77. package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts +14 -0
  78. package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts.map +1 -0
  79. package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts +10 -0
  80. package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts.map +1 -0
  81. package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts +8 -0
  82. package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts.map +1 -0
  83. package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts +16 -0
  84. package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts.map +1 -0
  85. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts +3 -0
  86. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts.map +1 -0
  87. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts +16 -0
  88. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts.map +1 -0
  89. package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts +6 -0
  90. package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts.map +1 -0
  91. package/lib/typescript/src/screens/ResourceCenter/index.d.ts +4 -0
  92. package/lib/typescript/src/screens/ResourceCenter/index.d.ts.map +1 -0
  93. package/lib/typescript/src/screens/ResourceCenter/types.d.ts +28 -0
  94. package/lib/typescript/src/screens/ResourceCenter/types.d.ts.map +1 -0
  95. package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -1
  96. package/lib/typescript/src/services/resourceCenter.d.ts +9 -0
  97. package/lib/typescript/src/services/resourceCenter.d.ts.map +1 -0
  98. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  99. package/lib/typescript/src/types/attachment.d.ts +2 -0
  100. package/lib/typescript/src/types/attachment.d.ts.map +1 -1
  101. package/lib/typescript/src/types/chat.d.ts +58 -0
  102. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  103. package/lib/typescript/src/utils/url.d.ts +7 -0
  104. package/lib/typescript/src/utils/url.d.ts.map +1 -1
  105. package/package.json +1 -1
  106. package/src/assets/images/index.ts +1 -0
  107. package/src/assets/images/resource-center-empty-box.png +0 -0
  108. package/src/components/MediaViewerModal.tsx +8 -3
  109. package/src/components/MergedImageGrid.tsx +1 -0
  110. package/src/config/api-endpoints.ts +2 -0
  111. package/src/core/notification/pushToken.ts +7 -7
  112. package/src/hooks/query-keys.ts +6 -0
  113. package/src/hooks/resourceCenter/useThreadResources.ts +124 -0
  114. package/src/hooks/useImageAttachment.ts +1 -2
  115. package/src/hooks/useMediaViewer.ts +21 -7
  116. package/src/hooks/useSendAttachment.ts +4 -1
  117. package/src/index.tsx +2 -0
  118. package/src/screens/MediaView/index.tsx +117 -54
  119. package/src/screens/ResourceCenter/FileResourceRow.tsx +99 -0
  120. package/src/screens/ResourceCenter/GridRenderer.tsx +104 -0
  121. package/src/screens/ResourceCenter/GridThumbnail.tsx +98 -0
  122. package/src/screens/ResourceCenter/LinkResourceRow.tsx +96 -0
  123. package/src/screens/ResourceCenter/ListRenderer.tsx +81 -0
  124. package/src/screens/ResourceCenter/ResourceCenterTabBar.tsx +89 -0
  125. package/src/screens/ResourceCenter/ResourceCenterTabScene.tsx +142 -0
  126. package/src/screens/ResourceCenter/ResourceEmptyState.tsx +39 -0
  127. package/src/screens/ResourceCenter/index.tsx +129 -0
  128. package/src/screens/ResourceCenter/types.ts +56 -0
  129. package/src/services/attachmentOrchestrator.ts +15 -2
  130. package/src/services/resourceCenter.ts +137 -0
  131. package/src/translation/resources/i18n.ts +7 -0
  132. package/src/types/attachment.ts +3 -0
  133. package/src/types/chat.ts +73 -0
  134. package/src/utils/url.ts +11 -0
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ import { memo } from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { KContainer, KImage, KLabel, KColors, KSpacingValue } from '@droppii/libs';
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export const LinkResourceRow = /*#__PURE__*/memo(({
8
+ item,
9
+ onPressUrl
10
+ }) => /*#__PURE__*/_jsxs(KContainer.Touchable, {
11
+ style: styles.row,
12
+ br: "3x",
13
+ background: KColors.opacity.grayLighter[20],
14
+ onPress: () => item.linkUrl && onPressUrl?.(item.linkUrl),
15
+ children: [/*#__PURE__*/_jsxs(KContainer.View, {
16
+ style: styles.thumb,
17
+ children: [/*#__PURE__*/_jsx(KContainer.VisibleView, {
18
+ visible: !!item.linkImageUrl,
19
+ children: /*#__PURE__*/_jsx(KImage.Base, {
20
+ uri: item.linkImageUrl ?? '',
21
+ width: 76,
22
+ height: 76,
23
+ br: "2x",
24
+ resizeMode: "cover"
25
+ })
26
+ }), /*#__PURE__*/_jsx(KContainer.VisibleView, {
27
+ visible: !item.linkImageUrl,
28
+ children: /*#__PURE__*/_jsx(KContainer.View, {
29
+ style: styles.thumbFallback,
30
+ children: /*#__PURE__*/_jsx(KImage.VectorIcons, {
31
+ name: "link-alt-o",
32
+ color: KColors.white
33
+ })
34
+ })
35
+ })]
36
+ }), /*#__PURE__*/_jsxs(KContainer.View, {
37
+ flexS: 1,
38
+ children: [/*#__PURE__*/_jsx(KContainer.VisibleView, {
39
+ visible: !!item.linkDomain,
40
+ children: /*#__PURE__*/_jsx(KLabel.Text, {
41
+ // ⚠️ U7: Figma domain-line color (#5C6366) has no exact @droppii/libs
42
+ // token match — using closest system token (gray.w500) pending Designer confirm.
43
+ typo: "TextNmNormal",
44
+ color: KColors.palette.gray.w500,
45
+ numberOfLines: 1,
46
+ children: item.linkDomain
47
+ })
48
+ }), /*#__PURE__*/_jsx(KContainer.VisibleView, {
49
+ visible: !!item.linkTitle,
50
+ children: /*#__PURE__*/_jsx(KLabel.Text, {
51
+ typo: "TextMdMedium",
52
+ color: KColors.palette.gray.w900,
53
+ numberOfLines: 2,
54
+ children: item.linkTitle
55
+ })
56
+ })]
57
+ })]
58
+ }));
59
+ const styles = StyleSheet.create({
60
+ row: {
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ gap: KSpacingValue['0.5rem'],
64
+ padding: KSpacingValue['0.75rem'],
65
+ marginBottom: KSpacingValue['0.5rem']
66
+ },
67
+ // Figma Link-Item: thumbnail slot is 76x76 (not 56x56).
68
+ thumb: {
69
+ width: 76,
70
+ height: 76
71
+ },
72
+ thumbFallback: {
73
+ width: 76,
74
+ height: 76,
75
+ borderRadius: 12,
76
+ justifyContent: 'center',
77
+ alignItems: 'center',
78
+ backgroundColor: KColors.palette.gray.w200
79
+ }
80
+ });
81
+ //# sourceMappingURL=LinkResourceRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","StyleSheet","KContainer","KImage","KLabel","KColors","KSpacingValue","jsx","_jsx","jsxs","_jsxs","LinkResourceRow","item","onPressUrl","Touchable","style","styles","row","br","background","opacity","grayLighter","onPress","linkUrl","children","View","thumb","VisibleView","visible","linkImageUrl","Base","uri","width","height","resizeMode","thumbFallback","VectorIcons","name","color","white","flexS","linkDomain","Text","typo","palette","gray","w500","numberOfLines","linkTitle","w900","create","flexDirection","alignItems","gap","padding","marginBottom","borderRadius","justifyContent","backgroundColor","w200"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/LinkResourceRow.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,SACEC,UAAU,EACVC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,aAAa,QACR,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQvB,OAAO,MAAMC,eAAe,gBAAGX,IAAI,CAAC,CAAC;EAAEY,IAAI;EAAEC;AAAkB,CAAC,kBAC9DH,KAAA,CAACR,UAAU,CAACY,SAAS;EACnBC,KAAK,EAAEC,MAAM,CAACC,GAAI;EAClBC,EAAE,EAAC,IAAI;EACPC,UAAU,EAAEd,OAAO,CAACe,OAAO,CAACC,WAAW,CAAC,EAAE,CAAE;EAC5CC,OAAO,EAAEA,CAAA,KAAMV,IAAI,CAACW,OAAO,IAAIV,UAAU,GAAGD,IAAI,CAACW,OAAO,CAAE;EAAAC,QAAA,gBAE1Dd,KAAA,CAACR,UAAU,CAACuB,IAAI;IAACV,KAAK,EAAEC,MAAM,CAACU,KAAM;IAAAF,QAAA,gBACnChB,IAAA,CAACN,UAAU,CAACyB,WAAW;MAACC,OAAO,EAAE,CAAC,CAAChB,IAAI,CAACiB,YAAa;MAAAL,QAAA,eACnDhB,IAAA,CAACL,MAAM,CAAC2B,IAAI;QACVC,GAAG,EAAEnB,IAAI,CAACiB,YAAY,IAAI,EAAG;QAC7BG,KAAK,EAAE,EAAG;QACVC,MAAM,EAAE,EAAG;QACXf,EAAE,EAAC,IAAI;QACPgB,UAAU,EAAC;MAAO,CACnB;IAAC,CACoB,CAAC,eAMzB1B,IAAA,CAACN,UAA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;IACpBC,GAAG,EAAE/C,aAAa,CAAC,QAAQ,CAAC;IAC5BgD,OAAO,EAAEhD,aAAa,CAAC,SAAS,CAAC;IACjCiD,YAAY,EAAEjD,aAAa,CAAC,QAAQ;EACtC,CAAC;EACD;EACAoB,KAAK,EAAE;IACLM,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV,CAAC;EACDE,aAAa,EAAE;IACbH,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVuB,YAAY,EAAE,EAAE;IAChBC,cAAc,EAAE,QAAQ;IACxBL,UAAU,EAAE,QAAQ;IACpBM,eAAe,EAAErD,OAAO,CAACuC,OAAO,CAACC,IAAI,CAACc;EACxC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import { memo, useCallback } from 'react';
4
+ import { ActivityIndicator, StyleSheet } from 'react-native';
5
+ import { LegendList } from '@legendapp/list/react-native';
6
+ import { KContainer, KColors, KSpacingValue } from '@droppii/libs';
7
+ import { FileResourceRow } from "./FileResourceRow.js";
8
+ import { LinkResourceRow } from "./LinkResourceRow.js";
9
+ import { DThreadResourceContentType } from "../../types/chat.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const ROW_ESTIMATE = 80;
12
+ export const ListRenderer = /*#__PURE__*/memo(({
13
+ items,
14
+ contentType,
15
+ onEndReached,
16
+ isFetchingNextPage,
17
+ onPressUrl,
18
+ onRefresh,
19
+ isRefetching,
20
+ emptyComponent
21
+ }) => {
22
+ const isLink = contentType === DThreadResourceContentType.URL_TEXT;
23
+ const renderItem = useCallback(({
24
+ item
25
+ }) => isLink ? /*#__PURE__*/_jsx(LinkResourceRow, {
26
+ item: item,
27
+ onPressUrl: onPressUrl
28
+ }) : /*#__PURE__*/_jsx(FileResourceRow, {
29
+ item: item
30
+ }), [isLink, onPressUrl]);
31
+ const keyExtractor = useCallback(item => item.id, []);
32
+ return /*#__PURE__*/_jsx(LegendList, {
33
+ data: items,
34
+ renderItem: renderItem,
35
+ keyExtractor: keyExtractor,
36
+ estimatedItemSize: ROW_ESTIMATE,
37
+ contentContainerStyle: styles.content,
38
+ onEndReached: onEndReached,
39
+ onEndReachedThreshold: 0.5,
40
+ onRefresh: onRefresh,
41
+ refreshing: isRefetching,
42
+ ListEmptyComponent: emptyComponent,
43
+ ListFooterComponent: /*#__PURE__*/_jsx(KContainer.VisibleView, {
44
+ visible: isFetchingNextPage,
45
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
46
+ style: styles.footer,
47
+ color: KColors.palette.primary.w400
48
+ })
49
+ })
50
+ });
51
+ });
52
+ const styles = StyleSheet.create({
53
+ content: {
54
+ padding: KSpacingValue['0.75rem']
55
+ },
56
+ footer: {
57
+ paddingVertical: KSpacingValue['1rem']
58
+ }
59
+ });
60
+ //# sourceMappingURL=ListRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","useCallback","ActivityIndicator","StyleSheet","LegendList","KContainer","KColors","KSpacingValue","FileResourceRow","LinkResourceRow","DThreadResourceContentType","jsx","_jsx","ROW_ESTIMATE","ListRenderer","items","contentType","onEndReached","isFetchingNextPage","onPressUrl","onRefresh","isRefetching","emptyComponent","isLink","URL_TEXT","renderItem","item","keyExtractor","id","data","estimatedItemSize","contentContainerStyle","styles","content","onEndReachedThreshold","refreshing","ListEmptyComponent","ListFooterComponent","VisibleView","visible","children","style","footer","color","palette","primary","w400","create","padding","paddingVertical"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/ListRenderer.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEzC,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAC5D,SAASC,UAAU,QAAQ,8BAA8B;AACzD,SAASC,UAAU,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AAClE,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC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,CAACC;MAAK,CACrC;IAAC,CACoB;EACzB,CACF,CAAC;AAEN,CACF,CAAC;AAED,MAAMd,MAAM,GAAG7B,UAAU,CAAC4C,MAAM,CAAC;EAC/Bd,OAAO,EAAE;IACPe,OAAO,EAAEzC,aAAa,CAAC,SAAS;EAClC,CAAC;EACDmC,MAAM,EAAE;IACNO,eAAe,EAAE1C,aAAa,CAAC,MAAM;EACvC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ import { useMemo } from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { TabBar } from 'react-native-tab-view';
6
+ import { KLabel, KColors, KSpacingValue } from '@droppii/libs';
7
+
8
+ // Stable module-level reference — must NOT be defined inside the component body
9
+ // (or inside the `useMemo` below), or React treats it as a new type every render.
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const renderTabLabel = ({
12
+ labelText,
13
+ color
14
+ }) => /*#__PURE__*/_jsx(KLabel.Text, {
15
+ typo: "TextNmBold",
16
+ color: color,
17
+ children: labelText
18
+ });
19
+
20
+ // Uses `react-native-tab-view`'s own `TabBar` (animated sliding indicator,
21
+ // built-in accessibility/ripple) instead of a hand-rolled tab row — only the
22
+ // design tokens are custom (colors/indicator/label typography), matching the
23
+ // Figma underline-tab spec via the library's supported customization surface
24
+ // (`activeColor`/`inactiveColor`/`indicatorStyle`/per-route `label`).
25
+ //
26
+ // NOT wrapped in `React.memo`: `TabView` calls `renderTabBar(props)` as a plain
27
+ // function (not `<Comp/>` JSX — see `TabView.js`: `renderTabBar({...})`), and a
28
+ // `memo()`-wrapped component is a React element object, not a callable function.
29
+ // Passing the memoized object here throws `renderTabBar is not a function`.
30
+ export function ResourceCenterTabBar(props) {
31
+ const options = useMemo(() => Object.fromEntries(props.navigationState.routes.map(route => [route.key, {
32
+ labelText: route.title,
33
+ label: renderTabLabel
34
+ }])), [props.navigationState.routes]);
35
+ return /*#__PURE__*/_jsx(TabBar, {
36
+ ...props,
37
+ scrollEnabled: true,
38
+ options: options,
39
+ activeColor: KColors.palette.primary.w400,
40
+ inactiveColor: KColors.palette.gray.w400,
41
+ pressColor: "transparent",
42
+ style: styles.bar,
43
+ tabStyle: styles.tab,
44
+ indicatorStyle: styles.indicator
45
+ });
46
+ }
47
+ const styles = StyleSheet.create({
48
+ // Figma `Tab-Bar` (14208:92918): solid white background + 1px bottom hairline
49
+ // (`gray.w25` #EFEFEF) — no shadow/elevation.
50
+ bar: {
51
+ backgroundColor: KColors.white,
52
+ borderBottomWidth: 1,
53
+ borderBottomColor: KColors.palette.gray.w25,
54
+ shadowOpacity: 0,
55
+ elevation: 0
56
+ },
57
+ // `width: 'auto'` is REQUIRED alongside `scrollEnabled` above — without it,
58
+ // `TabBar`'s internal `getComputedTabWidth` falls back to `layout.width / 5 * 2`
59
+ // (40% of screen width per tab) before it has measured anything, rendering
60
+ // hugely oversized tabs. `'auto'` makes it use each tab's real measured label
61
+ // width instead (`tabWidths[route.key]`) — matches Figma's hug-content tabs
62
+ // (widths 53/65/73/81pt), fixed to each tab's own text, not stretched/guessed.
63
+ tab: {
64
+ width: 'auto',
65
+ paddingHorizontal: KSpacingValue['0.75rem'],
66
+ minHeight: 0
67
+ },
68
+ // Figma: 3px bar, cornerRadius 4, primary blue.
69
+ indicator: {
70
+ backgroundColor: KColors.palette.primary.w400,
71
+ height: 3,
72
+ borderRadius: 4
73
+ }
74
+ });
75
+ //# sourceMappingURL=ResourceCenterTabBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","StyleSheet","TabBar","KLabel","KColors","KSpacingValue","jsx","_jsx","renderTabLabel","labelText","color","Text","typo","children","ResourceCenterTabBar","props","options","Object","fromEntries","navigationState","routes","map","route","key","title","label","scrollEnabled","activeColor","palette","primary","w400","inactiveColor","gray","pressColor","style","styles","bar","tabStyle","tab","indicatorStyle","indicator","create","backgroundColor","white","borderBottomWidth","borderBottomColor","w25","shadowOpacity","elevation","width","paddingHorizontal","minHeight","height","borderRadius"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/ResourceCenterTabBar.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SACEC,MAAM,QAID,uBAAuB;AAC9B,SAASC,MAAM,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;;AAE9D;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,cAA0D,GAAGA,CAAC;EAClEC,SAAS;EACTC;AACF,CAAC,kBACCH,IAAA,CAACJ,MAAM,CAACQ,IAAI;EAACC,IAAI,EAAC,YAAY;EAACF,KAAK,EAAEA,KAAM;EAAAG,QAAA,EACzCJ;AAAS,CACC,CACd;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,oBAAoBA,CAAkBC,KAAqB,EAAE;EAC3E,MAAMC,OAAO,GAAGhB,OAAO,CACrB,MACEiB,MAAM,CAACC,WAAW,CAChBH,KAAK,CAACI,eAAe,CAACC,MAAM,CAACC,GAAG,CAAEC,KAAK,IAAK,CAC1CA,KAAK,CAACC,GAAG,EACT;IACEd,SAAS,EAAGa,KAAK,CAAgCE,KAAK;IACtDC,KAAK,EAAEjB;EACT,CAAC,CACF,CACH,CAAC,EACH,CAACO,KAAK,CAACI,eAAe,CAACC,MAAM,CAC/B,CAAC;EAED,oBACEb,IAAA,CAACL,MAAM;IAAA,GACDa,KAAK;IACTW,aAAa;IACbV,OAAO,EAAEA,OAAQ;IACjBW,WAAW,EAAEvB,OAAO,CAACwB,OAAO,CAACC,OAAO,CAACC,IAAK;IAC1CC,aAAa,EAAE3B,OAAO,CAACwB,OAAO,CAACI,IAAI,CAACF,IAAK;IACzCG,UAAU,EAAC,aAAa;IACxBC,KAAK,EAAEC,MAAM,CAACC,GAAI;IAClBC,QAAQ,EAAEF,MAAM,CAACG,GAAI;IACrBC,cAAc,EAAEJ,MAAM,CAACK;EAAU,CAClC,CAAC;AAEN;AAEA,MAAML,MAAM,GAAGlC,UAAU,CAACwC,MAAM,CAAC;EAC/B;EACA;EACAL,GAAG,EAAE;IACHM,eAAe,EAAEtC,OAAO,CAACuC,KAAK;IAC9BC,iBAAiB,EAAE,CAAC;IACpBC,iBAAiB,EAAEzC,OAAO,CAACwB,OAAO,CAACI,IAAI,CAACc,GAAG;IAC3CC,aAAa,EAAE,CAAC;IAChBC,SAAS,EAAE;EACb,CAAC;EACD;EACA;EACA;EACA;EACA;EACA;EACAV,GAAG,EAAE;IACHW,KAAK,EAAE,MAAM;IACbC,iBAAiB,EAAE7C,aAAa,CAAC,SAAS,CAAC;IAC3C8C,SAAS,EAAE;EACb,CAAC;EACD;EACAX,SAAS,EAAE;IACTE,eAAe,EAAEtC,OAAO,CAACwB,OAAO,CAACC,OAAO,CAACC,IAAI;IAC7CsB,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ import { memo, useCallback } from 'react';
4
+ import { ActivityIndicator, StyleSheet } from 'react-native';
5
+ import { KContainer, KLabel, KColors } from '@droppii/libs';
6
+ import { trans } from "../../translation/index.js";
7
+ import { useThreadResources } from "../../hooks/resourceCenter/useThreadResources.js";
8
+ import { ResourceEmptyState } from "./ResourceEmptyState.js";
9
+ import { GridRenderer } from "./GridRenderer.js";
10
+ import { ListRenderer } from "./ListRenderer.js";
11
+ import { DThreadResourceContentType } from "../../types/chat.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ // One scene per tab — owns its own `useThreadResources` call so react-query
14
+ // caches independently per (recvID, contentType) and `lazy` TabView scenes
15
+ // don't all fetch on mount.
16
+ //
17
+ // Known limitation (deliberate, not an oversight): the shared `MediaViewerModal`
18
+ // is opened with a static snapshot of the currently-loaded page. If the user swipes
19
+ // to the last loaded item while more pages exist server-side, the viewer does not
20
+ // auto-fetch more — they need to close it, scroll the grid to trigger `loadMore`,
21
+ // then reopen. Wiring live pagination into the viewer would require either coupling
22
+ // the shared `MediaView` (used by in-chat bubbles too) to react-query state, or
23
+ // forking its ~230 lines of zoom/video/download logic into a separate component —
24
+ // not worth it for this ticket's scope.
25
+ export const ResourceCenterTabScene = /*#__PURE__*/memo(({
26
+ recvID,
27
+ chatType,
28
+ contentType,
29
+ layout,
30
+ emptyKey,
31
+ onPressUrl,
32
+ mediaViewerRef
33
+ }) => {
34
+ const {
35
+ items,
36
+ isLoading,
37
+ isError,
38
+ loadMore,
39
+ isFetchingNextPage,
40
+ isRefetching,
41
+ refetch,
42
+ refreshFirstPage
43
+ } = useThreadResources(recvID, contentType, chatType);
44
+ const onPressGridItem = useCallback(index => {
45
+ const mediaItems = items.map(item => ({
46
+ url: item.sourceUrl ?? '',
47
+ isVideo: contentType === DThreadResourceContentType.VIDEO
48
+ }));
49
+ // Resource Center grids (Ảnh/Video tabs) can hold hundreds of items —
50
+ // the viewer's dot/counter pagination indicator is meant for small,
51
+ // in-chat message groups and becomes noise at this scale. Hide it here.
52
+ mediaViewerRef.current?.show(mediaItems, index, {
53
+ pagination: false
54
+ });
55
+ }, [items, contentType, mediaViewerRef]);
56
+ if (isLoading) {
57
+ return /*#__PURE__*/_jsx(KContainer.View, {
58
+ style: styles.centerFill,
59
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
60
+ color: KColors.palette.primary.w400
61
+ })
62
+ });
63
+ }
64
+ if (isError) {
65
+ return /*#__PURE__*/_jsxs(KContainer.View, {
66
+ style: styles.centerFill,
67
+ children: [/*#__PURE__*/_jsx(KLabel.Text, {
68
+ typo: "TextSmNormal",
69
+ color: KColors.palette.gray.w400,
70
+ style: styles.errorText,
71
+ children: trans('chat:generic_error')
72
+ }), /*#__PURE__*/_jsx(KContainer.Touchable, {
73
+ onPress: () => refetch(),
74
+ children: /*#__PURE__*/_jsx(KLabel.Text, {
75
+ typo: "TextNmBold",
76
+ color: KColors.palette.primary.w400,
77
+ children: trans('chat:retry')
78
+ })
79
+ })]
80
+ });
81
+ }
82
+
83
+ // `ResourceEmptyState` is passed as `ListEmptyComponent` (not an early return)
84
+ // so the list itself — and its `RefreshControl` — stays mounted even with 0
85
+ // items, letting pull-to-refresh work on the empty state too.
86
+ const emptyComponent = /*#__PURE__*/_jsx(ResourceEmptyState, {
87
+ emptyKey: emptyKey
88
+ });
89
+ if (layout === 'grid') {
90
+ return /*#__PURE__*/_jsx(GridRenderer, {
91
+ items: items,
92
+ onEndReached: loadMore,
93
+ isFetchingNextPage: isFetchingNextPage,
94
+ onPressItem: onPressGridItem,
95
+ onRefresh: refreshFirstPage,
96
+ isRefetching: isRefetching,
97
+ emptyComponent: emptyComponent
98
+ });
99
+ }
100
+ return /*#__PURE__*/_jsx(ListRenderer, {
101
+ items: items,
102
+ contentType: contentType,
103
+ onEndReached: loadMore,
104
+ isFetchingNextPage: isFetchingNextPage,
105
+ onPressUrl: onPressUrl,
106
+ onRefresh: refreshFirstPage,
107
+ isRefetching: isRefetching,
108
+ emptyComponent: emptyComponent
109
+ });
110
+ });
111
+ const styles = StyleSheet.create({
112
+ centerFill: {
113
+ flex: 1,
114
+ alignItems: 'center',
115
+ justifyContent: 'center',
116
+ gap: 8
117
+ },
118
+ errorText: {
119
+ textAlign: 'center'
120
+ }
121
+ });
122
+ //# sourceMappingURL=ResourceCenterTabScene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","useCallback","ActivityIndicator","StyleSheet","KContainer","KLabel","KColors","trans","useThreadResources","ResourceEmptyState","GridRenderer","ListRenderer","DThreadResourceContentType","jsx","_jsx","jsxs","_jsxs","ResourceCenterTabScene","recvID","chatType","contentType","layout","emptyKey","onPressUrl","mediaViewerRef","items","isLoading","isError","loadMore","isFetchingNextPage","isRefetching","refetch","refreshFirstPage","onPressGridItem","index","mediaItems","map","item","url","sourceUrl","isVideo","VIDEO","current","show","pagination","View","style","styles","centerFill","children","color","palette","primary","w400","Text","typo","gray","errorText","Touchable","onPress","emptyComponent","onEndReached","onPressItem","onRefresh","create","flex","alignItems","justifyContent","gap","textAlign"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/ResourceCenterTabScene.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AACzC,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAE5D,SAASC,UAAU,EAAEC,MAAM,EAAEC,OAAO,QAAQ,eAAe;AAC3D,SAASC,KAAK,QAAQ,4BAAmB;AACzC,SAASC,kBAAkB,QAAQ,kDAA+C;AAClF,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,0BAA0B,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAc9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,gBAAGjB,IAAI,CACxC,CAAC;EACCkB,MAAM;EACNC,QAAQ;EACRC,WAAW;EACXC,MAAM;EACNC,QAAQ;EACRC,UAAU;EACVC;AACK,CAAC,KAAK;EACX,MAAM;IACJC,KAAK;IACLC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,kBAAkB;IAClBC,YAAY;IACZC,OAAO;IACPC;EACF,CAAC,GAAGxB,kBAAkB,CAACU,MAAM,EAAEE,WAAW,EAAED,QAAQ,CAAC;EAErD,MAAMc,eAAe,GAAGhC,WAAW,CAChCiC,KAAa,IAAK;IACjB,MAAMC,UAAU,GAAGV,KAAK,CAACW,GAAG,CAAEC,IAAI,KAAM;MACtCC,GAAG,EAAED,IAAI,CAACE,SAAS,IAAI,EAAE;MACzBC,OAAO,EAAEpB,WAAW,KAAKR,0BAA0B,CAAC6B;IACtD,CAAC,CAAC,CAAC;IACH;IACA;IACA;IACAjB,cAAc,CAACkB,OAA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,IAAA,CAACJ,YAAY;MACXe,KAAK,EAAEA,KAAM;MACboC,YAAY,EAAEjC,QAAS;MACvBC,kBAAkB,EAAEA,kBAAmB;MACvCiC,WAAW,EAAE7B,eAAgB;MAC7B8B,SAAS,EAAE/B,gBAAiB;MAC5BF,YAAY,EAAEA,YAAa;MAC3B8B,cAAc,EAAEA;IAAe,CAChC,CAAC;EAEN;EAEA,oBACE9C,IAAA,CAACH,YAAY;IACXc,KAAK,EAAEA,KAAM;IACbL,WAAW,EAAEA,WAAY;IACzByC,YAAY,EAAEjC,QAAS;IACvBC,kBAAkB,EAAEA,kBAAmB;IACvCN,UAAU,EAAEA,UAAW;IACvBwC,SAAS,EAAE/B,gBAAiB;IAC5BF,YAAY,EAAEA,YAAa;IAC3B8B,cAAc,EAAEA;EAAe,CAChC,CAAC;AAEN,CACF,CAAC;AAED,MAAMb,MAAM,GAAG5C,UAAU,CAAC6D,MAAM,CAAC;EAC/BhB,UAAU,EAAE;IACViB,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,GAAG,EAAE;EACP,CAAC;EACDX,SAAS,EAAE;IACTY,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ import { memo } from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { KContainer, KImage, KLabel, KColors } from '@droppii/libs';
6
+ import { trans } from "../../translation/index.js";
7
+ import Images from "../../assets/images/index.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export const ResourceEmptyState = /*#__PURE__*/memo(({
10
+ emptyKey
11
+ }) => /*#__PURE__*/_jsxs(KContainer.View, {
12
+ style: styles.wrapper,
13
+ children: [/*#__PURE__*/_jsx(KImage.Base, {
14
+ uri: Images.RESOURCE_CENTER_EMPTY_BOX,
15
+ width: 120,
16
+ height: 120
17
+ }), /*#__PURE__*/_jsx(KLabel.Text, {
18
+ typo: "TextSmNormal",
19
+ color: KColors.palette.gray.w400,
20
+ style: styles.text,
21
+ children: trans(emptyKey)
22
+ })]
23
+ }));
24
+ const styles = StyleSheet.create({
25
+ wrapper: {
26
+ flex: 1,
27
+ alignItems: 'center',
28
+ justifyContent: 'center',
29
+ paddingTop: 60,
30
+ gap: 12
31
+ },
32
+ text: {
33
+ textAlign: 'center'
34
+ }
35
+ });
36
+ //# sourceMappingURL=ResourceEmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","StyleSheet","KContainer","KImage","KLabel","KColors","trans","Images","jsx","_jsx","jsxs","_jsxs","ResourceEmptyState","emptyKey","View","style","styles","wrapper","children","Base","uri","RESOURCE_CENTER_EMPTY_BOX","width","height","Text","typo","color","palette","gray","w400","text","create","flex","alignItems","justifyContent","paddingTop","gap","textAlign"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/ResourceEmptyState.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,QAAQ,eAAe;AACnE,SAASC,KAAK,QAAQ,4BAAmB;AACzC,OAAOC,MAAM,MAAM,8BAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMzC,OAAO,MAAMC,kBAAkB,gBAAGZ,IAAI,CAAC,CAAC;EAAEa;AAAgB,CAAC,kBACzDF,KAAA,CAACT,UAAU,CAACY,IAAI;EAACC,KAAK,EAAEC,MAAM,CAACC,OAAQ;EAAAC,QAAA,gBACrCT,IAAA,CAACN,MAAM,CAACgB,IAAI;IACVC,GAAG,EAAEb,MAAM,CAACc,yBAA0B;IACtCC,KAAK,EAAE,GAAI;IACXC,MAAM,EAAE;EAAI,CACb,CAAC,eACFd,IAAA,CAACL,MAAM,CAACoB,IAAI;IACVC,IAAI,EAAC,cAAc;IACnBC,KAAK,EAAErB,OAAO,CAACsB,OAAO,CAACC,IAAI,CAACC,IAAK;IACjCd,KAAK,EAAEC,MAAM,CAACc,IAAK;IAAAZ,QAAA,EAElBZ,KAAK,CAACO,QAAQ;EAAC,CACL,CAAC;AAAA,CACC,CAClB,CAAC;AAEF,MAAMG,MAAM,GAAGf,UAAU,CAAC8B,MAAM,CAAC;EAC/Bd,OAAO,EAAE;IACPe,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,EAAE;IACdC,GAAG,EAAE;EACP,CAAC;EACDN,IAAI,EAAE;IACJO,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ import { memo, useCallback, useMemo, useRef, useState } from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { TabView } from 'react-native-tab-view';
6
+ import { KNavigation, KContainer, KColors } from '@droppii/libs';
7
+ import { SessionType } from '@droppii/openim-rn-client-sdk';
8
+ import { trans } from "../../translation/index.js";
9
+ import { useConversation } from "../../store/index.js";
10
+ import { MediaViewerModal } from "../../components/MediaViewerModal.js";
11
+ import { ResourceCenterTabBar } from "./ResourceCenterTabBar.js";
12
+ import { ResourceCenterTabScene } from "./ResourceCenterTabScene.js";
13
+ import { RESOURCE_TABS } from "./types.js";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ const ResourceCenterScreen = /*#__PURE__*/memo(({
16
+ conversationId,
17
+ fallbackGroupID,
18
+ fallbackUserID,
19
+ initialTab,
20
+ onBack,
21
+ onPressUrl
22
+ }) => {
23
+ // Same derivation every host app previously duplicated: groupID-first
24
+ // (group/bot threads), userID fallback (1-1 threads), with route-param
25
+ // fallbacks for the window before `conversationId` lands in the store.
26
+ const conversation = useConversation(conversationId);
27
+ const groupID = conversation?.groupID || fallbackGroupID;
28
+ const recvID = groupID || conversation?.userID || fallbackUserID || '';
29
+ // `chatType` must reflect the conversation's actual session type, not just
30
+ // "did a groupID show up somewhere" — `conversationType` (SessionType.Group
31
+ // === 3, covers WorkingGroup too since it shares the same numeric value) is
32
+ // the authoritative signal once the conversation is loaded. Only fall back
33
+ // to the groupID-presence heuristic for the window before it lands in the
34
+ // store (conversation === undefined).
35
+ const isGroupConversation = conversation ? conversation?.conversationType === SessionType.Group : !!groupID;
36
+ const chatType = isGroupConversation ? 'GROUP' : 'SINGLE';
37
+ const [routes] = useState(() => RESOURCE_TABS.map(tab => ({
38
+ key: String(tab.contentType),
39
+ title: trans(tab.labelKey),
40
+ contentType: tab.contentType,
41
+ layout: tab.layout,
42
+ emptyKey: tab.emptyKey
43
+ })));
44
+ const initialIndex = useMemo(() => {
45
+ const idx = routes.findIndex(r => r.contentType === initialTab);
46
+ return idx >= 0 ? idx : 0;
47
+ }, [routes, initialTab]);
48
+ const [index, setIndex] = useState(initialIndex);
49
+ const mediaViewerRef = useRef(null);
50
+
51
+ // `renderScene` is a render prop consumed by `TabView` — matching `Inbox.tsx`'s
52
+ // convention of `useCallback`-wrapping it so it doesn't get a new identity (and
53
+ // force unnecessary internal re-renders) on every parent render.
54
+ // `renderTabBar` needs no wrapper: `ResourceCenterTabBar` already implements
55
+ // `TabView`'s own `renderTabBar` prop contract directly (it wraps the library's
56
+ // `TabBar`), so its component reference — already stable — is passed as-is.
57
+ const renderScene = useCallback(({
58
+ route
59
+ }) => /*#__PURE__*/_jsx(ResourceCenterTabScene, {
60
+ recvID: recvID,
61
+ chatType: chatType,
62
+ contentType: route.contentType,
63
+ layout: route.layout,
64
+ emptyKey: route.emptyKey,
65
+ onPressUrl: onPressUrl,
66
+ mediaViewerRef: mediaViewerRef
67
+ }), [recvID, chatType, onPressUrl]);
68
+ return /*#__PURE__*/_jsxs(KContainer.View, {
69
+ style: styles.flex,
70
+ children: [/*#__PURE__*/_jsx(KNavigation.Header, {
71
+ title: trans('chat:resource_center_title'),
72
+ alignment: "left",
73
+ size: "small",
74
+ theme: "light",
75
+ leftButton: {
76
+ id: 'back',
77
+ icon: {
78
+ vectorName: 'arrow-left-o'
79
+ },
80
+ onPress: onBack
81
+ }
82
+ }), /*#__PURE__*/_jsx(TabView, {
83
+ navigationState: {
84
+ index,
85
+ routes
86
+ },
87
+ onIndexChange: setIndex,
88
+ lazy: true,
89
+ renderTabBar: ResourceCenterTabBar,
90
+ renderScene: renderScene
91
+ }), /*#__PURE__*/_jsx(MediaViewerModal, {
92
+ ref: mediaViewerRef
93
+ })]
94
+ });
95
+ });
96
+ ResourceCenterScreen.displayName = 'Screen.ResourceCenter';
97
+ export default ResourceCenterScreen;
98
+ const styles = StyleSheet.create({
99
+ flex: {
100
+ flex: 1,
101
+ backgroundColor: KColors.white
102
+ }
103
+ });
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","useCallback","useMemo","useRef","useState","StyleSheet","TabView","KNavigation","KContainer","KColors","SessionType","trans","useConversation","MediaViewerModal","ResourceCenterTabBar","ResourceCenterTabScene","RESOURCE_TABS","jsx","_jsx","jsxs","_jsxs","ResourceCenterScreen","conversationId","fallbackGroupID","fallbackUserID","initialTab","onBack","onPressUrl","conversation","groupID","recvID","userID","isGroupConversation","conversationType","Group","chatType","routes","map","tab","key","String","contentType","title","labelKey","layout","emptyKey","initialIndex","idx","findIndex","r","index","setIndex","mediaViewerRef","renderScene","route","View","style","styles","flex","children","Header","alignment","size","theme","leftButton","id","icon","vectorName","onPress","navigationState","onIndexChange","lazy","renderTabBar","ref","displayName","create","backgroundColor","white"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/index.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACpE,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,eAAe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MACN+D,eAAe,EAAE;QAAEnB,KAAK;QAAEd;MAAO,CAAE;MACnCkC,aAAa,EAAEnB,QAAS;MACxBoB,IAAI;MACJC,YAAY,EAAE1D,oBAAqB;MACnCuC,WAAW,EAAEA;IAAY,CAC1B,CAAC,eAEFnC,IAAA,CAACL,gBAAgB;MAAC4D,GAAG,EAAErB;IAAe,CAAE,CAAC;EAAA,CAC1B,CAAC;AAEtB,CACF,CAAC;AAED/B,oBAAoB,CAACqD,WAAW,GAAG,uBAAuB;AAE1D,eAAerD,oBAAoB;AAEnC,MAAMoC,MAAM,GAAGpD,UAAU,CAACsE,MAAM,CAAC;EAC/BjB,IAAI,EAAE;IACJA,IAAI,EAAE,CAAC;IACPkB,eAAe,EAAEnE,OAAO,CAACoE;EAC3B;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import { DThreadResourceContentType } from "../../types/chat.js";
4
+ export const RESOURCE_TABS = [{
5
+ contentType: DThreadResourceContentType.IMAGE,
6
+ labelKey: 'chat:resource_center_tab_image',
7
+ emptyKey: 'chat:resource_center_empty_generic',
8
+ layout: 'grid'
9
+ }, {
10
+ contentType: DThreadResourceContentType.VIDEO,
11
+ labelKey: 'chat:resource_center_tab_video',
12
+ emptyKey: 'chat:resource_center_empty_generic',
13
+ layout: 'grid'
14
+ }, {
15
+ contentType: DThreadResourceContentType.FILE,
16
+ labelKey: 'chat:resource_center_tab_file',
17
+ emptyKey: 'chat:resource_center_empty_generic',
18
+ layout: 'list'
19
+ }, {
20
+ contentType: DThreadResourceContentType.URL_TEXT,
21
+ labelKey: 'chat:resource_center_tab_link',
22
+ emptyKey: 'chat:resource_center_empty_link',
23
+ layout: 'list'
24
+ }];
25
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DThreadResourceContentType","RESOURCE_TABS","contentType","IMAGE","labelKey","emptyKey","layout","VIDEO","FILE","URL_TEXT"],"sourceRoot":"../../../../src","sources":["screens/ResourceCenter/types.ts"],"mappings":";;AAAA,SAASA,0BAA0B,QAAQ,qBAAkB;AA8B7D,OAAO,MAAMC,aAAkC,GAAG,CAChD;EACEC,WAAW,EAAEF,0BAA0B,CAACG,KAAK;EAC7CC,QAAQ,EAAE,gCAAgC;EAC1CC,QAAQ,EAAE,oCAAoC;EAC9CC,MAAM,EAAE;AACV,CAAC,EACD;EACEJ,WAAW,EAAEF,0BAA0B,CAACO,KAAK;EAC7CH,QAAQ,EAAE,gCAAgC;EAC1CC,QAAQ,EAAE,oCAAoC;EAC9CC,MAAM,EAAE;AACV,CAAC,EACD;EACEJ,WAAW,EAAEF,0BAA0B,CAACQ,IAAI;EAC5CJ,QAAQ,EAAE,+BAA+B;EACzCC,QAAQ,EAAE,oCAAoC;EAC9CC,MAAM,EAAE;AACV,CAAC,EACD;EACEJ,WAAW,EAAEF,0BAA0B,CAACS,QAAQ;EAChDL,QAAQ,EAAE,+BAA+B;EACzCC,QAAQ,EAAE,iCAAiC;EAC3CC,MAAM,EAAE;AACV,CAAC,CACF","ignoreList":[]}
@@ -74,7 +74,7 @@ export let AttachmentOrchestratorService;
74
74
  attachmentIds: payloads.map(p => p.attachmentId)
75
75
  });
76
76
  try {
77
- const mergedMsgId = await sendMergedMessage(payloads.map(p => p.payload), options.includeCaption);
77
+ const mergedMsgId = await sendMergedMessage(payloads.map(p => p.payload), options.applicationType, options.includeCaption);
78
78
  console.log('[AttachmentOrchestrator] Messages sent via merger:', {
79
79
  messageId: mergedMsgId,
80
80
  count: payloads.length
@@ -95,7 +95,7 @@ export let AttachmentOrchestratorService;
95
95
  return result;
96
96
  }
97
97
  _AttachmentOrchestratorService.sendPreparedAttachments = sendPreparedAttachments;
98
- async function sendMergedMessage(payloads, _caption) {
98
+ async function sendMergedMessage(payloads, applicationType, _caption) {
99
99
  const currentConversation = useConversationStore.getState().getCurrentConversation();
100
100
  if (!currentConversation) {
101
101
  throw new Error('No conversation selected');
@@ -206,8 +206,23 @@ export let AttachmentOrchestratorService;
206
206
  console.log('[AttachmentOrchestrator] Sending all messages in priority order', {
207
207
  totalMessages: allMessages.length
208
208
  });
209
- const recvID = currentConversation.userID || '';
210
- const groupID = currentConversation.groupID || '';
209
+ const {
210
+ currentUserId,
211
+ currentGroupId
212
+ } = useConversationStore.getState();
213
+ const recvID = currentConversation.userID || currentUserId || '';
214
+ const groupID = currentConversation.groupID || currentGroupId || '';
215
+
216
+ // Attachment messages otherwise skip `ex`, unlike text messages
217
+ // (buildSendParams), leaving applicationType context missing.
218
+ if (applicationType) {
219
+ const extendMessageInfo = {
220
+ applicationType
221
+ };
222
+ for (let i = 0; i < allMessages.length; i++) {
223
+ allMessages[i].ex = JSON.stringify(extendMessageInfo);
224
+ }
225
+ }
211
226
 
212
227
  // Push all messages as "Sending" immediately so the user sees every
213
228
  // bubble right away, instead of waiting for each network call in turn.