From eee6ac780ef68a5a7a52b11c2d6bb34f6ef01f65 Mon Sep 17 00:00:00 2001
From: Achraf Eddaqqaq <51858084+aeddaqqa@users.noreply.github.com>
Date: Tue, 4 Jul 2023 20:49:11 +0100
Subject: [PATCH 01/12] feat: expose the commit hash to the suite (#133)
---
package.json | 1 +
src/components/Footer/LoadWalletVersion.tsx | 18 ++++++
src/components/Footer/Version.tsx | 45 +++++++++++++
src/components/Footer/index.tsx | 71 ++++++++++++++++++++-
src/constants/route-paths.ts | 8 +++
src/theme/typography.ts | 2 +-
webpack.common.js | 23 +++++++
yarn.lock | 21 +++++-
8 files changed, 186 insertions(+), 3 deletions(-)
create mode 100644 src/components/Footer/LoadWalletVersion.tsx
create mode 100644 src/components/Footer/Version.tsx
diff --git a/package.json b/package.json
index 7e4da16a..1e69e7cf 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"babel-loader": "^8.2.2",
"copy-webpack-plugin": "^11.0.0",
"cypress-file-upload": "^4.0.7",
+ "dotenv-webpack": "^8.0.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-react-app": "^7.0.1",
diff --git a/src/components/Footer/LoadWalletVersion.tsx b/src/components/Footer/LoadWalletVersion.tsx
new file mode 100644
index 00000000..89f2eec5
--- /dev/null
+++ b/src/components/Footer/LoadWalletVersion.tsx
@@ -0,0 +1,18 @@
+import React, { useRef } from 'react'
+import { mountVersionComponent } from 'wallet/mountVersionComponent'
+import { useEffectOnce } from '../../hooks/useEffectOnce'
+
+const WalletVersionComponent = () => {
+ const ref = useRef(null)
+ useEffectOnce(() => {
+ mountVersionComponent(ref.current)
+ }) // eslint-disable-line react-hooks/exhaustive-deps
+
+ return (
+ <>
+
+ >
+ )
+}
+
+export default React.memo(WalletVersionComponent)
diff --git a/src/components/Footer/Version.tsx b/src/components/Footer/Version.tsx
new file mode 100644
index 00000000..6b58b433
--- /dev/null
+++ b/src/components/Footer/Version.tsx
@@ -0,0 +1,45 @@
+import React from 'react'
+import WalletVersionComponent from './LoadWalletVersion'
+import { Box, Typography } from '@mui/material'
+import { useStore } from 'Explorer/useStore'
+import { Link } from 'react-router-dom'
+import { SUITE, SUITE_EXPLORER, SUITE_WALLET } from '../../constants/route-paths'
+
+const LinkButton = ({ children, type, to }) => {
+ return (
+
+
+ {type}
+
+
+
+ {children}
+
+
+
+ )
+}
+
+const Version = () => {
+ const { state } = useStore()
+ return (
+
+
+ {process.env.GIT_COMMIT_HASH}
+
+
+
+
+
+ {state.appConfig.commitHash}
+
+
+ )
+}
+
+export default Version
diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx
index b7aef62c..8e8aa273 100644
--- a/src/components/Footer/index.tsx
+++ b/src/components/Footer/index.tsx
@@ -1,5 +1,15 @@
import React from 'react'
-import { Box, Grid, Typography, useTheme, Divider, Container, MenuItem } from '@mui/material'
+import {
+ Box,
+ Grid,
+ Typography,
+ useTheme,
+ Divider,
+ Container,
+ MenuItem,
+ Tooltip,
+ Fade,
+} from '@mui/material'
import {
DOCS,
TWITTER,
@@ -9,8 +19,12 @@ import {
GITHUB,
DISCORD,
CAMINO,
+ SUITE_RELEASES,
} from '../../constants/route-paths'
import { Link } from 'react-router-dom'
+import { mdiInformationOutline } from '@mdi/js'
+import Icon from '@mdi/react'
+import Version from './Version'
export default function Footer() {
const theme = useTheme()
@@ -139,6 +153,61 @@ export default function Footer() {
))}
+
+
+
+
+ Camino Network Foundation © 2023
+
+
+
+
+ {process.env.NODE_ENV === 'development' ? (
+ }
+ placement="top"
+ PopperProps={{
+ sx: {
+ '& .MuiTooltip-tooltip': {
+ maxWidth: '500px !important',
+ },
+ },
+ }}
+ >
+
+
+ ) : (
+
+ )}
+
+
+
+ {process.env.VERSION}
+
+
+
+
+
diff --git a/src/constants/route-paths.ts b/src/constants/route-paths.ts
index 88c296e8..b7a1280f 100644
--- a/src/constants/route-paths.ts
+++ b/src/constants/route-paths.ts
@@ -14,6 +14,14 @@ export const GITHUB = 'https://github.com/chain4travel/'
export const CAMINO = 'https://camino.network/'
+export const SUITE_RELEASES = 'https://github.com/chain4travel/camino-suite/releases'
+
+export const SUITE_WALLET = 'https://github.com/chain4travel/camino-wallet/tree/suite'
+
+export const SUITE_EXPLORER = 'https://github.com/chain4travel/camino-block-explorer/tree/suite'
+
+export const SUITE = 'https://github.com/chain4travel/camino-suite/tree/suite'
+
export const WALLET = '/wallet'
export const BASE_PATH = '/explorer'
diff --git a/src/theme/typography.ts b/src/theme/typography.ts
index dd5251ad..d4539656 100644
--- a/src/theme/typography.ts
+++ b/src/theme/typography.ts
@@ -16,7 +16,7 @@ function responsiveFontSizes({ sm, md, lg }: { sm: number; md: number; lg: numbe
}
}
-const FONT_PRIMARY = 'ClashDisplay'
+const FONT_PRIMARY = 'Inter'
const FONT_SECONDARY = 'Inter'
const typography = {
diff --git a/webpack.common.js b/webpack.common.js
index d19a7463..a4979b15 100644
--- a/webpack.common.js
+++ b/webpack.common.js
@@ -1,6 +1,23 @@
const HtmlWebPackPlugin = require('html-webpack-plugin')
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
+const Dotenv = require('dotenv-webpack')
+const webpack = require('webpack')
+const { execSync } = require('child_process')
+
+const getGitInformation = () => {
+ try {
+ const commit = execSync('git rev-parse --short HEAD').toString().trim()
+ const repo = execSync('git config --get remote.origin.url').toString().trim()
+ const tag = execSync('git describe --tags --always').toString().trim()
+ return { commit, repo, tag }
+ } catch (e) {
+ return { commit: '', repo: '', tag: '' }
+ }
+}
+
+const gitInfo = getGitInformation()
+
module.exports = {
resolve: {
extensions: ['.vue', '.tsx', '.ts', '.jsx', '.js', '.json'],
@@ -33,6 +50,12 @@ module.exports = {
},
plugins: [
+ new Dotenv(),
+ new webpack.DefinePlugin({
+ 'process.env.GIT_COMMIT_HASH': JSON.stringify(gitInfo.commit),
+ 'process.env.VERSION': JSON.stringify(gitInfo.tag),
+ 'process.env.RELEASES_PAGE': JSON.stringify(gitInfo.repo),
+ }),
new HtmlWebPackPlugin({
template: path.resolve(__dirname, 'public/index.html'),
favicon: 'public/favicon.ico',
diff --git a/yarn.lock b/yarn.lock
index 4c5717b9..665951df 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1173,7 +1173,7 @@
"@c4tplatform/camino-wallet-sdk@file:camino-wallet-sdk":
version "0.0.2"
dependencies:
- "@c4tplatform/caminojs" "file:../../../../.cache/yarn/v6/npm-@c4tplatform-camino-wallet-sdk-0.0.2-219ce51b-7ff5-45af-90b9-a8b0ac92aba5-1685654423926/node_modules/@c4tplatform/camino-wallet-sdk/caminojs"
+ "@c4tplatform/caminojs" "file:../../../../Library/Caches/Yarn/v6/npm-@c4tplatform-camino-wallet-sdk-0.0.2-7816f32c-f51e-4cd0-b062-32a01391a346-1686832390604/node_modules/@c4tplatform/camino-wallet-sdk/caminojs"
"@ethereumjs/tx" "3.4.0"
"@ledgerhq/hw-app-eth" "6.12.2"
"@ledgerhq/hw-transport" "^6.19.0"
@@ -6184,16 +6184,35 @@ dot-case@^3.0.4:
no-case "^3.0.4"
tslib "^2.0.3"
+dotenv-defaults@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-2.0.2.tgz#6b3ec2e4319aafb70940abda72d3856770ee77ac"
+ integrity sha512-iOIzovWfsUHU91L5i8bJce3NYK5JXeAwH50Jh6+ARUdLiiGlYWfGw6UkzsYqaXZH/hjE/eCd/PlfM/qqyK0AMg==
+ dependencies:
+ dotenv "^8.2.0"
+
dotenv-expand@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
+dotenv-webpack@^8.0.1:
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-8.0.1.tgz#6656550460a8076fab20e5ac2eac867e72478645"
+ integrity sha512-CdrgfhZOnx4uB18SgaoP9XHRN2v48BbjuXQsZY5ixs5A8579NxQkmMxRtI7aTwSiSQcM2ao12Fdu+L3ZS3bG4w==
+ dependencies:
+ dotenv-defaults "^2.0.2"
+
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
+dotenv@^8.2.0:
+ version "8.6.0"
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
+ integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==
+
duplexer3@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e"
From 59a556fa5131faef51915be8bcdbd2ac56a38778 Mon Sep 17 00:00:00 2001
From: Achraf Eddaqqaq <51858084+aeddaqqa@users.noreply.github.com>
Date: Wed, 5 Jul 2023 16:12:16 +0100
Subject: [PATCH 02/12] add beta tag to kyb button (#139)
---
src/components/Navbar/LoginButton.tsx | 35 ++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/components/Navbar/LoginButton.tsx b/src/components/Navbar/LoginButton.tsx
index d9234b87..ff20461c 100644
--- a/src/components/Navbar/LoginButton.tsx
+++ b/src/components/Navbar/LoginButton.tsx
@@ -1,6 +1,6 @@
import React from 'react'
import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks'
-import { MenuItem, MenuList, Select, IconButton, useTheme, Typography } from '@mui/material'
+import { MenuItem, MenuList, Select, IconButton, useTheme, Typography, Chip } from '@mui/material'
import store from 'wallet/store'
import { useNavigate } from 'react-router-dom'
import {
@@ -52,8 +52,20 @@ export default function LoginIcon() {
-