mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 19:01:23 +02:00
Move inactive projects out of active workspace: - bauntown (community website) - maerchenzauber (AI story generation) - memoro (voice memo app) - news (news aggregation) - nutriphi (nutrition tracking) - reader (reading app) - uload (URL shortener) - wisekeep (AI wisdom extraction) Update CLAUDE.md documentation: - Add presi to active projects - Document archived projects section - Update workspace configuration Archived apps can be re-activated by moving back to apps/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import React, { createContext, useContext, ReactNode } from 'react';
|
|
import useSpaces from '../hooks/useSpaces';
|
|
import { Space, Memo, CreateSpaceRequest, UpdateSpaceRequest } from '../services/spaceService';
|
|
|
|
// Define the context shape
|
|
interface SpaceContextType {
|
|
spaces: Space[];
|
|
isLoading: boolean;
|
|
error: string | null;
|
|
fetchSpaces: () => Promise<void>;
|
|
createSpace: (spaceData: CreateSpaceRequest) => Promise<Space>;
|
|
updateSpace: (spaceId: string, spaceData: UpdateSpaceRequest) => Promise<Space>;
|
|
deleteSpace: (spaceId: string) => Promise<boolean>;
|
|
leaveSpace: (spaceId: string) => Promise<boolean>;
|
|
getSpace: (spaceId: string) => Promise<Space>;
|
|
getSpaceMemos: (spaceId: string) => Promise<Memo[]>;
|
|
linkMemoToSpace: (memoId: string, spaceId: string) => Promise<boolean>;
|
|
unlinkMemoFromSpace: (memoId: string, spaceId: string) => Promise<boolean>;
|
|
}
|
|
|
|
// Create the context
|
|
export const SpaceContext = createContext<SpaceContextType | undefined>(undefined);
|
|
|
|
// Create provider component
|
|
export const SpaceProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
|
|
const spacesMethods = useSpaces();
|
|
|
|
return <SpaceContext.Provider value={spacesMethods}>{children}</SpaceContext.Provider>;
|
|
};
|
|
|
|
// Custom hook to use the space context
|
|
export const useSpaceContext = () => {
|
|
const context = useContext(SpaceContext);
|
|
if (context === undefined) {
|
|
throw new Error('useSpaceContext must be used within a SpaceProvider');
|
|
}
|
|
return context;
|
|
};
|
|
|
|
export default SpaceProvider;
|