better url handling

This commit is contained in:
HF 2022-09-05 01:23:04 +02:00
parent 4f96f6d7d6
commit 60ea16271c
4 changed files with 18 additions and 10 deletions

View File

@ -1,2 +0,0 @@
#!/bin/sh
grep -rli "$1" | xargs -i@ sed -i "s/${1}/s\/${1}/g" @

View File

@ -1,4 +0,0 @@
#!/bin/bash
grep -rli "${1}" * | xargs -i@ sed -i "s/${1}/s\/${1}/g" @

View File

@ -3,25 +3,31 @@
*/
import { buildPopUpUrl } from '../../components/windows/popUpAvailable';
function setFullTitle(windowType, title) {
const name = windowType[0] + windowType.substring(1).toLowerCase();
document.title = (title) ? `${name} - ${title}` : name;
}
export default (store) => (next) => (action) => {
const ret = next(action);
switch (action.type) {
case 'SET_WIN_TITLE': {
const { windowType } = store.getState().popup;
const { title } = action;
const name = windowType[0] + windowType.substring(1).toLowerCase();
document.title = (title) ? `${name} - ${title}` : name;
const { windowType, title } = store.getState().popup;
setFullTitle(windowType, title);
break;
}
case 'CHANGE_WIN_TYPE':
case 'SET_WIN_ARGS': {
const {
args,
windowType,
title,
} = store.getState().popup;
const url = buildPopUpUrl(windowType, args);
window.history.pushState({}, undefined, url);
setFullTitle(windowType, title);
break;
}

View File

@ -66,6 +66,14 @@ export default function popup(
};
}
case 'SET_WIN_TITLE': {
const { title } = action;
return {
...state,
title,
};
}
case 'CHANGE_WIN_TYPE': {
const {
windowType,