Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/oraichain/oraiswap-v3-app in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
haunv3 committed Jun 19, 2024
2 parents 1dabf63 + e10f043 commit 669f4ea
Show file tree
Hide file tree
Showing 76 changed files with 3,198 additions and 2,255 deletions.
11 changes: 0 additions & 11 deletions .env

This file was deleted.

3 changes: 3 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"hosting": {
"oraidex-amm-v3-staging": [
"oraidex-amm-v3-staging"
],
"oraidex-amm-v3-prod": [
"oraidex-amm-v3-prod"
]
}
}
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is a basic workflow to help you get started with Actions

name: Prod

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.18.0]

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
./node_modules/
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Yarn
run: npm install -g yarn
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --ignore-platform --ignore-engines --silent
# run: yarn --ignore-platform --ignore-engines --silent
- name: Copy env
run: cp .env.example .env
- name: Build
run: yarn build
env:
CI: false
# - name: Sentry sourcemap
# run: echo "$ENV_SENTRY_PROD" > sentry.env && source sentry.env && yarn sentry:sourcemap
# shell: bash
# env:
# ENV_SENTRY_PROD: ${{secrets.ENV_SENTRY_PROD}}
- name: Set firebase project alias
run: yarn firebase deploy --only hosting:oraidex-amm-v3-prod --token ${{ secrets.FIREBASE_TOKEN }}
- name: Send discord message
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
username: "GitBot"
message: ':loudspeaker: [prod] Repo ``oraiswap-v3-app`` has just published by ${{ github.event.head_commit.author.name }}'
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
# env:
# ENV_SENTRY_PROD: ${{secrets.ENV_SENTRY_PROD}}
- name: Set firebase project alias
run: yarn firebase deploy --only hosting:oraidex-amm-v3-staging --token ${{ secrets.FIREBASE_TOKEN_PHUTX }} -m "${{ github.event.head_commit.message }}"
run: yarn firebase deploy --only hosting:oraidex-amm-v3-staging --token ${{ secrets.FIREBASE_TOKEN }}
- name: Send discord message
uses: appleboy/discord-action@master
with:
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ dist-ssr
/storybook-static
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env*
!.env.example
.idea
.firebase

