Skip to content

Commit 1cc2935

Browse files
committed
refactor: clean up variable names again
1 parent eac4164 commit 1cc2935

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

site/src/pages/TemplatePage/TemplatePageHeader.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type FC, useRef, useState } from "react";
22
import { Link as RouterLink, useNavigate } from "react-router-dom";
3-
import { useDeletionPopoverState } from "./useDeletionPopoverState";
3+
import { useDeletionDialogState } from "./useDeletionDialogState";
44

55
import { useQuery } from "react-query";
66
import { workspacesByQuery } from "api/queries/workspaces";
@@ -123,7 +123,7 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
123123
onDeleteTemplate,
124124
}) => {
125125
const navigate = useNavigate();
126-
const popoverState = useDeletionPopoverState(template, onDeleteTemplate);
126+
const dialogState = useDeletionDialogState(template, onDeleteTemplate);
127127

128128
const queryText = `template:${template.name}`;
129129
const workspaceCountQuery = useQuery({
@@ -153,7 +153,7 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
153153
<TemplateMenu
154154
templateVersion={activeVersion.name}
155155
templateName={template.name}
156-
onDelete={popoverState.openDeleteConfirmation}
156+
onDelete={dialogState.openDeleteConfirmation}
157157
/>
158158
)}
159159
</>
@@ -184,9 +184,9 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
184184

185185
{safeToDeleteTemplate ? (
186186
<DeleteDialog
187-
isOpen={popoverState.isDeleteDialogOpen}
188-
onConfirm={popoverState.confirmDelete}
189-
onCancel={popoverState.cancelDeleteConfirmation}
187+
isOpen={dialogState.isDeleteDialogOpen}
188+
onConfirm={dialogState.confirmDelete}
189+
onCancel={dialogState.cancelDeleteConfirmation}
190190
entity="template"
191191
name={template.name}
192192
/>
@@ -195,8 +195,8 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
195195
type="info"
196196
title="Unable to delete"
197197
hideCancel={false}
198-
open={popoverState.isDeleteDialogOpen}
199-
onClose={popoverState.cancelDeleteConfirmation}
198+
open={dialogState.isDeleteDialogOpen}
199+
onClose={dialogState.cancelDeleteConfirmation}
200200
confirmText="See workspaces"
201201
confirmLoading={workspaceCountQuery.status !== "success"}
202202
onConfirm={() => {

site/src/pages/TemplatePage/useDeletionPopoverState.test.ts renamed to site/src/pages/TemplatePage/useDeletionDialogState.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { act, renderHook, waitFor } from "@testing-library/react";
22
import { MockTemplate } from "testHelpers/entities";
3-
import { useDeletionPopoverState } from "./useDeletionPopoverState";
3+
import { useDeletionDialogState } from "./useDeletionDialogState";
44
import * as API from "api/api";
55

66
test("delete dialog starts closed", () => {
77
const { result } = renderHook(() =>
8-
useDeletionPopoverState(MockTemplate, jest.fn()),
8+
useDeletionDialogState(MockTemplate, jest.fn()),
99
);
1010
expect(result.current.isDeleteDialogOpen).toBeFalsy();
1111
});
1212

1313
test("confirm template deletion", async () => {
1414
const onDeleteTemplate = jest.fn();
1515
const { result } = renderHook(() =>
16-
useDeletionPopoverState(MockTemplate, onDeleteTemplate),
16+
useDeletionDialogState(MockTemplate, onDeleteTemplate),
1717
);
1818

1919
//Open delete confirmation
@@ -31,7 +31,7 @@ test("confirm template deletion", async () => {
3131

3232
test("cancel template deletion", () => {
3333
const { result } = renderHook(() =>
34-
useDeletionPopoverState(MockTemplate, jest.fn()),
34+
useDeletionDialogState(MockTemplate, jest.fn()),
3535
);
3636

3737
//Open delete confirmation

site/src/pages/TemplatePage/useDeletionPopoverState.ts renamed to site/src/pages/TemplatePage/useDeletionDialogState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type DeleteTemplateState =
99
| { status: "confirming" }
1010
| { status: "deleting" };
1111

12-
export const useDeletionPopoverState = (
12+
export const useDeletionDialogState = (
1313
template: Template,
1414
onDelete: () => void,
1515
) => {

0 commit comments

Comments
 (0)