-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement first step of modular #25
base: main
Are you sure you want to change the base?
Conversation
oh awesome :) |
there's some (testing-only?) jsonfake struct in 4ebe0c0? |
Yep, still some things to do. Small question, I'll implement a secnd active-app condition, so in the json it'll be : |
if the url matching is done on the full url (eg after the mapstore edit: my usecase is differentiating |
@landryb should solve everything a42e38b#diff-a0d1c9a9f2eec4ee7507a995e0254b610e5d97262285b35e057980c9ca50a159R69-R76 |
that looks clever.. ive build the PR locally and get some errors about properties not existing:
i've tried quickly with for some reason (and i have no idea if that's related to that PR) but here the edit nvm i think i found it, the headerscript needs to be set in mapstore's localConfig.json too. |
mm.. i might be missing something, but once 'fixed' mapstore with the
in fact that's because |
just for the record: it works for the
but then it opens another can of works where multiple apps end up being 'hilighted', for which we're trying to find the best heuristic... maybe based on the full url length, eg the longest one being the 'more specific':
|
retested with f1cd390 and this config section, for extra complexity:
i think one shouldnt mix (eg it should be documented)
there's a strange difference of behaviour whether one clicks on an entry in the header, or directly loads the url (say from an external link) retrying with a less complex/real config:
i have the expected behaviour if clicking on MapsApps and Cadastrapp (eg the right entry is hilighted, and only this one) but if i click on mapstore in the header, no entry is hilighted. The Mapstore entry is hilighted only if i reload the page. we're slowly getting there :) |
one think i dont understand yet is the purpose of the with that config (taken from the PR example):
with the what was the intended rationale ?
|
more testing with latest commits, with some changes to the default config:
something cleverer should be done for GN-UI, otherwise an user having roles for both will get two hilighted entries. for now trying with |
when being on mapstore (thus the corresponding entry is highlighted) and clicking on the cadastrapp entry, it correctly loads the cadastre context, but the mapstore item is still hilighted, and the cadastrapp entry isnt. It is only hilighted properly when reloading the complete page. I .. guess that's a side effect of the SPA. |
Indeed, the # act as a hash and break the change of tab. maybe I can trigger a recheck after each click |
im not sure 8a2ef79 is 'the right way' because it's quite glitchy, at least for the mapstore test case:
from my little understanding of this modern JS thing, the header keeps a 'state' when it stays 'on the same page' (eg in a SPA, be it mapstore or GN admin or GN search results). Can't we use that to remember which entry is highlighted, and if the new-to-be-hilighted-entry is different/changed, remove the highlighting on the previous one/reset all existing highlighting ? |
still testing this PR, the looking at the code, my understanding is that it should, but from testing, if the index.html contains
where the config keys for logo/stylesheet are the ones coming from |
meh, yet again got bit by having the header configuration in mapstore's |
another side-effect, we're losing the |
Yep I need to edit every georchestra's app to remove attribute and set config file one. The stylesheet and active this still be present as they are used in other apps or in legacy header. https://github.com/georchestra/header/pull/25/files#diff-a0d1c9a9f2eec4ee7507a995e0254b610e5d97262285b35e057980c9ca50a159L17-L23 For the icons, I temporarily decided to remove it, as I didn't find an elegant way to introduce it. |
state.loaded = true | ||
} | ||
|
||
function matchLinkUrl(link: Link): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO cannot survive without tests, cannot be understood without tests.
Desserve some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could create a pure function (value returned only depends on arguments) easily testable outside component.
This PR allows to edit header with a config file. No need to fork it anymore.
TODO :
Custom config
You can add a custom config file to the
geor-header
:It can contains a custom menu, config and i18n.
Config
Config can contains old tag attributes :
Menu
Menu can contain three type of objects :
link
(by default),separator
ordropdown
See config.json for example.
i18n
Contains additional translations for the app.