fix(chat): open full chat in place instead of a new window (#1181)
The chat modal's pop-out button called window.open('/chat', '_blank').
/chat is served by the admin app itself, so this spawned a second browser
window for a same-origin internal route.
That breaks anyone running NOMAD as an installed web app or in kiosk mode:
clicking it leaves a stray window they then have to get back out of, which
is exactly the complaint in #1123.
Navigate with router.visit instead, and relabel the button from "Open in
New Tab" to "Open Full Chat" so it describes what now happens. IconMessage
isn't in the DynamicIcon registry (deliberately curated for tree-shaking),
so use the already-registered IconArrowRight.
Refs #1123
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cdf6c00d4c
commit
dabc869aeb
|
|
@ -117,18 +117,17 @@ export default function ChatSidebar({
|
|||
<img src="/project_nomad_logo.webp" alt="Project NOMAD Logo" className="h-28 w-28 mb-6" />
|
||||
<StyledButton
|
||||
onClick={() => {
|
||||
if (isInModal) {
|
||||
window.open('/chat', '_blank')
|
||||
} else {
|
||||
router.visit('/home')
|
||||
}
|
||||
// /chat is served by the admin app itself, so navigate in place rather than
|
||||
// spawning a window. Popping out broke anyone running NOMAD as an installed
|
||||
// web app or in kiosk mode, who then had a stray window to get back out of.
|
||||
router.visit(isInModal ? '/chat' : '/home')
|
||||
}}
|
||||
icon={isInModal ? 'IconExternalLink' : 'IconHome'}
|
||||
icon={isInModal ? 'IconArrowRight' : 'IconHome'}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
fullWidth
|
||||
>
|
||||
{isInModal ? 'Open in New Tab' : 'Back to Home'}
|
||||
{isInModal ? 'Open Full Chat' : 'Back to Home'}
|
||||
</StyledButton>
|
||||
<StyledButton
|
||||
onClick={() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue