This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

115 lines
3.4 KiB
TypeScript

import { useMutation } from '@apollo/react-hooks';
import React, { useContext, useRef, useState } from 'react';
import { KeyboardAvoidingView, Platform, ScrollView, StyleSheet } from 'react-native';
import Feather from 'react-native-vector-icons/Feather';
import { useNavigation } from 'react-navigation-hooks';
import { Asset, IconSizes, Routes, Errors } from '@app/constants';
import { AppContext } from '@app/context';
import { MUTATION_CREATE_POST } from '@app/graphql/mutation';
import { Button, FormInput, Header } from '@app/layout';
import { ThemeStatic } from '@app/theme';
import { ThemeColors } from '@app/types/theme';
import { uploadToStorage, crashlytics } from '@app/utils/firebase';
import { inputLimitErrorNotification, noAssetInfoNotification, postUploadedNotification, uploadErrorNotification } from '@app/utils/notifications';
import UploadBanner from './components/UploadBanner';
const UploadScreen: React.FC = () => {
const { user, theme } = useContext(AppContext);
const { navigate } = useNavigation();
const [pickedAsset, setPickedAsset] = useState('');
const [caption, setCaption] = useState('');
const [isUploading, setIsUploading] = useState(false);
const [createPost] = useMutation(MUTATION_CREATE_POST);
const captionInputRef = useRef();
const uploadImage = async () => {
if (!pickedAsset) {
noAssetInfoNotification();
return;
}
if (caption.length > 200) {
inputLimitErrorNotification('Caption', 'less', 200);
return;
}
try {
setIsUploading(true);
const { downloadURL: uri } = await uploadToStorage(Asset.post, pickedAsset, user.id);
const { data: { createPost: { id: postId } } } = await createPost({
variables: {
userId: user.id,
uri,
caption
}
});
setIsUploading(false);
setPickedAsset('')
setCaption('');
// @ts-ignore
captionInputRef.current.clear();
postUploadedNotification();
navigate(Routes.PostViewScreen, { postId });
} catch ({ message }) {
setIsUploading(false);
uploadErrorNotification('Post');
crashlytics.recordCustomError(Errors.ASSET_UPLOAD, message);
}
};
const Icon = () => <Feather
name='upload-cloud'
color={ThemeStatic.white}
size={IconSizes.x5}
/>;
const keyboardBehavior = Platform.OS === 'ios' ? 'padding' : undefined;
return (
<KeyboardAvoidingView behavior={keyboardBehavior} style={styles(theme).container}>
<Header title='Upload' />
<ScrollView showsVerticalScrollIndicator={false} style={styles().content}>
<UploadBanner pickedAsset={pickedAsset} onAsset={setPickedAsset} />
<FormInput
ref={captionInputRef}
multiline
label='Caption'
placeholder='Write a caption...'
value={caption}
onChangeText={setCaption}
characterRestriction={200}
/>
<Button
Icon={Icon}
label='Upload'
onPress={uploadImage}
loading={isUploading}
containerStyle={styles().uploadButton}
/>
</ScrollView>
</KeyboardAvoidingView>
);
};
const styles = (theme = {} as ThemeColors) => StyleSheet.create({
container: {
flex: 1,
backgroundColor: theme.base
},
content: {
flex: 1,
paddingHorizontal: 20
},
uploadButton: {
marginVertical: 20,
marginBottom: 40
}
});
export default UploadScreen;