CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { colors } from '../theme/colors';
import { fontSizes, fontWeights, fonts } from '../theme/typography';
import { type Commit } from '../api/client';
interface Props {
commit: Commit;
}
function timeAgo(dateStr: string): string {
const diff = Date.now() - new Date(dateStr).getTime();
const minutes = Math.floor(diff / 60000);
if (minutes < 60) return `${minutes}m ago`;
const hours = Math.floor(minutes / 60);
if (hours < 24) return `${hours}h ago`;
const days = Math.floor(hours / 24);
if (days < 30) return `${days}d ago`;
return `${Math.floor(days / 30)}mo ago`;
}
export function CommitRow({ commit }: Props) {
const shortSha = commit.sha.slice(0, 7);
const subject = commit.message.split('\n')[0];
return (
<View style={styles.row}>
<View style={styles.content}>
<Text style={styles.message} numberOfLines={2}>
{subject}
</Text>
<View style={styles.meta}>
<Text style={styles.sha}>{shortSha}</Text>
<Text style={styles.author}>{commit.author.name}</Text>
<Text style={styles.time}>{timeAgo(commit.author.date)}</Text>
</View>
</View>
</View>
);
}
const styles = StyleSheet.create({
row: {
padding: 12,
borderBottomWidth: 1,
borderBottomColor: colors.border,
},
content: {
gap: 4,
},
message: {
color: colors.text,
fontSize: fontSizes.sm,
fontWeight: fontWeights.regular,
lineHeight: 18,
},
meta: {
flexDirection: 'row',
alignItems: 'center',
gap: 8,
},
sha: {
color: colors.accent,
fontSize: fontSizes.xs,
fontFamily: fonts.mono,
fontWeight: fontWeights.medium,
},
author: {
color: colors.textMuted,
fontSize: fontSizes.xs,
},
time: {
color: colors.textMuted,
fontSize: fontSizes.xs,
},
});
|