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.

894 B
Raw Blame
import type { ThreadId } from '@core/comments/commentType';
import { createMemo, createSelector } from 'solid-js';
import { usePdfComments } from '../../context/pdf-comments-context';
import { useFreeComments } from './freeComments';
import { useHighlightComments } from './highlightComments';

export const useIsActiveThreadSelector = () => {
  const isSelected = createSelector(
    usePdfComments().activeThreadId,
    (id: ThreadId | null, activeId) => {
      if (id == null) return false;
      return id === activeId;
    }
  );
  return isSelected;
};

export function usePdfCommentProjection() {
  const highlightComments = useHighlightComments();
  const freeComments = useFreeComments();
  return createMemo(() => [...highlightComments(), ...freeComments()]);
}

export const useHasComments = () => {
  const comments = usePdfComments().all;
  return () => comments().length > 0;
};