From 10337183a8f75027539532c6424bddfa5ab9bf7a Mon Sep 17 00:00:00 2001 From: doobry Date: Tue, 25 Jun 2024 17:37:47 +0200 Subject: [PATCH] Harmonize naming of Enable/Disable and Delete buttons --- src/components/ticker/BlueskyCard.test.tsx | 4 ++-- src/components/ticker/BlueskyCard.tsx | 6 +++--- src/components/ticker/MastodonCard.test.tsx | 4 ++-- src/components/ticker/MastodonCard.tsx | 8 ++++---- src/components/ticker/TelegramCard.test.tsx | 4 ++-- src/components/ticker/TelegramCard.tsx | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/ticker/BlueskyCard.test.tsx b/src/components/ticker/BlueskyCard.test.tsx index fe6df3a9..ac31f9e7 100644 --- a/src/components/ticker/BlueskyCard.test.tsx +++ b/src/components/ticker/BlueskyCard.test.tsx @@ -64,7 +64,7 @@ describe('BlueSkyCard', () => { expect(screen.getByText('You are connected with Bluesky.')).toBeInTheDocument() expect(screen.getByRole('link', { name: 'handle.bsky.social' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Configure' })).toBeInTheDocument() - expect(screen.getByRole('button', { name: 'Disconnect' })).toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Delete' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Disable' })).toBeInTheDocument() fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) @@ -84,7 +84,7 @@ describe('BlueSkyCard', () => { fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) - await userEvent.click(screen.getByRole('button', { name: 'Disconnect' })) + await userEvent.click(screen.getByRole('button', { name: 'Delete' })) expect(fetchMock).toHaveBeenCalledTimes(2) expect(fetchMock).toHaveBeenCalledWith('http://localhost:8080/v1/admin/tickers/1/bluesky', { diff --git a/src/components/ticker/BlueskyCard.tsx b/src/components/ticker/BlueskyCard.tsx index b8c24fcc..eb2e9378 100644 --- a/src/components/ticker/BlueskyCard.tsx +++ b/src/components/ticker/BlueskyCard.tsx @@ -20,7 +20,7 @@ const BlueskyCard: FC = ({ ticker }) => { const bluesky = ticker.bluesky - const handleDisconnect = useCallback(() => { + const handleDelete = useCallback(() => { deleteTickerBlueskyApi(token, ticker).finally(() => { queryClient.invalidateQueries({ queryKey: ['ticker', ticker.id] }) }) @@ -75,8 +75,8 @@ const BlueskyCard: FC = ({ ticker }) => { Enable )} - ) : null} diff --git a/src/components/ticker/MastodonCard.test.tsx b/src/components/ticker/MastodonCard.test.tsx index 1197a354..b01a3233 100644 --- a/src/components/ticker/MastodonCard.test.tsx +++ b/src/components/ticker/MastodonCard.test.tsx @@ -65,7 +65,7 @@ describe('MastodonCard', () => { expect(screen.getByText('Your Profile:')).toBeInTheDocument() expect(screen.getByText('@user@mastodon.social')).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Configure' })).toBeInTheDocument() - expect(screen.getByRole('button', { name: 'Disconnect' })).toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Delete' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Disable' })).toBeInTheDocument() fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) @@ -85,7 +85,7 @@ describe('MastodonCard', () => { fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) - screen.getByRole('button', { name: 'Disconnect' }).click() + screen.getByRole('button', { name: 'Delete' }).click() expect(fetchMock).toHaveBeenCalledTimes(2) expect(fetchMock).toHaveBeenCalledWith('http://localhost:8080/v1/admin/tickers/1/mastodon', { diff --git a/src/components/ticker/MastodonCard.tsx b/src/components/ticker/MastodonCard.tsx index daa576f3..d24c34d2 100644 --- a/src/components/ticker/MastodonCard.tsx +++ b/src/components/ticker/MastodonCard.tsx @@ -1,5 +1,5 @@ import { faMastodon } from '@fortawesome/free-brands-svg-icons' -import { faBan, faGear, faPause, faPlay } from '@fortawesome/free-solid-svg-icons' +import { faGear, faPause, faPlay, faTrash } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { Box, Button, Card, CardActions, CardContent, Divider, Link, Stack, Typography } from '@mui/material' import { useQueryClient } from '@tanstack/react-query' @@ -20,7 +20,7 @@ const MastodonCard: FC = ({ ticker }) => { const mastodon = ticker.mastodon - const handleDisconnect = useCallback(() => { + const handleDelete = useCallback(() => { deleteTickerMastodonApi(token, ticker).finally(() => { queryClient.invalidateQueries({ queryKey: ['ticker', ticker.id] }) }) @@ -79,8 +79,8 @@ const MastodonCard: FC = ({ ticker }) => { Enable )} - ) : null} diff --git a/src/components/ticker/TelegramCard.test.tsx b/src/components/ticker/TelegramCard.test.tsx index 50ee7eda..e1fcb43e 100644 --- a/src/components/ticker/TelegramCard.test.tsx +++ b/src/components/ticker/TelegramCard.test.tsx @@ -64,7 +64,7 @@ describe('TelegramCard', () => { expect(screen.getByText('You are connected with Telegram.')).toBeInTheDocument() expect(screen.getByRole('link', { name: 'channel' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Configure' })).toBeInTheDocument() - expect(screen.getByRole('button', { name: 'Disconnect' })).toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Delete' })).toBeInTheDocument() expect(screen.getByRole('button', { name: 'Disable' })).toBeInTheDocument() fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) @@ -84,7 +84,7 @@ describe('TelegramCard', () => { fetchMock.mockResponseOnce(JSON.stringify({ status: 'success' })) - await userEvent.click(screen.getByRole('button', { name: 'Disconnect' })) + await userEvent.click(screen.getByRole('button', { name: 'Delete' })) expect(fetchMock).toHaveBeenCalledTimes(2) expect(fetchMock).toHaveBeenCalledWith('http://localhost:8080/v1/admin/tickers/1/telegram', { diff --git a/src/components/ticker/TelegramCard.tsx b/src/components/ticker/TelegramCard.tsx index ed96d101..a841731c 100644 --- a/src/components/ticker/TelegramCard.tsx +++ b/src/components/ticker/TelegramCard.tsx @@ -1,5 +1,5 @@ import { faTelegram } from '@fortawesome/free-brands-svg-icons' -import { faBan, faGear, faPause, faPlay } from '@fortawesome/free-solid-svg-icons' +import { faGear, faPause, faPlay, faTrash } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { Box, Button, Card, CardActions, CardContent, Divider, Link, Stack, Typography } from '@mui/material' import { useQueryClient } from '@tanstack/react-query' @@ -23,7 +23,7 @@ const TelegramCard: FC = ({ ticker }) => { putTickerTelegramApi(token, { active: !telegram.active }, ticker).finally(() => queryClient.invalidateQueries({ queryKey: ['ticker', ticker.id] })) }, [token, queryClient, telegram.active, ticker]) - const handleDisconnect = useCallback(() => { + const handleDelete = useCallback(() => { deleteTickerTelegramApi(token, ticker).finally(() => { queryClient.invalidateQueries({ queryKey: ['ticker', ticker.id] }) }) @@ -74,8 +74,8 @@ const TelegramCard: FC = ({ ticker }) => { Enable )} - ) : null}