making progress
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import { useParams, Link } from 'react-router-dom'
|
||||
import { usePR } from '../api/queries/prs'
|
||||
import { useRepoDiff } from '../api/queries/repos'
|
||||
import { DiffViewer } from '../components/diff/DiffViewer'
|
||||
import { MobileComment } from '../components/diff/MobileComment'
|
||||
import { Skeleton } from '../ui/Skeleton'
|
||||
@@ -9,6 +10,11 @@ import { cn } from '../lib/utils'
|
||||
export default function PRDetailPage() {
|
||||
const { owner = '', repo = '', prId = '' } = useParams<{ owner: string; repo: string; prId: string }>()
|
||||
const { data: pr, isLoading, isError } = usePR(owner, repo, parseInt(prId, 10))
|
||||
const { data: diffs } = useRepoDiff(
|
||||
owner, repo,
|
||||
pr?.targetBranch ?? '',
|
||||
pr?.sourceBranch ?? '',
|
||||
)
|
||||
const [comment, setComment] = useState<{ file: string; line: number } | null>(null)
|
||||
|
||||
if (isLoading) {
|
||||
@@ -73,8 +79,7 @@ export default function PRDetailPage() {
|
||||
Files changed
|
||||
</h2>
|
||||
|
||||
{/* Demo diff — real diff loads when repo has commits on both branches */}
|
||||
<DiffViewer files={DEMO_DIFF} />
|
||||
<DiffViewer files={diffs ?? []} />
|
||||
</div>
|
||||
|
||||
{/* Mobile comment sheet */}
|
||||
@@ -88,22 +93,3 @@ export default function PRDetailPage() {
|
||||
)
|
||||
}
|
||||
|
||||
// Demo diff to show the component before real git data is available
|
||||
const DEMO_DIFF = [
|
||||
{
|
||||
path: 'README.md',
|
||||
additions: 6,
|
||||
deletions: 1,
|
||||
patch: `@@ -1,3 +1,8 @@
|
||||
-# Project
|
||||
+# My Project
|
||||
+
|
||||
+A sovereign, federated git collaboration platform.
|
||||
+
|
||||
+## Features
|
||||
+- Fast Go backend
|
||||
+- React 18 frontend
|
||||
+- ActivityPub federation
|
||||
`,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user