|
|
@@ -64,6 +64,7 @@ export default function ReviewPage() {
|
|
|
const [showComparePicker, setShowComparePicker] = useState(false);
|
|
|
const [projectAssets, setProjectAssets] = useState<Asset[]>([]);
|
|
|
const [compareMismatch, setCompareMismatch] = useState<string | null>(null);
|
|
|
+ const [compareComments, setCompareComments] = useState<Comment[]>([]);
|
|
|
const [playing, setPlaying] = useState(false);
|
|
|
|
|
|
const handleCompareSelect = useCallback((compareAssetArg: Asset) => {
|
|
|
@@ -84,12 +85,19 @@ export default function ReviewPage() {
|
|
|
}
|
|
|
setCompareAsset(compareAssetArg);
|
|
|
setCompareMode(true);
|
|
|
- }, [asset]);
|
|
|
+ // Fetch compare asset's own comments for per-video annotations
|
|
|
+ if (token) {
|
|
|
+ commentsApi.list(token, compareAssetArg.id).then(({ comments: cc }) => {
|
|
|
+ setCompareComments(cc);
|
|
|
+ }).catch(() => setCompareComments([]));
|
|
|
+ }
|
|
|
+ }, [asset, token]);
|
|
|
|
|
|
const handleExitCompare = useCallback(() => {
|
|
|
setCompareMode(false);
|
|
|
setCompareAsset(null);
|
|
|
setCompareMismatch(null);
|
|
|
+ setCompareComments([]);
|
|
|
}, []);
|
|
|
|
|
|
useEffect(() => {
|
|
|
@@ -371,6 +379,14 @@ export default function ReviewPage() {
|
|
|
(c.annotations ?? []).map(ann => ({ annotation: ann, timestamp: c.timestamp ?? 0 }))
|
|
|
);
|
|
|
|
|
|
+ // Annotations for the compare video — independent per-video data
|
|
|
+ const compareVisibleComments = compareComments.filter(c => !c.deleted && (showResolved || !c.resolved));
|
|
|
+ const compareVisibleAnnotations = compareVisibleComments
|
|
|
+ .filter(c => !c.deleted)
|
|
|
+ .flatMap(c =>
|
|
|
+ (c.annotations ?? []).map(ann => ({ annotation: ann, timestamp: c.timestamp ?? 0 }))
|
|
|
+ );
|
|
|
+
|
|
|
if (loading) {
|
|
|
return (
|
|
|
<div className="h-screen flex items-center justify-center" style={{ background: 'var(--bg)' }}>
|
|
|
@@ -613,8 +629,8 @@ export default function ReviewPage() {
|
|
|
src={compareAsset.hlsPath ? `${API_BASE}/uploads${compareAsset.hlsPath}` : `${API_BASE}/uploads/${compareAsset.filePath}`}
|
|
|
mimeType={compareAsset.mimeType}
|
|
|
fps={compareAsset.fps ?? 30}
|
|
|
- comments={[]}
|
|
|
- visibleAnnotations={[]}
|
|
|
+ comments={compareComments}
|
|
|
+ visibleAnnotations={compareVisibleAnnotations}
|
|
|
drawMode={false}
|
|
|
drawTool={drawTool}
|
|
|
drawColor={drawColor}
|