Skip to content

Commit 5bd78b8

Browse files
committed
🚚(frontend) rename feature summary to table of content
We rename the feature summary to table of content to better reflect the feature purpose.
1 parent ed39c01 commit 5bd78b8

File tree

12 files changed

+41
-33
lines changed

12 files changed

+41
-33
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-summary.spec.ts renamed to src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ test.beforeEach(async ({ page }) => {
66
await page.goto('/');
77
});
88

9-
test.describe('Doc Summary', () => {
10-
test('it checks the doc summary', async ({ page, browserName }) => {
11-
const [randomDoc] = await createDoc(page, 'doc-summary', browserName, 1);
9+
test.describe('Doc Table Content', () => {
10+
test('it checks the doc table content', async ({ page, browserName }) => {
11+
const [randomDoc] = await createDoc(
12+
page,
13+
'doc-table-content',
14+
browserName,
15+
1,
16+
);
1217

1318
await expect(page.locator('h2').getByText(randomDoc)).toBeVisible();
1419

src/frontend/apps/impress/src/features/docs/doc-editor/components/DocEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Panel } from '@/components/Panel';
99
import { useCunninghamTheme } from '@/cunningham';
1010
import { DocHeader } from '@/features/docs/doc-header';
1111
import { Doc } from '@/features/docs/doc-management';
12-
import { Summary } from '@/features/docs/doc-summary';
12+
import { TableContent } from '@/features/docs/doc-table-content';
1313
import {
1414
VersionList,
1515
Versions,
@@ -70,7 +70,7 @@ export const DocEditor = ({ doc }: DocEditorProps) => {
7070
<VersionList doc={doc} />
7171
</Panel>
7272
)}
73-
<Summary doc={doc} />
73+
<TableContent doc={doc} />
7474
</Box>
7575
</>
7676
);

src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
ModalShare,
1010
ModalUpdateDoc,
1111
} from '@/features/docs/doc-management';
12-
import { useDocSummaryStore } from '@/features/docs/doc-summary';
12+
import { useDocTableContentStore } from '@/features/docs/doc-table-content';
1313
import { useDocVersionStore } from '@/features/docs/doc-versioning';
1414

1515
import { ModalPDF } from './ModalExport';
@@ -26,7 +26,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
2626
const [isModalPDFOpen, setIsModalPDFOpen] = useState(false);
2727
const [isDropOpen, setIsDropOpen] = useState(false);
2828
const { setIsPanelVersionOpen } = useDocVersionStore();
29-
const { setIsPanelSummaryOpen } = useDocSummaryStore();
29+
const { setIsPanelTableContentOpen } = useDocTableContentStore();
3030

3131
return (
3232
<Box
@@ -83,7 +83,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
8383
)}
8484
<Button
8585
onClick={() => {
86-
setIsPanelSummaryOpen(true);
86+
setIsPanelTableContentOpen(true);
8787
setIsPanelVersionOpen(false);
8888
setIsDropOpen(false);
8989
}}

src/frontend/apps/impress/src/features/docs/doc-summary/components/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/frontend/apps/impress/src/features/docs/doc-summary/stores/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/frontend/apps/impress/src/features/docs/doc-summary/stores/useDocSummaryStore.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/frontend/apps/impress/src/features/docs/doc-summary/components/Summary.tsx renamed to src/frontend/apps/impress/src/features/docs/doc-table-content/components/TableContent.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Panel } from '@/components/Panel';
66
import { useDocStore } from '@/features/docs/doc-editor';
77
import { Doc } from '@/features/docs/doc-management';
88

9-
import { useDocSummaryStore } from '../stores';
9+
import { useDocTableContentStore } from '../stores';
1010

1111
import { Heading } from './Heading';
1212

@@ -20,11 +20,11 @@ type HeadingBlock = {
2020
};
2121
};
2222

23-
interface SummaryProps {
23+
interface TableContentProps {
2424
doc: Doc;
2525
}
2626

27-
export const Summary = ({ doc }: SummaryProps) => {
27+
export const TableContent = ({ doc }: TableContentProps) => {
2828
const { docsStore } = useDocStore();
2929
const { t } = useTranslation();
3030

@@ -38,28 +38,29 @@ export const Summary = ({ doc }: SummaryProps) => {
3838
);
3939

4040
const [headings, setHeadings] = useState<HeadingBlock[]>();
41-
const { setIsPanelSummaryOpen, isPanelSummaryOpen } = useDocSummaryStore();
41+
const { setIsPanelTableContentOpen, isPanelTableContentOpen } =
42+
useDocTableContentStore();
4243
const [hasBeenClose, setHasBeenClose] = useState(false);
4344
const setClosePanel = () => {
4445
setHasBeenClose(true);
45-
setIsPanelSummaryOpen(false);
46+
setIsPanelTableContentOpen(false);
4647
};
4748

4849
const [headingIdHighlight, setHeadingIdHighlight] = useState<string>();
4950

5051
// Open the panel if there are more than 1 heading
5152
useEffect(() => {
5253
if (headings?.length && headings.length > 1 && !hasBeenClose) {
53-
setIsPanelSummaryOpen(true);
54+
setIsPanelTableContentOpen(true);
5455
}
55-
}, [setIsPanelSummaryOpen, headings, hasBeenClose]);
56+
}, [setIsPanelTableContentOpen, headings, hasBeenClose]);
5657

5758
// Close the panel unmount
5859
useEffect(() => {
5960
return () => {
60-
setIsPanelSummaryOpen(false);
61+
setIsPanelTableContentOpen(false);
6162
};
62-
}, [setIsPanelSummaryOpen]);
63+
}, [setIsPanelTableContentOpen]);
6364

6465
// To highlight the first heading in the viewport
6566
useEffect(() => {
@@ -112,7 +113,7 @@ export const Summary = ({ doc }: SummaryProps) => {
112113
setHeadings(headingFiltering());
113114
});
114115

115-
if (!isPanelSummaryOpen) {
116+
if (!isPanelTableContentOpen) {
116117
return null;
117118
}
118119

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './TableContent';

0 commit comments

Comments
 (0)