Skip to content

Commit 90f2146

Browse files
committed
fix: add decorator to right place
1 parent ebe8821 commit 90f2146

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

site/.storybook/preview.jsx

+22-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ import { QueryClient, QueryClientProvider, parseQueryArgs } from "react-query";
3232
import { withRouter } from "storybook-addon-remix-react-router";
3333
import "theme/globalFonts";
3434
import themes from "../src/theme";
35+
import { TimeSyncProvider } from "../src/hooks/useTimeSync";
3536

3637
DecoratorHelpers.initializeThemeState(Object.keys(themes), "dark");
3738

3839
/** @type {readonly Decorator[]} */
39-
export const decorators = [withRouter, withQuery, withHelmet, withTheme];
40+
export const decorators = [
41+
withRouter,
42+
withQuery,
43+
withHelmet,
44+
withTheme,
45+
withTimeSyncProvider,
46+
];
4047

4148
/** @type {Preview["parameters"]} */
4249
export const parameters = {
@@ -101,6 +108,20 @@ function withHelmet(Story) {
101108
);
102109
}
103110

111+
const storyDate = new Date("March 15, 2022");
112+
function withTimeSyncProvider(Story) {
113+
return (
114+
<TimeSyncProvider
115+
options={{
116+
initialDatetime: storyDate,
117+
resyncOnNewSubscription: false,
118+
}}
119+
>
120+
<Story />
121+
</TimeSyncProvider>
122+
);
123+
}
124+
104125
/** @type {Decorator} */
105126
function withQuery(Story, { parameters }) {
106127
const queryClient = new QueryClient({

site/src/pages/DeploymentSettingsPage/NotificationsPage/storybookUtils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,5 @@ export const baseMeta = {
215215
withAuthProvider,
216216
withDashboardProvider,
217217
withOrganizationSettingsProvider,
218-
withTimeSyncProvider,
219218
],
220219
} satisfies Meta<typeof NotificationsPage>;

site/src/testHelpers/storybook.tsx

+1-16
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import { hasFirstUserKey, meKey } from "api/queries/users";
66
import type { Entitlements } from "api/typesGenerated";
77
import { GlobalSnackbar } from "components/GlobalSnackbar/GlobalSnackbar";
88
import { AuthProvider } from "contexts/auth/AuthProvider";
9-
import { TimeSyncProvider } from "hooks/useTimeSync";
109
import { DashboardContext } from "modules/dashboard/DashboardProvider";
1110
import { DeploymentConfigContext } from "modules/management/DeploymentConfigProvider";
1211
import { OrganizationSettingsContext } from "modules/management/OrganizationSettingsLayout";
1312
import { permissionChecks } from "modules/permissions";
14-
import type { FC, ReactElement } from "react";
13+
import type { FC } from "react";
1514
import { useQueryClient } from "react-query";
1615
import {
1716
MockAppearanceConfig,
@@ -157,20 +156,6 @@ export const withGlobalSnackbar = (Story: FC) => (
157156
</>
158157
);
159158

160-
const storyDate = new Date("March 15, 2022");
161-
export const withTimeSyncProvider = (Story: FC): ReactElement => {
162-
return (
163-
<TimeSyncProvider
164-
options={{
165-
initialDatetime: storyDate,
166-
resyncOnNewSubscription: false,
167-
}}
168-
>
169-
<Story />
170-
</TimeSyncProvider>
171-
);
172-
};
173-
174159
export const withOrganizationSettingsProvider = (Story: FC) => {
175160
return (
176161
<OrganizationSettingsContext.Provider

0 commit comments

Comments
 (0)