Skip to content

Commit

Permalink
feat: Show Explorer client version from package.json on the Footer (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
msarcev authored Jan 24, 2024
1 parent c7af50a commit 7247b7d
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 2 deletions.
25 changes: 25 additions & 0 deletions client/src/app/components/footer/ExplorerVersion.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@import "../../../scss/fonts";
@import "../../../scss/media-queries";
@import "../../../scss/mixins";
@import "../../../scss/variables";

.explorer-version {
display: flex;
width: 100%;
background-color: $gray-11;
justify-content: center;
padding-bottom: 12px;

&.shimmer-version {
position: absolute;
bottom: 0;
background-color: transparent;
}

span {
@include font-size(13px);

font-family: $inter;
color: $gray-6;
}
}
17 changes: 17 additions & 0 deletions client/src/app/components/footer/ExplorerVersion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import classNames from "classnames";
import "./ExplorerVersion.scss";

export default function ExplorerVersion({ shimmerTheme }: { shimmerTheme?: boolean }): React.JSX.Element {
const explorerVersion = EXPLORER_VERSION ?? "";

return (
<>
{explorerVersion && (
<section className={classNames("explorer-version", { "shimmer-version": shimmerTheme })}>
<span>v{explorerVersion}</span>
</section>
)}
</>
);
}
2 changes: 1 addition & 1 deletion client/src/app/components/footer/Footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ footer {
.footer--content {
display: flex;
justify-content: center;
padding: 40px 20px 64px 20px;
padding: 40px 20px 0px 20px;
background-color: $gray-11;
color: $white;

Expand Down
2 changes: 2 additions & 0 deletions client/src/app/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import TwitterIcon from "~assets/twitter.svg?react";
import YoutubeIcon from "~assets/youtube.svg?react";
import { FoundationDataHelper } from "~helpers/foundationDataHelper";
import AsyncComponent from "../AsyncComponent";
import ExplorerVersion from "./ExplorerVersion";
import "./Footer.scss";

/**
Expand Down Expand Up @@ -135,6 +136,7 @@ class Footer extends AsyncComponent<FooterProps, FooterState> {
</div>
</div>
</section>
<ExplorerVersion />
<section className="social--media__wrapper">
{this.SOCIAL_LINKS.map((social, socialID) => (
<a
Expand Down
1 change: 1 addition & 0 deletions client/src/app/components/footer/ShimmerFooter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "../../../scss/variables";

footer {
position: relative;
.shimmer-footer--content {
display: flex;
justify-content: center;
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/components/footer/ShimmerFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import GithubIcon from "~assets/github.svg?react";
import Logo from "~assets/shimmer-footer-bg.svg?react";
import TwitterIcon from "~assets/twitter.svg?react";
import { FoundationDataHelper } from "~helpers/foundationDataHelper";
import "./ShimmerFooter.scss";
import AsyncComponent from "../AsyncComponent";
import ExplorerVersion from "./ExplorerVersion";
import "./ShimmerFooter.scss";

/**
* Component which will show the footer.
Expand Down Expand Up @@ -114,6 +115,7 @@ class ShimmerFooter extends AsyncComponent<FooterProps, FooterState> {
</section>
</div>
</div>
<ExplorerVersion shimmerTheme />
</section>
</footer>
);
Expand Down
1 change: 1 addition & 0 deletions client/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
declare const EXPLORER_VERSION: string;

3 changes: 3 additions & 0 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default defineConfig(() => {
}),
nodePolyfills()
],
define: {
EXPLORER_VERSION: JSON.stringify(process.env.npm_package_version)
},
test: {
globals: true,
teardownTimeout: 100
Expand Down

0 comments on commit 7247b7d

Please sign in to comment.