Skip to content

Commit a17b67e

Browse files
authored
Documentation rebuild (#2)
* upload feedback to leancloud feedback table * update Join our community link * fix Edit this page links * Allow off-site links in left-side nav bar * update assets
1 parent a1ce898 commit a17b67e

File tree

9 files changed

+46
-8
lines changed

9 files changed

+46
-8
lines changed
Lines changed: 9 additions & 0 deletions
Loading

public/default-og-image.png

-520 KB
Loading

public/favicon.ico

51 KB
Binary file not shown.

src/components/LeftSidebar/LeftSidebar.astro

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { currentPage, content } = Astro.props as Props
99
1010
// SIDEBAR is a flat array. Group it by sections to properly render.
1111
const sidebarSections = !!SIDEBAR[content?.section] ? SIDEBAR[content?.section] : []
12+
const isExternal = (path: string) => /^(https?:|mailto:|tel:)/.test(path)
1213
1314
const removeSlashes = function (url: string) {
1415
let sanitizedUrl = url
@@ -52,21 +53,39 @@ const currentPageMatch = removeSlashes(currentPage.slice(1))
5253
<>
5354
<li class="nav-link">
5455
<a
55-
href={`${Astro.site.pathname}${child.url}`}
56+
href={isExternal(child.url) ? `${child.url}` : `${Astro.site.pathname}${child.url}`}
57+
target={isExternal(child.url) ? "_blank" : "_self"}
5658
aria-current={`${currentPageMatch === removeSlashes(child.url) ? "page" : "false"}`}
5759
>
5860
{child.title}
61+
{isExternal(child.url) && (
62+
<img
63+
src="/assets/icons/external-link.svg"
64+
alt="external link"
65+
style="width:12px; height: 12px"
66+
/>
67+
)}
5968
</a>
6069
</li>
6170
{!!child.children && (
6271
<ul>
6372
{child.children.map((childItem) => (
6473
<li class="nav-link nested">
6574
<a
66-
href={`${Astro.site.pathname}${childItem.url}`}
75+
href={
76+
isExternal(childItem.url) ? childItem.url : `${Astro.site.pathname}${childItem.url}`
77+
}
78+
target={isExternal(child.url) ? "_blank" : "_self"}
6779
aria-current={`${currentPageMatch === removeSlashes(childItem.url) ? "page" : "false"}`}
6880
>
6981
{childItem.title}
82+
{isExternal(childItem.url) && (
83+
<img
84+
src="/assets/icons/external-link.svg"
85+
alt="external link"
86+
style="width:12px; height: 12px"
87+
/>
88+
)}
7089
</a>
7190
</li>
7291
))}

src/components/PageContent/Feedback.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const starOutline = (
1717
/>
1818
</svg>
1919
)
20+
21+
const appId = "hvIeDclG2pt2nzAdbKWM0qms-MdYXbMMI"
22+
const appKey = "lKObgvpdxLT2JK839oxSM4Fn"
23+
2024
export const Feedback = () => {
2125
const [rating, setRating] = useState<number>(undefined)
2226
const [isSent, setIsSent] = useState(false)
@@ -29,7 +33,7 @@ export const Feedback = () => {
2933
}
3034
setRating(selectedNumber + 1)
3135
setIsSent(false)
32-
const path = "https://docs2-cl-default-rtdb.firebaseio.com/allratings.json"
36+
const path = "https://leancloud.scroll.io/1.1/classes/Feedback"
3337
const data = {
3438
rating: selectedNumber,
3539
time: Date.now(),
@@ -40,6 +44,8 @@ export const Feedback = () => {
4044
headers: {
4145
Accept: "application/json",
4246
"Content-Type": "application/json",
47+
"X-LC-Id": appId,
48+
"X-LC-Key": appKey,
4349
},
4450
body: JSON.stringify(data),
4551
})
@@ -55,13 +61,15 @@ export const Feedback = () => {
5561
url: window.location.href,
5662
}
5763

58-
const path = "https://docs2-cl-default-rtdb.firebaseio.com/feedback.json"
64+
const path = "https://leancloud.scroll.io/1.1/classes/Feedback"
5965
setIsSubmitting(true)
6066
fetch(path, {
6167
method: "POST",
6268
headers: {
6369
Accept: "application/json",
6470
"Content-Type": "application/json",
71+
"X-LC-Id": appId,
72+
"X-LC-Key": appKey,
6573
},
6674
body: JSON.stringify(data),
6775
})

src/config/sidebar.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const SIDEBAR = {
1313
{
1414
section: "Pre-Alpha Testnet",
1515
contents: [
16-
{ title: "Introduction", url: "/" },
16+
{ title: "Introduction", url: "https://l2scan.scroll.io/" },
1717
{
1818
title: "User Guide",
1919
url: "user-guide/",
@@ -24,7 +24,8 @@ export const SIDEBAR = {
2424
},
2525
{
2626
title: "Faucet",
27-
url: "user-guide/faucet",
27+
// url: "user-guide/faucet",
28+
url: "https://scroll.io/prealpha/faucet",
2829
},
2930
{
3031
title: "Bridge",

src/config/site.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export const OPEN_GRAPH = {
2121
export const GITHUB_EDIT_URL = `https://github.com/scroll-tech/scroll-documentation/tree/main/`
2222

2323
// Uncomment this to add an "Join our Community" button to every page of documentation.
24-
export const COMMUNITY_INVITE_URL = `https://discord.gg/s84eJSdFhn`
24+
export const COMMUNITY_INVITE_URL = `https://discord.gg/scroll`

src/layouts/MainLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { content = {}, frontmatter } = Astro.props
1414
const headings = Astro.props?.headings || Astro.props?.content?.astro.headings
1515
1616
const currentPage = new URL(Astro.request.url).pathname
17-
const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.${frontmatter?.isMdx ? "mdx" : "md"}`
17+
const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.${frontmatter?.file.split(".").pop() || "md"}`
1818
const githubEditUrl = CONFIG.GITHUB_EDIT_URL + currentFile
1919
const formattedContentTitle = content.title
2020
? `${content.title} | ${CONFIG.SITE.title}`

src/pages/research.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: ../layouts/MainLayout.astro
33
section: research
44
title: "Research Landing Title"
5+
isMdx: true
56
---
67

78
Content for the Research landing page. for fancy stuff, see the infrastructure page.

0 commit comments

Comments
 (0)