@stack-spot/ai-chat-widget 1.18.0-beta.0 → 1.18.0-beta.10

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 (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/app-metadata.json +6 -6
  3. package/dist/components/ComponentNavigator.d.ts +22 -5
  4. package/dist/components/ComponentNavigator.d.ts.map +1 -1
  5. package/dist/components/ComponentNavigator.js.map +1 -1
  6. package/dist/components/ListResource.d.ts +29 -0
  7. package/dist/components/ListResource.d.ts.map +1 -0
  8. package/dist/components/{ListGroup.js → ListResource.js} +6 -5
  9. package/dist/components/ListResource.js.map +1 -0
  10. package/dist/components/Selector/index.js +2 -2
  11. package/dist/components/Selector/index.js.map +1 -1
  12. package/dist/components/WorkspaceTabNavigator.d.ts +6 -4
  13. package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
  14. package/dist/components/WorkspaceTabNavigator.js +9 -9
  15. package/dist/components/WorkspaceTabNavigator.js.map +1 -1
  16. package/dist/components/form/DescribedCheckboxGroup.js +1 -1
  17. package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/state/ChatEntry.d.ts +4 -0
  23. package/dist/state/ChatEntry.d.ts.map +1 -1
  24. package/dist/state/ChatEntry.js.map +1 -1
  25. package/dist/views/Agents/AgentsPanel.js +1 -1
  26. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  27. package/dist/views/Agents/AgentsTab.js.map +1 -1
  28. package/dist/views/Agents/dictionary.d.ts +1 -1
  29. package/dist/views/Agents/dictionary.d.ts.map +1 -1
  30. package/dist/views/Agents/dictionary.js +2 -2
  31. package/dist/views/Agents/dictionary.js.map +1 -1
  32. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  33. package/dist/views/Chat/ChatMessage.js +5 -5
  34. package/dist/views/Chat/ChatMessage.js.map +1 -1
  35. package/dist/views/Chat/StepsList.js +2 -2
  36. package/dist/views/Chat/StepsList.js.map +1 -1
  37. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  38. package/dist/views/ChatHistory/utils.js +7 -3
  39. package/dist/views/ChatHistory/utils.js.map +1 -1
  40. package/dist/views/KnowledgeSources.js +3 -3
  41. package/dist/views/KnowledgeSources.js.map +1 -1
  42. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  43. package/dist/views/MessageInput/AgentSelector.js +8 -5
  44. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  45. package/dist/views/MessageInput/ButtonGroup.js +2 -2
  46. package/dist/views/MessageInput/ButtonGroup.js.map +1 -1
  47. package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
  48. package/dist/views/MessageInput/QuickCommandSelector.js +5 -3
  49. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  50. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  51. package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
  52. package/dist/views/MessageInput/dictionary.js +6 -6
  53. package/dist/views/MessageInput/dictionary.js.map +1 -1
  54. package/dist/views/Stacks.js +3 -3
  55. package/dist/views/Stacks.js.map +1 -1
  56. package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
  57. package/dist/views/Workspaces/WorkspacesTab.js +6 -6
  58. package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
  59. package/dist/views/Workspaces/index.js +4 -13
  60. package/dist/views/Workspaces/index.js.map +1 -1
  61. package/package.json +3 -3
  62. package/src/app-metadata.json +6 -6
  63. package/src/components/ComponentNavigator.tsx +32 -7
  64. package/src/components/ListResource.tsx +60 -0
  65. package/src/components/Selector/index.tsx +2 -2
  66. package/src/components/WorkspaceTabNavigator.tsx +28 -23
  67. package/src/components/form/DescribedCheckboxGroup.tsx +12 -12
  68. package/src/index.ts +2 -0
  69. package/src/state/ChatEntry.ts +4 -0
  70. package/src/views/Agents/AgentsPanel.tsx +1 -1
  71. package/src/views/Agents/AgentsTab.tsx +2 -2
  72. package/src/views/Agents/dictionary.ts +2 -2
  73. package/src/views/Chat/ChatMessage.tsx +6 -5
  74. package/src/views/Chat/StepsList.tsx +2 -2
  75. package/src/views/ChatHistory/utils.ts +9 -4
  76. package/src/views/KnowledgeSources.tsx +5 -5
  77. package/src/views/MessageInput/AgentSelector.tsx +17 -6
  78. package/src/views/MessageInput/ButtonGroup.tsx +3 -3
  79. package/src/views/MessageInput/QuickCommandSelector.tsx +11 -5
  80. package/src/views/MessageInput/dictionary.ts +6 -6
  81. package/src/views/Stacks.tsx +5 -5
  82. package/src/views/Workspaces/WorkspacesTab.tsx +19 -16
  83. package/src/views/Workspaces/index.tsx +4 -13
  84. package/dist/components/ListGroup.d.ts +0 -46
  85. package/dist/components/ListGroup.d.ts.map +0 -1
  86. package/dist/components/ListGroup.js.map +0 -1
  87. package/src/components/ListGroup.tsx +0 -76
@@ -8,7 +8,7 @@ import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
8
8
  import { difference, uniqBy } from 'lodash'
9
9
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
10
10
  import { ButtonFavorite } from '../components/ButtonFavorite'
11
- import { NavigationItem } from '../components/ComponentNavigator'
11
+ import { NavigationComponent } from '../components/ComponentNavigator'
12
12
  import { DescribedCheckboxGroup } from '../components/form/DescribedCheckboxGroup'
13
13
  import { IconInput } from '../components/IconInput'
14
14
  import { RightPanelTabs } from '../components/RightPanelTabs'
@@ -68,7 +68,7 @@ const KnowledgeSourcesPanel = () => {
68
68
  { title: t.favorites, content: <KnowledgeSourcesTab key="favorite" visibility="favorite" allKS={allKS} onSubmit={onSubmit} /> },
69
69
  { title: t.personal, content: <KnowledgeSourcesTab key="personal" visibility="personal" allKS={allKS} onSubmit={onSubmit} /> },
70
70
  { title: t.shared, content: <KnowledgeSourcesTab key="shared" visibility="shared" allKS={allKS} onSubmit={onSubmit} /> },
71
- { title: t.spaces, content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
71
+ { title: t.spots, content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
72
72
  { title: t.account, content: <KnowledgeSourcesTab key="account" visibility="account" allKS={allKS} onSubmit={onSubmit} /> },
73
73
  ]
74
74
 
@@ -198,7 +198,7 @@ export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId,
198
198
  export function KnowledgeSourcesTabWorkspace({ allKS, onSubmit }: TabProps) {
199
199
  const workspaceTabComponents = useMemo(() => ({ ks: KnowledgeSourcesTab }), [allKS, onSubmit])
200
200
 
201
- const buildNavigateParams = (workspace: WorkspaceResponse): NavigationItem<typeof workspaceTabComponents> => ({
201
+ const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
202
202
  component: 'ks',
203
203
  props: { visibility: 'workspace', workspaceId: workspace.id, allKS, onSubmit },
204
204
  })
@@ -220,7 +220,7 @@ const dictionary = {
220
220
  noSearchResultsDescription: 'Please, try another search term.',
221
221
  noData: 'There are no knowledge sources in this category yet.',
222
222
  noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new knowledge sources.',
223
- spaces: 'Spaces',
223
+ spots: 'Spots',
224
224
  },
225
225
  pt: {
226
226
  title: 'Knowledge Sources',
@@ -234,6 +234,6 @@ const dictionary = {
234
234
  noSearchResultsDescription: 'Por favor, tente outra busca.',
235
235
  noData: 'Ainda não há knowledge sources nesta categoria.',
236
236
  noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novos knowledge sources.',
237
- spaces: 'Spaces',
237
+ spots: 'Spots',
238
238
  },
239
239
  } satisfies Dictionary
@@ -9,17 +9,23 @@ import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
9
9
  import { agentRegex } from '../../regex'
10
10
  import { useAgentFavorites } from '../Agents/useAgentFavorites'
11
11
 
12
- const AgentItem = ({ avatar, name }: AgentResponse) => {
12
+ type AgentWithSpaceName = AgentResponse & { spaceName?: string }
13
+
14
+ const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
13
15
  const avatarComponent = avatar ? <Image width="32" height="32" radius="full" src={avatar} /> : <IconBox size="md"><Agent /></IconBox>
14
16
 
15
17
  return <Flex flexWrap="nowrap" alignItems="center" sx={{ gap: '8px' }}>
16
18
  {avatarComponent}
17
- <p className="selector-title">{name}</p>
19
+ <div>
20
+ <p className="selector-description">{spaceName}</p>
21
+ <p className="selector-title">{name}</p>
22
+ </div>
18
23
  </Flex>
19
24
  }
20
25
 
21
26
  export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
22
- inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>, }) => {
27
+ inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
28
+ }) => {
23
29
  const chat = useCurrentChat()
24
30
  const isAgentEnabled = useCurrentChatState('features').agent
25
31
 
@@ -33,8 +39,10 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
33
39
  const isBuiltIn = agent.visibility_level === 'builtIn' || builtInsAgents.some((builtInAgent) => builtInAgent.id === agent.id)
34
40
  chat.set(
35
41
  'agent',
36
- { id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
37
- builtIn: isBuiltIn, visibility_level: agent.visibility_level },
42
+ {
43
+ id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
44
+ builtIn: isBuiltIn, visibility_level: agent.visibility_level,
45
+ },
38
46
  )
39
47
 
40
48
  if (!inputRef.current) return
@@ -47,6 +55,9 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
47
55
  const publicAgents = agentClient.publicAgents.useQuery({})
48
56
  const builtInsAgents = [...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))]
