Deep-audit + build-out across all products to fully-usable state; all typecheck clean. - gitgram-web (99): wire Store feature to real endpoints, close 9 gaps - gitgram-backend (100): close 8 flow gaps, document infra-provisioning items - gitgram-mobile (90): fix API base-URL/path mismatch (404s) + copy proximity components into components/proximity wired to real screens; 15 gaps, +react-native-svg - aitm-core (95): wire natural-language CLI flow end-to-end; 11 gaps - aitm-api (97): fix teams metadata runtime bug; copy a2a-js server/client/grpc into src/a2a and wire A2A route; crates.io package search; 8 gaps - aitm-mcp (100): fix A2A client/server card mismatch; 9 gaps - aitm-website (95): build missing docs routes; 9 gaps Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
93 lines
2.5 KiB
TypeScript
93 lines
2.5 KiB
TypeScript
import React, { useCallback, useEffect, useState } from 'react';
|
|
import { View, StyleSheet } from 'react-native';
|
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
|
import { Colors } from '../../../constants/Colors';
|
|
import Header from '../../../components/navigation/Header';
|
|
import LoadingSpinner from '../../../components/common/LoadingSpinner';
|
|
import EmptyState from '../../../components/common/EmptyState';
|
|
import StoryViewer from '../../../components/Story/StoryViewer';
|
|
import { storyService } from '../../../services/storyService';
|
|
import { logger } from '../../../utils/logger';
|
|
|
|
interface Story {
|
|
id: string;
|
|
mediaType: string;
|
|
mediaUrl: string;
|
|
user: {
|
|
id: string;
|
|
username: string;
|
|
avatar?: string;
|
|
};
|
|
}
|
|
|
|
export default function HighlightViewerScreen() {
|
|
const router = useRouter();
|
|
const { id } = useLocalSearchParams<{ id: string }>();
|
|
const [stories, setStories] = useState<Story[]>([]);
|
|
const [title, setTitle] = useState('Highlight');
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
const load = useCallback(async () => {
|
|
if (!id) return;
|
|
setError(null);
|
|
setLoading(true);
|
|
try {
|
|
const response = await storyService.getHighlight(id);
|
|
const highlight = response.highlight || response;
|
|
setTitle(highlight.name || 'Highlight');
|
|
setStories(highlight.stories || []);
|
|
} catch (err) {
|
|
logger.error('Load highlight error:', err);
|
|
setError('This highlight is unavailable.');
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
}, [id]);
|
|
|
|
useEffect(() => {
|
|
load();
|
|
}, [load]);
|
|
|
|
if (loading) {
|
|
return (
|
|
<View style={styles.container}>
|
|
<Header title={title} />
|
|
<LoadingSpinner fullScreen />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
if (error || stories.length === 0) {
|
|
return (
|
|
<View style={styles.container}>
|
|
<Header title={title} />
|
|
<EmptyState
|
|
icon="📭"
|
|
title="Nothing to show"
|
|
message={error || 'This highlight has no stories yet.'}
|
|
actionLabel="Go back"
|
|
onAction={() => router.back()}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<View style={styles.viewer}>
|
|
<StoryViewer stories={stories} initialIndex={0} onClose={() => router.back()} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
},
|
|
viewer: {
|
|
flex: 1,
|
|
backgroundColor: '#000',
|
|
},
|
|
});
|