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

Init pages #137

Merged
merged 7 commits into from
Jul 19, 2022
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
16 changes: 16 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app"
],
"framework": "@storybook/react",
"core": {
"builder": "@storybook/builder-webpack5"
}
}
22 changes: 22 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Grommet, grommet } from 'grommet';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};

export const decorators = [
Story => {

return <>
<Grommet theme={grommet}>
<Story />
</Grommet>
</>
},
];
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@

## Setup

This is a private package in the WIN.SO mono-repository under Lerna management.
All dependencies have to be installed via `yarn bootstrap` from the root of repository.
This is a win dapp.
All dependencies have to be installed via `yarn` from the root of repository.

## Development

Create `.env` file in the root of `stays` package with content like in the file `.env.example`. To start project locally please rum this command.
Create proto folder in `src/` and run `yarn`
```bash
mkdir src/proto
yarn
```

Create `.env` file in the root of repository with content like in the file `.env.example`. To start project locally please rum this command.
```bash
yarn start
```
## Storybook

Runs a storybook UI at http://localhost:6006/
```bash
yarn storybook
```

Create `.env` file in the root of repository with content like in the file `.env.example`. To start project locally please rum this command.
```bash
yarn start
```
## Production build

```bash
Expand Down
31 changes: 28 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,26 @@
"protoc:libs": "cp -pR ./node_modules/@windingtree/stays-models/dist/proto/*.proto ./src/proto/",
"protoc:local": "protoc --ts_out ./src/proto --proto_path ./src/proto ./src/proto/*.proto",
"prepublish": "yarn protoc:libs && yarn protoc:local && yarn typechain:videre",
"typechain:videre": "npx typechain --target ethers-v5 --out-dir ./src/typechain-videre './node_modules/@windingtree/videre-contracts/artifacts/contracts/**/*.json'"
"typechain:videre": "npx typechain --target ethers-v5 --out-dir ./src/typechain-videre './node_modules/@windingtree/videre-contracts/artifacts/contracts/**/*.json'",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
],
"ignorePatterns": ["*/proto/*"]
},
"browserslist": {
"production": [
Expand All @@ -80,7 +93,19 @@
]
},
"devDependencies": {
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-interactions": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/builder-webpack5": "^6.5.9",
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/node-logger": "^6.5.9",
"@storybook/preset-create-react-app": "^4.1.2",
"@storybook/react": "^6.5.9",
"@storybook/testing-library": "^0.0.13",
"@types/luxon": "^2.3.2",
"@windingtree/videre-contracts": "^1.0.2"
"@windingtree/videre-contracts": "^1.0.2",
"babel-plugin-named-exports-order": "^0.0.2",
"prop-types": "^15.8.1"
}
}
10 changes: 10 additions & 0 deletions public/discord-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions public/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { AppStateProvider } from './store';
import { AppRoutes } from './Routes';
import { Theme } from './Theme';
import { AppHeader } from './components/AppHeader';
import { AppFooter } from './components/AppFooter';

const App = () => (
<AppStateProvider>
<Theme>
<AppHeader />
<AppRoutes />
<AppFooter />
</Theme>
</AppStateProvider>
);
Expand Down
79 changes: 68 additions & 11 deletions src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { useAppState } from './store';

// Pages
import { Home } from './pages/Home';
import { Facility } from './pages/Facility';
import { Bookings } from './pages/Bookings';
import { Faq } from './pages/Faq';
import { About } from './pages/About';
import { Contacts } from './pages/Contacts';
import { Legal } from './pages/Legal';
import { Security } from './pages/Security';
import { Developers } from './pages/Developers';

export interface ProtectedProps {
component: ReactNode;
Expand All @@ -25,18 +33,18 @@ export const Protected = ({
component,
path = '/'
}: ProtectedProps) => {
const location = useLocation();
const { account } = useAppState();
const location = useLocation();
const { account } = useAppState();

return (
<>
{
account !== undefined
? component
: <Navigate to={path} state={{ location }} />
}
</>
);
return (
<>
{
account !== undefined
? component
: <Navigate to={path} state={{ location }} />
}
</>
);
};

export const pagesRoutesConfig: Routes = [
Expand All @@ -46,6 +54,55 @@ export const pagesRoutesConfig: Routes = [
title: "Stays",
label: "Home",
},
{
path: "/facility/:id",
element: <Facility />,
title: "Facility",
// label: "Facility",
},
{
path: "/bookings",
element: <Bookings />,
title: "Bookings",
label: "Bookings",
},
{
path: "/faq",
element: <Faq />,
title: "FAQ",
label: "FAQ",
},
{
path: "/about",
element: <About />,
title: "About",
label: "About",
},
{
path: "/security",
element: <Security />,
title: "Security info",
label: "Security info",
},
{
path: "/legal",
element: <Legal />,
title: "Legal info",
label: "Legal info",
},
{
path: "/contacts",
element: <Contacts />,
title: "Contacts",
label: "Contacts",
},
{
path: "/developers",
element: <Developers />,
title: "Developers",
// label: "Developers",
}

];

export const processPagesConfig = (config: Routes): Routes =>
Expand Down
19 changes: 12 additions & 7 deletions src/components/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import type { Web3ModalProvider } from '../hooks/useWeb3Modal';
import { useCallback, useMemo, useState } from 'react';
import { utils } from 'ethers';
import Blockies from 'react-blockies';
import styled from 'styled-components';
import { Box, Text, Notification } from 'grommet';
import { centerEllipsis, copyToClipboard } from '../utils/strings';
import { usePoller } from '../hooks/usePoller';
import { useAppState } from "../store";

export interface AccountProps {
account?: string;
provider?: Web3ModalProvider;
}

const AccountIcon = styled(Blockies)`
border-radius: 50%;
Expand All @@ -16,11 +21,11 @@ const AccountHash = styled(Text)`
cursor: pointer;
`;

export const Account = () => {
const {
provider,
account
} = useAppState();
export const Account: React.FC<AccountProps> = ({ account, provider }) => {
// const {
// provider,
// account
// } = useAppState();
const [balance, setBalance] = useState<string>('');
const [notification, setNotification] = useState<boolean>(false);

Expand Down Expand Up @@ -50,7 +55,7 @@ export const Account = () => {
'Account balance'
);

if (!provider || !account || balance === '') {
if (!provider || !account) {
return null;
}

Expand Down
Loading