overleaf-cep/services/web/modules/full-project-search/stories/full-project-search.stories.tsx
Jakob Ackermann 67342e9c33 [terraform] clsi: add pre-emp C2D capacity in zone b (#26755)
GitOrigin-RevId: aa52dec1f7135f53f8c887199c1d1e4e31ef70ff
2025-07-03 08:04:53 +00:00

113 lines
3.8 KiB
TypeScript

import { Meta, StoryObj } from '@storybook/react'
import { ScopeDecorator } from '../../../frontend/stories/decorators/scope'
import useFetchMock from '../../../frontend/stories/hooks/use-fetch-mock'
import FullProjectSearchUI from '../frontend/js/components/full-project-search-ui'
const meta = {
title: 'Editor / Full Project Search',
component: FullProjectSearchUI,
decorators: [
Story => ScopeDecorator(Story, { mockCompileOnLoad: true }),
Story => {
useFetchMock(fetchMock => {
fetchMock.post('express:/project/:projectId/flush', { status: 204 })
fetchMock.get('express:/project/:projectId/latest/history', {
status: 200,
body: {
chunk: {
history: {
snapshot: {
files: {},
},
changes: [
{
operations: [
{
pathname: 'main.tex',
file: {
hash: '5199b66d9d1226551be436c66bad9d962cc05537',
stringLength: 7066,
},
},
],
timestamp: '2025-01-03T10:10:40.840Z',
authors: [],
v2Authors: ['66e040e0da7136ec75ffe8a3'],
projectVersion: '1.0',
},
{
operations: [
{
pathname: 'sample.bib',
file: {
hash: 'a0e21c740cf81e868f158e30e88985b5ea1d6c19',
stringLength: 244,
},
},
],
timestamp: '2025-01-03T10:10:40.856Z',
authors: [],
v2Authors: ['66e040e0da7136ec75ffe8a3'],
projectVersion: '2.0',
},
{
operations: [
{
pathname: 'frog.jpg',
file: {
hash: '5b889ef3cf71c83a4c027c4e4dc3d1a106b27809',
byteLength: 97080,
},
},
],
timestamp: '2025-01-03T10:10:40.890Z',
authors: [],
v2Authors: ['66e040e0da7136ec75ffe8a3'],
projectVersion: '3.0',
},
],
},
startVersion: 0,
},
},
})
fetchMock.get('express:/project/:projectId/changes', {
status: 200,
body: [],
})
fetchMock.get(
'express:/project/:projectId/blob/5199b66d9d1226551be436c66bad9d962cc05537',
{
status: 200,
body: `Simply use the section and subsection commands, as in this example document! With Overleaf, all the formatting and numbering is handled automatically according to the template you've chosen. If you're using the Visual Editor, you can also create new section and subsections via the buttons in the editor toolbar.`,
}
)
fetchMock.get(
'express:/project/:projectId/blob/a0e21c740cf81e868f158e30e88985b5ea1d6c19',
{
status: 200,
body: `@article{greenwade93,
author = "George D. Greenwade",
title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year = "1993",
journal = "TUGBoat",
volume = "14",
number = "3",
pages = "342--351"
}`,
}
)
})
return <Story />
},
],
} satisfies Meta<typeof FullProjectSearchUI>
export default meta
type Story = StoryObj<typeof FullProjectSearchUI>
export const UI = {} satisfies Story