Skip to content

Commit baedb75

Browse files
authored
Merge pull request #394 from opacity/fix/update-copy-2021-02-13
Copy changes and version hash display
2 parents 700b145 + 55a3128 commit baedb75

File tree

6 files changed

+144
-75
lines changed

6 files changed

+144
-75
lines changed

config/webpack.config.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
const HtmlWebpackPlugin = require("html-webpack-plugin");
55
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
66
const ManifestPlugin = require("webpack-manifest-plugin");
7-
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
8-
.BundleAnalyzerPlugin;
7+
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
98
const InterpolateHtmlPlugin = require("interpolate-html-plugin");
109
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin");
1110
const eslintFormatter = require("react-dev-utils/eslintFormatter");
1211
const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin");
1312
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
1413
const CopyWebpackPlugin = require("copy-webpack-plugin");
1514
const CompressionPlugin = require("compression-webpack-plugin");
15+
const DumpMetaPlugin = require("dumpmeta-webpack-plugin").DumpMetaPlugin;
1616

1717
const path = require("path");
1818
const merge = require("webpack-merge");
@@ -140,7 +140,11 @@ function returnDevelopmentConfiguration () {
140140
devServer: {
141141
port: 3001,
142142
open: true,
143-
historyApiFallback: true
143+
historyApiFallback: true,
144+
contentBase: path.join(__dirname, paths.appBuild),
145+
watchOptions: {
146+
ignored: /node_modules|build/,
147+
},
144148
},
145149
devtool: "source-map",
146150
entry: paths.appIndexJs,
@@ -177,8 +181,16 @@ function returnDevelopmentConfiguration () {
177181
{ from: "./public/logo.png" }, // <- your path to logo
178182
{ from: "./public/manifest.json" }, // <- your path to manifest
179183
{ from: "./public/robots.txt" }, // <- your path to robots
180-
{ from: "./public/sitemap.xml" } // <- your path to sitemap
181-
])
184+
{ from: "./public/sitemap.xml" }, // <- your path to sitemap
185+
{ from: "./build/version.json" },
186+
]),
187+
new DumpMetaPlugin({
188+
filename: path.join(paths.appBuild, "version.json"),
189+
prepare: stats => ({
190+
// add any other information you need to dump
191+
hash: stats.hash,
192+
})
193+
}),
182194
]
183195
});
184196
}
@@ -292,8 +304,16 @@ function returnProductionConfiguration () {
292304
{ from: "./public/logo.png" }, // <- your path to logo
293305
{ from: "./public/manifest.json" }, // <- your path to manifest
294306
{ from: "./public/robots.txt" }, // <- your path to robots
295-
{ from: "./public/sitemap.xml" } // <- your path to sitemap
296-
])
307+
{ from: "./public/sitemap.xml" }, // <- your path to sitemap
308+
{ from: "./build/version.json" },
309+
]),
310+
new DumpMetaPlugin({
311+
filename: path.join(paths.appBuild, "version.json"),
312+
prepare: stats => ({
313+
// add any other information you need to dump
314+
hash: stats.hash,
315+
})
316+
}),
297317
]
298318
});
299319
}

package-lock.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
"copy-webpack-plugin": "^4.6.0",
136136
"cross-env": "^5.2.0",
137137
"cypress": "^3.4.1",
138+
"dumpmeta-webpack-plugin": "^0.2.0",
138139
"enzyme": "^3.8.0",
139140
"enzyme-adapter-react-16": "^1.7.1",
140141
"enzyme-to-json": "^3.3.5",

src/components/file-manager/file-manager-slide.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,20 @@ const FileManagerSlide = ({
493493
getFileList({ directory, masterHandle });
494494
}, [directory]);
495495

