-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7253f1
commit 81bd2fa
Showing
18 changed files
with
560 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"download_neuron": "Download Neuron" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"download_neuron": "下载 Neuron" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.trigger { | ||
all: unset; | ||
display: flex; | ||
} | ||
|
||
.content { | ||
// TODO: Some styles are written for the checksum tooltip in the download page, and will be extracted later. | ||
max-width: 596px; | ||
margin-bottom: 7px; | ||
padding: 12px 16px; | ||
color: #f5f5f5; | ||
font-size: 16px; | ||
line-height: 200%; | ||
background: #111; | ||
border: 1px solid #414141; | ||
border-radius: 8px; | ||
backdrop-filter: blur(38px); | ||
} | ||
|
||
.arrow { | ||
fill: #111; | ||
stroke: #414141; | ||
stroke-width: 0.4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { FC, PropsWithChildren, ReactNode } from 'react' | ||
import { Root, Trigger, Content, Provider, Portal, Arrow } from '@radix-ui/react-tooltip' | ||
import styles from './index.module.scss' | ||
|
||
export const Tooltip: FC<PropsWithChildren<{ content?: ReactNode }>> = props => { | ||
return ( | ||
<Root> | ||
<Trigger className={styles.trigger}>{props.children}</Trigger> | ||
<Portal> | ||
<Content className={styles.content}> | ||
{props.content} | ||
{/* TODO: The inside border line needs to be hidden */} | ||
<Arrow className={styles.arrow} width={32} height={16} /> | ||
</Content> | ||
</Portal> | ||
</Root> | ||
) | ||
} | ||
|
||
export const TooltipProvider: FC<PropsWithChildren> = props => { | ||
return <Provider delayDuration={0}>{props.children}</Provider> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.page { | ||
.top { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
.left { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 24px; | ||
} | ||
|
||
.right { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
} | ||
} | ||
} | ||
|
||
.neuron { | ||
display: flex; | ||
gap: 12px; | ||
align-items: center; | ||
font-weight: 600; | ||
font-size: 26px; | ||
|
||
.name { | ||
margin-top: 6px; | ||
} | ||
} | ||
|
||
.text1 { | ||
font-weight: 700; | ||
font-size: 40px; | ||
} | ||
|
||
.version { | ||
display: flex; | ||
align-items: center; | ||
width: fit-content; | ||
height: 40px; | ||
padding: 0 16px; | ||
border: 1px solid #f5f5f5; | ||
border-radius: 40px; | ||
} | ||
|
||
.assets { | ||
width: 100%; | ||
margin-top: 32px; | ||
margin-bottom: 158px; | ||
overflow: hidden; | ||
background: linear-gradient(180deg, rgb(54 54 54 / 40%) 0%, rgb(29 29 29 / 20%) 100%); | ||
border: 1px solid rgb(255 255 255 / 20%); | ||
border-radius: 24px; | ||
border-spacing: 0; | ||
backdrop-filter: blur(40px); | ||
|
||
.row { | ||
height: 64px; | ||
font-size: 16px; | ||
|
||
& > td { | ||
padding: 0 40px; | ||
border-top: 1px solid #333; | ||
} | ||
|
||
&.head { | ||
font-size: 20px; | ||
|
||
& > th { | ||
font-weight: 400; | ||
} | ||
} | ||
} | ||
|
||
.os { | ||
display: flex; | ||
gap: 4px; | ||
align-items: center; | ||
} | ||
|
||
.checksum { | ||
display: flex; | ||
gap: 4px; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.operation { | ||
& > a { | ||
color: #00c891; | ||
font-weight: 600; | ||
font-size: 16px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { GetStaticProps, type NextPage } from 'next' | ||
import { useTranslation } from 'next-i18next' | ||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations' | ||
import Link from 'next/link' | ||
import Image from 'next/image' | ||
import { useMemo } from 'react' | ||
import clsx from 'clsx' | ||
import { BooleanT, Release, getLatestRelease } from '../../utils' | ||
import { Page } from '../../components/Page' | ||
import styles from './index.module.scss' | ||
import ImgNeuronLogo from './neuron-logo.png' | ||
import ImgDownloadWallet from './download-wallet.png' | ||
import IconWindows from './windows.svg' | ||
import IconMacOS from './macos.svg' | ||
import IconLinux from './linux.svg' | ||
import IconTips from './tips.svg' | ||
import { Tooltip } from '../../components/Tooltip' | ||
|
||
interface PageProps { | ||
release: Release | ||
} | ||
|
||
const HelpCenter: NextPage<PageProps> = ({ release }) => { | ||
const { t } = useTranslation('download') | ||
|
||
const assets = useMemo(() => { | ||
const tableLines = release.body?.match(/^(.*?\|)+.*?$/gm) | ||
if (!tableLines) return [] | ||
|
||
return tableLines | ||
.map(line => { | ||
const [os, arch, packageInfo, checksum] = line.split('|') | ||
if (!os || !arch || !packageInfo || !checksum) return null | ||
|
||
const packageItems = packageInfo.match(/\[(.*?)\]\((.*?)\)/) | ||
if (!packageItems) return null | ||
const [, packageType, packageLink] = packageItems | ||
if (!packageType || !packageLink) return null | ||
|
||
return { | ||
os: os?.trim(), | ||
arch: arch?.trim(), | ||
packageType, | ||
checksum: checksum?.replace(/<.*?>(.*?)<\/.*?>/, '$1').trim(), | ||
packageLink, | ||
} | ||
}) | ||
.filter(BooleanT()) | ||
}, [release]) | ||
|
||
return ( | ||
<Page className={styles.page}> | ||
<div className={styles.top}> | ||
<div className={styles.left}> | ||
<div className={styles.neuron}> | ||
<Image src={ImgNeuronLogo} alt="Neuron Logo" width={44} height={44} /> | ||
<span className={styles.name}>Neuron</span> | ||
</div> | ||
|
||
<div className={styles.text1}>{t('download_neuron')}</div> | ||
|
||
<div className={styles.version}>Current Version {release.tag_name}</div> | ||
</div> | ||
|
||
<div className={styles.right}> | ||
<Image src={ImgDownloadWallet} alt="Help" width={200} height={168} /> | ||
</div> | ||
</div> | ||
|
||
<table className={styles.assets}> | ||
<thead> | ||
<tr className={clsx(styles.row, styles.head)}> | ||
<th>System</th> | ||
<th>Architecture</th> | ||
<th>Package Type</th> | ||
<th> | ||
<div className={styles.checksum}> | ||
Checksum | ||
<Tooltip content="After the download is complete, you can check the Checksum to ensure that the installation package has not been tampered with during the download process."> | ||
<IconTips /> | ||
</Tooltip> | ||
</div> | ||
</th> | ||
<th>Operation</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{assets.map(asset => ( | ||
<tr key={asset.os + asset.arch + asset.packageType} className={styles.row}> | ||
<td> | ||
<div className={styles.os}> | ||
{asset.os.toLowerCase() === 'windows' && <IconWindows />} | ||
{asset.os.toLowerCase() === 'macos' && <IconMacOS />} | ||
{asset.os.toLowerCase() === 'linux' && <IconLinux />} | ||
{asset.os} | ||
</div> | ||
</td> | ||
<td>{asset.arch}</td> | ||
<td>{asset.packageType}</td> | ||
<td>{asset.checksum}</td> | ||
<td className={styles.operation}> | ||
<Link href={asset.packageLink} target="_blank" rel="noopener noreferrer"> | ||
Download | ||
</Link> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</Page> | ||
) | ||
} | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale = 'en' }) => { | ||
const release = await getLatestRelease() | ||
const lng = await serverSideTranslations(locale, ['common', 'download']) | ||
|
||
const props: PageProps = { | ||
release, | ||
...lng, | ||
} | ||
|
||
return { props } | ||
} | ||
|
||
export default HelpCenter |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.