@vertesia/ui 0.64.0 → 0.66.0

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 (241) hide show
  1. package/lib/esm/core/components/EmptyCollection.js +2 -2
  2. package/lib/esm/core/components/EmptyCollection.js.map +1 -1
  3. package/lib/esm/core/components/InputList.js +2 -2
  4. package/lib/esm/core/components/InputList.js.map +1 -1
  5. package/lib/esm/core/components/SidePanel.js +1 -1
  6. package/lib/esm/core/components/SidePanel.js.map +1 -1
  7. package/lib/esm/core/components/Switch.js +2 -2
  8. package/lib/esm/core/components/Switch.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/calendar.js +0 -1
  10. package/lib/esm/core/components/shadcn/calendar.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/checkbox.js +0 -1
  12. package/lib/esm/core/components/shadcn/checkbox.js.map +1 -1
  13. package/lib/esm/core/components/shadcn/command.js +0 -1
  14. package/lib/esm/core/components/shadcn/command.js.map +1 -1
  15. package/lib/esm/core/components/shadcn/dialog.js +0 -1
  16. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  17. package/lib/esm/core/components/shadcn/filters/comboBox.js +18 -0
  18. package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -1
  19. package/lib/esm/core/components/shadcn/filters/filterBar.js +38 -17
  20. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  21. package/lib/esm/core/components/shadcn/filters/filters.js +11 -5
  22. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -1
  23. package/lib/esm/core/components/shadcn/filters/selectFilter.js +1 -1
  24. package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +1 -1
  25. package/lib/esm/core/components/shadcn/filters/stringListFilter.js +24 -0
  26. package/lib/esm/core/components/shadcn/filters/stringListFilter.js.map +1 -0
  27. package/lib/esm/core/components/shadcn/filters/textFilter.js +2 -1
  28. package/lib/esm/core/components/shadcn/filters/textFilter.js.map +1 -1
  29. package/lib/esm/core/components/shadcn/label.js +0 -1
  30. package/lib/esm/core/components/shadcn/label.js.map +1 -1
  31. package/lib/esm/core/components/shadcn/selectBox.js +1 -1
  32. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  33. package/lib/esm/env/index.js +4 -1
  34. package/lib/esm/env/index.js.map +1 -1
  35. package/lib/esm/features/agent/PayloadBuilder.js +56 -16
  36. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  37. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -6
  38. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  39. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -2
  40. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  41. package/lib/esm/features/facets/VEnvironmentFacet.js +24 -0
  42. package/lib/esm/features/facets/VEnvironmentFacet.js.map +1 -0
  43. package/lib/esm/features/facets/VFacetsNav.js +69 -26
  44. package/lib/esm/features/facets/VFacetsNav.js.map +1 -1
  45. package/lib/esm/features/facets/VInteractionFacet.js +45 -0
  46. package/lib/esm/features/facets/VInteractionFacet.js.map +1 -0
  47. package/lib/esm/features/facets/VStringFacet.js +6 -5
  48. package/lib/esm/features/facets/VStringFacet.js.map +1 -1
  49. package/lib/esm/features/facets/VUserFacet.js +6 -6
  50. package/lib/esm/features/facets/VUserFacet.js.map +1 -1
  51. package/lib/esm/features/layout/GenericPageNavHeader.js +1 -1
  52. package/lib/esm/features/magic-pdf/PdfPageProvider.js +3 -3
  53. package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +1 -1
  54. package/lib/esm/features/magic-pdf/TextPageView.js +1 -2
  55. package/lib/esm/features/magic-pdf/TextPageView.js.map +1 -1
  56. package/lib/esm/features/store/collections/CollectionsTable.js +9 -5
  57. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -1
  58. package/lib/esm/features/store/collections/{CollectionsView.js → CreateCollection.js} +6 -14
  59. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -0
  60. package/lib/esm/features/store/collections/EditCollectionView.js +1 -1
  61. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  62. package/lib/esm/features/store/collections/SelectCollection.js +24 -0
  63. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -0
  64. package/lib/esm/features/store/collections/index.js +2 -2
  65. package/lib/esm/features/store/collections/index.js.map +1 -1
  66. package/lib/esm/features/store/objects/DocumentSearchResults.js +6 -3
  67. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  68. package/lib/esm/features/store/objects/components/ContentOverview.js +14 -14
  69. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  70. package/lib/esm/features/store/objects/components/DocumentIcon.js +7 -10
  71. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
  72. package/lib/esm/features/store/objects/components/DocumentInput.js +1 -2
  73. package/lib/esm/features/store/objects/components/DocumentInput.js.map +1 -1
  74. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +4 -2
  75. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -1
  76. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +1 -2
  77. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
  78. package/lib/esm/features/store/objects/components/SelectDocument.js +9 -3
  79. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -1
  80. package/lib/esm/features/store/objects/components/SelectDocumentModal.js +2 -2
  81. package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +1 -1
  82. package/lib/esm/features/store/objects/layout/documentLayout.js +2 -2
  83. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
  84. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +4 -2
  85. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  86. package/lib/esm/features/store/objects/selection/SelectionActions.js +1 -1
  87. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
  88. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +7 -10
  89. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
  90. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +1 -1
  91. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -1
  92. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +2 -2
  93. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
  94. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +1 -1
  95. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -1
  96. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +1 -1
  97. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +1 -1
  98. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +2 -3
  99. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +1 -1
  100. package/lib/esm/features/store/types/ContentObjectTypesTable.js +1 -1
  101. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +1 -1
  102. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +2 -2
  103. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
  104. package/lib/esm/features/store/types/ObjectSchemaEditor.js +2 -3
  105. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  106. package/lib/esm/features/store/types/TableLayoutEditor.js +1 -1
  107. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -1
  108. package/lib/esm/features/store/types/index.js +0 -2
  109. package/lib/esm/features/store/types/index.js.map +1 -1
  110. package/lib/esm/features/user/UserInfo.js +1 -2
  111. package/lib/esm/features/user/UserInfo.js.map +1 -1
  112. package/lib/esm/features/utils/rendition.js +22 -2
  113. package/lib/esm/features/utils/rendition.js.map +1 -1
  114. package/lib/esm/session/UserSession.js +2 -2
  115. package/lib/esm/session/UserSession.js.map +1 -1
  116. package/lib/esm/session/auth/composable.js +1 -1
  117. package/lib/esm/session/auth/composable.js.map +1 -1
  118. package/lib/esm/session/constants.js +3 -0
  119. package/lib/esm/session/constants.js.map +1 -0
  120. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +2 -2
  121. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -1
  122. package/lib/esm/widgets/properties/PropertiesView.js +4 -2
  123. package/lib/esm/widgets/properties/PropertiesView.js.map +1 -1
  124. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +1 -1
  125. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
  126. package/lib/tsconfig.tsbuildinfo +1 -1
  127. package/lib/types/core/components/InputList.d.ts +2 -1
  128. package/lib/types/core/components/Switch.d.ts +2 -1
  129. package/lib/types/core/components/shadcn/filters/comboBox.d.ts +5 -0
  130. package/lib/types/core/components/shadcn/filters/stringListFilter.d.ts +10 -0
  131. package/lib/types/core/components/shadcn/filters/types.d.ts +3 -3
  132. package/lib/types/env/index.d.ts +1 -0
  133. package/lib/types/features/agent/PayloadBuilder.d.ts +12 -2
  134. package/lib/types/features/facets/VEnvironmentFacet.d.ts +11 -0
  135. package/lib/types/features/facets/VFacetsNav.d.ts +9 -1
  136. package/lib/types/features/facets/VInteractionFacet.d.ts +14 -0
  137. package/lib/types/features/facets/VStringFacet.d.ts +3 -2
  138. package/lib/types/features/facets/VUserFacet.d.ts +3 -2
  139. package/lib/types/features/store/collections/{CollectionsView.d.ts → CreateCollection.d.ts} +5 -3
  140. package/lib/types/features/store/collections/SelectCollection.d.ts +14 -0
  141. package/lib/types/features/store/collections/index.d.ts +2 -2
  142. package/lib/types/features/store/objects/components/ContentOverview.d.ts +2 -1
  143. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +2 -1
  144. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts +2 -1
  145. package/lib/types/features/store/objects/layout/documentLayout.d.ts +1 -1
  146. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +3 -2
  147. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +2 -1
  148. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts +2 -1
  149. package/lib/types/features/store/types/index.d.ts +0 -2
  150. package/lib/types/features/utils/rendition.d.ts +1 -1
  151. package/lib/types/session/UserSession.d.ts +2 -2
  152. package/lib/types/session/constants.d.ts +2 -0
  153. package/lib/vertesia-ui-core.js +1 -1
  154. package/lib/vertesia-ui-core.js.map +1 -1
  155. package/lib/vertesia-ui-env.js +1 -1
  156. package/lib/vertesia-ui-env.js.map +1 -1
  157. package/lib/vertesia-ui-features.js +1 -1
  158. package/lib/vertesia-ui-features.js.map +1 -1
  159. package/lib/vertesia-ui-session.js +1 -1
  160. package/lib/vertesia-ui-session.js.map +1 -1
  161. package/lib/vertesia-ui-widgets.js +1 -1
  162. package/lib/vertesia-ui-widgets.js.map +1 -1
  163. package/package.json +6 -4
  164. package/src/core/components/EmptyCollection.tsx +26 -24
  165. package/src/core/components/InputList.tsx +3 -1
  166. package/src/core/components/SidePanel.tsx +2 -2
  167. package/src/core/components/Switch.tsx +4 -3
  168. package/src/core/components/shadcn/calendar.tsx +0 -2
  169. package/src/core/components/shadcn/checkbox.tsx +0 -2
  170. package/src/core/components/shadcn/command.tsx +0 -2
  171. package/src/core/components/shadcn/dialog.tsx +0 -2
  172. package/src/core/components/shadcn/filters/comboBox.tsx +73 -0
  173. package/src/core/components/shadcn/filters/filterBar.tsx +41 -17
  174. package/src/core/components/shadcn/filters/filters.tsx +30 -14
  175. package/src/core/components/shadcn/filters/selectFilter.tsx +3 -3
  176. package/src/core/components/shadcn/filters/stringListFilter.tsx +58 -0
  177. package/src/core/components/shadcn/filters/textFilter.tsx +2 -1
  178. package/src/core/components/shadcn/filters/types.ts +3 -3
  179. package/src/core/components/shadcn/label.tsx +0 -2
  180. package/src/core/components/shadcn/selectBox.tsx +1 -1
  181. package/src/env/index.ts +5 -1
  182. package/src/features/agent/PayloadBuilder.tsx +66 -16
  183. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +0 -11
  184. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +11 -12
  185. package/src/features/facets/VEnvironmentFacet.tsx +42 -0
  186. package/src/features/facets/VFacetsNav.tsx +87 -29
  187. package/src/features/facets/VInteractionFacet.tsx +73 -0
  188. package/src/features/facets/VStringFacet.tsx +7 -6
  189. package/src/features/facets/VUserFacet.tsx +7 -6
  190. package/src/features/layout/GenericPageNavHeader.tsx +1 -1
  191. package/src/features/magic-pdf/PdfPageProvider.tsx +3 -3
  192. package/src/features/magic-pdf/TextPageView.tsx +1 -2
  193. package/src/features/store/collections/CollectionsTable.tsx +49 -40
  194. package/src/features/store/collections/{CollectionsView.tsx → CreateCollection.tsx} +15 -42
  195. package/src/features/store/collections/EditCollectionView.tsx +1 -1
  196. package/src/features/store/collections/SelectCollection.tsx +46 -0
  197. package/src/features/store/collections/index.ts +2 -2
  198. package/src/features/store/objects/DocumentSearchResults.tsx +6 -3
  199. package/src/features/store/objects/components/ContentOverview.tsx +33 -95
  200. package/src/features/store/objects/components/DocumentIcon.tsx +27 -14
  201. package/src/features/store/objects/components/DocumentInput.tsx +1 -2
  202. package/src/features/store/objects/components/PropertiesEditorModal.tsx +7 -3
  203. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +2 -2
  204. package/src/features/store/objects/components/SelectDocument.tsx +18 -3
  205. package/src/features/store/objects/components/SelectDocumentModal.tsx +6 -6
  206. package/src/features/store/objects/layout/documentLayout.tsx +2 -2
  207. package/src/features/store/objects/search/DocumentSearchContext.ts +6 -3
  208. package/src/features/store/objects/selection/ObjectsActionContext.tsx +1 -1
  209. package/src/features/store/objects/selection/SelectionActions.tsx +0 -1
  210. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +10 -21
  211. package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +1 -1
  212. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +2 -2
  213. package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +1 -1
  214. package/src/features/store/objects/selection/actions/RemoveFromCollectionAction.tsx +1 -1
  215. package/src/features/store/types/ContentObjectTypesSearch.tsx +3 -4
  216. package/src/features/store/types/ContentObjectTypesTable.tsx +3 -1
  217. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +2 -9
  218. package/src/features/store/types/ObjectSchemaEditor.tsx +4 -5
  219. package/src/features/store/types/TableLayoutEditor.tsx +4 -4
  220. package/src/features/store/types/index.ts +0 -2
  221. package/src/features/user/UserInfo.tsx +1 -2
  222. package/src/features/utils/rendition.ts +23 -1
  223. package/src/session/UserSession.ts +2 -2
  224. package/src/session/auth/composable.ts +1 -1
  225. package/src/session/constants.ts +2 -0
  226. package/src/widgets/codemirror/CodeMirrorEditor.tsx +2 -2
  227. package/src/widgets/properties/PropertiesView.tsx +10 -2
  228. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +1 -1
  229. package/lib/esm/features/store/collections/CollectionView.js +0 -53
  230. package/lib/esm/features/store/collections/CollectionView.js.map +0 -1
  231. package/lib/esm/features/store/collections/CollectionsView.js.map +0 -1
  232. package/lib/esm/features/store/types/ContentObjectTypeView.js +0 -158
  233. package/lib/esm/features/store/types/ContentObjectTypeView.js.map +0 -1
  234. package/lib/esm/features/store/types/ContentObjectTypesView.js +0 -55
  235. package/lib/esm/features/store/types/ContentObjectTypesView.js.map +0 -1
  236. package/lib/types/features/store/collections/CollectionView.d.ts +0 -5
  237. package/lib/types/features/store/types/ContentObjectTypeView.d.ts +0 -5
  238. package/lib/types/features/store/types/ContentObjectTypesView.d.ts +0 -8
  239. package/src/features/store/collections/CollectionView.tsx +0 -94
  240. package/src/features/store/types/ContentObjectTypeView.tsx +0 -244
  241. package/src/features/store/types/ContentObjectTypesView.tsx +0 -71
