From b60ef719efe3b87ee5d59a89f27d11db314fa660 Mon Sep 17 00:00:00 2001 From: Onat <53895969+onattech@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:22:39 +0300 Subject: [PATCH 1/3] Fix algolia search --- .env.example | 4 +++- config.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ docusaurus.config.js | 4 ++-- 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 config.json diff --git a/.env.example b/.env.example index 256b8e4..54077d8 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,5 @@ EMAILJS_SERVER_ID=service_sedddrb EMAILJS_TEMPLATE_ID=template_2w42djr -EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql \ No newline at end of file +EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql +APPLICATION_ID=QREGAGU3YC +API_KEY=95b0c6179810e72eefdf5f0e8915ac85 \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..d625ebc --- /dev/null +++ b/config.json @@ -0,0 +1,44 @@ +{ + "index_name": "docsearch", + "sitemap_urls": [ + "https://docs.appseed.us/sitemap.xml" + ], + "sitemap_alternate_links": true, + "selectors": { + "lvl0": { + "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "type": "xpath", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "header h1", + "lvl2": "article h2", + "lvl3": "article h3", + "lvl4": "article h4", + "lvl5": "article h5, article td:first-child", + "lvl6": "article h6", + "text": "article p, article li, article td:last-child" + }, + "strip_chars": " .,;:#", + "custom_settings": { + "separatorsToIndex": "_", + "attributesForFaceting": [ + "language", + "version", + "type", + "docusaurus_tag" + ], + "attributesToRetrieve": [ + "hierarchy", + "content", + "anchor", + "url", + "url_without_anchor", + "type" + ] + }, + "conversation_id": [ + "833762294" + ], + "nb_hits": 46250 +} \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index bcacec5..784622a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -253,8 +253,8 @@ const config = { darkTheme: darkCodeTheme, }, algolia: { - appId: "QREGAGU3YC", - apiKey: "95b0c6179810e72eefdf5f0e8915ac85", + appId: process.env.APPLICATION_ID, + apiKey: process.env.API_KEY, indexName: "docsearch", contextualSearch: true, searchParameters: {}, From 1b584995496b430ebb4a51fcd01e26e2de4350d0 Mon Sep 17 00:00:00 2001 From: Onat <53895969+onattech@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:37:52 +0300 Subject: [PATCH 2/3] Update emailjs, remove hard coded envs --- src/theme/NotFound.js | 55 ++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/src/theme/NotFound.js b/src/theme/NotFound.js index 974b9fe..29e8b58 100644 --- a/src/theme/NotFound.js +++ b/src/theme/NotFound.js @@ -10,24 +10,37 @@ export default function NotFound() { const location = useLocation(); const { siteConfig } = useDocusaurusContext(); - const serverId = 'service_3xvalkw' ; // process.env.EMAILJS_SERVER_ID; - const templateId = 'template_gpdzs7i' ; // process.env.EMAILJS_TEMPLATE_ID; - const publicKey = 'mbYWDBjQhv-h3CLXl'; // process.env.EMAILJS_PUBLIC_KEY; + const serverId = siteConfig.customFields.EMAILJS_SERVER_ID + const templateId = siteConfig.customFields.EMAILJS_TEMPLATE_ID + const publicKey = siteConfig.customFields.EMAILJS_PUBLIC_KEY - //console.log('serverId :' + serverId ); - //console.log('templateId :' + templateId ); - //console.log('publicKey :' + publicKey ); - - useEffect(async () => { - emailjs.send(serverId, templateId, { url: "https://docs.appseed.us" + location.pathname }, publicKey).then( - function (response) { - console.log("SUCCESS!", response.status, response.text); - }, - function (error) { - console.log("FAILED...", error); - } - ); - }, []); + useEffect(() => { + if (!serverId || !templateId || !publicKey) return + + async function emailJS() { + emailjs + .send( + serverId, + templateId, + { + url: + 'https://docusaurus-soft-design.onrender.com' + + location.pathname, + }, + publicKey + ) + .then( + function (response) { + console.log('SUCCESS!', response.status, response.text) + }, + function (error) { + console.log('FAILED...', error) + } + ) + } + + emailJS() + }, []) return ( <> -

+

Sorry but the page you were looking for could not be found. -

-

+

+
Back to Home Page
-

+
From 74a67d403d2252889e9205d6a19adaed3cd54bf8 Mon Sep 17 00:00:00 2001 From: Onat <53895969+onattech@users.noreply.github.com> Date: Tue, 28 Feb 2023 11:18:44 +0300 Subject: [PATCH 3/3] Add sticky media support --- .env.development | 4 +++- docs/content/how-to/sticky-media.md | 25 +++++++++++++++++++++++++ docusaurus.config.js | 11 +++++++++++ src/css/custom.css | 8 ++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 docs/content/how-to/sticky-media.md diff --git a/.env.development b/.env.development index 256b8e4..54077d8 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ EMAILJS_SERVER_ID=service_sedddrb EMAILJS_TEMPLATE_ID=template_2w42djr -EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql \ No newline at end of file +EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql +APPLICATION_ID=QREGAGU3YC +API_KEY=95b0c6179810e72eefdf5f0e8915ac85 \ No newline at end of file diff --git a/docs/content/how-to/sticky-media.md b/docs/content/how-to/sticky-media.md new file mode 100644 index 0000000..351adb4 --- /dev/null +++ b/docs/content/how-to/sticky-media.md @@ -0,0 +1,25 @@ +--- +title: Sticky Media +sidebar_label: Sticky Media +--- + +# Sticky media + +You may add a sticky video by giving `sticky-popup` class to an `a` tag. + +```html + + +Sticky video + + +``` + +## Try it! + +Sticky video diff --git a/docusaurus.config.js b/docusaurus.config.js index 784622a..fc248ff 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -6,6 +6,7 @@ const lightCodeTheme = require("prism-react-renderer/themes/github"); // const darkCodeTheme = require("prism-react-renderer/themes/dracula"); // const Embed = require("./plugins/remark/embed"); const darkCodeTheme = require("prism-react-renderer/themes/shadesOfPurple"); +require('dotenv').config() const customFields = { meta: { title: "An atom based state manager for JavaScript apps.", @@ -52,6 +53,16 @@ const config = { defaultLocale: "en", locales: ["en"], }, + + scripts: [ + { + src: '//cdn.jsdelivr.net/gh/app-generator/sticky-media@0.0.17/dist/index.min.js', + id: 'stickyVideoScript', + defer: true, + class: 'sticky-popup', + }, + ], + // themes: ["@docusaurus/theme-live-codeblock"], plugins: [ // "docusaurus-plugin-sass", diff --git a/src/css/custom.css b/src/css/custom.css index 8ed892b..f8d4ae7 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -265,3 +265,11 @@ ul.menu__list > li > a.menu__link--active { } /* Home Page Header */ + +/* Sticky media */ +.sticky-video-modal { + width: 100%; + height: 100%; + right: 0; + bottom: 0; +} \ No newline at end of file