fix: more navigation and chat fixes
This commit is contained in:
parent
de77f0fbe9
commit
0bc303a762
2 changed files with 16 additions and 47 deletions
|
|
@ -57,29 +57,24 @@ const APP = {
|
|||
groups: {},
|
||||
};
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
url: window.location.href,
|
||||
hash: window.location.hash,
|
||||
view,
|
||||
channel_id,
|
||||
});
|
||||
*/
|
||||
if (!document.body.dataset.view || document.body.dataset.view !== view) {
|
||||
const previous = typeof document.body.dataset.view === 'string' ? document.body.dataset.view : undefined;
|
||||
if ( view ) {
|
||||
document.body.dataset.view = view;
|
||||
}
|
||||
else {
|
||||
delete document.body.dataset.view;
|
||||
}
|
||||
|
||||
this._emit( 'view_changed', {
|
||||
previous,
|
||||
view
|
||||
});
|
||||
}
|
||||
|
||||
if (!document.body.dataset.channel || document.body.dataset.channel !== channel_id) {
|
||||
const previous = typeof document.body.dataset.channel === 'string' ? document.body.dataset.channel : undefined;
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
channel_changed: {
|
||||
detail: {
|
||||
previous,
|
||||
channel_id,
|
||||
},
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
if ( channel_id ) {
|
||||
document.body.dataset.channel = channel_id;
|
||||
}
|
||||
|
|
@ -90,7 +85,7 @@ const APP = {
|
|||
const target_channel_id = channel_id ?? this.CHANNELS.CHANNEL_LIST[0]?.id;
|
||||
|
||||
// TODO: allow a different default than chat
|
||||
const hash_target = '/chat' + ( target_channel_id ? `/channel/${ target_channel_id }` : '' );
|
||||
const hash_target = `/${ view ? view : 'chat' }` + ( target_channel_id ? `/channel/${ target_channel_id }` : '' );
|
||||
|
||||
if ( window.location.hash?.slice( 1 ) !== hash_target ) {
|
||||
if ( previous !== target_channel_id ) {
|
||||
|
|
@ -103,32 +98,6 @@ const APP = {
|
|||
window.location.hash = hash_target;
|
||||
}
|
||||
}
|
||||
|
||||
if (!document.body.dataset.view || document.body.dataset.view !== view) {
|
||||
const previous = typeof document.body.dataset.view === 'string' ? document.body.dataset.view : undefined;
|
||||
if ( view ) {
|
||||
document.body.dataset.view = view;
|
||||
}
|
||||
else {
|
||||
delete document.body.dataset.view;
|
||||
}
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
view_changed: {
|
||||
detail: {
|
||||
previous,
|
||||
view,
|
||||
},
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
this._emit( 'view_changed', {
|
||||
previous,
|
||||
view
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
load: async function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue