Skip to content

Commit 485522b

Browse files
committed
Merge branch 'main' into dev
2 parents eb6a2ad + c2b60aa commit 485522b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+932
-1459
lines changed

.frontmatter/database/mediaDb.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

components/Docs/PageActions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { PencilIcon } from '@heroicons/react/24/outline';
22
import * as React from 'react';
33
import { Extension } from '../../constants/extension';
44
import { PageFrontMatter } from '../../models/PageFrontMatter';
5+
import { CONFIG } from '../../constants';
56

67
export interface IPageActionsProps {
78
page: PageFrontMatter | undefined;
@@ -16,7 +17,7 @@ export const PageActions: React.FunctionComponent<IPageActionsProps> = ({ page }
1617
<div className={`mt-16 mb-8`}>
1718
<a
1819
className={`flex items-center text-whisper-900 hover:text-whisper-500`}
19-
href={`${Extension.githubDocs}/edit/${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`}
20+
href={`${Extension.githubDocs}/edit/${CONFIG.environment === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`}
2021
target="_blank"
2122
rel={`noopener noreferrer`}>
2223
<PencilIcon className={`w-4 h-4 mr-2`} /> <span>Edit page</span>

components/Docs/PageInfo.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Extension } from '../../constants/extension';
55
import { PageFrontMatter } from '../../models/PageFrontMatter';
66
import Giscus from "@giscus/react";
77
import { PageActions } from './PageActions';
8+
import { CONFIG } from '../../constants';
89

910
export interface IPageInfoProps {
1011
items: PageFrontMatter[];
@@ -36,7 +37,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
3637
}
3738

3839
const date = parseJSON(page.lastmod);
39-
// const feedbackUrl = `${Extension.issueLink}/new?title=Feedback:%20&body=%0A%0A%5BEnter%20feedback%20here%5D%0A%0A%0A---%0A%23%23%23%23%20Document%20Details%0A%0A%E2%9A%A0%20*Do%20not%20edit%20this%20section*%0A%0A*%20ID%3A%20${page.fileName}%0A*%20URL%3A%20${`${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? Extension.mainSite : Extension.betaSite}/docs/${page.fileName}`}%0A*%20Content%20Source%3A%20${encodeURIComponent(`/content/docs/${page.fileName}.md`)}`;
40+
// const feedbackUrl = `${Extension.issueLink}/new?title=Feedback:%20&body=%0A%0A%5BEnter%20feedback%20here%5D%0A%0A%0A---%0A%23%23%23%23%20Document%20Details%0A%0A%E2%9A%A0%20*Do%20not%20edit%20this%20section*%0A%0A*%20ID%3A%20${page.fileName}%0A*%20URL%3A%20${`${CONFIG.environment === "production" ? Extension.mainSite : Extension.betaSite}/docs/${page.fileName}`}%0A*%20Content%20Source%3A%20${encodeURIComponent(`/content/docs/${page.fileName}.md`)}`;
4041

4142
return (
4243
<>
@@ -88,7 +89,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
8889
reactionsEnabled="0"
8990
emitMetadata="0"
9091
inputPosition="top"
91-
theme={process.env.NEXT_PUBLIC_GISCUS_THEME}
92+
theme={CONFIG.giscus.theme}
9293
lang="en"
9394
loading="lazy" />
9495
</div>
@@ -102,7 +103,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
102103
}
103104

104105
<div className="mt-2 text-sm">
105-
<p>Did you spot an issue in our documentation, or want to contribute? Edit this page on <a className={`text-teal-500 hover:text-teal-900`} href={`${Extension.githubDocs}/edit/${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`} target="_blank" rel={`noopener noreferrer`}>Github</a>!</p>
106+
<p>Did you spot an issue in our documentation, or want to contribute? Edit this page on <a className={`text-teal-500 hover:text-teal-900`} href={`${Extension.githubDocs}/edit/${CONFIG.environment === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`} target="_blank" rel={`noopener noreferrer`}>Github</a>!</p>
106107
</div>
107108
</div>
108109
</>

components/Page/DocsLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Header } from './Header';
99
import { Home } from './Home';
1010
import { Sponsors } from './Sponsors';
1111
import { AiOutlineRobot } from 'react-icons/ai';
12+
import { CONFIG } from '../../constants';
1213