@@ -1,5 +1,4 @@
1
- import { JSONCode } from "@vertesia/ui/widgets";
2
- import { Theme, XMLViewer } from '@vertesia/ui/widgets';
1
+ import { JSONCode, Theme, XMLViewer } from '@vertesia/ui/widgets';
3
2
  import { useEffect, useLayoutEffect, useState } from "react";
4
3
  import { usePdfPagesInfo } from "./PdfPageProvider";
5
4
  import { ViewType } from "./types";
@@ -1,11 +1,11 @@
1
1
  import { NavLink } from "@vertesia/ui/router";
2
2
  import { useUserSession } from "@vertesia/ui/session";
3
3
  import { FolderClosed, Search, Trash2 } from "lucide-react";
4
- import { Button, ConfirmModal, ErrorBox, Table, TBody, TR, useToast, VTooltip } from "@vertesia/ui/core";
5
- import { useFetch } from "@vertesia/ui/core";
4
+ import { Button, ConfirmModal, ErrorBox, Table, TBody, TR, useToast, VTooltip, useFetch, EmptyCollection } from "@vertesia/ui/core";
6
5
  import dayjs from 'dayjs';
7
6
  import relativeTime from 'dayjs/plugin/relativeTime';
8
7
  import { useState, useEffect } from "react";
