Skip to content

Commit 98de385

Browse files
authored
Merge pull request storybookjs#35276 from storybookjs/review/review-arrival
Review: Notify on review arrival instead of auto-navigating
2 parents 5e02302 + 4ef593a commit 98de385

32 files changed

Lines changed: 1007 additions & 243 deletions

code/core/src/components/components/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { deprecate } from 'storybook/internal/client-logger';
55

66
import { Slot } from '@radix-ui/react-slot';
77
import { darken, lighten, rgba, transparentize } from 'polished';
8-
import { type API_KeyCollection, shortcutToAriaKeyshortcuts } from 'storybook/manager-api';
8+
import { shortcutToAriaKeyshortcuts, type API_KeyCollection } from 'storybook/manager-api';
99
import { isPropValid, styled } from 'storybook/theming';
1010

1111
import { InteractiveTooltipWrapper } from './helpers/InteractiveTooltipWrapper.tsx';

code/core/src/core-server/server-channel/review-channel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const sampleReview: ReviewState = {
5959
};
6060

6161
describe('initReviewChannel', () => {
62-
const NOW = 1_700_000_000_000;
62+
const NOW = new Date().getTime();
6363

6464
beforeEach(() => {
6565
vi.spyOn(Date, 'now').mockReturnValue(NOW);

code/core/src/manager-api/modules/stories.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ import type {
4848
Tag,
4949
TagsOptions,
5050
} from 'storybook/internal/types';
51+
import { isReviewManagerRoute } from '../../shared/review/routes.ts';
5152

5253
import { global } from '@storybook/global';
5354

55+
import { BUILT_IN_FILTERS } from '../../shared/constants/tags.ts';
56+
import { countStatusesByValue } from '../../shared/status-store/index.ts';
5457
import { getEventMetadata } from '../lib/events.ts';
5558
import {
5659
addPreparedStories,
@@ -63,8 +66,6 @@ import type { ModuleFn } from '../lib/types.tsx';
6366
import { buildNavigationUrl } from '../lib/url.ts';
6467
import type { ComposedRef } from '../root.tsx';
6568
import { fullStatusStore } from '../stores/status.ts';
66-
import { BUILT_IN_FILTERS } from '../../shared/constants/tags.ts';
67-
import { countStatusesByValue } from '../../shared/status-store/index.ts';
6869
import { computeStatusFilterFn, parseStatusesParam, serializeStatusesParam } from './statuses.ts';
6970
import {
7071
computeStaticFilterFn,
@@ -1053,7 +1054,8 @@ export const init: ModuleFn<SubAPI, SubState> = ({
10531054
if (sourceType === 'local') {
10541055
const state = store.getState();
10551056
const isCanvasRoute =
1056-
state.path === '/' || state.viewMode === 'story' || state.viewMode === 'docs';
1057+
!isReviewManagerRoute(state.path, state.customQueryParams) &&
1058+
(state.path === '/' || state.viewMode === 'story' || state.viewMode === 'docs');
10571059
const stateHasSelection = state.viewMode && state.storyId;
10581060
const stateSelectionDifferent = state.viewMode !== viewMode || state.storyId !== storyId;
10591061
const { type } = state.index?.[state.storyId] || {};

code/core/src/manager/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Global, createGlobal } from 'storybook/theming';
1010
import { ManagerErrorBoundary } from './components/error-boundary/ManagerErrorBoundary.tsx';
1111
import { Layout } from './components/layout/Layout.tsx';
1212
import { useLayout } from './components/layout/LayoutProvider.tsx';
13-
import { ReviewPersistentLayer } from './components/review/ReviewPersistentLayer.tsx';
13+
import { ReviewPersistentLayer } from './components/review/components/ReviewPersistentLayer.tsx';
1414
import Panel from './container/Panel.tsx';
1515
import Preview from './container/Preview.tsx';
1616
import Sidebar from './container/Sidebar.tsx';

code/core/src/manager/components/layout/Layout.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,13 @@ export const MobileDocs = {
509509
},
510510
};
511511

512-
export const MobilePages: Story = {
512+
export const MobileReview: Story = {
513513
...Mobile,
514514
args: {
515515
managerLayoutState: { ...defaultState, viewMode: 'review' },
516516
},
517517
play: async ({ canvas }) => {
518-
expect(canvas.queryByLabelText('Open navigation menu')).not.toBeInTheDocument();
519-
expect(canvas.getByTestId('page')).toBeInTheDocument();
518+
expect(canvas.getByLabelText('Open navigation menu')).toBeInTheDocument();
519+
expect(canvas.getByTestId('preview')).toBeInTheDocument();
520520
},
521521
};

code/core/src/manager/components/layout/Layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useEffect, useLayoutEffect, useState } from 'react';
33

44
import type { API_Layout, API_ViewMode } from 'storybook/internal/types';
55

6-
import { type API, useStorybookApi } from 'storybook/manager-api';
6+
import { useStorybookApi, type API } from 'storybook/manager-api';
77
import { styled } from 'storybook/theming';
88

99
import { MEDIA_DESKTOP_BREAKPOINT, MINIMUM_CONTENT_WIDTH_PX } from '../../constants.ts';
@@ -107,7 +107,8 @@ const useLayoutSyncingState = ({
107107
const isPagesShown =
108108
managerLayoutState.viewMode !== undefined &&
109109
managerLayoutState.viewMode !== 'story' &&
110-
managerLayoutState.viewMode !== 'docs';
110+
managerLayoutState.viewMode !== 'docs' &&
111+
managerLayoutState.viewMode !== 'review';
111112
const isPanelShown = managerLayoutState.viewMode === 'story' && !hasTab;
112113

113114
const { navSize, rightPanelWidth, bottomPanelHeight } = internalDraggingSizeState.isDragging

code/core/src/manager/components/preview/Preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { global } from '@storybook/global';
1010

1111
import type { TabListState } from '@react-stately/tabs';
1212
import { Helmet } from 'react-helmet-async';
13-
import { type Combo, Consumer, addons, merge, types } from 'storybook/manager-api';
13+
import { Consumer, addons, merge, types, type Combo } from 'storybook/manager-api';
1414

1515
import { useLandmark } from '../../hooks/useLandmark.ts';
16-
import { ReviewToolbarHeader } from '../review/ReviewToolbarHeader.tsx';
16+
import { ReviewToolbarHeader } from '../review/components/ReviewToolbarHeader.tsx';
1717
import { FramesRenderer } from './FramesRenderer.tsx';
1818
import { ToolbarComp } from './Toolbar.tsx';
1919
import { ApplyWrappers } from './Wrappers.tsx';

0 commit comments

Comments
 (0)