diff --git a/frontend/src/locale/en/translation.json b/frontend/src/locale/en/translation.json index e8d23cb..83b0651 100644 --- a/frontend/src/locale/en/translation.json +++ b/frontend/src/locale/en/translation.json @@ -275,7 +275,8 @@ "subscribed-multi": "{{name}} subscribed to you ({{months}} months) (Tier {{tier}})", "subscrition-gift_one": "{{name}} gifted {{count}} subscription (Tier {{tier}})", "subscrition-gift_other": "{{name}} gifted {{count}} subscriptions (Tier {{tier}})" - } + }, + "replay": "Replay event" } }, "onboarding": { diff --git a/frontend/src/locale/it/translation.json b/frontend/src/locale/it/translation.json index b9e9508..81b0247 100644 --- a/frontend/src/locale/it/translation.json +++ b/frontend/src/locale/it/translation.json @@ -156,7 +156,8 @@ "subscribed-multi": "{{name}} si รจ abbonato ({{months}} mesi) (Livello {{tier}})", "subscrition-gift_one": "{{name}} ha regalato {{count}} abbonamento (Livello {{tier}})", "subscrition-gift_other": "{{name}} ha regalato {{count}} abbonamenti (Livello {{tier}})" - } + }, + "replay": "Ripeti evento" } }, "debug": { diff --git a/frontend/src/ui/pages/Dashboard.tsx b/frontend/src/ui/pages/Dashboard.tsx index 766514a..01195b0 100644 --- a/frontend/src/ui/pages/Dashboard.tsx +++ b/frontend/src/ui/pages/Dashboard.tsx @@ -1,4 +1,4 @@ -import { CircleIcon, InfoCircledIcon } from '@radix-ui/react-icons'; +import { CircleIcon, InfoCircledIcon, UpdateIcon } from '@radix-ui/react-icons'; import { Trans, useTranslation } from 'react-i18next'; import { EventSubNotification, @@ -6,6 +6,7 @@ import { unwrapEvent, } from '~/lib/eventSub'; import { useLiveKey } from '~/lib/react'; +import { useAppSelector } from '~/store'; import { PageContainer, SectionHeader, styled, TextBlock } from '../theme'; import WIPNotice from '../components/utils/WIPNotice'; import BrowserLink from '../components/BrowserLink'; @@ -87,6 +88,17 @@ const TwitchEventContainer = styled('div', { const TwitchEventContent = styled('div', { flex: 1, }); +const TwitchEventActions = styled('div', { + display: 'flex', + margin: '0 10px', + '& a': { + color: '$gray10', + '&:hover': { + color: '$gray12', + cursor: 'pointer', + }, + }, +}); const TwitchEventTime = styled('time', { color: '$gray10', fontSize: '13px', @@ -107,6 +119,17 @@ const supportedMessages: EventSubNotificationType[] = [ function TwitchEvent({ data }: { data: EventSubNotification }) { const { t } = useTranslation(); + const client = useAppSelector((state) => state.api.client); + + const replay = () => { + void client.putJSON('twitch/ev/eventsub-event', { + ...data, + subscription: { + ...data.subscription, + created_at: new Date().toISOString(), + }, + }); + }; let content: JSX.Element | string; const message = unwrapEvent(data); @@ -292,13 +315,23 @@ function TwitchEvent({ data }: { data: EventSubNotification }) { > {date.toLocaleTimeString()} + + { + replay(); + }} + > + + + ); } function TwitchEventLog({ events }: { events: EventSubNotification[] }) { const { t } = useTranslation(); - // TODO Include a note specifying that it's not ALL events!! return ( <> @@ -360,7 +393,6 @@ function TwitchSection() { const twitchEvents = useLiveKey( 'twitch/eventsub-history', ); - console.log(twitchEvents); return ( <> diff --git a/frontend/src/ui/pages/TwitchSettings.tsx b/frontend/src/ui/pages/TwitchSettings.tsx index 9b8225f..e6cf68f 100644 --- a/frontend/src/ui/pages/TwitchSettings.tsx +++ b/frontend/src/ui/pages/TwitchSettings.tsx @@ -4,10 +4,9 @@ import { helix } from '@wailsapp/go/models'; import { BrowserOpenURL } from '@wailsapp/runtime/runtime'; import React, { useEffect, useState } from 'react'; import { Trans, useTranslation } from 'react-i18next'; -import { useSelector } from 'react-redux'; import eventsubTests from '~/data/eventsub-tests'; import { useModule, useStatus } from '~/lib/react'; -import { RootState, useAppDispatch } from '~/store'; +import { useAppDispatch, useAppSelector } from '~/store'; import apiReducer, { modules } from '~/store/api/reducer'; import { checkTwitchKeys } from '~/lib/twitch'; import BrowserLink from '../components/BrowserLink'; @@ -376,7 +375,7 @@ const TwitchName = styled('p', { fontWeight: 'bold' }); function TwitchEventSubSettings() { const { t } = useTranslation(); const [userStatus, setUserStatus] = useState(null); - const kv = useSelector((state: RootState) => state.api.client); + const kv = useAppSelector((state) => state.api.client); const getUserInfo = async () => { try {