Skip to content

Commit 05da6a0

Browse files
hhkaosclaude
andcommitted
Add preview tool link and adopter-registry banner to dashboard
- Link to the central /preview tool (same ?repo= pattern as editor/publish) for a human-readable view of the generated feeds. - Check opentechevents.org/data/adopters.json and show a banner inviting registration when the feed is not listed; fails silently on network errors and local previews. - DESIGN.md: note that the editor absorbs importing (no separate /import). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ca3a3bf commit 05da6a0

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

DESIGN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ El Pages del fork sirve una página estática mínima que **enlaza a las herrami
4949

5050
```
5151
https://tools.opentechevents.org/editor?repo=usuario/mi-comunidad
52-
https://tools.opentechevents.org/import?repo=usuario/mi-comunidad
5352
https://tools.opentechevents.org/publish?repo=usuario/mi-comunidad
5453
```
5554

55+
El editor absorbe la importación (crear, importar y editar eventos en una sola UI); no hay herramienta `/import` separada. En la UI, `/editor` se etiqueta "Manage events" y `/publish` "Promote" (difundir el evento a otras plataformas — el feed ya es la publicación).
56+
5657
Cada herramienta lee `?repo=`, hace `fetch` del feed y del `ote.config.json` vía `raw.githubusercontent.com` (CORS abierto) y renderiza. El fork sigue siendo datos + config + una página tonta; las herramientas evolucionan sin tocar ningún fork, y siempre saben qué repositorio están "editando".
5758

5859
## Flujo de escritura: formulario → issue → PR (uniforme)

docs/index.html

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
code { background: #f2f2f2; padding: .1rem .3rem; border-radius: 3px; }
1414
footer { margin-top: 2rem; font-size: .85rem; color: #666; }
1515
.warn { color: #a00; }
16+
.banner { background: #fff8e1; border: 1px solid #e6c200; border-radius: 6px; padding: .6rem .8rem; font-size: .95rem; }
1617
</style>
1718
</head>
1819
<body>
@@ -28,9 +29,9 @@ <h2>Your feed</h2>
2829

2930
<h2>Tools</h2>
3031
<ul id="tools">
31-
<li><a id="editor" href="#">Edit events</a> — create, edit or delete events without writing JSON</li>
32-
<li><a id="import" href="#">Import</a>bring events from an .ics file or an event page</li>
33-
<li><a id="publish" href="#">Publish</a>spread an event to other platforms</li>
32+
<li><a id="editor" href="#">Manage events</a> — create, import, edit or delete events from a simple UI</li>
33+
<li><a id="publish" href="#">Promote</a>spread your event to other platforms</li>
34+
<li><a id="preview" href="#">Preview feed</a>human-readable view of your generated feeds</li>
3435
</ul>
3536

3637
<footer>
@@ -55,7 +56,7 @@ <h2>Tools</h2>
5556
if (repo) {
5657
el.textContent = repo;
5758
var base = "https://tools.opentechevents.org/";
58-
["editor", "import", "publish"].forEach(function (t) {
59+
["editor", "publish", "preview"].forEach(function (t) {
5960
document.getElementById(t).href = base + t + "?repo=" + encodeURIComponent(repo);
6061
});
6162
} else {
@@ -66,6 +67,30 @@ <h2>Tools</h2>
6667
'<p class="warn">Could not detect the repository from this URL. If you use a custom domain, add a <code>config.js</code> with <code>window.OTE_REPO = "user/repo"</code>.</p>'
6768
);
6869
}
70+
71+
// Adopter registry check: if this feed isn't listed in the OTE adopters
72+
// registry, invite the organizer to register it. Fails silently (network
73+
// error, CORS, local preview) — the banner only shows on a confirmed miss.
74+
(function () {
75+
if (/^(localhost|127\.|0\.0\.0\.0)/.test(location.hostname)) return;
76+
var feedUrl = new URL("feed.json", location.href).href;
77+
fetch("https://opentechevents.org/data/adopters.json")
78+
.then(function (r) { return r.ok ? r.json() : Promise.reject(); })
79+
.then(function (data) {
80+
// Schema-agnostic: look for this feed's URL anywhere in the registry.
81+
var listed = JSON.stringify(data).toLowerCase()
82+
.indexOf(feedUrl.toLowerCase()) !== -1;
83+
if (listed) return;
84+
document.querySelector("h2").insertAdjacentHTML(
85+
"beforebegin",
86+
'<p class="banner">📣 This feed is not in the ' +
87+
'<a href="https://opentechevents.org/data/adopters.json">OTE adopters registry</a> yet. ' +
88+
'<a href="https://opentechevents.org/register/?feed=' + encodeURIComponent(feedUrl) + '">Register it</a> ' +
89+
'so more directories, developers and users can discover it and import your events.</p>'
90+
);
91+
})
92+
.catch(function () {});
93+
})();
6994
</script>
7095
</body>
7196
</html>

0 commit comments

Comments
 (0)