Skip to content

Commit d9f58c5

Browse files
Revert "Inline submit — no page navigation, everything in background (#5)"
This reverts commit 21776a3.
1 parent 21776a3 commit d9f58c5

File tree

3 files changed

+32
-506
lines changed

3 files changed

+32
-506
lines changed

generate-index.go

Lines changed: 32 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ func main() {
5959
os.Exit(1)
6060
}
6161

62-
if err := generate404(); err != nil {
63-
fmt.Fprintf(os.Stderr, "Error generating 404.html: %v\n", err)
64-
os.Exit(1)
65-
}
66-
6762
// Copy CNAME and static root files to site directory
6863
if cname, err := os.ReadFile("CNAME"); err == nil {
6964
os.WriteFile("site/CNAME", cname, 0644)
@@ -76,14 +71,7 @@ func main() {
7671
for _, cat := range cfg.Categories {
7772
totalRepos += len(cat.Repos)
7873
}
79-
fmt.Printf("Generated site (%d repos)\n", totalRepos)
80-
}
81-
82-
func generate404() error {
83-
return os.WriteFile("site/404.html", []byte(`<!DOCTYPE html>
84-
<html><head><meta charset="utf-8"><meta http-equiv="refresh" content="0;url=/"><title>Redirecting…</title></head>
85-
<body><p>Redirecting to <a href="/">homepage</a>…</p></body></html>
86-
`), 0644)
74+
fmt.Printf("Generated index.html and sitemap.xml (%d repos)\n", totalRepos)
8775
}
8876

8977
func generateSitemap(cfg Config) error {
@@ -208,6 +196,18 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
208196
.site-nav { display: flex; gap: 16px; align-items: center; }
209197
.site-nav a { color: var(--text-muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
210198
.site-nav a:hover { color: var(--text); text-decoration: none; }
199+
.request-btn {
200+
color: var(--accent-light) !important;
201+
border: 1px solid var(--accent);
202+
border-radius: var(--radius);
203+
padding: 6px 12px;
204+
transition: background 0.2s, color 0.2s;
205+
}
206+
.request-btn:hover {
207+
background: var(--accent);
208+
color: #fff !important;
209+
text-decoration: none !important;
210+
}
211211
.hero {
212212
padding: 64px 0 48px;
213213
text-align: center;
@@ -395,21 +395,14 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
395395
pointer-events: auto;
396396
}
397397
.submit-btn.active:hover { background: var(--accent-light); }
398-
.submit-btn.loading {
399-
opacity: 0.6;
400-
pointer-events: none;
401-
}
402-
.submit-feedback {
403-
margin-top: 10px;
398+
.submit-preview {
399+
margin-top: 8px;
404400
font-size: 13px;
401+
color: var(--green);
405402
font-family: var(--mono);
406403
display: none;
407404
}
408-
.submit-feedback.visible { display: block; }
409-
.submit-feedback.preview { color: var(--text-muted); }
410-
.submit-feedback.success { color: var(--green); }
411-
.submit-feedback.success a { color: var(--green); text-decoration: underline; }
412-
.submit-feedback.error { color: var(--red); }
405+
.submit-preview.visible { display: block; }
413406
@media (max-width: 768px) {
414407
.container { padding: 0 16px; }
415408
.hero { padding: 40px 0 32px; }
@@ -439,6 +432,7 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
439432
<a href="https://supermodeltools.com">Website</a>
440433
<a href="https://github.com/supermodeltools">GitHub</a>
441434
<a href="https://x.com/supermodeltools">X</a>
435+
<a href="https://github.com/supermodeltools/supermodeltools.github.io/issues/new?template=request-repo.yml" class="request-btn">+ Request a Repo</a>
442436
</nav>
443437
</div>
444438
</header>
@@ -468,9 +462,9 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
468462
<div class="submit-label">Don't see your repo? Paste a URL to generate arch docs:</div>
469463
<div class="submit-row">
470464
<input type="text" class="submit-input" id="submit-url" placeholder="https://github.com/owner/repo" autocomplete="off" spellcheck="false">
471-
<button class="submit-btn" id="submit-btn" type="button">Generate</button>
465+
<button class="submit-btn" id="submit-btn" type="button">Request</button>
472466
</div>
473-
<div class="submit-feedback" id="submit-feedback"></div>
467+
<div class="submit-preview" id="submit-preview"></div>
474468
</div>
475469
</div>
476470
@@ -516,10 +510,10 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
516510
var noResults = document.getElementById('no-results');
517511
var submitInput = document.getElementById('submit-url');
518512
var submitBtn = document.getElementById('submit-btn');
519-
var feedback = document.getElementById('submit-feedback');
513+
var submitPreview = document.getElementById('submit-preview');
520514
var noResultsRequest = document.getElementById('no-results-request');
521515
522-
var API_URL = '/api/request';
516+
var issueBase = 'https://github.com/supermodeltools/supermodeltools.github.io/issues/new?template=request-repo.yml';
523517
524518
// --- Search ---
525519
searchInput.addEventListener('input', function() {
@@ -552,65 +546,36 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
552546
return null;
553547
}
554548
555-
function showFeedback(msg, type) {
556-
feedback.className = 'submit-feedback visible ' + type;
557-
feedback.innerHTML = msg;
558-
}
559-
560549
submitInput.addEventListener('input', function() {
561550
var parsed = parseRepo(this.value);
562551
if (parsed) {
563552
var name = parsed.split('/')[1];
564-
showFeedback('\u2192 repos.supermodeltools.com/' + name + '/', 'preview');
553+
submitPreview.textContent = '\u2192 Docs will be at repos.supermodeltools.com/' + name + '/';
554+
submitPreview.classList.add('visible');
565555
submitBtn.classList.add('active');
566556
} else {
567-
feedback.className = 'submit-feedback';
557+
submitPreview.classList.remove('visible');
568558
submitBtn.classList.remove('active');
569559
}
570560
});
571561
572-
async function submitRequest() {
562+
function submitRequest() {
573563
var parsed = parseRepo(submitInput.value);
574564
if (!parsed) return;
575-
576565
var repoUrl = 'https://github.com/' + parsed;
577566
var name = parsed.split('/')[1];
578-
579-
// Loading state
580-
submitBtn.classList.add('loading');
581-
submitBtn.textContent = 'Generating...';
582-
showFeedback('Setting up ' + name + '...', 'preview');
583-
584-
try {
585-
var resp = await fetch(API_URL, {
586-
method: 'POST',
587-
headers: { 'Content-Type': 'application/json' },
588-
body: JSON.stringify({ url: repoUrl }),
589-
});
590-
var data = await resp.json();
591-
592-
if (!resp.ok || !data.success) {
593-
showFeedback(data.error || 'Something went wrong. Please try again.', 'error');
594-
submitBtn.classList.remove('loading');
595-
submitBtn.textContent = 'Generate';
596-
return;
597-
}
598-
599-
// Redirect to the skeleton loading page — served by the worker
600-
window.location.href = data.generating_url;
601-
} catch (e) {
602-
showFeedback('Network error. Please try again.', 'error');
603-
submitBtn.classList.remove('loading');
604-
submitBtn.textContent = 'Generate';
605-
}
567+
var url = issueBase
568+
+ '&repo_url=' + encodeURIComponent(repoUrl)
569+
+ '&title=' + encodeURIComponent('[Repo Request] ' + name);
570+
window.open(url, '_blank');
606571
}
607572
608573
submitBtn.addEventListener('click', submitRequest);
609574
submitInput.addEventListener('keydown', function(e) {
610-
if (e.key === 'Enter' && submitBtn.classList.contains('active')) submitRequest();
575+
if (e.key === 'Enter') submitRequest();
611576
});
612577
613-
// "No results" link: scroll up and focus the submit input
578+
// "No results" request link: pre-fill with search query as a guess
614579
noResultsRequest.addEventListener('click', function() {
615580
var q = searchInput.value.trim();
616581
submitInput.value = q;
@@ -623,4 +588,3 @@ a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; b
623588
</body>
624589
</html>
625590
`
626-

0 commit comments

Comments
 (0)