Skip to content

Commit e4becd7

Browse files
committed
Move about page to frontend rendering
1 parent 1bc530a commit e4becd7

File tree

6 files changed

+33
-44
lines changed

6 files changed

+33
-44
lines changed

binderhub/app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343
from traitlets.config import Application
4444

45-
from .base import AboutHandler, Custom404, VersionHandler
45+
from .base import Custom404, VersionHandler
4646
from .build import BuildExecutor, KubernetesBuildExecutor, KubernetesCleaner
4747
from .builder import BuildHandler
4848
from .events import EventLog
@@ -993,8 +993,7 @@ def initialize(self, *args, **kwargs):
993993
# In API only mode the endpoints in the list below
994994
# are unregistered as they don't make sense in a API only scenario
995995
handlers += [
996-
(r"/about", AboutHandler),
997-
(r"/(?:v2/.*)?", MainHandler),
996+
(r"/(?:v2/.*|about)?", MainHandler),
998997
(r"/repo/([^/]+)/([^/]+)(/.*)?", LegacyRedirectHandler),
999998
(r"/api/repoproviders", RepoProvidersHandlers),
1000999
# for backward-compatible mybinder.org badge URLs

binderhub/base.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,6 @@ def prepare(self):
229229
raise web.HTTPError(404)
230230

231231

232-
class AboutHandler(BaseHandler):
233-
"""Serve the about page"""
234-
235-
async def get(self):
236-
self.render_template(
237-
"about.html",
238-
base_url=self.settings["base_url"],
239-
submit=False,
240-
binder_version=binder_version,
241-
message=self.settings["about_message"],
242-
extra_footer_scripts=self.settings["extra_footer_scripts"],
243-
)
244-
245-
246232
class VersionHandler(BaseHandler):
247233
"""Serve information about versions running"""
248234

binderhub/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from tornado.httputil import url_concat
66
from tornado.web import authenticated
77

8+
from . import __version__ as binder_version
89
from .base import BaseHandler
910

1011

@@ -23,6 +24,8 @@ def get(self):
2324
"logoUrl": self.static_url("logo.svg"),
2425
"logoWidth": "320px",
2526
"repoProviders": repoproviders_display_config,
27+
"aboutMessage": self.settings["about_message"],
28+
"binderVersion": binder_version,
2629
}
2730
self.render_template(
2831
"page.html",

binderhub/static/js/App.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import "@fontsource/clear-sans/300.css";
1010
import "@fontsource/clear-sans/400.css";
1111
import { HomePage } from "./pages/HomePage.jsx";
1212
import { createRoutesFromElements } from "react-router";
13+
import { AboutPage } from "./pages/AboutPage.jsx";
1314

1415
export const PAGE_CONFIG = window.pageConfig;
1516

@@ -64,6 +65,16 @@ const router = createBrowserRouter(
6465
element={<LoadingPage baseUrl={BASE_URL} />}
6566
/>
6667
))}
68+
<Route
69+
key="about"
70+
path={`${PAGE_CONFIG.baseUrl}about`}
71+
element={
72+
<AboutPage
73+
aboutMessage={PAGE_CONFIG.aboutMessage}
74+
binderVersion={PAGE_CONFIG.binderVersion}
75+
/>
76+
}
77+
/>
6778
</Route>,
6879
),
6980
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export function AboutPage({ aboutMessage, binderVersion }) {
2+
return (
3+
<div className="text-center">
4+
<h3>BinderHub</h3>
5+
<div>
6+
<p>
7+
This website is powered by{" "}
8+
<a href="https://github.com/jupyterhub/binderhub">BinderHub</a> v
9+
{binderVersion}
10+
</p>
11+
{aboutMessage && (
12+
<p dangerouslySetInnerHTML={{ __html: aboutMessage }}></p>
13+
)}
14+
</div>
15+
</div>
16+
);
17+
}

binderhub/templates/about.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)