496+
const [buildVersion, setBuildVersion] = useState("Loading...");
497+
498+
useEffect(() => {
499+
fetch("/version.json")
500+
.then(async res => {
501+
const { hash }: { hash: string } = await res.json();
502+
503+
setBuildVersion(hash.slice(-6));
504+
})
505+
.catch(err => {
506+
setBuildVersion(err);
507+
});
508+
}, []);
509+
496510
return (
497511
<DroppableZone {...getRootProps()}>
498512
<ThemeProvider theme={theme}>
@@ -513,7 +527,7 @@ const FileManagerSlide = ({
513527
<TitleWrapper>
514528
<div>
515529
<Title>Opacity File Manager</Title>
516-
<span>{version}</span>
530+
<span>{version}{buildVersion && " - "}{buildVersion}</span>
517531
</div>
518532
<UsageWrapper>
519533
<UsageInfo>

src/components/shared/footer.tsx

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useEffect, useState } from "react";
22
import { Link } from "react-router-dom";
33
import styled, { ThemeProvider } from "styled-components";
44

@@ -196,70 +196,89 @@ const CopyrightMobile = styled(Copyright)`
196196
}
197197
`;
198198

199-
const Footer = () => (
200-
<ThemeProvider theme={theme}>
201-
<Wrapper>
202-
<Container>
203-
<FooterLinks>
204-
<LinkExternal href="https://opacity.io" target="_blank">
205-
Opacity Storage <IconArrow src={ICON_ARROW_RIGHT} />
206-
</LinkExternal>
207-
<LinkFooter to="/stands-out">
208-
The Platform <IconArrow src={ICON_ARROW_RIGHT} />
209-
</LinkFooter>
210-
<LinkFooter to="/team-page">
211-
Team <IconArrow src={ICON_ARROW_RIGHT} />
212-
</LinkFooter>
213-
<LinkExternal
214-
href="https://medium.com/opacity-storage/"
215-
target="_blank"
216-
>
217-
Blog <IconArrow src={ICON_ARROW_RIGHT} />
218-
</LinkExternal>
219-
<LinkExternal
220-
href="https://www.kucoin.com/trade/OPCT-BTC"
221-
target="_blank"
222-
>
223-
Buy OPCT <IconArrow src={ICON_ARROW_RIGHT} />
224-
</LinkExternal>
225-
</FooterLinks>
226-
<FooterIcons>
227-
<LinkButton href="https://telegram.me/opacitystorage" target="_blank">
228-
Contact Us
229-
</LinkButton>
230-
<IconContainer>
231-
<LinkIcon href="https://github.com/opacity" target="_blank">
232-
<Icon src={ICON_GITHUB} />
233-
</LinkIcon>
234-
<LinkIcon href="https://telegram.me/opacitystorage" target="_blank">
235-
<Icon src={ICON_TELEGRAM} />
236-
</LinkIcon>
237-
<LinkIcon href="https://www.reddit.com/r/Opacity/" target="_blank">
238-
<Icon src={ICON_REDDIT} />
239-
</LinkIcon>
240-
<LinkIcon
241-
href="https://twitter.com/Opacity_Storage"
199+
const Footer = () => {
200+
const [buildVersion, setBuildVersion] = useState("Loading...");
201+
202+
useEffect(() => {
203+
fetch("/version.json")
204+
.then(async res => {
205+
const { hash }: { hash: string } = await res.json();
206+
207+
setBuildVersion(hash.slice(-6));
208+
})
209+
.catch(err => {
210+
setBuildVersion(err);
211+
});
212+
}, []);
213+
214+
return (
215+
<ThemeProvider theme={theme}>
216+
<Wrapper>
217+
<Container>
218+
<FooterLinks>
219+
<LinkExternal href="https://opacity.io" target="_blank">
220+
Opacity Storage <IconArrow src={ICON_ARROW_RIGHT} />
221+
</LinkExternal>
222+
<LinkFooter to="/stands-out">
223+
The Platform <IconArrow src={ICON_ARROW_RIGHT} />
224+
</LinkFooter>
225+
<LinkFooter to="/team-page">
226+
Team <IconArrow src={ICON_ARROW_RIGHT} />
227+
</LinkFooter>
228+
<LinkExternal
229+
href="https://medium.com/opacity-storage/"
242230
target="_blank"
243231
>
244-
<Icon src={ICON_TWITTER} />
245-
</LinkIcon>
246-
<LinkIcon
247-
href="http://www.youtube.com/c/OpacityStorage"
232+
Blog <IconArrow src={ICON_ARROW_RIGHT} />
233+
</LinkExternal>
234+
<LinkExternal
235+
href="https://www.kucoin.com/trade/OPCT-BTC"
248236
target="_blank"
249237
>
250-
<Icon src={ICON_YOUTUBE} />
251-
</LinkIcon>
252-
</IconContainer>
253-
</FooterIcons>
254-
<FooterCopyright>
255-
<Copyright>Opacity © 2019</Copyright>
256-
<LinkTerms to="/terms-of-service">Terms of Service</LinkTerms>
257-
<LinkTerms to="/privacy-policy">Privacy Policy</LinkTerms>
258-
<CopyrightMobile>Opacity © 2019</CopyrightMobile>
259-
</FooterCopyright>
260-
</Container>
261-
</Wrapper>
262-
</ThemeProvider>
263-
);
238+
Buy OPCT <IconArrow src={ICON_ARROW_RIGHT} />
239+
</LinkExternal>
240+
</FooterLinks>
241+
<FooterIcons>
242+
<LinkButton href="https://telegram.me/opacitystorage" target="_blank">
243+
Contact Us
244+
</LinkButton>
245+
<IconContainer>
246+
<LinkIcon href="https://github.com/opacity" target="_blank">
247+
<Icon src={ICON_GITHUB} />
248+
</LinkIcon>
249+
<LinkIcon href="https://telegram.me/opacitystorage" target="_blank">
250+
<Icon src={ICON_TELEGRAM} />
251+
</LinkIcon>
252+
<LinkIcon href="https://www.reddit.com/r/Opacity/" target="_blank">
253+
<Icon src={ICON_REDDIT} />
254+
</LinkIcon>
255+
<LinkIcon
256+
href="https://twitter.com/Opacity_Storage"
257+
target="_blank"
258+
>
259+
<Icon src={ICON_TWITTER} />
260+
</LinkIcon>
261+
<LinkIcon
262+
href="http://www.youtube.com/c/OpacityStorage"
263+
target="_blank"
264+
>
265+
<Icon src={ICON_YOUTUBE} />
266+
</LinkIcon>
267+
</IconContainer>
268+
</FooterIcons>
269+
<FooterCopyright>
270+
<Copyright>Opacity © 2021</Copyright>
271+
<LinkTerms to="/terms-of-service">Terms of Service</LinkTerms>
272+
<LinkTerms to="/privacy-policy">Privacy Policy</LinkTerms>
273+
<CopyrightMobile>Opacity © 2021</CopyrightMobile>
274+
</FooterCopyright>
275+
<p>
276+
Build version: {buildVersion}
277+
</p>
278+
</Container>
279+
</Wrapper>
280+
</ThemeProvider>
281+
);
282+
};
264283

265284
export default Footer;

src/components/stands-out/stands-out-slide.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,17 @@ const SubscriptionSlide = ({ history, isLoggedIn }) => (
422422
<Column>
423423
<InfoIcon src={ICON_EXPLORE_CODE} />
424424
<InfoContent>
425-
Want an overview of Opacity, its current architecture, and where
426-
we want to go in the future? Check out the Opacity Whitepaper!
427-
Current version: 1.0
425+
<p>
426+
Want an overview of Opacity, its current architecture, and where
427+
we want to go in the future? Check out the Opacity Whitepaper!
428+
Current version: 1.0
429+
</p>
430+
<p style={{ fontWeight: "bold" }}>
431+
Whitepaper 2.0 Coming Soon
432+
</p>
428433
</InfoContent>
429434
<StandsOutButtonLink
430-
href="/share#handle=cffea1e29b305cffa52beb8c72abf878473298585fb8cb81c02eea01d07178514eb695c10a4bb1328eaf99926aba133b9b4e4f34ff42a7868707f30a6f9405a8"
435+
href="https://opacity.io/share#handle=2f417d6670977ce138aa651023393d95397a4ec01a6fe6bf55d05860a430bbf87b63abc8ae130301bba169a986df7b299c4cc7b46077ef2ba90be2a439ec3c10"
431436
target="_blank"
432437
>
433438
Download Whitepaper

0 commit comments

Comments
 (0)