Expand Down
7 changes: 7 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const config: StorybookConfig = {
},
docs: {
autodocs: 'tag'
},
typescript: {
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: prop => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true)
}
}
}
export default config
3 changes: 3 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
}
</style>
<script>
BigInt.prototype.toJSON = function () {
return this.toString()
}
window.global = window
</script>
35 changes: 35 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
{
"hosting": [
{
"target": "oraidex-amm-v3-prod",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [
{
"source": "/**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|woff2|font.css)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=604800"
}
]
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "oraidex-amm-v3-staging",
"public": "dist",
Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<head>
<script>
window.global = window
// @ts-ignore
BigInt.prototype.toJSON = function () {
return this.toString()
}
</script>
<!-- <script type="module" src="/src/shims.ts"></script> -->
<meta charset="UTF-8" />
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"animated-number-react": "^0.1.2",
"axios": "^0.28.0",
"classnames": "^2.5.1",
"firebase-tools": "^13.11.2",
"notistack": "^3.0.1",
"rc-scrollbars": "^1.1.6",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/AnimatedButton/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useStyles = makeStyles()(() => {
textTransform: 'none',
...typography.body1,
color: colors.oraidex.componentBcg,
background: colors.oraidex.pinkLinearGradient,
background: colors.oraidex.greenLinearGradient,
transition: 'background-color 0ms ease, box-shadow 150ms linear',
position: 'relative',
overflow: 'hidden',
Expand Down
3 changes: 1 addition & 2 deletions src/components/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/react'
import { fn } from '@storybook/test'
import Header from './Header'
import { MemoryRouter } from 'react-router-dom'
import { Network } from '@store/consts/utils'

const meta = {
title: 'Layout/Header',
Expand All @@ -29,7 +28,7 @@ export const Primary: Story = {
onDisconnectWallet: fn(),
onNetworkSelect: fn(),
rpc: 'https://rpc.testnet.moonbeam.network',
typeOfNetwork: Network.Testnet,
typeOfNetwork: 'Testnet',
walletConnected: true,
onFaucet: fn()
}
Expand Down
22 changes: 13 additions & 9 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import SelectNetworkButton from './HeaderButton/SelectNetworkButton'
import SelectRPCButton from './HeaderButton/SelectRPCButton'
import useButtonStyles from './HeaderButton/style'
import useStyles from './style'
import { Network } from '@store/consts/utils'

export interface IHeader {
address: string
Expand Down Expand Up @@ -65,14 +64,19 @@ export const Header: React.FC<IHeader> = ({

const testnetRPCs = [
{
networkType: Network.Testnet,
networkType: 'Testnet' as Network,
rpc: OraichainNetworks.TEST,
rpcName: 'Aleph zero'
}
]

return (
<Grid container>
<Grid
container
sx={{
backgroundColor: '#121511',
borderBottom: '1px solid #232521'
}}>
<Grid container className={classes.root} direction='row' alignItems='center' wrap='nowrap'>
<Grid
container
Expand Down Expand Up @@ -118,7 +122,7 @@ export const Header: React.FC<IHeader> = ({
</Grid>

<Grid container item className={classes.buttons} wrap='nowrap' gap={1.5}>
{typeOfNetwork === Network.Testnet ? (
{typeOfNetwork === 'Testnet' ? (
<Box sx={{ display: { xs: 'none', sm: 'block' } }}>
<Button
className={buttonStyles.classes.headerButton}
Expand All @@ -129,12 +133,12 @@ export const Header: React.FC<IHeader> = ({
</Button>
</Box>
) : null}
{typeOfNetwork === Network.Testnet ? (
{typeOfNetwork === 'Testnet' ? (
<Box sx={{ display: { xs: 'none', sm: 'block' } }}>
<SelectRPCButton rpc={rpc} networks={testnetRPCs} onSelect={onNetworkSelect} />
</Box>
) : null}
<SelectNetworkButton name={typeOfNetwork} networks={[]} onSelect={onNetworkSelect} />
{/* <SelectNetworkButton name={typeOfNetwork} networks={[]} onSelect={onNetworkSelect} /> */}
<ChangeWalletButton
name={
walletConnected
Expand Down Expand Up @@ -180,17 +184,17 @@ export const Header: React.FC<IHeader> = ({
setRoutesModalOpen(false)
unblurContent()
}}
onFaucet={typeOfNetwork === Network.Testnet && isXsDown ? onFaucet : undefined}
onFaucet={typeOfNetwork === 'Testnet' && isXsDown ? onFaucet : undefined}
onRPC={
typeOfNetwork === Network.Testnet && isXsDown
typeOfNetwork === 'Testnet' && isXsDown
? () => {
setRoutesModalOpen(false)
setTestnetRpcsOpen(true)
}
: undefined
}
/>
{typeOfNetwork === Network.Testnet ? (
{typeOfNetwork === 'Testnet' ? (
<SelectTestnetRPC
networks={testnetRPCs}
open={testnetRpcsOpen}
Expand Down
7 changes: 3 additions & 4 deletions src/components/Header/HeaderButton/HeaderButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import ChangeWalletButton from './ChangeWalletButton'
import SelectNetworkButton from './SelectNetworkButton'
import SelectRPCButton from './SelectRPCButton'

import { Network } from '@store/consts/utils'
import { action } from '@storybook/addon-actions'

const meta = {
Expand Down Expand Up @@ -58,8 +57,8 @@ export const SelectNetwork: Story = {
render: () => (
<div style={{ padding: '100px' }}>
<SelectNetworkButton
name={Network.Testnet}
networks={[{ networkType: Network.Testnet, rpc: OraichainNetworks.TEST }]}
name={'Mainnet'}
networks={[{ networkType: 'Mainnet', rpc: OraichainNetworks.MAIN }]}
onSelect={(networkType, rpc) => action('chosen: ' + networkType + ' ' + rpc)()}
/>
</div>
Expand All @@ -73,7 +72,7 @@ export const SelectRPC: Story = {
rpc={OraichainNetworks.TEST}
networks={[
{
networkType: Network.Testnet,
networkType: 'Testnet',
rpc: OraichainNetworks.TEST,
rpcName: 'Testnet'
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/HeaderButton/SelectNetworkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { blurContent, unblurContent } from '@utils/uiUtils'
import { Button } from '@mui/material'
import SelectNetwork from '@components/Modals/SelectNetwork/SelectNetwork'
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
import { Network } from '@store/consts/utils'

export interface IProps {
name: Network
Expand Down Expand Up @@ -45,6 +44,7 @@ export const SelectNetworkButton: React.FC<IProps> = ({
onClick={handleClick}>
{name}
</Button>

<SelectNetwork
networks={networks}
open={openNetworks}
Expand Down
1 change: 0 additions & 1 deletion src/components/Header/HeaderButton/SelectRPCButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { blurContent, unblurContent } from '@utils/uiUtils'
import { Button } from '@mui/material'
import SelectTestnetRPC from '@components/Modals/SelectTestnetRPC/SelectTestnetRPC'
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
import { Network } from '@store/consts/utils'

export interface IProps {
rpc: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/HeaderButton/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useStyles = makeStyles()((theme: Theme) => {
WebkitPaddingBefore: '2px'
},
headerButtonConnect: {
background: colors.oraidex.pinkLinearGradientOpacity,
background: colors.oraidex.greenLinearGradientOpacity,
color: colors.oraidex.newDark,
paddingInline: 12,
borderRadius: 10,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/DepositAmountInput/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useStyles = makeStyles()((theme: Theme) => {
}
},
input: {
color: colors.oraidex.light,
color: colors.oraidex.text,
...typography.heading2,
width: '100%',
textAlign: 'right',
Expand Down
Loading

0 comments on commit 669f4ea

Please sign in to comment.