2022-06-23 10:55:08 +03:00
|
|
|
import { useState, useEffect } from "react";
|
|
|
|
import { configure, GlobalHotKeys } from "react-hotkeys";
|
2022-11-08 03:31:58 +03:00
|
|
|
import { init } from "@socialgouv/matomo-next";
|
2022-11-17 04:42:14 +03:00
|
|
|
import { Search } from "@urbit/foundation-design-system";
|
2022-08-02 22:53:24 +03:00
|
|
|
import Head from "next/head";
|
2022-06-23 10:55:08 +03:00
|
|
|
|
2022-08-02 22:53:24 +03:00
|
|
|
import "@urbit/foundation-design-system/styles/globals.css";
|
|
|
|
import "@urbit/foundation-design-system/styles/markdown.css";
|
|
|
|
import "@urbit/foundation-design-system/styles/prism.css";
|
2022-06-22 03:49:31 +03:00
|
|
|
import "../styles/developers.css";
|
2021-12-11 01:30:57 +03:00
|
|
|
|
2022-11-08 03:31:58 +03:00
|
|
|
const MATOMO_URL = process?.env?.NEXT_PUBLIC_MATOMO_URL || "";
|
|
|
|
const MATOMO_SITE_ID = process?.env?.NEXT_PUBLIC_MATOMO_SITE_ID || "";
|
|
|
|
|
2021-09-30 16:10:31 +03:00
|
|
|
function MyApp({ Component, pageProps }) {
|
2022-06-23 10:55:08 +03:00
|
|
|
const [showSearch, setSearch] = useState(false);
|
2022-11-08 03:31:58 +03:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
init({
|
|
|
|
url: MATOMO_URL,
|
|
|
|
siteId: MATOMO_SITE_ID,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-06-23 10:55:08 +03:00
|
|
|
const closeSearch = (event) => {
|
|
|
|
if (event?.preventDefault) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
setSearch(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
const openSearch = (event) => {
|
|
|
|
if (event?.preventDefault) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
setSearch(true);
|
|
|
|
};
|
|
|
|
|
|
|
|
const toggleSearch = (event) => {
|
|
|
|
if (event?.preventDefault) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
setSearch((state) => !state);
|
|
|
|
};
|
|
|
|
|
|
|
|
const keyMap = {
|
|
|
|
closeSearch: ["esc"],
|
|
|
|
toggleSearch: ["command+k", "ctrl+k"],
|
|
|
|
};
|
|
|
|
|
|
|
|
const handlers = {
|
2023-09-22 02:56:51 +03:00
|
|
|
// closeSearch: (event) => closeSearch(event),
|
|
|
|
// openSearch: (event) => openSearch(event),
|
|
|
|
// toggleSearch: (event) => toggleSearch(event),
|
2022-06-23 10:55:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
configure({
|
|
|
|
// ignoreTags: [],
|
|
|
|
ignoreTags: ["input", "select", "textarea"],
|
2023-11-06 18:02:15 +03:00
|
|
|
ignoreEventsCondition: function () {},
|
2022-06-23 10:55:08 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<GlobalHotKeys keyMap={keyMap} handlers={handlers} />
|
|
|
|
<Search
|
|
|
|
showSearch={showSearch}
|
|
|
|
toggleSearch={toggleSearch}
|
|
|
|
closeSearch={closeSearch}
|
|
|
|
openSearch={openSearch}
|
2022-11-17 04:42:14 +03:00
|
|
|
order={["dev", "org", "ops", "roadmap"]}
|
|
|
|
ourSite="https://developers.urbit.org"
|
2022-06-23 10:55:08 +03:00
|
|
|
/>
|
2023-11-06 18:02:15 +03:00
|
|
|
<div className="flex items-center justify-center"
|
|
|
|
style={{ backgroundColor: "#5A5A6E" }}
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className="text-base p-2"
|
|
|
|
style={{ color: "#F0FFFF" }}
|
|
|
|
>
|
|
|
|
This site has been deprecated. Go to{" "}
|
|
|
|
<a
|
|
|
|
className="font-medium"
|
|
|
|
style={{ color: "#A0DCE6" }}
|
|
|
|
href="https://docs.urbit.org"
|
|
|
|
>
|
|
|
|
docs.urbit.org
|
|
|
|
</a>
|
|
|
|
.
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-23 10:55:08 +03:00
|
|
|
<Component
|
|
|
|
{...pageProps}
|
|
|
|
search={{
|
|
|
|
toggleSearch: toggleSearch,
|
|
|
|
closeSearch: closeSearch,
|
|
|
|
openSearch: openSearch,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
2021-09-30 16:10:31 +03:00
|
|
|
}
|
|
|
|
|
2021-09-30 16:23:38 +03:00
|
|
|
export default MyApp;
|