Skip to content

Commit

Permalink
render git commit info if env var is set
Browse files Browse the repository at this point in the history
took out h1

logging

don't substring if <= 8???
  • Loading branch information
whunter committed May 6, 2024
1 parent 355658b commit 735d6f4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
4 changes: 0 additions & 4 deletions cypress/e2e/integration/browse_collections.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ describe("browse_collections: Browse collections page", () => {
cy.visit("/collections");
});

it("displays the correct page title", () => {
cy.get("h1").invoke("text").should("equal", "About Our Collections");
});

it("finds the first collection sorted by title as default", () => {
cy.get(".gallery-item")
.first()
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import AnalyticsConfig from "./components/AnalyticsConfig";
import Header from "./components/Header";
import NavBar from "./components/NavBar";
import Footer from "./components/Footer";
import { GitDetails } from "./components/GitDetails";
import LoadingScreen from "./components/LoadingScreen";
import { buildRoutes } from "./lib/CustomPageRoutes";
import HomePage from "./pages/HomePage";
Expand Down Expand Up @@ -192,6 +193,7 @@ class App extends Component {
</Routes>
</div>
</main>
<GitDetails />
<Footer />
</ThemeProvider>
</StyledEngineProvider>
Expand Down
25 changes: 25 additions & 0 deletions src/components/GitDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link } from "react-router-dom";
import "../css/GitDetails.scss";

const GitDetails = () => {
const gitCommit = process.env.REACT_APP_GIT_COMMIT;
console.log("GitDetails gitCommit", gitCommit);
if (!gitCommit) {
return null;
}
return (
<div className="git-detail-section">
<p>
This site is running commit{" "}
<Link to={`https://github.com/VTUL/dlp-access/commit/${gitCommit}`}>
{gitCommit.length > 8 ? gitCommit.substring(0, 7) : gitCommit}
</Link>{" "}
of the{" "}
<Link to={"https://github.com/VTUL/dlp-access/"}>vtdlp-access</Link>{" "}
project
</p>
</div>
);
};

export { GitDetails };
20 changes: 20 additions & 0 deletions src/css/GitDetails.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git-detail-section {
position: relative;
display: block;
background-color: var(--light-gray);
width: 100%;
margin-bottom: 15px;
padding: 10px;
p {
position: relative;
display: block;
text-align: center;
font-family: "gineso-condensed", sans-serif;
a,
a:visited {
position: relative;
color: var(--themeHighlightColor);
cursor: pointer;
}
}
}

0 comments on commit 735d6f4

Please sign in to comment.