Skip to content

Commit

Permalink
feat: move content of main page to /dev and root/main page is a redir…
Browse files Browse the repository at this point in the history
…ection page to the widgets page of docs.bosonprotocol.io
  • Loading branch information
albertfolch-redeemeum committed Mar 22, 2024
1 parent bf4cf7c commit d648c06
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 47 deletions.
66 changes: 33 additions & 33 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@bosonprotocol/react-kit": "^0.29.0-alpha.6",
"@bosonprotocol/react-kit": "^0.29.0-alpha.7",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -23,7 +23,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-app-rewired start",
"start": "PORT=3006 react-app-rewired start",
"dev": "npm run start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
Expand Down
28 changes: 19 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import { HashRouter, Route, Routes } from "react-router-dom";

import { Index, indexPath } from "./components/Index";
import { Index } from "./components/Index";
import {
redirectPath,
RedirectToDocs
} from "./components/redirect/RedirectToDocs";
import { Commit, commitPath } from "./components/widgets/commit/Commit";
import { Finance, financePath } from "./components/widgets/finance/Finance";
import { indexPath } from "./components/widgets/path";
import { Redeem, redeemPath } from "./components/widgets/redeem/Redeem";
import { GlobalStyle } from "./globalStyles";

function App() {
return (
<HashRouter>
<Routes>
<Route path={indexPath} element={<Index />} />
<Route path={financePath} element={<Finance />}></Route>
<Route path={commitPath} element={<Commit />}></Route>
<Route path={redeemPath} element={<Redeem />}></Route>
</Routes>
</HashRouter>
<>
<GlobalStyle />
<HashRouter>
<Routes>
<Route path={redirectPath} element={<RedirectToDocs />} />
<Route path={indexPath} element={<Index />} />
<Route path={financePath} element={<Finance />}></Route>
<Route path={commitPath} element={<Commit />}></Route>
<Route path={redeemPath} element={<Redeem />}></Route>
</Routes>
</HashRouter>
</>
);
}

Expand Down
2 changes: 0 additions & 2 deletions src/components/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { CommitDisplay } from "./widgets/commit/CommitDisplay";
import { FinanceDisplay } from "./widgets/finance/FinanceDisplay";
import { RedeemDisplay } from "./widgets/redeem/RedeemDisplay";

export const indexPath = "/";

const envConfigs = getEnvConfigs(CONFIG.envName);

export function Index() {
Expand Down
53 changes: 53 additions & 0 deletions src/components/redirect/RedirectToDocs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React, { useEffect } from "react";
import styled from "styled-components";

import { ReactComponent as BosonLogo } from "../../logo.svg";
export const redirectPath = "/";

const widgetsPage = "https://docs.bosonprotocol.io/docs/category/widgets";

const Redirecting = styled.div`
width: 104px;
@keyframes ellipsis {
to {
width: 1.25em;
}
}
&:after {
overflow: hidden;
display: inline-block;
vertical-align: bottom;
animation: ellipsis steps(4, end) 900ms infinite;
content: "...";
width: 0px;
}
`;

export const RedirectToDocs: React.FC = () => {
useEffect(() => {
window.location.href = widgetsPage;
}, []);
return (
<div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column",
height: "100%"
}}
>
<BosonLogo width="300px" style={{ maxWidth: "100%" }} />
<Redirecting>Redirecting</Redirecting>
<p
style={{
wordBreak: "break-word",
textAlign: "center"
}}
>
If you don't get automatically redirected, click on{" "}
<a href={widgetsPage}>{widgetsPage}</a>
</p>
</div>
);
};
1 change: 1 addition & 0 deletions src/components/widgets/path.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const indexPath = "/dev";
17 changes: 17 additions & 0 deletions src/globalStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
html, body, #root {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-family: "Plus Jakarta Sans", sans-serif;
margin: 0;
padding: 0;
font-style: normal;
height: 100vh;
}
`;
Loading

0 comments on commit d648c06

Please sign in to comment.