Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TAS-167] Feat/swap #8

Merged
merged 5 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"plugins": [
"@nx",
"formatjs",
"unused-imports",
"simple-import-sort",
"prettier"
],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"extends": ["plugin:react/recommended", "plugin:prettier/recommended"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
Expand All @@ -18,7 +25,41 @@
}
]
}
]
],
"react/react-in-jsx-scope": "off",
// Unused imports rules
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "warn",

// Import ordering rules
"simple-import-sort/imports": [
"warn",
{
"groups": [
// Side effect imports
["^\\u0000"],
// React Package(s) comes first as seperate group
["^react(-dom(/client)?)?$"],
// All other imports
["^@?\\w"],
["^((?!\\u0000$)|/.*|$)"],
["^\\."],
// Type imports: keep these last!
["^@?\\w.*\\u0000$"],
["^.*\\u0000$"],
["^\\..*\\u0000$"]
]
}
],

// import types rules
"@typescript-eslint/consistent-type-imports": "error",

// FormatJS rules
"formatjs/enforce-default-message": ["error", "literal"],
"formatjs/no-id": "error",
"formatjs/no-multiple-whitespaces": "error",
"formatjs/no-offset": "error"
}
},
{
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ⚡ Chromatic Check

on: push

jobs:
publish-chromatic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: true

- name: Build storybook
run: pnpm build-storybook

- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: 'dist/storybook/shared-storybook'
27 changes: 0 additions & 27 deletions .github/workflows/storybook.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2
}
11 changes: 9 additions & 2 deletions apps/oeth/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand All @@ -7,7 +7,14 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.css" />
<!-- Inter font -->
<link rel="preconnect" href="https://rsms.me/" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
<!-- -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/typeface-sailec@1.0.0/index.min.css"
/>
</head>
<body>
<div id="root"></div>
Expand Down
17 changes: 17 additions & 0 deletions apps/oeth/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { HistoryView, SwapView, WrapView } from '@origin/defi/oeth';
import { Route, Routes } from 'react-router-dom';

import { Layout } from './Layout';

export function App() {
return (
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<SwapView />} />
<Route path="wrap" element={<WrapView />} />
<Route path="history" element={<HistoryView />} />
<Route path="swap" element={<SwapView />} />
</Route>
</Routes>
);
}
39 changes: 39 additions & 0 deletions apps/oeth/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Container } from '@mui/material';
import { TopNav } from '@origin/shared/components';
import { useIntl } from 'react-intl';
import { Outlet } from 'react-router-dom';

export function Layout() {
const intl = useIntl();

return (
<>
<TopNav
logo="https://app.oeth.com/images/origin-ether-logo.svg"
tabs={[
intl.formatMessage({ defaultMessage: 'Swap' }),
intl.formatMessage({ defaultMessage: 'Wrap' }),
intl.formatMessage({ defaultMessage: 'History' }),
]}
selected={0}
connected={false}
ipfsLink={'https://oeth.on.fleek.co/'}
/>
<Container
sx={{
mt: {
xs: 3,
md: 5,
paddingInline: {
xs: 2,
md: 0,
},
},
}}
maxWidth="sm"
>
<Outlet />
</Container>
</>
);
}
1 change: 1 addition & 0 deletions apps/oeth/src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './App';
4 changes: 0 additions & 4 deletions apps/oeth/src/index.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions apps/oeth/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { StrictMode } from 'react';
import * as ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { OethRoot } from './views/root';
import { QueryClientProvider } from '@tanstack/react-query';
import { queryClient } from '@origin/shared/data-access';
import { theme } from '@origin/shared/theme';
Expand All @@ -11,6 +10,7 @@ import {
} from '@mui/material';
import { IntlProvider } from 'react-intl';
import { en } from './lang';
import { App } from './components';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
Expand All @@ -22,7 +22,7 @@ root.render(
<QueryClientProvider client={queryClient}>
<CssVarsProvider theme={theme} defaultMode="dark">
<CssBaseline />
<OethRoot />
<App />
</CssVarsProvider>
</QueryClientProvider>
</BrowserRouter>
Expand Down
13 changes: 0 additions & 13 deletions apps/oeth/src/views/root/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/oeth/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"src/**/*.spec.jsx",
"src/**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx", "../../libs/defi/oeth/src/components/TopNav.tsx"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ../../libs/defi/oeth/src/components/TopNav.tsx necessary?

}
15 changes: 14 additions & 1 deletion apps/oeth/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
/// <reference types="vite-plugin-svgr/client" />
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import svgr from 'vite-plugin-svgr';
import viteTsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
Expand All @@ -17,6 +21,7 @@ export default defineConfig({
},

plugins: [
svgr(),
react({
babel: {
plugins: [
Expand All @@ -33,6 +38,14 @@ export default defineConfig({
viteTsConfigPaths({
root: '../../',
}),
viteStaticCopy({
targets: [
{
src: path.resolve(__dirname, '../../libs/shared/assets/files/*'),
dest: './images',
},
],
}),
],

// Uncomment this if you are using workers.
Expand Down
3 changes: 1 addition & 2 deletions apps/ousd/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand All @@ -7,7 +7,6 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<div id="root"></div>
Expand Down
30 changes: 30 additions & 0 deletions libs/defi/oeth/src/components/History/HistoryButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { HistoryFilterButton } from './HistoryButton';

import type { Meta, StoryObj } from '@storybook/react';

const meta: Meta<typeof HistoryFilterButton> = {
component: HistoryFilterButton,
title: 'History/History filter button',
args: {
circle: false,
children: 'Test',
},
render: (args) => <HistoryFilterButton {...args} />,
};

export default meta;

export const Primary: StoryObj<typeof HistoryFilterButton> = {};

export const WithCircle: StoryObj<typeof HistoryFilterButton> = {
args: {
circle: true,
},
};

export const Selected: StoryObj<typeof HistoryFilterButton> = {
args: {
circle: true,
selected: true,
},
};
Loading
Loading