-
-
-
+
shareTG(i18n.language as LanguageType, walletAddress)} />
+
shareTW(i18n.language as LanguageType, walletAddress)} />
+
shareLK(i18n.language as LanguageType, walletAddress)} />
@@ -261,7 +264,7 @@ const ContractRecord = (props: ContractRecordProps) => {
const { list, rate, currentTime } = props
const { t } = useTranslation()
const { push } = useRouter()
-
+
return (
diff --git a/src/router/layout/index.tsx b/src/router/layout/index.tsx
index f17ea19..93382cb 100644
--- a/src/router/layout/index.tsx
+++ b/src/router/layout/index.tsx
@@ -49,6 +49,11 @@ const LayoutRouter = () => {
push('/', null, true)
window.sessionStorage.setItem(SOFIL_LANGUAGE, pathname)
}
+ console.log('----------------------');
+
+ if (location.pathname === '/') {
+ push('/', null, true)
+ }
}
diff --git a/src/utils/share.ts b/src/utils/share.ts
new file mode 100644
index 0000000..3ce6e7a
--- /dev/null
+++ b/src/utils/share.ts
@@ -0,0 +1,64 @@
+export type LanguageType = 'en' | 'zh' | 'hk'
+
+export const shareTG = async (language: LanguageType, address: string) => {
+ const text = shareText(language, address)
+ const url = process.env.REACT_APP_SHARE_URL as string
+
+ const tg = `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`
+ window.open(tg)
+}
+
+export const shareTW = async (language: LanguageType, address: string) => {
+ const text = shareText(language, address)
+ const url = process.env.REACT_APP_SHARE_URL as string
+ const tw = `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`
+ window.open(tw)
+}
+
+export const shareLK = async (language: LanguageType, address: string) => {
+ const text = shareText(language, address)
+ const url = process.env.REACT_APP_SHARE_URL as string
+ const linkedinShareUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`;
+ window.open(linkedinShareUrl)
+}
+
+
+const shareText = (language: LanguageType, address: string) => {
+ const ts = {
+ 'en': `
+ Join me to stake $FIL on SOFIL with my referral code to earn up to 16.23% APY !
+ SOFIL is a DeFi platform offering stake-to-earn opportunities to crypto holders.
+
+ My referral code: ${address}
+ You can insert my referral code before you stake.
+
+ Come and explore more with me on SOFIL by scanning the following QR code or directly visit app.sofil.io on your MetaMask
+
+ SOFIL Official Website: https://sofil.io
+ `,
+
+ 'hk':
+ `
+ 使用我的推薦碼在 SOFIL 上質押 $FIL,即可賺取高達 16.23% 年利率!\n
+ SOFIL 是一個去中心金融平台,為加密貨幣持有者提供質押賺取的機會。\n
+ 我的推薦碼:${address} \n
+ 您可以在質押前輸入我的推薦碼。\n
+ 掃描以下二維碼或直接在 MetaMask 上瀏覽 app.sofil.io,與我一起探索 SOFIL 的更多內容!\n
+ SOFIL官方網站:https://sofil.io
+ `,
+
+ 'zh': `
+ 使用我的推荐码在 SOFIL 上质押 $FIL,即可赚取高达 16.23% 年利率!
+ SOFIL 是一个去中心金融平台,为加密货币持有者提供质押赚取的机会。
+
+ 我的推荐码:${address}
+ 您可以在质押前输入我的推荐码。
+
+ 扫描以下二维码或直接在 MetaMask 上浏览 app.sofil.io,与我一起探索 SOFIL 的更多内容!
+
+ SOFIL官方网站:https://sofil.io
+ `
+ } as { [key: string]: string }
+ return ts[language]
+}
+// https://t.me/share/url?url=https://baidu.com&text=sdasdasdasdasd\nasdkahdkashdkajshd
\ No newline at end of file