Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

784 B
Raw Blame
import type { BoardId } from 'features/gallery/store/types';
import { getDateFromVirtualBoardId, isVirtualBoardId } from 'features/gallery/store/types';
import { t } from 'i18next';
import { useListAllBoardsQuery } from 'services/api/endpoints/boards';

export const useBoardName = (board_id: BoardId) => {
  const { boardName } = useListAllBoardsQuery(
    { include_archived: true },
    {
      selectFromResult: ({ data }) => {
        if (isVirtualBoardId(board_id)) {
          return { boardName: getDateFromVirtualBoardId(board_id) };
        }
        const selectedBoard = data?.find((b) => b.board_id === board_id);
        const boardName = selectedBoard?.board_name || t('boards.uncategorized');

        return { boardName };
      },
    }
  );

  return boardName;
};