diff --git a/src/components/UpdaterModal.test.tsx b/src/components/UpdaterModal.test.tsx deleted file mode 100644 index fc9f156e6..000000000 --- a/src/components/UpdaterModal.test.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { fireEvent, render, screen } from '@testing-library/react' -import { vi } from 'vitest' -import { UpdaterModal } from './UpdaterModal' - -describe('UpdaterModal tests', () => { - test('Renders the modal', () => { - const callback = vi.fn() - const data = { - version: '1.2.3', - date: '2021-22-23T21:22:23Z', - body: 'This is the body.', - } - - render( - {}} - onResolve={callback} - instanceId="" - open={false} - close={(res) => {}} - version={data.version} - date={data.date} - body={data.body} - /> - ) - - expect(screen.getByTestId('update-version')).toHaveTextContent(data.version) - - const updateButton = screen.getByTestId('update-button-update') - expect(updateButton).toBeEnabled() - fireEvent.click(updateButton) - expect(callback.mock.calls).toHaveLength(1) - expect(callback.mock.lastCall[0]).toEqual({ wantUpdate: true }) - - const cancelButton = screen.getByTestId('update-button-cancel') - expect(cancelButton).toBeEnabled() - fireEvent.click(cancelButton) - expect(callback.mock.calls).toHaveLength(2) - expect(callback.mock.lastCall[0]).toEqual({ wantUpdate: false }) - }) -}) diff --git a/src/components/UpdaterModal.tsx b/src/components/UpdaterModal.tsx deleted file mode 100644 index 8742851e1..000000000 --- a/src/components/UpdaterModal.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { create, InstanceProps } from 'react-modal-promise' -import { ActionButton } from './ActionButton' -import { Logo } from './Logo' -import { Marked } from '@ts-stack/markdown' - -type ModalResolve = { - wantUpdate: boolean -} - -type ModalReject = boolean - -type UpdaterModalProps = InstanceProps & { - version: string - date?: string - body?: string -} - -export const createUpdaterModal = create< - UpdaterModalProps, - ModalResolve, - ModalReject -> - -export const UpdaterModal = ({ - onResolve, - version, - date, - body, -}: UpdaterModalProps) => ( -
-
-
-

New version available!

- -
-
- - v{version} - - Published on {date} -
- {/* TODO: fix list bullets */} - {body && ( -
- )} -
- onResolve({ wantUpdate: false })} - iconStart={{ - icon: 'close', - bgClassName: 'bg-destroy-80', - iconClassName: 'text-destroy-20 group-hover:text-destroy-10', - }} - className="hover:border-destroy-40 hover:bg-destroy-10/50 dark:hover:bg-destroy-80/50" - data-testid="update-button-cancel" - > - Not now - - onResolve({ wantUpdate: true })} - iconStart={{ - icon: 'arrowRight', - bgClassName: 'dark:bg-chalkboard-80', - }} - className="dark:hover:bg-chalkboard-80/50" - data-testid="update-button-update" - > - Update - -
-
-
-)