Skip to content

[dashboard] load on Safari < 14 #4069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,20 @@ function App() {
}
updateTheme();
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
mediaQuery.addEventListener('change', updateTheme);
if (mediaQuery instanceof EventTarget) {
mediaQuery.addEventListener('change', updateTheme);
} else {
// backward compatibility for Safari < 14
(mediaQuery as MediaQueryList).addListener(updateTheme);
}
window.addEventListener('storage', updateTheme);
return function cleanup() {
mediaQuery.removeEventListener('change', updateTheme);
if (mediaQuery instanceof EventTarget) {
mediaQuery.removeEventListener('change', updateTheme);
} else {
// backward compatibility for Safari < 14
(mediaQuery as MediaQueryList).removeListener(updateTheme);
}
window.removeEventListener('storage', updateTheme);
}
}, [localStorage.theme]);
Expand All @@ -79,7 +89,7 @@ function App() {
}
if (window.location.pathname.startsWith('/blocked')) {
return <div className="mt-48 text-center">
<img src={gitpodIcon} className="h-16 mx-auto"/>
<img src={gitpodIcon} className="h-16 mx-auto" />
<h1 className="mt-12 text-gray-500 text-3xl">Your account has been blocked.</h1>
<p className="mt-4 mb-8 text-lg w-96 mx-auto">Please contact support if you think this is an error. See also <a className="hover:text-blue-600 dark:hover:text-blue-400" href="https://www.gitpod.io/terms/">terms of service</a>.</p>
<a className="mx-auto" href="mailto:[email protected]?Subject=Blocked"><button className="secondary">Contact Support</button></a>
Expand Down Expand Up @@ -116,19 +126,19 @@ function App() {
<Route path="/admin/workspaces" component={WorkspacesSearch} />

<Route path={["/", "/login"]} exact>
<Redirect to="/workspaces"/>
<Redirect to="/workspaces" />
</Route>
<Route path={["/settings"]} exact>
<Redirect to="/account"/>
<Redirect to="/account" />
</Route>
<Route path={["/access-control"]} exact>
<Redirect to="/integrations"/>
<Redirect to="/integrations" />
</Route>
<Route path={["/subscription", "/usage", "/upgrade-subscription"]} exact>
<Redirect to="/plans"/>
<Redirect to="/plans" />
</Route>
<Route path={["/admin"]} exact>
<Redirect to="/admin/users"/>
<Redirect to="/admin/users" />
</Route>
<Route path="/sorry" exact>
<div className="mt-48 text-center">
Expand Down Expand Up @@ -171,7 +181,7 @@ function getURLHash() {
}

const renderMenu = (user?: User) => {
const left = [
const left = [
{
title: 'Workspaces',
link: '/workspaces',
Expand Down