Skip to content

Documentation rebuild #2

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 5 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions public/assets/icons/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/default-og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
23 changes: 21 additions & 2 deletions src/components/LeftSidebar/LeftSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { currentPage, content } = Astro.props as Props

// SIDEBAR is a flat array. Group it by sections to properly render.
const sidebarSections = !!SIDEBAR[content?.section] ? SIDEBAR[content?.section] : []
const isExternal = (path: string) => /^(https?:|mailto:|tel:)/.test(path)

const removeSlashes = function (url: string) {
let sanitizedUrl = url
Expand Down Expand Up @@ -52,21 +53,39 @@ const currentPageMatch = removeSlashes(currentPage.slice(1))
<>
<li class="nav-link">
<a
href={`${Astro.site.pathname}${child.url}`}
href={isExternal(child.url) ? `${child.url}` : `${Astro.site.pathname}${child.url}`}
target={isExternal(child.url) ? "_blank" : "_self"}
aria-current={`${currentPageMatch === removeSlashes(child.url) ? "page" : "false"}`}
>
{child.title}
{isExternal(child.url) && (
<img
src="/assets/icons/external-link.svg"
alt="external link"
style="width:12px; height: 12px"
/>
)}
</a>
</li>
{!!child.children && (
<ul>
{child.children.map((childItem) => (
<li class="nav-link nested">
<a
href={`${Astro.site.pathname}${childItem.url}`}
href={
isExternal(childItem.url) ? childItem.url : `${Astro.site.pathname}${childItem.url}`
}
target={isExternal(child.url) ? "_blank" : "_self"}
aria-current={`${currentPageMatch === removeSlashes(childItem.url) ? "page" : "false"}`}
>
{childItem.title}
{isExternal(childItem.url) && (
<img
src="/assets/icons/external-link.svg"
alt="external link"
style="width:12px; height: 12px"
/>
)}
</a>
</li>
))}
Expand Down
12 changes: 10 additions & 2 deletions src/components/PageContent/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const starOutline = (
/>
</svg>
)

const appId = "hvIeDclG2pt2nzAdbKWM0qms-MdYXbMMI"
const appKey = "lKObgvpdxLT2JK839oxSM4Fn"

export const Feedback = () => {
const [rating, setRating] = useState<number>(undefined)
const [isSent, setIsSent] = useState(false)
Expand All @@ -29,7 +33,7 @@ export const Feedback = () => {
}
setRating(selectedNumber + 1)
setIsSent(false)
const path = "https://docs2-cl-default-rtdb.firebaseio.com/allratings.json"
const path = "https://leancloud.scroll.io/1.1/classes/Feedback"
const data = {
rating: selectedNumber,
time: Date.now(),
Expand All @@ -40,6 +44,8 @@ export const Feedback = () => {
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"X-LC-Id": appId,
"X-LC-Key": appKey,
},
body: JSON.stringify(data),
})
Expand All @@ -55,13 +61,15 @@ export const Feedback = () => {
url: window.location.href,
}

const path = "https://docs2-cl-default-rtdb.firebaseio.com/feedback.json"
const path = "https://leancloud.scroll.io/1.1/classes/Feedback"
setIsSubmitting(true)
fetch(path, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"X-LC-Id": appId,
"X-LC-Key": appKey,
},
body: JSON.stringify(data),
})
Expand Down
5 changes: 3 additions & 2 deletions src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const SIDEBAR = {
{
section: "Pre-Alpha Testnet",
contents: [
{ title: "Introduction", url: "/" },
{ title: "Introduction", url: "https://l2scan.scroll.io/" },
{
title: "User Guide",
url: "user-guide/",
Expand All @@ -24,7 +24,8 @@ export const SIDEBAR = {
},
{
title: "Faucet",
url: "user-guide/faucet",
// url: "user-guide/faucet",
url: "https://scroll.io/prealpha/faucet",
},
{
title: "Bridge",
Expand Down
2 changes: 1 addition & 1 deletion src/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export const OPEN_GRAPH = {
export const GITHUB_EDIT_URL = `https://github.com/scroll-tech/scroll-documentation/tree/main/`

// Uncomment this to add an "Join our Community" button to every page of documentation.
export const COMMUNITY_INVITE_URL = `https://discord.gg/s84eJSdFhn`
export const COMMUNITY_INVITE_URL = `https://discord.gg/scroll`
2 changes: 1 addition & 1 deletion src/layouts/MainLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { content = {}, frontmatter } = Astro.props
const headings = Astro.props?.headings || Astro.props?.content?.astro.headings

const currentPage = new URL(Astro.request.url).pathname
const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.${frontmatter?.isMdx ? "mdx" : "md"}`
const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.${frontmatter?.file.split(".").pop() || "md"}`
const githubEditUrl = CONFIG.GITHUB_EDIT_URL + currentFile
const formattedContentTitle = content.title
? `${content.title} | ${CONFIG.SITE.title}`
Expand Down
1 change: 1 addition & 0 deletions src/pages/research.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: ../layouts/MainLayout.astro
section: research
title: "Research Landing Title"
isMdx: true
---

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