49
57
  const workspaceAgents = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'agent' })
58
+
59
+ const workspaceAgentsWithWorkspaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
60
+ agents?.map((agent) => ({ ...agent, spaceName: space_name }))) as AgentWithSpaceName[]
50
61
  let accountAgents: AgentResponse[] = []
51
62
  let sharedAgents: AgentResponse[] = []
52
63
  if (!isTrial) {
@@ -54,7 +65,7 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
54
65
  sharedAgents = agentClient.agents.useQuery({ visibility: 'SHARED' }) || []
55
66
  }
56
67
 
57
- return uniqBy([...personalAgents, ...workspaceAgents.agents, ...accountAgents, ...sharedAgents, ...builtInsAgents], 'id')
68
+ return uniqBy([...personalAgents, ...workspaceAgentsWithWorkspaceName, ...accountAgents, ...sharedAgents, ...builtInsAgents], 'id')
58
69
  }
59
70
 
60
71
  return <Selector
@@ -1,4 +1,4 @@
1
- import { ChevronRight, Circle, Code, KnowledgeSource, Send, Stack, Times } from '@citric/icons'
1
+ import { ChevronRight, Code, KnowledgeSource, Send, Spaces, Stack, Times } from '@citric/icons'
2
2
  import { IconButton } from '@citric/ui'
