Skip to content

Commit

Permalink
Merge branch 'feat/api-docs' into canary
Browse files Browse the repository at this point in the history
  • Loading branch information
twosugar committed Nov 6, 2023
2 parents 8e6a55f + 9116515 commit 1cf0df9
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 14 deletions.
26 changes: 22 additions & 4 deletions components/locale-link.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
import { Link } from 'react-router-dom'
import { Link, LinkProps } from 'react-router-dom'
import { isServer } from '@/utils/common'
import { useTranslation } from 'next-i18next'
import { useEffect, useState } from 'react'

// @ts-ignore
export const LocaleLink: typeof Link = ({ to, children, ...other }) => {
export const LocaleLink = (props: LinkProps & { pageUrl?: string }) => {
const { to, children, pageUrl, ...other } = props
const { i18n } = useTranslation('common')
const localePrefix = i18n.language === 'zh-HK' ? '' : `/${i18n.language}`
const [pageUrlLink, setPageUrlLink] = useState('')

useEffect(() => {
const isLocal = location.hostname
const origin = isLocal ? 'https://cloud.longbridge.xyz' : ''
setPageUrlLink(`${origin}/${i18n.language}${pageUrl}`)
}, [])

if (!pageUrl || isServer()) {
return (
<Link to={`${localePrefix}${to}`} {...other}>
{children}
</Link>
)
}

return (
<Link to={`${localePrefix}${to}`} {...other}>
<a href={pageUrlLink} target="_self">
{children}
</Link>
</a>
)
}
9 changes: 5 additions & 4 deletions features/block/top-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const IndexBanner = () => {
<BlockBetween
left={
<>
<div className="text-text_color_3_supplement text-3xl mb-3 text-left">
<div className="mb-3 text-3xl text-left text-text_color_3_supplement">
{i18n.t('home_top_banner_text_1')}
</div>
<div className="text-white text-[54px] leading-[68px]text-left">
Expand All @@ -110,7 +110,7 @@ export const IndexBanner = () => {
<img
src="https://assets.lbkrs.com/uploads/c8bc35cf-c93d-419f-a703-23e1d3cb52dc/va.png"
alt="va"
className="lg:absolute top-0 bottom-0 h-full w-auto object-cover"
className="top-0 bottom-0 object-cover w-auto h-full lg:absolute"
/>
</div>
}
Expand All @@ -122,8 +122,9 @@ export const IndexBanner = () => {
<BlockBetween
left={
<>
<div className="text-text_color_3_supplement text-3xl mb-3 text-left">
<div className="mb-3 text-3xl text-left text-text_color_3_supplement">
{i18n.t('pages_locale_product_portai_891115')}
<div>{i18n.t('pages_locale_product_portai_891115_1')}</div>
</div>
<div className="text-white text-[48px] leading-[68px] text-left">
<div>{i18n.t('pages_locale_product_portai_891116')}</div>
Expand All @@ -138,7 +139,7 @@ export const IndexBanner = () => {
<img
src="https://assets.lbkrs.com/uploads/c5c9454b-3451-43ab-9466-66e5f7da53ec/ai.png"
alt="ai"
className="lg:absolute top-0 bottom-0 h-full w-auto object-cover"
className="top-0 bottom-0 object-cover w-auto h-full lg:absolute"
/>
</div>
}
Expand Down
12 changes: 8 additions & 4 deletions features/experience-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useState } from 'react'
import { useTranslation } from 'next-i18next'
import { FullMask } from '@/components/popup'
import Button from '@/components/button'
import Icon from '@/components/icon'
import { FullMask } from '@/components/popup'
import classnames from 'classnames'
import { useTranslation } from 'next-i18next'
import { useState } from 'react'

const formInfo: any = {
'zh-HK': 'https://longbridge.feishu.cn/share/base/form/shrcnhxdx8hRz3BYtrdTA8qO1Vb?lang=zh-HK',
Expand All @@ -25,6 +25,10 @@ const ExperienceDemo = ({ className = '' }) => {
const [visible, setVisible] = useState(false)
const i18n = useTranslation('common')

const openForm = () => {
window.open(formInfo[i18n.i18n.language])
}

return (
<>
{visible && (
Expand All @@ -45,7 +49,7 @@ const ExperienceDemo = ({ className = '' }) => {
'!bg-transparent cursor-pointer mt-10 border border-brand_color !text-brand_color h-[42px] px-2.5 flex items-center justify-center hover:text-brand_color_2 hover:border-brand_color_2',
className
)}
onClick={() => setVisible(true)}
onClick={openForm}
>
{i18n.t('features_experience_demo_891117')}
</Button>
Expand Down
8 changes: 7 additions & 1 deletion features/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ function useNavs() {
}, */
],
},
{
value: '',
pageUrl: '/api',
label: 'API',
children: [],
},
{
value: '/about',
suffix: '',
Expand Down Expand Up @@ -196,7 +202,7 @@ const Navs = () => {
</Dropdown>
)}
{nav.children.length === 0 && (
<LocaleLink className="flex items-center hover:text-brand_color" to={nav.value}>
<LocaleLink className="flex items-center hover:text-brand_color" to={nav.value} pageUrl={nav.pageUrl}>
<span>{nav.label}</span>
{nav.suffix && <span className="ml-2">{nav.suffix}</span>}
</LocaleLink>
Expand Down
3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,8 @@
"features_home_data_card_hour": "7×24",
"home_top_banner_text_1": "First virtual asset solution available in the HK market",
"home_top_banner_text_2": "24/7 One-stop Virtual Asset Trading Solution",
"pages_locale_product_portai_891115": "First \"FinancialGPT\" based on LLMs in Hong Kong",
"pages_locale_product_portai_891115": "First \"FinancialGPT\" based on",
"pages_locale_product_portai_891115_1": "LLMs in Hong Kong",
"pages_locale_product_portai_891116": "PortAI: AI-powered Investment Knowledge Platform for brokers",
"pages_locale_product_portai_891117": "Leveraging cutting-edge global language models, expertly optimized for the investment domain",
"pages_locale_product_portai_891118": "Amassed a substantial dataset comprising macroeconomic data, industry and company financial data, and real-time global financial information",
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@
"features_footer_index_891113": "联系我们,共同迈向数字化未来",
"features_footer_index_891114": "如您有更多需求,可直接联系我们,将及时为您解答",
"pages_locale_product_portai_891115": "香港第一個基於大語言模型的「FinancialGPT」",
"pages_locale_product_portai_891115_1": "",
"pages_locale_product_portai_891116": "PortAI:面向券商的「AI 投資知識服務平台」",
"features_home_home_solution_swiperx": "专业的行情及交易工具"
}
1 change: 1 addition & 0 deletions public/locales/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@
"home_top_banner_text_1": "香港市场第一家可用的虚拟资产解决方案",
"home_top_banner_text_2": "7×24 一站式虚拟资产交易解决方案",
"pages_locale_product_portai_891115": "香港第一个基于大语言模型的「FinancialGPT」",
"pages_locale_product_portai_891115_1": "",
"pages_locale_product_portai_891116": "PortAI:面向券商的「AI 投资知识服务平台」",
"pages_locale_product_portai_891117": "使用全球最先进的大语言模型,针对投资领域进行专业调优",
"pages_locale_product_portai_891118": "接入海量宏观经济数据,行业与公司金融数据、经营数据和全球实时财经资讯",
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh-HK/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@
"home_top_banner_text_1": "香港市場第一家可用的虛擬資產解決方案",
"home_top_banner_text_2": "7×24 一站式虛擬資產交易解決方案",
"pages_locale_product_portai_891115": "香港第一個基於大語言模型的「FinancialGPT」",
"pages_locale_product_portai_891115_1": "",
"pages_locale_product_portai_891116": "PortAI:面向券商的「AI 投資知識服務平台」",
"pages_locale_product_portai_891117": "使用全球最先進的大語言模型,針對投資領域進行專業調優",
"pages_locale_product_portai_891118": "接入海量宏觀經濟數據,行業與公司金融數據、經營數據和全球實時財經資訊",
Expand Down
1 change: 1 addition & 0 deletions styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ html {
.ant-carousel .slick-dots li button {
background: #000000;
opacity: 0.2;
@apply relative after:absolute after:bottom-0 after:left-0 after:h-6 after:w-full after:top-1/2 after:transform after:-translate-y-1/2;
}
.ant-carousel .slick-dots li.slick-active button {
background: #5622cf;
Expand Down

0 comments on commit 1cf0df9

Please sign in to comment.