vchikalkin 0b188ee5ed refactor(contacts): rename masters to invited and update related functionality
- Changed the terminology from "masters" to "invited" and "invitedBy" across the codebase for clarity and consistency.
- Updated the `addContact` function to reflect the new naming convention.
- Refactored API actions and server methods to support the new invited structure.
- Adjusted components and hooks to utilize the updated invited data, enhancing user experience and simplifying logic.
2025-09-08 13:42:30 +03:00

18 lines
616 B
TypeScript

'use client';
import { createContext, type PropsWithChildren, useMemo, useState } from 'react';
export type FilterType = 'all' | 'invited' | 'invitedBy';
type ContextType = { filter: FilterType; setFilter: (filter: FilterType) => void };
export const ContactsContext = createContext<ContextType>({} as ContextType);
export function ContactsContextProvider({ children }: Readonly<PropsWithChildren>) {
const [filter, setFilter] = useState<FilterType>('all');
const value = useMemo(() => ({ filter, setFilter }), [filter, setFilter]);
return <ContactsContext value={value}>{children}</ContactsContext>;
}