Skip to content

Commit

Permalink
[BUG] redirection monimpacttransport
Browse files Browse the repository at this point in the history
  • Loading branch information
bdavidxyz authored Sep 28, 2023
1 parent 905baff commit 3b60dc2
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# CHANGELOG

## 1.20.6 (28/09/2023)

* Bmit - Bug API monimpacttransport

## 1.20.5 (28/09/2023)

* Ubug - API ne fonctionne plus
Expand Down
18 changes: 0 additions & 18 deletions middleware.js

This file was deleted.

44 changes: 26 additions & 18 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
var shell = require('shelljs')
var fs = require('fs')
var shell = require("shelljs");
var fs = require("fs");

const getLastVersion = function () {
let result = 'unknown'
const data = fs.readFileSync('./CHANGELOG.md', 'utf8')
let result = "unknown";
const data = fs.readFileSync("./CHANGELOG.md", "utf8");
// Define the regular expression pattern to match version numbers
const versionPattern = /^##\s\[?(\d+\.\d+\.\d+)\]?(?:.*?)$/m
const versionPattern = /^##\s\[?(\d+\.\d+\.\d+)\]?(?:.*?)$/m;

// Search for version numbers in the CHANGELOG
const versions = data.match(versionPattern)
const versions = data.match(versionPattern);

if (versions && versions.length > 1) {
// The latest version will be the second match
result = versions[1]
console.log('Latest release version:', result)
result = versions[1];
console.log("Latest release version:", result);
} else {
console.log('No release versions found in the CHANGELOG.')
console.log("No release versions found in the CHANGELOG.");
}
return result
}
return result;
};

const nextConfig = {
reactStrictMode: true,
compiler: {
styledComponents: true,
},
i18n: {
locales: ['fr'],
defaultLocale: 'fr',
locales: ["fr"],
defaultLocale: "fr",
},
env: {
thebuildid:
getLastVersion() + '-' + shell.exec('git rev-parse --short HEAD'),
customKey: 'my-value',
thebuildid: getLastVersion() + "-" + shell.exec("git rev-parse --short HEAD"),
customKey: "my-value",
},
}
async redirects() {
return [
{
source: "/iframes/transport/itineraire",
destination: "/button.html",
permanent: false,
},
];
},
};

module.exports = nextConfig
module.exports = nextConfig;
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@
"twemoji": "^14.0.2",
"use-animate-number": "^1.0.5",
"use-local-storage": "^3.0.0",
"use-query-params": "^2.2.0"
"use-query-params": "^2.2.0",
"shelljs": "^0.8.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"devDependencies": {
"@playwright/test": "^1.33.0",
Expand All @@ -73,10 +76,7 @@
"eslint-plugin-styled-components-a11y": "^0.1.0",
"husky": "^8.0.3",
"lint-staged": "^13.1.1",
"prettier": "2.8.4",
"shelljs": "^0.8.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"prettier": "2.8.4"
},
"lint-staged": {
"*.{js,jsx}": [
Expand Down
19 changes: 19 additions & 0 deletions public/button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div style="display: flex; justify-content: center; align-items: center; height: 100%; font-family: Verdana">
<a
target="_blank"
title="Impact du transport sur le climat (ouvre le site impactCO2 dans un nouvel onglet)"
href="https://impactco2.fr/transport/itineraire"
style="
background-color: rgb(38, 130, 124);
color: white;
cursor: pointer;
display: block;
padding: 1rem;
border-radius: 8px;
text-decoration: none;
text-align: center;
"
>
D&eacute;couvrir l'impact carbone du transport sur le climat
</a>
</div>
1 change: 0 additions & 1 deletion src/components/views/equivalent/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const StyledMagicLink = styled(MagicLink)`

export default function Details(props) {
const { setCo2e, setWarningNegaoctet } = useContext(ModalContext);
console.log(props);
return (
<>
<Section>
Expand Down

0 comments on commit 3b60dc2

Please sign in to comment.