Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
import { createContext, useContext } from 'react';
import { LocalMessageNode } from '@colanode/client/types';
import { NodeRole } from '@colanode/core';
interface ConversationContext {
id: string;
rootId: string;
role: NodeRole;
canCreateMessage: boolean;
onReply: (message: LocalMessageNode) => void;
onLastMessageIdChange: (id: string) => void;
canDeleteMessage: (message: LocalMessageNode) => boolean;
}
export const ConversationContext = createContext<ConversationContext>(
{} as ConversationContext
);
export const useConversation = () => useContext(ConversationContext);