caelum0x f80b04ae0f feat(ritgram): move GitGram app into railyard as Ritgram, next to Rithub
Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram).
AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan.
Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 04:18:46 +03:00

82 lines
1.9 KiB
TypeScript

import React, { useContext } from 'react';
import { StyleSheet, Text, FlatList } from 'react-native';
import { AppContext } from '@app/context';
import { ListEmptyComponent } from '@app/layout';
import { Typography } from '@app/theme';
import { ThemeColors } from '@app/types/theme';
import CommentCard from './CommentCard';
import { Comment } from '@app/types/screens';
const { FontWeights, FontSizes } = Typography;
interface CommentsProps {
postId: string,
comments: Comment[]
};
const Comments: React.FC<CommentsProps> = ({ postId, comments }) => {
const { theme } = useContext(AppContext);
const renderItem = ({ item }) => {
const {
id: commentId,
author: {
id: authorId,
avatar,
handle
},
body,
createdAt
} = item;
return (
<CommentCard
postId={postId}
commentId={commentId}
authorId={authorId}
avatar={avatar}
handle={handle}
body={body}
time={createdAt}
/>
);
};
const ListHeaderComponent = () => <Text style={[styles(theme).commentsHeader, { marginBottom }]}>Comments</Text>
const marginBottom = comments.length === 0 ? 0 : 20;
return (
<FlatList
bounces={false}
showsVerticalScrollIndicator={false}
ListHeaderComponent={ListHeaderComponent}
data={comments}
renderItem={renderItem}
style={styles().listStyle}
ListEmptyComponent={() =>
<ListEmptyComponent
placeholder='Be the first one to comment'
placeholderStyle={styles().placeholderStyle}
spacing={10}
/>
}
/>
);
};
const styles = (theme = {} as ThemeColors) => StyleSheet.create({
commentsHeader: {
...FontWeights.Regular,
...FontSizes.Body,
color: theme.text01
},
listStyle: {
marginBottom: 10
},
placeholderStyle: {
...FontSizes.Body
}
});
export default Comments;