managarten/apps-archived/memoro/apps/mobile/features/spaces/contexts/SpaceContext.tsx
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
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>
2025-11-29 07:03:59 +01:00

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;