1314
export interface IDocsLayoutProps {
1415
navItems?: PageFrontMatter[];
@@ -69,7 +70,7 @@ export const DocsLayout: React.FunctionComponent<React.PropsWithChildren<IDocsLa
6970
backgroundColor: "transparent",
7071
color: "transparent"
7172
}}
72-
anon_key={process.env.MENDABLE_ANON_KEY ?? ""} />
73+
anon_key={CONFIG.mendable.key ?? ""} />
7374
</div>
7475

7576
<Footer />

components/Page/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const Footer: React.FunctionComponent<IFooterProps> = (props: React.Props
6666
</a>
6767
))}
6868
</div>
69-
<p className="mt-8 text-center text-base text-whisper-900">&copy; 2023 {Extension.name}. All rights reserved.</p>
69+
<p className="mt-8 text-center text-base text-whisper-900">&copy; 2024 {Extension.name}. All rights reserved.</p>
7070
</div>
7171
</footer>
7272
);

components/Page/Searchbox.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ import * as React from 'react';
22
// const docsearch = require('@docsearch/js');
33
// import { useEffect } from 'react';
44
import { DocSearch } from '@docsearch/react';
5+
import { CONFIG } from '../../constants';
56

6-
export interface ISearchboxProps {}
7+
export interface ISearchboxProps { }
78

89
export const Searchbox: React.FunctionComponent<ISearchboxProps> = (props: React.PropsWithChildren<ISearchboxProps>) => {
910

1011
return (
1112
<>
12-
<DocSearch
13-
apiKey={process.env.NEXT_PUBLIC_AGOLIA_APIKEY || ""}
14-
indexName={process.env.NEXT_PUBLIC_AGOLIA_INDEX || ""}
15-
appId={process.env.NEXT_PUBLIC_AGOLIA_APPID || ""}
13+
<DocSearch
14+
apiKey={CONFIG.agolia.apiKey || ""}
15+
indexName={CONFIG.agolia.index || ""}
16+
appId={CONFIG.agolia.appId || ""}
1617
disableUserPersonalization={true}
17-
/>
18+
/>
1819
</>
1920
);
2021
};

components/Page/Sponsors.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { Sponsor, SponsorData } from '../../models/SponsorData';
66
import sponsors from '../../sponsors.json';
7+
import { CONFIG } from '../../constants';
78

89
export interface ISponsorsProps { }
910

@@ -13,7 +14,7 @@ export const Sponsors: React.FunctionComponent<ISponsorsProps> = (props: React.P
1314

1415
useEffect(() => {
1516
const getSponsors = async () => {
16-
const response = await fetch('/api/sponsors');
17+
const response = await fetch(`${CONFIG.urls.api}${CONFIG.api.sponsors}`);
1718

1819
if (!response.ok) {
1920
setIndividuals(null);

constants/config.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export const CONFIG = {
2+
urls: {
3+
api: process.env.NEXT_PUBLIC_API_URL,
4+
production: "https://frontmatter.codes",
5+
preview: "https://cloudflare.front-matter-docs.pages.dev",
6+
local: "http://localhost:3000",
7+
},
8+
api: {
9+
sponsors: "/sponsors",
10+
stats: "/stats",
11+
stars: "/stars",
12+
},
13+
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
14+
github: {
15+
token: process.env.GITHUB_AUTH,
16+
},
17+
sponsors: process.env.BACKERS,
18+
agolia: {
19+
apiKey: process.env.NEXT_PUBLIC_AGOLIA_APIKEY,
20+
index: process.env.NEXT_PUBLIC_AGOLIA_INDEX,
21+
appId: process.env.NEXT_PUBLIC_AGOLIA_APPID,
22+
},
23+
giscus: {
24+
theme: process.env.NEXT_PUBLIC_GISCUS_THEME,
25+
},
26+
mendable: {
27+
key: process.env.MENDABLE_ANON_KEY,
28+
},
29+
};

constants/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from "./config";
2+
export * from "./extension";
3+
export * from "./features";
4+
export * from "./navigation";

constants/navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ export const navigation = {
8484
>
8585
Open Collective
8686
</a>
87-
<a
87+
{/* <a
8888
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm rounded"
8989
onClick={() => setOpen(false)}
9090
href={Extension.sponsorCoffee}
9191
target={`_blank`}
9292
rel={`noopener noreferrer`}
9393
>
9494
Buy us a coffee or LEGO
95-
</a>
95+
</a> */}
9696
</div>
9797
</Modal>
9898
)

0 commit comments

Comments
 (0)