Skip to content

Commit

Permalink
feat: update dev header to get the new one
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jan 22, 2025
1 parent 98e21d2 commit 369bd60
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mapstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: mkdir -p scratch && cp web/target/georchestra-mapstore*.deb scratch/georchestra-mapstore-${{ github.sha }}.deb

- name: "publish deb as artifact"
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: georchestra-mapstore.deb
path: scratch/georchestra-mapstore-${{ github.sha }}.deb
Expand All @@ -76,7 +76,7 @@ jobs:
run: mkdir -p scratch && cp web/target/mapstore.war scratch/mapstore-${{ github.sha }}.war

- name: "publish war as artifact"
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: mapstore.war
path: scratch/mapstore-${{ github.sha }}.war
Expand Down
6 changes: 5 additions & 1 deletion configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
},
"header": {
"height": 90,
"url": "/header/"
"url": "/header/",
"script": "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
"legacy": false,
"logoUrl": "https://www.georchestra.org/public/georchestra-logo.svg",
"stylesheet": ""
},
"defaultMapOptions": {
"cesium": {
Expand Down
23 changes: 18 additions & 5 deletions js/plugins/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
import {useEffect} from "react";
import { createPlugin, connect } from "@mapstore/utils/PluginsUtils";

export const Header = ({url = "/header/", page = "mapstore", height = 90, ignoreIFrame = false}) => {
export const Header = ({url = "/header/", page = "mapstore", height = 90, ignoreIFrame = false,
script = "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
legacy = false,
logoUrl = "https://www.georchestra.org/public/georchestra-logo.svg",
stylesheet = ""}) => {
useEffect(() => {
const header = document.getElementById("georchestra-header");
const headerScript = document.getElementById("georchestra-header-script");
const container = document.getElementById("container");
if (header) {
if (!ignoreIFrame && window.location !== window.parent.location) {
Expand All @@ -19,9 +24,13 @@ export const Header = ({url = "/header/", page = "mapstore", height = 90, ignore
container.style.top = '0';
}
} else {
header.style.display = 'block';
header.src = url + "?active=" + page;
header.style.height = height + "px";
header.setAttribute("active-app", page);
header.setAttribute("legacy-url", url);
header.setAttribute("legacy-header", legacy);
header.setAttribute("style", `height:${height}px`);
header.setAttribute("logo-url", logoUrl);
header.setAttribute("stylesheet", stylesheet);
headerScript.src = script;

if (container) {
container.style.top = height + "px";
Expand All @@ -36,6 +45,10 @@ export const Header = ({url = "/header/", page = "mapstore", height = 90, ignore
export default createPlugin('Header', {
component: connect((state) => ({
url: state.localConfig && state.localConfig.header && state.localConfig.header.url,
height: state.localConfig && state.localConfig.header && state.localConfig.header.height
height: state.localConfig && state.localConfig.header && state.localConfig.header.height,
script: state.localConfig && state.localConfig.header && state.localConfig.header.script,
legacy: state.localConfig && state.localConfig.header && state.localConfig.header.legacy,
logoUrl: state.localConfig && state.localConfig.header && state.localConfig.header.logoUrl,
stylesheet: state.localConfig && state.localConfig.header && state.localConfig.header.stylesheet
}))(Header)
});

0 comments on commit 369bd60

Please sign in to comment.