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.

1.3 KB
Raw Blame
import { EntityConversation } from '@core/messages/EntityConversation';
import { buildSimpleEntityUrl } from '@core/util/url';
import { createMemo, createSignal } from 'solid-js';
import { projectRouteId } from './core/route';

/** Projects use the same unanchored discussion and composer as task detail. */
export function ProjectDiscussion(props: {
  projectId: string;
  canWrite: boolean;
  targetId?: string;
  targetRequestKey?: string | number;
}) {
  const targetId = createMemo(() => props.targetId);
  const targetRequest = createMemo(() => ({
    id: targetId(),
    key: props.targetRequestKey,
  }));
  const [clearedTarget, setClearedTarget] =
    createSignal<ReturnType<typeof targetRequest>>();

  return (
    <EntityConversation
      parent={{ type: 'initiative', id: props.projectId }}
      canWrite={props.canWrite}
      targetId={props.targetId}
      targetRequestKey={props.targetRequestKey}
      targetCleared={clearedTarget() === targetRequest()}
      onClearTarget={() => setClearedTarget(targetRequest())}
      buildLink={(message) =>
        buildSimpleEntityUrl({
          type: 'component',
          id: projectRouteId({
            id: props.projectId,
            section: 'overview',
            discussionId: message.id,
          }),
        })
      }
    />
  );
}