8
+ import { CreateCollectionModal } from "./CreateCollection";
9
9
 
10
10
  dayjs.extend(relativeTime);
11
11
 
@@ -16,9 +16,10 @@ export function CollectionsTable({ }: CollectionsTableProps) {
16
16
  const toast = useToast();
17
17
  const [collectionToDelete, setCollectionToDelete] = useState<string | undefined>();
18
18
  const [isLoading, setIsLoading] = useState(true);
19
+ const [isOpen, setOpen] = useState(false);
19
20
 
20
21
  const { data: collections, error, refetch } = useFetch(() => client.store.collections.list(), []);
21
-
22
+
22
23
  // Update loading state when data is fetched
23
24
  useEffect(() => {
24
25
  if (collections || error) {
@@ -32,7 +33,7 @@ export function CollectionsTable({ }: CollectionsTableProps) {
32
33
 
33
34
  const deleteCollection = async () => {
34
35
  if (!collectionToDelete) return;
35
-
36
+
36
37
  try {
37
38
  await client.store.collections.delete(collectionToDelete);
38
39
  toast({
@@ -56,42 +57,50 @@ export function CollectionsTable({ }: CollectionsTableProps) {
56
57
 
57
58
  return (
58
59
  <>
59
- {collections && <Table className="w-full">
60
- <thead>
61
- <tr>
62
- <th>Name</th>
63
- <th>Type</th>
64
- <th>Created</th>
65
- <th></th>
66
- </tr>
67
- </thead>
68
- <TBody columns={4} isLoading={isLoading}>
69
- {
70
- collections.map((c) => {
71
- return <TR key={c.id}>
72
- <td>
73
- <div className="flex items-center gap-2">
74
- {collectionIcon(c.dynamic)}
75
- <NavLink href={`/collections/${c.id}`}>{c.name}</NavLink>
76
- </div>
77
- </td>
78
- <td>{c.type?.name || "-"}</td>
79
- <td>{dayjs(c.created_at).fromNow()}</td>
80
- <td className="text-right">
81
- <Button
82
- variant="destructive"
83
- size="sm"
84
- onClick={() => setCollectionToDelete(c.id)}
85
- >
86
- <Trash2 className="size-4" />
87
- </Button>
88
- </td>
89
- </TR>
90
- })
91
- }
92
- </TBody>
93
- </Table>}
94
-
60
+ {collections &&
61
+ (collections.length > 0 ?
62
+ (<Table className="w-full">
63
+ <thead>
64
+ <tr>
65
+ <th>Name</th >
66
+ <th>Type</th>
67
+ <th>Created</th>
68
+ <th></th>
69
+ </tr >
70
+ </thead >
71
+ <TBody columns={4} isLoading={isLoading}>
72
+ {
73
+ collections.map((c) => {
74
+ return <TR key={c.id}>
75
+ <td>
76
+ <div className="flex items-center gap-2">
77
+ {collectionIcon(c.dynamic)}
78
+ <NavLink href={`/collections/${c.id}`}>{c.name}</NavLink>
79
+ </div>
80
+ </td>
81
+ <td>{c.type?.name || "-"}</td>
82
+ <td>{dayjs(c.created_at).fromNow()}</td>
83
+ <td className="text-right">
84
+ <Button
85
+ variant="destructive"
86
+ size="sm"
87
+ onClick={() => setCollectionToDelete(c.id)}
88
+ >
89
+ <Trash2 className="size-4" />
90
+ </Button>
91
+ </td>
92
+ </TR>
93
+ })
94
+ }
95
+ </TBody>
96
+ </Table >) :
97
+ <EmptyCollection title="No Collections" buttonLabel='New Collections' onClick={() => setOpen(true)}>
98
+ Get started by creating a new Collections.
99
+ </EmptyCollection>)
100
+ }
101
+
102
+ <CreateCollectionModal isOpen={isOpen} onClose={() => setOpen(false)} />
103
+
95
104
  <ConfirmModal
96
105
  isOpen={!!collectionToDelete}
97
106
  title="Delete Collection"
@@ -1,49 +1,9 @@
1
1
  import { CreateCollectionPayload } from "@vertesia/common";
2
- import {
3
- Button, FormItem, Input, Styles,
4
- Switch, useFlag, useToast, VModal,
5
- VModalBody,
6
- VModalFooter,
7
- VModalTitle
8
- } from "@vertesia/ui/core";
9
- import { FullHeightLayout } from "@vertesia/ui/layout";
2
+ import { useToast, VModalBody, FormItem, Styles, VModalFooter, Input, Switch, Button, VModal, VModalTitle } from "@vertesia/ui/core";
3
+ import { SelectContentType } from "../types/SelectContentType";
10
4
  import { useNavigate } from "@vertesia/ui/router";
11
5
  import { useUserSession } from "@vertesia/ui/session";
12
6
  import { useState } from "react";
13
- import { GenericPageNavHeader } from "../../layout";
14
- import { SelectContentType } from "../../store";
15
- import { CollectionsTable } from "./CollectionsTable";
16
-
17
- interface CollectionsViewProps { }
18
- export function CollectionsView({ }: CollectionsViewProps) {
19
- const actions = [<CreateCollectionButton key="create" />];
20
- return (
21
- <FullHeightLayout>
22
- <GenericPageNavHeader
23
- title="Collections"
24
- breadcrumbs={[<span key="0">Collections</span>]}
25
- description="Group objects together using a collection"
26
- actions={actions}
27
- />
28
- <FullHeightLayout.Body>
29
- <CollectionsTable />
30
- </FullHeightLayout.Body>
31
- </FullHeightLayout>
32
- );
33
- }
34
-
35
- function CreateCollectionButton() {
36
- const { on, off, isOn } = useFlag();
37
- return (
38
- <div>
39
- <VModal onClose={off} isOpen={isOn}>
40
- <VModalTitle>Create a Collection</VModalTitle>
41
- <CreateCollectionForm onClose={off} />
42
- </VModal>
43
- <Button onClick={on}>Create Collection</Button>
44
- </div>
45
- );
46
- }
47
7
 
48
8
  interface CreateCollectionFormProps {
49
9
  onClose: () => void;
@@ -164,3 +124,16 @@ export function CreateCollectionForm({ onClose, redirect = true, onAddToCollecti
164
124
  </form >
165
125
  );
166
126
  }
127
+
128
+ interface CreateCollectionModalProps {
129
+ isOpen: boolean;
130
+ onClose: () => void;
131
+ }
132
+ export function CreateCollectionModal({ isOpen, onClose }: CreateCollectionModalProps) {
133
+ return (
134
+ <VModal onClose={onClose} isOpen={isOpen}>
135
+ <VModalTitle>Create a Collection</VModalTitle>
136
+ <CreateCollectionForm onClose={onClose} />
137
+ </VModal>
138
+ );
139
+ }
@@ -5,7 +5,7 @@ import { useUserSession } from "@vertesia/ui/session";
5
5
  import { CodeMirrorEditor, EditorApi, GeneratedForm, ManagedObject } from "@vertesia/ui/widgets";
6
6
  import { basicSetup } from "codemirror";
7
7
  import { useMemo, useRef, useState } from "react";
8
- import { SelectContentType, stringifyTableLayout } from "../../store";
8
+ import { SelectContentType, stringifyTableLayout } from "../types";
9
9
 
10
10
  const extensions = [basicSetup, json()];
11
11
 
@@ -0,0 +1,46 @@
1
+ import { ErrorBox, useFetch, VSelectBox } from "@vertesia/ui/core";
2
+ import { useUserSession } from "@vertesia/ui/session";
3
+
4
+ interface SelectCollectionProps {
5
+ value?: string; // Collection ID
6
+ onChange: (collectionId: string | undefined, collection?: any) => void;
7
+ disabled?: boolean;
8
+ className?: string;
9
+ }
10
+
11
+ /**
12
+ * A component to select a collection from a list of collections.
13
+ * It fetches the collections from the store and displays them in a dropdown.
14
+ * @param props - The properties for the component.
15
+ * @returns A dropdown to select a collection.
16
+ */
17
+ export function SelectCollection({ onChange, value, disabled = false, className }: SelectCollectionProps) {
18
+ const { client } = useUserSession();
19
+ const { data: collections, error } = useFetch(() => client.store.collections.list({ dynamic: false }), []);
20
+
21
+ if (error) {
22
+ return <ErrorBox title='Collection fetch failed'>{error.message}</ErrorBox>
23
+ }
24
+
25
+ // Find the selected collection object from the ID
26
+ const selectedCollection = value ? collections?.find(col => col.id === value) : undefined;
27
+
28
+ const handleChange = (collection: any) => {
29
+ // Call onChange with both the ID and the full collection object
30
+ onChange(collection?.id, collection);
31
+ };
32
+
33
+ return (
34
+ <VSelectBox
35
+ filterBy={"name"}
36
+ value={selectedCollection}
37
+ onChange={handleChange}
38
+ placeholder="Select a collection"
39
+ options={collections || []}
40
+ optionLabel={(col: any) => col.name}
41
+ by="id"
42
+ className={className}
43
+ disabled={disabled}
44
+ />
45
+ );
46
+ }
@@ -1,5 +1,5 @@
1
1
  export * from "./BrowseCollectionView";
2
2
  export * from "./CollectionsTable";
3
- export * from "./CollectionsView";
4
- export * from "./CollectionView";
5
3
  export * from "./EditCollectionView";
4
+ export * from "./CreateCollection";
5
+ export * from "./SelectCollection";
@@ -4,11 +4,14 @@ import { ColumnLayout, ContentObject, ContentObjectItem, VectorSearchQuery } fro
4
4
  import { Button, Divider, ErrorBox, SidePanel, Spinner, useDebounce, useIntersectionObserver, useToast } from '@vertesia/ui/core';
5
5
  import { useNavigate } from "@vertesia/ui/router";
6
6
  import { TypeRegistry, useUserSession } from '@vertesia/ui/session';
7
- import { Download, RefreshCw, SquareArrowOutUpRight } from 'lucide-react';
7
+ import { Download, RefreshCw, Eye } from 'lucide-react';
8
8
  import { VFacetsNav } from "../../facets";
9
9
  import { VectorSearchWidget } from './components/VectorSearchWidget';
10
10
 
11
- import { ContentDispositionButton, DocumentTable, useDocumentSearch, useDocumentUploadHandler, useWatchDocumentSearchFacets, useWatchDocumentSearchResult } from "../../store";
11
+ import { ContentDispositionButton } from './components/ContentDispositionButton';
12
+ import { DocumentTable } from './DocumentTable';
13
+ import { useDocumentSearch, useWatchDocumentSearchFacets, useWatchDocumentSearchResult } from './search/DocumentSearchContext';
14
+ import { useDocumentUploadHandler } from './upload/useUploadHandler';
12
15
  import { ContentOverview } from './components/ContentOverview';
13
16
  import { useDownloadDocument } from './components/useDownloadObject';
14
17
 
@@ -192,7 +195,7 @@ function OverviewDrawer({ object, onClose }: OverviewDrawerProps) {
192
195
  <SidePanel title={object.properties?.title || object.name} isOpen={true} onClose={onClose}>
193
196
  <div className="flex items-center gap-x-2">
194
197
  <Button variant="ghost" size="sm" title="Open Object" onClick={() => navigate(`/objects/${object.id}`)}>
195
- <SquareArrowOutUpRight className="size-4" />
198
+ <Eye className="size-4" />
196
199
  </Button>
197
200
  {object.content?.source && (
198
201
  <Button variant="ghost" size="sm" title="Download" onClick={onDownload}>
@@ -12,10 +12,12 @@ import { PropertiesEditorModal } from "./PropertiesEditorModal";
12
12
  interface ContentOverviewProps {
13
13
  object: ContentObject;
14
14
  loadText?: boolean;
15
+ refetch?: () => Promise<unknown>;
15
16
  }
16
17
  export function ContentOverview({
17
18
  object,
18
19
  loadText,
20
+ refetch,
19
21
  }: ContentOverviewProps) {
20
22
  const { client, store } = useUserSession();
21
23
  const [isLoadingText, setIsLoadingText] = useState(false);
@@ -144,7 +146,7 @@ export function ContentOverview({
144
146
  };
145
147
 
146
148
  const handleExportDocx = () => handleExportDocument("docx");
147
- //const handleExportPdf = () => handleExportDocument("pdf");
149
+ const handleExportPdf = () => handleExportDocument("pdf");
148
150
 
149
151
  const content = object.content;
150
152
  const isImage =
@@ -295,6 +297,15 @@ export function ContentOverview({
295
297
  <Download className="h-4 w-4" />
296
298
  DOCX
297
299
  </Button>
300
+ <Button
301
+ variant="ghost"
302
+ size="sm"
303
+ onClick={handleExportPdf}
304
+ className="flex items-center gap-2"
305
+ >
306
+ <Download className="h-4 w-4" />
307
+ PDF
308
+ </Button>
298
309
  </>
299
310
  )}
300
311
  </div>
@@ -303,64 +314,29 @@ export function ContentOverview({
303
314
  {text ? (
304
315
  <div className="border shadow-xs rounded-xs max-w-7xl">
305
316
  {seemsMarkdown ? (
306
- <div className="prose prose-sm max-w-none prose-p:bg-transparent prose-p:my-0 prose-pre:bg-gray-800 dark:prose-pre:bg-gray-900 prose-pre:my-2 prose-code:bg-gray-200/70 dark:prose-code:bg-gray-700/50 prose-headings:bg-transparent prose-li:bg-transparent dark:prose-invert dark:text-gray-100">
317
+ <div className="vprose prose-sm p-1">
307
318
  <Markdown
308
319
  remarkPlugins={[remarkGfm]}
309
320
  components={{
310
- a: ({
311
- node,
312
- ...props
313
- }: {
314
- node?: any;
315
- href?: string;
316
- children?: React.ReactNode;
317
- }) => {
321
+ a: ({ node, ...props }: { node?: any; href?: string; children?: React.ReactNode }) => {
318
322
  const href = props.href || "";
319
- if (
320
- href.startsWith(
321
- "/store/objects/",
322
- )
323
- ) {
323
+ if (href.startsWith("/store/objects/")) {
324
324
  return (
325
325
  <Link
326
326
  href={href}
327
- className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
327
+ className="text-info"
328
328
  >
329
329
  {props.children}
330
330
  </Link>
331
331
  );
332
332
  }
333
- return (
334
- <a
335
- {...props}
336
- target="_blank"
337
- rel="noopener noreferrer"
338
- />
339
- );
333
+ return <a {...props} target="_blank" rel="noopener noreferrer" />;
340
334
  },
341
- p: ({
342
- node,
343
- ...props
344
- }: {
345
- node?: any;
346
- children?: React.ReactNode;
347
- }) => (
348
- <p
349
- {...props}
350
- className="my-0 text-gray-800 dark:text-gray-100"
351
- />
335
+ p: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
336
+ <p {...props} className={`my-0`} />
352
337
  ),
353
- pre: ({
354
- node,
355
- ...props
356
- }: {
357
- node?: any;
358
- children?: React.ReactNode;
359
- }) => (
360
- <pre
361
- {...props}
362
- className="my-2 bg-gray-800 dark:bg-gray-900 p-2 rounded text-gray-100"
363
- />
338
+ pre: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
339
+ <pre {...props} className={`my-2 p-2 rounded`} />
364
340
  ),
365
341
  code: ({
366
342
  node,
@@ -372,71 +348,32 @@ export function ContentOverview({
372
348
  className?: string;
373
349
  children?: React.ReactNode;
374
350
  }) => {
375
- const match =
376
- /language-(\w+)/.exec(
377
- className || "",
378
- );
351
+ const match = /language-(\w+)/.exec(className || "");
379
352
  const isInline = !match;
380
353
  return (
381
354
  <code
382
355
  {...props}
383
356
  className={
384
357
  isInline
385
- ? "px-1.5 py-0.5 rounded text-muted bg-gray-200/70 dark:bg-gray-700/50"
386
- : "text-gray-100"
358
+ ? `px-1.5 py-0.5 rounded`
359
+ : "text-muted"
387
360
  }
388
361
  >
389
362
  {children}
390
363
  </code>
391
364
  );
392
365
  },
393
- h1: ({
394
- node,
395
- ...props
396
- }: {
397
- node?: any;
398
- children?: React.ReactNode;
399
- }) => (
400
- <h1
401
- {...props}
402
- className="text-gray-900 dark:text-gray-50 font-bold text-2xl my-2"
403
- />
366
+ h1: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
367
+ <h1 {...props} className={`font-bold text-2xl my-2`} />
404
368
  ),
405
- h2: ({
406
- node,
407
- ...props
408
- }: {
409
- node?: any;
410
- children?: React.ReactNode;
411
- }) => (
412
- <h2
413
- {...props}
414
- className="text-gray-900 dark:text-gray-50 font-bold text-xl my-2"
415
- />
369
+ h2: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
370
+ <h2 {...props} className={`font-bold text-xl my-2`} />
416
371
  ),
417
- h3: ({
418
- node,
419
- ...props
420
- }: {
421
- node?: any;
422
- children?: React.ReactNode;
423
- }) => (
424
- <h3
425
- {...props}
426
- className="text-gray-900 dark:text-gray-50 font-bold text-lg my-2"
427
- />
372
+ h3: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
373
+ <h3 {...props} className={`font-bold text-lg my-2`} />
428
374
  ),
429
- li: ({
430
- node,
431
- ...props
432
- }: {
433
- node?: any;
434
- children?: React.ReactNode;
435
- }) => (
436
- <li
437
- {...props}
438
- className="text-gray-800 dark:text-gray-100"
439
- />
375
+ li: ({ node, ...props }: { node?: any; children?: React.ReactNode }) => (
376
+ <li {...props} />
440
377
  ),
441
378
  }}
442
379
  >
@@ -460,6 +397,7 @@ export function ContentOverview({
460
397
  isOpen={isPropertiesModalOpen}
461
398
  onClose={handleClosePropertiesModal}
462
399
  object={object}
400
+ refetch={refetch}
463
401
  />
464
402
  </div>
465
403
  );
@@ -3,27 +3,25 @@ import { ChangeEvent, useEffect, useState } from 'react'
3
3
  import { retrieveRendition } from '../../../utils'
4
4
 
5
5
  import { ContentObjectItem } from '@vertesia/common'
6
- import { Card, CardContent, Separator, VTooltip } from "@vertesia/ui/core"
7
- import { useNavigate } from "@vertesia/ui/router"
6
+ import { Button, Card, CardContent, Separator, VTooltip } from "@vertesia/ui/core"
7
+ import { NavLink } from "@vertesia/ui/router"
8
8
  import { useUserSession } from "@vertesia/ui/session"
9
9
  import { DocumentSelection } from '../DocumentSelectionProvider'
10
+ import { Eye } from 'lucide-react'
10
11
 
11
12
  interface DocumentIconProps {
12
13
  document: ContentObjectItem
13
14
  onSelectionChange: ((object: ContentObjectItem, ev: ChangeEvent<HTMLInputElement>) => void);
14
15
  selection: DocumentSelection;
15
-
16
+ onRowClick?: (object: ContentObjectItem) => void;
16
17
  }
17
- export function DocumentIcon({ selection, document, onSelectionChange }: Readonly<DocumentIconProps>) {
18
+ export function DocumentIcon({ selection, document, onSelectionChange, onRowClick }: Readonly<DocumentIconProps>) {
18
19
  const { client } = useUserSession()
19
- const navigate = useNavigate()
20
20
 
21
21
  const [renditionUrl, setRenditionUrl] = useState<string | undefined>(undefined)
22
22
  const [renditionAlt, setRenditionAlt] = useState<string | undefined>(undefined)
23
+ const [renditionStatus, setRenditionStatus] = useState<string | undefined>(undefined)
23
24
 
24
- const handleNavigateToDocument = () => {
25
- navigate(`/objects/${document.id}`)
26
- }
27
25
 
28
26
  const handleSelect = (ev: React.ChangeEvent<HTMLInputElement>) => {
29
27
  ev.stopPropagation()
@@ -35,13 +33,11 @@ export function DocumentIcon({ selection, document, onSelectionChange }: Readonl
35
33
  return
36
34
  }
37
35
 
38
- retrieveRendition(client, document, setRenditionUrl, setRenditionAlt)
36
+ retrieveRendition(client, document, setRenditionUrl, setRenditionAlt, setRenditionStatus)
39
37
  }, [document])
40
38
 
41
- console.log("renditionUrl", document)
42
-
43
39
  return (
44
- <Card className="relative flex flex-col border h-fit" onClick={handleNavigateToDocument}>
40
+ <Card className="relative flex flex-col border h-fit" onClick={() => (onRowClick && onRowClick(document))}>
45
41
  {
46
42
  selection && (
47
43
  <div
@@ -56,11 +52,28 @@ export function DocumentIcon({ selection, document, onSelectionChange }: Readonl
56
52
  )
57
53
  }
58
54
 
55
+ <div
56
+ className="absolute top-1 right-1 z-10 flex flex-col items-center"
57
+ >
58
+ <NavLink
59
+ topLevelNav
60
+ href={`/store/objects/${document.id}`}
61
+ >
62
+ <Button
63
+ variant="ghost" size="sm" title="Open Object"
64
+ >
65
+ <Eye className={`size-4 ${renditionStatus === 'ready' ? 'text-muted' : 'text-white'}`} />
66
+ </Button>
67
+ </NavLink>
68
+ </div>
69
+
59
70
  {
60
- renditionUrl ? (
71
+ (renditionUrl && renditionStatus == 'ready') ? (
61
72
  <img src={renditionUrl} alt={renditionAlt} className="w-auto h-48 object-cover rounded-t-xl" />
62
73
  ) : (
63
- <div className="h-48 bg-gray-700 rounded-t-xl"></div>
74
+ <div className="h-48 bg-gray-700 rounded-t-xl flex items-center justify-center text-muted">
75
+ {renditionStatus}
76
+ </div>
64
77
  )
65
78
  }
66
79
  <Separator className='bg-gray-200 h-[2px]' />
@@ -4,8 +4,7 @@ import { ChangeEvent, useEffect, useState } from 'react';
4
4
  import { useUserSession } from '@vertesia/ui/session';
5
5
  import { ContentObjectItem } from '@vertesia/common';
6
6
  import { ChevronsUpDown, X } from 'lucide-react';
7
- import { Button, Styles } from '@vertesia/ui/core';
8
- import { useFlag } from '@vertesia/ui/core';
7
+ import { Button, Styles, useFlag } from '@vertesia/ui/core';
9
8
  import { Node } from '@vertesia/ui/widgets';
10
9
 
11
10
  import { SelectDocumentModal } from './SelectDocumentModal';
@@ -22,9 +22,10 @@ export interface PropertiesEditorModalProps {
22
22
  isOpen: boolean;
23
23
  onClose: () => void;
24
24
  object: ContentObject;
25
+ refetch?: () => Promise<unknown>;
25
26
  }
26
27
 
27
- export function PropertiesEditorModal({ isOpen, onClose, object }: PropertiesEditorModalProps) {
28
+ export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: PropertiesEditorModalProps) {
28
29
  const { client, store } = useUserSession();
29
30
  const toast = useToast();
30
31
  const navigate = useNavigate();
@@ -169,8 +170,11 @@ export function PropertiesEditorModal({ isOpen, onClose, object }: PropertiesEdi
169
170
  description: 'The object properties have been updated successfully.',
170
171
  duration: 2000
171
172
  });
172
-
173
- // Close modals
173
+
174
+ if (refetch) {
175
+ await refetch();
176
+ }
177
+
174
178
  setShowConfirmation(false);
175
179
  onClose();
176
180
  }
@@ -7,9 +7,9 @@ import {
7
7
  ModalTitle,
8
8
  Input,
9
9
  RadioGroup,
10
- RadioOptionAdapter
10
+ RadioOptionAdapter,
11
+ FormItem
11
12
  } from '@vertesia/ui/core';
12
- import { FormItem } from '@vertesia/ui/core';
13
13
 
14
14
  export interface SaveVersionConfirmModalProps {
15
15
  isOpen: boolean;