Skip to content

Commit 7ccaf73

Browse files
committed
feat(RepoFileTree): add fallback documentation display with repo name
- Add selectedRepo prop to component destructuring for dynamic repo name display - Implement fallback markdown content when README/LICENSE files are missing or empty - Display generated heading with repo name and "No Documentation Yet" message - Replace plain text fallback UI with styled markdown-rendered content - Normalize repo name by removing .git suffix for cleaner display - Improve UX by showing consistent documentation placeholder across all states
1 parent 94d2e96 commit 7ccaf73

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

apps/frontend/src/pages/repo/components/RepoFileTree.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface RepoFileTreeProps {
2727

2828
export const RepoFileTree: FC<RepoFileTreeProps> = (props) => {
2929
const {
30+
selectedRepo,
3031
fileTree,
3132
branchOrCommit,
3233
branches,
@@ -150,15 +151,15 @@ export const RepoFileTree: FC<RepoFileTreeProps> = (props) => {
150151
const target = docTab === "readme" ? readmeFile : licenseFile;
151152

152153
if (!target) {
153-
// No README/LICENSE in tree yet — show skeleton while tree is loading, otherwise show message
154+
// No README/LICENSE in tree yet — show skeleton while tree is loading, otherwise show fallback
154155
if (isLoading) return <LoadingSkeleton />;
156+
157+
const fallbackContent = `# ${(selectedRepo || "Project").replace(/\.git$/, "")}\n\nNo Documentation Yet.`;
155158
return (
156-
<div className="bg-app-surface border border-app-border rounded-lg p-8 text-center">
157-
<p className="text-text-tertiary text-sm">
158-
{docTab === "readme"
159-
? "No README.md found"
160-
: "No LICENSE found"}
161-
</p>
159+
<div className="bg-app-surface border border-app-border rounded-lg p-6">
160+
<div className="markdown-body overflow-auto">
161+
<ReactMarkdown>{fallbackContent}</ReactMarkdown>
162+
</div>
162163
</div>
163164
);
164165
}
@@ -170,10 +171,15 @@ export const RepoFileTree: FC<RepoFileTreeProps> = (props) => {
170171
return <LoadingSkeleton />;
171172
}
172173

174+
const displayContent =
175+
content && content.trim()
176+
? content
177+
: `# ${(selectedRepo || "Project").replace(/\.git$/, "")}\n\nNo Documentation Yet.`;
178+
173179
return (
174180
<div className="bg-app-surface border border-app-border rounded-lg p-6">
175181
<div className="markdown-body overflow-auto">
176-
<ReactMarkdown>{content}</ReactMarkdown>
182+
<ReactMarkdown>{displayContent}</ReactMarkdown>
177183
</div>
178184
</div>
179185
);

0 commit comments

Comments
 (0)