Skip to content

Commit

Permalink
Move about page to frontend rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed May 24, 2024
1 parent b73310d commit 0a4e84c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 44 deletions.
5 changes: 2 additions & 3 deletions binderhub/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
from traitlets.config import Application

from .base import AboutHandler, Custom404, VersionHandler
from .base import Custom404, VersionHandler
from .build import BuildExecutor, KubernetesBuildExecutor, KubernetesCleaner
from .builder import BuildHandler
from .events import EventLog
Expand Down Expand Up @@ -993,8 +993,7 @@ def initialize(self, *args, **kwargs):
# In API only mode the endpoints in the list below
# are unregistered as they don't make sense in a API only scenario
handlers += [
(r"/about", AboutHandler),
(r"/(?:v2/.*)?", MainHandler),
(r"/(?:v2/.*|about)?", MainHandler),
(r"/repo/([^/]+)/([^/]+)(/.*)?", LegacyRedirectHandler),
(r"/api/repoproviders", RepoProvidersHandlers),
# for backward-compatible mybinder.org badge URLs
Expand Down
14 changes: 0 additions & 14 deletions binderhub/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ def prepare(self):
raise web.HTTPError(404)


class AboutHandler(BaseHandler):
"""Serve the about page"""

async def get(self):
self.render_template(
"about.html",
base_url=self.settings["base_url"],
submit=False,
binder_version=binder_version,
message=self.settings["about_message"],
extra_footer_scripts=self.settings["extra_footer_scripts"],
)


class VersionHandler(BaseHandler):
"""Serve information about versions running"""

Expand Down
3 changes: 3 additions & 0 deletions binderhub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from tornado.httputil import url_concat
from tornado.web import authenticated

from . import __version__ as binder_version
from .base import BaseHandler


Expand All @@ -23,6 +24,8 @@ def get(self):
"logoUrl": self.static_url("logo.svg"),
"logoWidth": "320px",
"repoProviders": repoproviders_display_config,
"aboutMessage": self.settings["about_message"],
"binderVersion": binder_version,
}
self.render_template(
"page.html",
Expand Down
11 changes: 11 additions & 0 deletions binderhub/static/js/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "@fontsource/clear-sans/300.css";
import "@fontsource/clear-sans/400.css";
import { HomePage } from "./pages/HomePage.jsx";
import { createRoutesFromElements } from "react-router";
import { AboutPage } from "./pages/AboutPage.jsx";

export const PAGE_CONFIG = window.pageConfig;

Expand Down Expand Up @@ -64,6 +65,16 @@ const router = createBrowserRouter(
element={<LoadingPage baseUrl={BASE_URL} />}
/>
))}
<Route
key="about"
path={`${PAGE_CONFIG.baseUrl}about`}
element={
<AboutPage
aboutMessage={PAGE_CONFIG.aboutMessage}
binderVersion={PAGE_CONFIG.binderVersion}
/>
}
/>
</Route>,
),
);
Expand Down
17 changes: 17 additions & 0 deletions binderhub/static/js/pages/AboutPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export function AboutPage({ aboutMessage, binderVersion }) {
return (
<div className="text-center">
<h3>BinderHub</h3>
<div>
<p>
This website is powered by{" "}
<a href="https://github.com/jupyterhub/binderhub">BinderHub</a> v
{binderVersion}
</p>
{aboutMessage && (
<p dangerouslySetInnerHTML={{ __html: aboutMessage }}></p>
)}
</div>
</div>
);
}
27 changes: 0 additions & 27 deletions binderhub/templates/about.html

This file was deleted.

0 comments on commit 0a4e84c

Please sign in to comment.