Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit faff9e2

Browse files
committed
fix: add the new prompt to generate .context files
1 parent abb5c7f commit faff9e2

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed

examples/context-editor/src/App.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ body {
6363
overflow-y: auto;
6464
}
6565

66+
/* New styles for links */
67+
.link-section {
68+
margin-bottom: 1rem;
69+
}
70+
71+
.link-section a {
72+
color: #1976d2;
73+
text-decoration: none;
74+
transition: color 0.3s ease;
75+
}
76+
77+
.link-section a:hover {
78+
color: #0f4c8a;
79+
text-decoration: underline;
80+
}
81+
6682
@media (max-width: 600px) {
6783
.header {
6884
flex-direction: column;

examples/context-editor/src/App.tsx

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const App: React.FC = () => {
2323
const [generatedContent, setGeneratedContent] = useState('');
2424
const [snackbarOpen, setSnackbarOpen] = useState(false);
2525
const [snackbarMessage, setSnackbarMessage] = useState('');
26+
const [promptModalOpen, setPromptModalOpen] = useState(false);
27+
const [promptContent, setPromptContent] = useState('');
2628

2729
const handleFormSubmit = (content: string) => {
2830
setGeneratedContent(content);
@@ -64,6 +66,23 @@ const App: React.FC = () => {
6466
setSnackbarOpen(false);
6567
};
6668

69+
const handleOpenPromptModal = async () => {
70+
try {
71+
const response = await fetch('https://raw.githubusercontent.com/Agentic-Insights/codebase-context-spec/main/GENERATE-CONTEXT-PROMPT.md');
72+
const content = await response.text();
73+
setPromptContent(content);
74+
setPromptModalOpen(true);
75+
} catch (error) {
76+
console.error('Error fetching GENERATE-CONTEXT-PROMPT.md:', error);
77+
setSnackbarMessage('Error fetching prompt content');
78+
setSnackbarOpen(true);
79+
}
80+
};
81+
82+
const handleClosePromptModal = () => {
83+
setPromptModalOpen(false);
84+
};
85+
6786
return (
6887
<ThemeProvider theme={theme}>
6988
<Router basename={BASE_PATH}>
@@ -77,12 +96,19 @@ const App: React.FC = () => {
7796
<Typography variant="body1" paragraph>
7897
This editor helps you create .context.md, .contextdocs.md, and .contextignore files for your project.
7998
</Typography>
80-
<Typography variant="body1" paragraph>
81-
GitHub Repository:{' '}
82-
<MuiLink href="https://github.com/Agentic-Insights/codebase-context-spec" target="_blank" rel="noopener noreferrer">
83-
https://github.com/Agentic-Insights/codebase-context-spec
84-
</MuiLink>
85-
</Typography>
99+
<div className="link-section">
100+
<Typography variant="body1" paragraph>
101+
GitHub Repository:{' '}
102+
<MuiLink href="https://github.com/Agentic-Insights/codebase-context-spec" target="_blank" rel="noopener noreferrer">
103+
https://github.com/Agentic-Insights/codebase-context-spec
104+
</MuiLink>
105+
</Typography>
106+
<Typography variant="body1" paragraph>
107+
<MuiLink href="#" onClick={handleOpenPromptModal}>
108+
View GENERATE-CONTEXT-PROMPT
109+
</MuiLink>
110+
</Typography>
111+
</div>
86112
<NavTabs />
87113
<Box className="form-section">
88114
<Routes>
@@ -148,6 +174,29 @@ const App: React.FC = () => {
148174
</Box>
149175
</Modal>
150176

177+
<Modal
178+
open={promptModalOpen}
179+
onClose={handleClosePromptModal}
180+
aria-labelledby="prompt-modal-title"
181+
aria-describedby="prompt-modal-description"
182+
>
183+
<Box className="modal-content">
184+
<Box display="flex" justifyContent="space-between" alignItems="center" mb={2}>
185+
<Typography id="prompt-modal-title" variant="h6" component="h2">
186+
GENERATE-CONTEXT-PROMPT
187+
</Typography>
188+
<IconButton onClick={handleClosePromptModal} size="small">
189+
<CloseIcon />
190+
</IconButton>
191+
</Box>
192+
<Box className="code-preview">
193+
<pre>
194+
{promptContent}
195+
</pre>
196+
</Box>
197+
</Box>
198+
</Modal>
199+
151200
<Snackbar
152201
anchorOrigin={{
153202
vertical: 'bottom',

0 commit comments

Comments
 (0)