Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(tags): folder row tag placement, folders tag facet, chat properties side panel (#4611)

gbirman0f181cd0a3e5
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
index e96acf234f..20807fddee 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
@@ -465,9 +465,9 @@ export function useSearchFacets(
},
});
- // Tags show only where tagging applies (all/documents/tasks/emails/agents),
- // gated behind both the broad tags flag and the search-view rollout flag,
- // and hidden when the caller has no tags defined.
+ // Tags show only where tagging applies (all/documents/tasks/emails/agents/
+ // folders), gated behind both the broad tags flag and the search-view
+ // rollout flag, and hidden when the caller has no tags defined.
const tagFacets = (): SearchFacetVM[] =>
searchTags() && tagSource.enabled() && tagSource.hasTags() ? [tags] : [];
@@ -492,6 +492,7 @@ export function useSearchFacets(
];
case 'document-or-file':
case 'agent':
+ case 'folders':
case 'all':
return [type, ...tagFacets()];
default:
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-filters-state.ts b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-filters-state.ts
index 5cd66a83f6..3a59181d0a 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-filters-state.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-filters-state.ts
@@ -26,14 +26,15 @@ export type SearchIndexId =
export type SearchTypeValue = SearchIndexId | 'all';
/** Search types where tag filtering applies: documents/tasks, emails, chats,
- * plus the mixed `all` view (tags there narrow the taggable result types and
- * leave the rest untouched). */
+ * folders, plus the mixed `all` view (tags there narrow the taggable result
+ * types and leave the rest untouched). */
export const TAG_SEARCH_TYPES = new Set<SearchTypeValue>([
'all',
'task',
'document-or-file',
'email',
'agent',
+ 'folders',
]);
/**
diff --git a/js/app/packages/app/component/side-panel/FileSidePanelSections.tsx b/js/app/packages/app/component/side-panel/FileSidePanelSections.tsx
index 43ea00f9fa..954fc9a988 100644
--- a/js/app/packages/app/component/side-panel/FileSidePanelSections.tsx
+++ b/js/app/packages/app/component/side-panel/FileSidePanelSections.tsx
@@ -108,7 +108,7 @@ function DetailsSectionContent() {
);
}
-function FolderLink(props: { projectId: string; projectName: string }) {
+export function FolderLink(props: { projectId: string; projectName: string }) {
const open = createCallback((e: MouseEvent) => {
openDocument('project', props.projectId, undefined, !e.shiftKey);
});
@@ -129,7 +129,7 @@ function FolderLink(props: { projectId: string; projectName: string }) {
);
}
-function OwnerValue(props: { ownerId: string }) {
+export function OwnerValue(props: { ownerId: string }) {
const [displayName] = useDisplayName(tryMacroId(props.ownerId));
return (
@@ -140,7 +140,7 @@ function OwnerValue(props: { ownerId: string }) {
);
}
-function DateValueDisplay(props: { value: DateValue }) {
+export function DateValueDisplay(props: { value: DateValue }) {
return (
<SidePanel.Pill>
<span class="truncate">
diff --git a/js/app/packages/app/component/side-panel/index.ts b/js/app/packages/app/component/side-panel/index.ts
index dde6c74d63..eb8b589a58 100644
--- a/js/app/packages/app/component/side-panel/index.ts
+++ b/js/app/packages/app/component/side-panel/index.ts
@@ -1,8 +1,11 @@
export type {} from './context';
export {
+ DateValueDisplay,
FileDetailsSection,
FilePropertiesSection,
FileSidePanelSections,
+ FolderLink,
+ OwnerValue,
} from './FileSidePanelSections';
export {
GithubPullRequestChecksContent,
diff --git a/js/app/packages/block-chat/component/Block.tsx b/js/app/packages/block-chat/component/Block.tsx
index 3c9dbb5da2..5ef2e25f68 100644
--- a/js/app/packages/block-chat/component/Block.tsx
+++ b/js/app/packages/block-chat/component/Block.tsx
@@ -1,5 +1,6 @@
import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
import { useBlockEntityCommands } from '@app/component/next-soup/actions';
+import { SidePanel } from '@app/component/side-panel';
import { DEFAULT_CHAT_NAME } from '@block-chat/definition';
import { useBlockId } from '@core/block';
import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';
@@ -9,6 +10,7 @@ import { Show } from 'solid-js';
import { chatBlockData } from '../signal/chatBlockData';
import { Chat } from './Chat';
import { ModalsProvider } from './ModalsProvider';
+import { ChatSidePanelSections } from './sidepanel/ChatSidePanelSections';
export default function ChatBlock() {
useBlockEntityCommands();
@@ -24,7 +26,12 @@ export default function ChatBlock() {
entity={{ type: 'chat', id: blockId }}
/>
<ModalsProvider>
- <Show when={chatBlockData()}>{(data) => <Chat data={data()} />}</Show>
+ <SidePanel.Layout defaultOpen={false}>
+ <ChatSidePanelSections />
+ <Show when={chatBlockData()}>
+ {(data) => <Chat data={data()} />}
+ </Show>
+ </SidePanel.Layout>
</ModalsProvider>
</div>
</DocumentBlockContainer>
diff --git a/js/app/packages/block-chat/component/sidepanel/ChatSidePanelSections.tsx b/js/app/packages/block-chat/component/sidepanel/ChatSidePanelSections.tsx
new file mode 100644
index 0000000000..9549b387eb
--- /dev/null
+++ b/js/app/packages/block-chat/component/sidepanel/ChatSidePanelSections.tsx
@@ -0,0 +1,97 @@
+import {
+ DateValueDisplay,
+ FolderLink,
+ OwnerValue,
+ SidePanel,
+} from '@app/component/side-panel';
+import { EntityPropertiesSection } from '@app/component/side-panel/properties';
+import { useBlockId } from '@core/block';
+import { useCanEdit } from '@core/signal/permissions';
+import { useChatDataQuery } from '@queries/cognition/chat-data';
+import { useProjectDataQuery } from '@queries/storage/project-data';
+import { createMemo, Show, Suspense } from 'solid-js';
+
+export function ChatSidePanelSections() {
+ const chatId = useBlockId();
+ const canEdit = useCanEdit();
+
+ return (
+ <>
+ <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ <Suspense fallback={<SidePanel.Loading />}>
+ <ChatDetailsContent chatId={chatId} />
+ </Suspense>
+ </SidePanel.Section>
+ <SidePanel.Section
+ id="properties"
+ title="Properties"
+ defaultOpen
+ order={20}
+ >
+ <Suspense fallback={<SidePanel.Loading />}>
+ <ChatPropertiesContent chatId={chatId} canEdit={canEdit()} />
+ </Suspense>
+ </SidePanel.Section>
+ </>
+ );
+}
+
+function ChatDetailsContent(props: { chatId: string }) {
+ const query = useChatDataQuery(() => props.chatId);
+ const chat = createMemo(() => query.data);
+ const projectQuery = useProjectDataQuery(
+ () => chat()?.projectId ?? undefined
+ );
+
+ return (
+ <SidePanel.Grid>
+ <Show when={chat()?.userId}>
+ {(ownerId) => (
+ <SidePanel.Row label="Owner">
+ <OwnerValue ownerId={ownerId()} />
+ </SidePanel.Row>
+ )}
+ </Show>
+ <Show
+ when={(() => {
+ const id = chat()?.projectId;
+ const name = projectQuery.data?.name;
+ return id && name ? { id, name } : undefined;
+ })()}
+ >
+ {(folder) => (
+ <SidePanel.Row label="Folder">
+ <FolderLink projectId={folder().id} projectName={folder().name} />
+ </SidePanel.Row>
+ )}
+ </Show>
+ <Show when={chat()?.createdAt}>
+ {(created) => (
+ <SidePanel.Row label="Created">
+ <DateValueDisplay value={created()} />
+ </SidePanel.Row>
+ )}
+ </Show>
+ <Show when={chat()?.updatedAt}>
+ {(updated) => (
+ <SidePanel.Row label="Last updated">
+ <DateValueDisplay value={updated()} />
+ </SidePanel.Row>
+ )}
+ </Show>
+ </SidePanel.Grid>
+ );
+}
+
+function ChatPropertiesContent(props: { chatId: string; canEdit: boolean }) {
+ const query = useChatDataQuery(() => props.chatId);
+
+ return (
+ <EntityPropertiesSection
+ entityId={props.chatId}
+ entityType="CHAT"
+ canEdit={props.canEdit}
+ documentName={query.data?.name}
+ />
+ );
+}
diff --git a/js/app/packages/core/component/DetailsDrawer.tsx b/js/app/packages/core/component/DetailsDrawer.tsx
index 34ec76e799..9973a5c415 100644
--- a/js/app/packages/core/component/DetailsDrawer.tsx
+++ b/js/app/packages/core/component/DetailsDrawer.tsx
@@ -1,9 +1,7 @@
-import { EntityPropertiesSection } from '@app/component/side-panel/properties';
import { SplitDrawer } from '@app/component/split-layout/components/SplitDrawer';
import { EntityIcon } from '@core/component/EntityIcon';
import { openDocument } from '@core/component/LexicalMarkdown/component/core/BlockLink';
import { UserIcon } from '@core/component/UserIcon';
-import { useCanEdit } from '@core/signal/permissions';
import { tryMacroId, useDisplayName } from '@core/user';
import { type DateValue, formatDate } from '@core/util/date';
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
@@ -86,29 +84,18 @@ function ChatDetails(props: { chatId: string }) {
const projectQuery = useProjectDataQuery(
() => chat()?.projectId ?? undefined
);
- const canEdit = useCanEdit();
return (
- <>
- <DetailsGrid
- owner={() => chat()?.userId}
- folder={() => {
- const id = chat()?.projectId;
- const name = projectQuery.data?.name;
- return id && name ? { id, name } : undefined;
- }}
- createdAt={() => chat()?.createdAt}
- updatedAt={() => chat()?.updatedAt}
- />
- <div class="px-2 py-2">
- <EntityPropertiesSection
- entityId={props.chatId}
- entityType="CHAT"
- canEdit={canEdit()}
- documentName={chat()?.name}
- />
- </div>
- </>
+ <DetailsGrid
+ owner={() => chat()?.userId}
+ folder={() => {
+ const id = chat()?.projectId;
+ const name = projectQuery.data?.name;
+ return id && name ? { id, name } : undefined;
+ }}
+ createdAt={() => chat()?.createdAt}
+ updatedAt={() => chat()?.updatedAt}
+ />
);
}
diff --git a/js/app/packages/entity/src/composed/list-entity/wide-layout.tsx b/js/app/packages/entity/src/composed/list-entity/wide-layout.tsx
index cb5edba398..52ccfb9142 100644
--- a/js/app/packages/entity/src/composed/list-entity/wide-layout.tsx
+++ b/js/app/packages/entity/src/composed/list-entity/wide-layout.tsx
@@ -155,6 +155,19 @@ export function WideLayout(props: LayoutProps) {
</Switch>
</Entity.Slot>
<Entity.Slot placement="meta" class="flex items-center gap-2">
+ <Show
+ when={
+ rowTagsVisible() && isProjectEntity(props.entity) && props.entity
+ }
+ >
+ {(entity) => (
+ <RowTags
+ entityId={entity().id}
+ entityType={EntityType.PROJECT}
+ properties={entity().properties}
+ />
+ )}
+ </Show>
<Show when={isProjectContainedEntity(props.entity) && props.entity}>
{(entity) => (
<span class="ph-no-capture text-ink-extra-muted text-xs">
@@ -224,19 +237,6 @@ export function WideLayout(props: LayoutProps) {
/>
)}
</Show>
- <Show
- when={
- rowTagsVisible() && isProjectEntity(props.entity) && props.entity
- }
- >
- {(entity) => (
- <RowTags
- entityId={entity().id}
- entityType={EntityType.PROJECT}
- properties={entity().properties}
- />
- )}
- </Show>
<Show
when={rowTagsVisible() && isChatEntity(props.entity) && props.entity}
>