mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix: open in chat does not work when the panel is not opened (#6703)
https://github.com/toeverything/AFFiNE/pull/6503 does not work with "open in chat". IMO resetting tab whenever opening right panel does not make too much sense. @zanwei fix AFF-951
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
import { IconButton } from '@affine/component';
|
import { IconButton } from '@affine/component';
|
||||||
import { useJournalInfoHelper } from '@affine/core/hooks/use-journal';
|
|
||||||
import { DocService, useService, WorkspaceService } from '@toeverything/infra';
|
|
||||||
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
||||||
import { useEffect } from 'react';
|
|
||||||
|
|
||||||
import type { SidebarTab, SidebarTabName } from '../multi-tabs/sidebar-tab';
|
import type { SidebarTab, SidebarTabName } from '../multi-tabs/sidebar-tab';
|
||||||
import * as styles from './header-switcher.css';
|
import * as styles from './header-switcher.css';
|
||||||
@@ -20,20 +17,8 @@ export const MultiTabSidebarHeaderSwitcher = ({
|
|||||||
activeTabName,
|
activeTabName,
|
||||||
setActiveTabName,
|
setActiveTabName,
|
||||||
}: MultiTabSidebarHeaderSwitcherProps) => {
|
}: MultiTabSidebarHeaderSwitcherProps) => {
|
||||||
const workspace = useService(WorkspaceService).workspace;
|
|
||||||
const doc = useService(DocService).doc;
|
|
||||||
|
|
||||||
const { isJournal } = useJournalInfoHelper(workspace.docCollection, doc.id);
|
|
||||||
|
|
||||||
const activeExtension = tabs.find(ext => ext.name === activeTabName);
|
const activeExtension = tabs.find(ext => ext.name === activeTabName);
|
||||||
|
|
||||||
// if journal is active, set selected to journal
|
|
||||||
useEffect(() => {
|
|
||||||
const journalExtension = tabs.find(ext => ext.name === 'journal');
|
|
||||||
isJournal && journalExtension && setActiveTabName('journal');
|
|
||||||
!isJournal && setActiveTabName('outline');
|
|
||||||
}, [tabs, isJournal, setActiveTabName]);
|
|
||||||
|
|
||||||
const vars = assignInlineVars({
|
const vars = assignInlineVars({
|
||||||
[styles.activeIdx]: String(
|
[styles.activeIdx]: String(
|
||||||
tabs.findIndex(ext => ext.name === activeExtension?.name) ?? 0
|
tabs.findIndex(ext => ext.name === activeExtension?.name) ?? 0
|
||||||
|
|||||||
Reference in New Issue
Block a user