Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions resources/js/components/Chat.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<template>
<div
:class="[
'flex flex-col bg-gray-100 border-gray-200 p-0 h-screen',
{
'rounded-lg border overflow-hidden': !$store.state.config.isMobile
}
]"
class="flex flex-col bg-gray-100 border-gray-200 p-0 h-dvh sm:rounded-lg sm:border sm:overflow-hidden"
>
<ChatHeader
@back="onBack"
Expand Down
10 changes: 4 additions & 6 deletions resources/js/components/ChatHeader.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<template>
<div
:class="[
'shrink-0 p-2 relative',
{
'rounded-t-lg': !$store.state.config.isMobile && !$store.state.docked
}
'shrink-0 p-2 sticky top-0 z-10',
{ 'sm:rounded-t-lg': !$store.state.docked }
]"
:style="{
backgroundColor: $store.state.config.mainColor
Expand All @@ -27,7 +25,7 @@
</button>
<button
v-if="$store.state.docked"
class="absolute right-8 top-1/2 -translate-y-1/2 outline-none text-white text-sm"
class="hidden sm:block absolute right-8 top-1/2 -translate-y-1/2 outline-none text-white text-sm"
@click.prevent="emitMessage('chat.undock')"
title="Switch to windowed mode"
>
Expand All @@ -39,7 +37,7 @@
</button>
<button
v-if="!$store.state.docked"
class="absolute right-8 top-1/2 -translate-y-1/2 outline-none text-white text-sm"
class="hidden sm:block absolute right-8 top-1/2 -translate-y-1/2 outline-none text-white text-sm"
@click.prevent="emitMessage('chat.dock')"
title="Dock as sidebar"
>
Expand Down
20 changes: 12 additions & 8 deletions resources/js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,22 @@
const initClient = () => {
window.superbotmanChatWidget = superbotmanChatWidget

// Restoring docked from a prior session takes priority over
// openByDefault — dock() opens the panel as part of its work.
if (persistedState.docked) {
// Honor an explicit close from a prior session before anything
// else. dock() opens the panel as a side effect of its work, so
// if persistedState.docked got stuck at true while open is false
// (a stale combination that shouldn't happen but has in practice
// on mobile), the docked branch would overrule the user's choice
// to close. Closed-state-wins guarantees that doesn't happen.
if (persistedState.open === false) {
// intentionally closed — leave the beacon visible and the
// chat panel hidden, regardless of any other persisted flag.
} else if (persistedState.docked) {
superbotmanChatWidget.dock()
} else if (persistedState.open === true) {
// If the user explicitly opened or closed the widget in a
// prior session, honor that. openByDefault is a first-visit
// fallback, not an every-reload override.
superbotmanChatWidget.open()
} else if (persistedState.open === false) {
// intentionally closed — leave as-is
} else if (config.openByDefault) {
// openByDefault is a first-visit fallback only — once the
// user interacts, the branches above take over.
superbotmanChatWidget.open()
}

Expand Down