Skip to content

Commit

Permalink
feat: set theme (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Sep 12, 2023
1 parent 2adf424 commit 5ee70ac
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 38 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Build and push docker image to GitHub Container Registry
strategy:
matrix:
environment: [devnet-1]
environment: [devnet-1, testnet-1]
runs-on: ubuntu-latest-16-core
environment: ${{ matrix.environment }}
outputs:
Expand Down Expand Up @@ -54,14 +54,14 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_EXECUTOR_SERVICE_ENDPOINT=${{ vars.VITE_EXECUTOR_SERVICE_ENDPOINT }}
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS=${{ vars.VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_ERC20_MESSAGING_CONTRACT_ADDRESS=${{ vars.VITE_ERC20_MESSAGING_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS=${{ vars.VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}
VITE_TOPOS_SUBNET_ENDPOINT=${{ vars.VITE_TOPOS_SUBNET_ENDPOINT }}
VITE_TRACING_OTEL_COLLECTOR_ENDPOINT=${{ vars.VITE_TRACING_OTEL_COLLECTOR_ENDPOINT }}
VITE_TRACING_SERVICE_NAME=${{ vars.VITE_TRACING_SERVICE_NAME }}
VITE_TRACING_SERVICE_VERSION=${{ vars.VITE_TRACING_SERVICE_VERSION }}
VITE_EXECUTOR_SERVICE_ENDPOINT=${{ vars.EXECUTOR_SERVICE_ENDPOINT }}
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS=${{ vars.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_ERC20_MESSAGING_CONTRACT_ADDRESS=${{ vars.ERC20_MESSAGING_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS=${{ vars.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}
VITE_TOPOS_SUBNET_ENDPOINT=${{ vars.TOPOS_SUBNET_ENDPOINT }}
VITE_TRACING_OTEL_COLLECTOR_ENDPOINT=${{ vars.TRACING_OTEL_COLLECTOR_ENDPOINT }}
VITE_TRACING_SERVICE_NAME=${{ vars.TRACING_SERVICE_NAME }}
VITE_TRACING_SERVICE_VERSION=${{ vars.TRACING_SERVICE_VERSION }}
cache-from: |
type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:build-cache-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.workflow }}
type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:build-cache-main-${{ github.workflow }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
- name: Run Frontend unit tests
run: npm run frontend:test
env:
VITE_ERC20_MESSAGING_CONTRACT_ADDRESS: ${{ vars.VITE_ERC20_MESSAGING_CONTRACT_ADDRESS }}
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ vars.VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ vars.VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}
VITE_ERC20_MESSAGING_CONTRACT_ADDRESS: ${{ vars.ERC20_MESSAGING_CONTRACT_ADDRESS }}
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ vars.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ vars.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}

unit-backend:
name: Test/Unit/Backend
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@opentelemetry/sdk-trace-node": "^1.11.0",
"@opentelemetry/sdk-trace-web": "^1.11.0",
"@opentelemetry/semantic-conventions": "^1.11.0",
"@topos-protocol/topos-smart-contracts": "^1.2.0",
"@topos-protocol/topos-smart-contracts": "^1.2.2",
"@types/event-source-polyfill": "^1.0.1",
"antd": "^5.4.0",
"axios": "^1.0.0",
Expand Down
24 changes: 9 additions & 15 deletions packages/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { ThemeProvider } from '@emotion/react'
import styled from '@emotion/styled'
import { Alert, ConfigProvider, Layout as _Layout, theme } from 'antd'
import { Alert, Layout as _Layout } from 'antd'
import { BigNumber, ethers } from 'ethers'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'

import Header from './components/Header'
import MultiStepForm from './components/MultiStepForm'
import { ErrorsContext } from './contexts/errors'
import { SubnetsContext } from './contexts/subnets'

import 'antd/dist/reset.css'
import useRegisteredSubnets from './hooks/useRegisteredSubnets'
import useTheme from './hooks/useTheme'
import { toposCoreContract } from './contracts'
import { SubnetWithId } from './types'
import { sanitizeURLProtocol } from './utils'

const { Content: _Content } = _Layout

import 'antd/dist/reset.css'

const Errors = styled.div`
margin: 1rem auto;
width: 80%;
Expand All @@ -32,6 +34,7 @@ const Content = styled(_Content)`
`

const App = () => {
const theme = useTheme()
const [errors, setErrors] = useState<string[]>([])
const [subnets, setSubnets] = useState<SubnetWithId[]>()
const { loading, registeredSubnets } = useRegisteredSubnets()
Expand Down Expand Up @@ -77,16 +80,7 @@ const App = () => {
)

return (
<ConfigProvider
theme={{
algorithm: theme.darkAlgorithm,
components: {
Layout: {
colorBgHeader: 'transparent',
},
},
}}
>
<ThemeProvider theme={theme}>
<ErrorsContext.Provider value={{ setErrors }}>
<SubnetsContext.Provider
value={{
Expand All @@ -107,7 +101,7 @@ const App = () => {
</Layout>
</SubnetsContext.Provider>
</ErrorsContext.Provider>
</ConfigProvider>
</ThemeProvider>
)
}

Expand Down
9 changes: 9 additions & 0 deletions packages/frontend/src/hooks/useTheme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { theme } from 'antd'

export default function useTheme() {
const { token } = theme.useToken()
token.colorPrimary = '#27c794'
token.colorPrimaryHover = '#15523f'

return token
}
23 changes: 21 additions & 2 deletions packages/frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { css, Global } from '@emotion/react'
import { ConfigProvider, theme } from 'antd'
import { MetaMaskProvider } from 'metamask-react'
import ReactDOM from 'react-dom/client'

Expand All @@ -10,7 +11,25 @@ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
// <React.StrictMode>
<MetaMaskProvider>
<App />
<ConfigProvider
theme={{
algorithm: theme.darkAlgorithm,
components: {
Layout: {
colorBgHeader: 'transparent',
},
},
}}
>
<Global
styles={css`
html {
background-color: black;
}
`}
/>
<App />
</ConfigProvider>
</MetaMaskProvider>
// </React.StrictMode>
)
Expand Down

0 comments on commit 5ee70ac

Please sign in to comment.