3
3
  import { listToClass } from '@stack-spot/portal-theme'
4
4
  import { useEffect, useRef } from 'react'
@@ -62,8 +62,8 @@ export const ButtonGroup = ({ onSend, onCancel, expanded, setExpanded, isLoading
62
62
  style={{ width: expanded ? featureButtonsWidth.current : 0 }}
63
63
  >
64
64
  {features.workspace && (
65
- <IconButton aria-label={t.space} title={t.space} onClick={() => widget.set('panel', 'workspace')}>
66
- <Circle />
65
+ <IconButton aria-label={t.spot} title={t.spot} onClick={() => widget.set('panel', 'workspace')}>
66
+ <Spaces />
67
67
  </IconButton>
68
68
  )}
69
69
  {features.knowledgeSource && (
@@ -1,11 +1,13 @@
1
1
  import { QuickCommand } from '@citric/icons'
2
2
  import { aiClient, workspaceAiClient } from '@stack-spot/portal-network'
3
- import { QuickCommandListResponse } from '@stack-spot/portal-network/api/ai'
3
+ import { QuickCommandResponse } from '@stack-spot/portal-network/api/ai'
4
4
  import { useCallback } from 'react'
5
5
  import { Selector } from '../../components/Selector'
6
6
  import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
7
7
  import { quickCommandRegex } from '../../regex'
8
8
 
9
+ type QuickCommandResponseWithSpaceName = QuickCommandResponse & { spaceName?: string }
10
+
9
11
  export const QuickCommandSelector = ({ inputRef, isTrial }:
10
12
  { isTrial: boolean, inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement> }) => {
11
13
  const chat = useCurrentChat()
@@ -65,7 +67,7 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
65
67
  }
66
68
  })
67
69
 
68
- const onSelectItem = useCallback((qc: QuickCommandListResponse) => {
70
+ const onSelectItem = useCallback((qc: QuickCommandResponseWithSpaceName) => {
69
71
  const newValue = `/${qc.slug}`
70
72
  chat.set('nextMessage', newValue)
71
73
 
@@ -77,11 +79,15 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
77
79
  const getQuickCommands = () => {
78
80
  const quickCommands = aiClient.quickCommands.useQuery({ order: 'a-to-z' })
79
81
  const quickCommandsFiltered = quickCommands.filter((qc) => qc.visibility_level.toLowerCase() !== 'workspace')
80
- const workspaceQuickCommands = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'quick_command' })
81
- return [...quickCommandsFiltered, ...workspaceQuickCommands.qcs]
82
+ const workspaceQuickCommands = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'quick_command' })
83
+ const workspaceQuickCommandsWithWorkspaceName: QuickCommandResponseWithSpaceName[] = workspaceQuickCommands
84
+ .flatMap(({ qcs, space_name }) => qcs?.map((qc) => ({ ...qc, spaceName: space_name }))) as QuickCommandResponseWithSpaceName[]
85
+
86
+ return [...quickCommandsFiltered, ...workspaceQuickCommandsWithWorkspaceName]
82
87
  }
83
88
 
84
- const QuickCommandItem = ({ slug, description }: QuickCommandListResponse) => <>
89
+ const QuickCommandItem = ({ slug, description, spaceName }: QuickCommandResponseWithSpaceName) => <>
90
+ <p className="selector-description">{spaceName}</p>
85
91
  <p className="selector-title">/{slug?.toUpperCase()}</p>
86
92
  <p className="selector-description">{description}</p>
87
93
  </>
@@ -4,8 +4,8 @@ const dictionary = {
4
4
  en: {
5
5
  stack: 'Select stack',
6
6
  code: 'Open code editor',
7
- workspace: 'Select workspace',
8
- space: 'Select space',
7
+ workspace: 'Select spot',
8
+ spot: 'Select spot',
9
9
  knowledgeSource: 'Select knowledge sources',
10
10
  agent: 'Select agent',
11
11
  collapse: 'Hide buttons',
@@ -15,7 +15,7 @@ const dictionary = {
15
15
  cancel: 'Cancel',
16
16
  removeConfig: 'Remove all the configuration',
17
17
  removeStack: 'Stop using the current stack',
18
- removeWorkspace: 'Stop using the current workspace',
18
+ removeWorkspace: 'Stop using the current spot',
19
19
  removeKS: 'Stop using this knowledge source',
20
20
  selected: 'Selected',
21
21
  removeSelection: 'Remove current code selection',
@@ -24,8 +24,8 @@ const dictionary = {
24
24
  pt: {
25
25
  stack: 'Selecionar stack',
26
26
  code: 'Abrir editor de código',
27
- workspace: 'Selecionar workspace',
28
- space: 'Select Space',
27
+ workspace: 'Selecionar spot',
28
+ spot: 'Selecionar spot',
29
29
  knowledgeSource: 'Selecionar knowledge sources',
30
30
  agent: 'Selecionar agente',
31
31
  collapse: 'Esconder botões',
@@ -35,7 +35,7 @@ const dictionary = {
35
35
  cancel: 'Cancelar',
36
36
  removeConfig: 'Remover todas as configurações',
37
37
  removeStack: 'Parar de usar a stack atual',
38
- removeWorkspace: 'Parar de usar o workspace atual',
38
+ removeWorkspace: 'Parar de usar o spot atual',
39
39
  removeKS: 'Parar de usar este knowledge source',
40
40
  selected: 'Selecionado',
41
41
  removeSelection: 'Desfazer seleção de código',
@@ -7,7 +7,7 @@ import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
7
7
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
8
8
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
9
9
  import { ButtonFavorite } from '../components/ButtonFavorite'
10
- import { NavigationItem } from '../components/ComponentNavigator'
10
+ import { NavigationComponent } from '../components/ComponentNavigator'
11
11
  import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup'
12
12
  import { IconInput } from '../components/IconInput'
13
13
  import { RightPanelTabs } from '../components/RightPanelTabs'
@@ -53,7 +53,7 @@ const StacksPanel = () => {
53
53
  { title: t.favorites, content: <StacksTab key="favorites" visibility="favorite" stack={stack} /> },
54
54
  { title: t.personal, content: <StacksTab key="personal" visibility="personal" stack={stack} /> },
55
55
  { title: t.shared, content: <StacksTab key="shared" visibility="shared" stack={stack} /> },
56
- { title: t.spaces, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
56
+ { title: t.spots, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
57
57
  { title: t.account, content: <StacksTab key="account" visibility="account" stack={stack} /> },
58
58
  ], [t, isTrial])
59
59
 
@@ -184,7 +184,7 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
184
184
  function StacksTabWorkspace({ stack, visibility, showSubmitButton }: StacksTabProps) {
185
185
  const workspaceTabComponents = useMemo(() => ({ stack: StacksTab }), [stack])
186
186
 
187
- const buildNavigateParams = (workspace: WorkspaceResponse): NavigationItem<typeof workspaceTabComponents> => ({
187
+ const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
188
188
  component: 'stack',
189
189
  props: { visibility, workspaceId: workspace.id, stack, showSubmitButton },
190
190
  })
@@ -205,7 +205,7 @@ const dictionary = {
205
205
  noData: 'There are no stacks in this category yet.',
206
206
  noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new stacks.',
207
207
  favorites: 'Favorites',
208
- spaces: 'Spaces',
208
+ spots: 'Spots',
209
209
  },
210
210
  pt: {
211
211
  title: 'Stacks AI',
@@ -219,6 +219,6 @@ const dictionary = {
219
219
  noData: 'Ainda não há stacks nesta categoria.',
220
220
  noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novas stacks.',
221
221
  favorites: 'Favoritos',
222
- spaces: 'Spaces',
222
+ spots: 'Spots',
223
223
  },
224
224
  } satisfies Dictionary
@@ -1,12 +1,13 @@
1
1
  import { Button, Flex, IconBox, Image, Text } from '@citric/core'
2
- import { Agent, Circle, KnowledgeSource, Stack } from '@citric/icons'
2
+ import { Agent, KnowledgeSource, Spaces, Stack } from '@citric/icons'
3
3
  import { Avatar } from '@citric/ui'
4
4
  import { workspaceAiClient } from '@stack-spot/portal-network'
5
5
  import { WorkspaceResponse, WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai'
6
6
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
7
7
  import { useTransition } from 'react'
8
8
  import { useComponentNavigation } from '../../components/ComponentNavigator'
9
- import { ListGroup } from '../../components/ListGroup'
9
+ import { Loading } from '../../components/FallbackBoundary/Loading'
10
+ import { ListResource } from '../../components/ListResource'
10
11
  import { CardSpace, WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
11
12
  import { ChatProperties } from '../../state/ChatState'
12
13
  import { AgentsTab } from '../Agents/AgentsTab'
@@ -16,14 +17,15 @@ import { StacksTab } from '../Stacks'
16
17
  const SpaceCard = ({ workspaceId }: { workspaceId: string }) => {
17
18
  const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId })
18
19
  return <Flex flexDirection="column" sx={{ gap: '8px' }}>
19
- <Flex alignItems="center" sx={{ gap: '4px' }}>
20
- {workspace.logo
21
- ? <Image src={workspace.logo} />
22
- : <Avatar size="xxs" appearance="square" sx={{ bg: 'light.500' }}><IconBox><Circle /></IconBox></Avatar>}
23
- <Text appearance="body2" weight="medium">{workspace.name} </Text>
20
+ <Flex flexDirection="column" sx={{ gap: '4px' }}>
21
+ <Flex alignContent="center" alignItems="center" sx={{ gap: '8px', m: 1 }} >
22
+ <Avatar size="xxs" appearance="square" sx={{ bg: 'light.600', r: 'xxs' }}>
23
+ {workspace.logo ? <Image src={workspace.logo} /> : <IconBox> <Spaces /> </IconBox>}
24
+ </Avatar>
25
+ <Text appearance="body2" weight="medium">{workspace.name} </Text>
26
+ </Flex>
27
+ <Text colorScheme="light.700">{workspace.description}</Text>
24
28
  </Flex>
25
-
26
- <Text colorScheme="light.700">{workspace.description}</Text>
27
29
  </Flex>
28
30
  }
29
31
 
@@ -70,13 +72,14 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }: Omit<Ta
70
72
 
71
73
  return (<>
72
74
  {workspaceId && <SpaceCard workspaceId={workspaceId} />}
73
- <ListGroup
74
- list={resourceTypes}
75
- keygen={w => w.id}
76
- onClick={(resource) => { handleNavigate(resource) }}
77
- renderLabel={r => <CardSpace name={r.displayName} icon={r.icon} onClick={() => handleNavigate(r)} />}
78
- style={{ gap: '6px', display: 'flex', flexDirection: 'column', opacity: isPending ? '0.5' : '1' }}
79
- />
75
+ {isPending ? <Loading /> :
76
+ <ListResource
77
+ list={resourceTypes}
78
+ keygen={w => w.id}
79
+ renderLabel={r => <CardSpace name={r.displayName} icon={r.icon} onClick={() => handleNavigate(r)} />}
80
+ style={{ gap: '6px', display: 'flex', flexDirection: 'column' }}
81
+ />
82
+ }
80
83
  </>
81
84
  )
82
85
  }
@@ -61,24 +61,15 @@ const WorkspacesPanel = () => {
61
61
 
62
62
  const dictionary = {
63
63
  en: {
64
- title: 'Spaces',
65
- description: 'By selecting a space, its Knowledge Sources (KSs), Agents, Quick Commands and Stacks Ai will be consulted to generate the answers.',
66
- apply: 'Apply',
64
+ title: 'Spot',
65
+ description: 'By selecting a spot, its Knowledge Sources (KSs), Agents, Quick Commands and Stacks Ai will be consulted to generate the answers.',
67
66
  noSearchResults: "Your search didn't yield results.",
68
- noSearchResultsDescription: 'Please, try another search term.',
69
- noData: 'There are no spaces yet.',
70
- noDataDescription: 'Use the AI portal to create new spaces.',
71
67
  all: 'All',
72
68
  favorites: 'Favorites',
73
69
  },
74
70
  pt: {
75
- title: 'Spaces',
76
- description: 'Ao selecionar um space, seus Knowledge Sources (KSs), Agentes, Quick Commands e Stacks Ai serão consultados para gerar as respostas.',
77
- apply: 'Aplicar',
78
- noSearchResults: 'Sua busca não produziu resultados',
79
- noSearchResultsDescription: 'Por favor, tente outra busca.',
80
- noData: 'Ainda não há spaces.',
81
- noDataDescription: 'Use o Portal AI para criar novos spaces.',
71
+ title: 'Spot',
72
+ description: 'Ao selecionar um spot, seus Knowledge Sources (KSs), Agentes, Quick Commands e Stacks Ai serão consultados para gerar as respostas.',
82
73
  all: 'Todos',
83
74
  favorites: 'Favoritos',
84
75
  },
@@ -1,46 +0,0 @@
1
- import { WithStyle } from '@stack-spot/portal-theme';
2
- interface ListGroupProps<T> extends WithStyle {
3
- /**
4
- * The list available.
5
- */
6
- list: T[];
7
- /**
8
- * A function that renders an option as a label. This can either return a string or a React Element.
9
- */
10
- renderLabel: (item: T) => React.ReactNode;
11
- /**
12
- * A function that renders an option as a description. This can either return a string or a React Element.
13
- */
14
- renderDescription?: (item: T) => React.ReactNode;
15
- /**
16
- * A function that renders a element before the content
17
- */
18
- renderBeforeElement?: (item: T) => React.ReactNode;
19
- /**
20
- * A function that renders a element after the content
21
- */
22
- renderAfterElement?: (item: T) => React.ReactNode;
23
- /**
24
- * A function that gives a custom className to the rendered option.
25
- */
26
- optionClassName?: (item: T) => string | undefined;
27
- /**
28
- * A function that gives a custom style to the rendered option.
29
- */
30
- optionStyle?: (item: T) => React.CSSProperties | undefined;
31
- /**
32
- * A function that generates a unique id for the option.
33
- */
34
- keygen: (item: T) => React.Key;
35
- /**
36
- * A function to call whenever the item click.
37
- */
38
- onClick: (item: T) => void;
39
- }
40
- /**
41
- * Renders a radio button group where each option has a label and a description.
42
- * The description in placed under the label and radio button as an accordion.
43
- */
44
- export declare function ListGroup<T>({ list, renderLabel, renderBeforeElement, renderAfterElement, className, keygen, style }: ListGroupProps<T>): import("react/jsx-runtime").JSX.Element;
45
- export {};
46
- //# sourceMappingURL=ListGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListGroup.d.ts","sourceRoot":"","sources":["../../src/components/ListGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAIpD,UAAU,cAAc,CAAC,CAAC,CAAE,SAAQ,SAAS;IAC3C;;OAEG;IACH,IAAI,EAAE,CAAC,EAAE,CAAC;IACV;;OAEG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACjD;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACnD;;OAEG;IACH,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAClD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IAClD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,EACE,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,2CAkB7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListGroup.js","sourceRoot":"","sources":["../../src/components/ListGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AA0C/B;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,EACE,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,KAAK,EAAqB;IAE5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChD,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;QACnC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,KAAK,GAAQ,CAAC,CAAC,CAAC,KAAK,CAAA;QAExE,OAAO,CACL,uBACE,MAAC,IAAI,IAAC,UAAU,EAAC,QAAQ,aACtB,mBAAmB,EAAE,CAAC,QAAQ,CAAC,EAC/B,OAAO,EACP,kBAAkB,EAAE,CAAC,QAAQ,CAAC,IAC1B,IALA,MAAM,CAAC,QAAQ,CAAC,CAMpB,CACN,CAAA;IACH,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEX,OAAO,KAAC,GAAG,IAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,YAAG,KAAK,GAAO,CAAA;AAC1F,CAAC"}
@@ -1,76 +0,0 @@
1
- import { Box, Flex, Text } from '@citric/core'
2
- import { WithStyle } from '@stack-spot/portal-theme'
3
- import { useMemo } from 'react'
4
-
5
-
6
- interface ListGroupProps<T> extends WithStyle {
7
- /**
8
- * The list available.
9
- */
10
- list: T[],
11
- /**
12
- * A function that renders an option as a label. This can either return a string or a React Element.
13
- */
14
- renderLabel: (item: T) => React.ReactNode,
15
- /**
16
- * A function that renders an option as a description. This can either return a string or a React Element.
17
- */
18
- renderDescription?: (item: T) => React.ReactNode,
19
- /**
20
- * A function that renders a element before the content
21
- */
22
- renderBeforeElement?: (item: T) => React.ReactNode,
23
- /**
24
- * A function that renders a element after the content
25
- */
26
- renderAfterElement?: (item: T) => React.ReactNode,
27
- /**
28
- * A function that gives a custom className to the rendered option.
29
- */
30
- optionClassName?: (item: T) => string | undefined,
31
- /**
32
- * A function that gives a custom style to the rendered option.
33
- */
34
- optionStyle?: (item: T) => React.CSSProperties | undefined,
35
- /**
36
- * A function that generates a unique id for the option.
37
- */
38
- keygen: (item: T) => React.Key,
39
- /**
40
- * A function to call whenever the item click.
41
- */
42
- onClick: (item: T) => void,
43
- }
44
-
45
- /**
46
- * Renders a radio button group where each option has a label and a description.
47
- * The description in placed under the label and radio button as an accordion.
48
- */
49
- export function ListGroup<T>(
50
- {
51
- list,
52
- renderLabel,
53
- renderBeforeElement,
54
- renderAfterElement,
55
- className,
56
- keygen,
57
- style }: ListGroupProps<T>,
58
- ) {
59
- const items = useMemo(() => list.map((listItem) => {
60
- const label = renderLabel(listItem)
61
- const content = typeof label === 'string' ? <Text>{label}</Text> : label
62
-
63
- return (
64
- <li key={keygen(listItem)}>
65
- <Flex alignItems="center">
66
- {renderBeforeElement?.(listItem)}
67
- {content}
68
- {renderAfterElement?.(listItem)}
69
- </Flex>
70
- </li>
71
- )
72
- }), [list])
73
-
74
- return <Box as="ul" m={0} p={0} w={12} style={style} className={className}>{items}</Box>
75
- }
76
-