history ok

This commit is contained in:
simplonco
2023-01-18 05:37:37 +01:00
parent 030dbb62a5
commit 4ccd3a4b93
3 changed files with 20 additions and 43 deletions

View File

@@ -21,24 +21,7 @@
*/
let room = "";
let admin = false;
let layouts = ["home", "home"];
/* hold previous version of layout, to go back
function set_layouts($layout)
{
if ($layout.length === 0)
layout.set(layouts[0]);
else if ($layout === "close")
return;
else if ($layout === layouts[0])
return;
else if ($layout === layouts[1])
layouts = [$layout, "home"];
else
layouts = [$layout, layouts[0]];
}
$: set_layouts($layout);
*/
$: {
$layout = $history[0];
console.log($history);
@@ -52,43 +35,43 @@
<HomeLayout />
{:else if $layout === "close"}
<CloseLayout back={layouts[0]} />
<CloseLayout />
{:else if $layout === "room"}
<RoomLayout back={layouts[1]} />
<RoomLayout />
{:else if $layout === "new"}
<NewLayout back={layouts[1]} />
<NewLayout />
{:else if $layout === "settings"}
<SettingsLayout back={layouts[1]} />
<SettingsLayout />
{:else if $layout === "room_set"}
<RoomsetLayout back={layouts[1]} />
<RoomsetLayout />
{:else if $layout === "password"}
<PasswordLayout back={layouts[1]} />
<PasswordLayout />
{:else if $layout === "add_password"}
<PasswordLayout back={layouts[1]} mode="add" />
<PasswordLayout mode="add" />
{:else if $layout === "change_password"}
<PasswordLayout back={layouts[1]} mode="change" />
<PasswordLayout mode="change" />
{:else if $layout === "remove_password"}
<PasswordLayout back={layouts[1]} mode="remove" />
<PasswordLayout mode="remove" />
{:else if $layout === "create"}
<CreateLayout back={layouts[1]} />
<CreateLayout />
{:else if $layout === "mute"}
<MuteLayout back={layouts[1]} />
<MuteLayout />
{:else if $layout === "user"}
<UserLayout back={layouts[1]} />
<UserLayout />
{:else if $layout === "invite"}
<InviteLayout back={layouts[1]} />
<InviteLayout />
{/if}

View File

@@ -6,7 +6,6 @@
export let my_class = "";
export let my_title = "";
export let new_layout = "";
let layout = writable("");
function update_layout() {
console.log("my_class:", my_class);
@@ -20,21 +19,16 @@
console.log("add history:", new_layout);
add_history(new_layout);
}
else
{
console.log("add history home default");
add_history("home");
}
// else
// {
// console.log("add history home default");
// add_history("home");
// }
}
$: {
$layout;
update_layout();
}
</script>
<button on:click title={my_title} class={my_class}>
<button on:click={update_layout} on:click title={my_title} class={my_class}>
<p><slot></slot></p>
</button>

View File

@@ -1,4 +1,4 @@
import { msgs, user, layout, socket, current_room, settings_user } from './Store_chat';
import { msgs, user, history, add_history, socket, current_room, settings_user } from './Store_chat';
import type { Room, FetchResponse } from './Types_chat';
import { FetchMethod, Mute, User } from './Types_chat';
import { to_print } from './Utils_chat';