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 {
DatabaseNameFieldAttributes,
FieldAttributes,
NodeRole,
} from '@colanode/core';
interface DatabaseContext {
id: string;
name: string;
nameField: DatabaseNameFieldAttributes | null | undefined;
fields: FieldAttributes[];
canEdit: boolean;
isLocked: boolean;
canCreateRecord: boolean;
role: NodeRole;
rootId: string;
toggleLock: () => void;
}
export const DatabaseContext = createContext<DatabaseContext>(
{} as DatabaseContext
);
export const useDatabase = () => useContext(DatabaseContext);