@@ -6,6 +6,7 @@ import ReactModal from "react-modal"
66import { toast } from "react-toastify"
77import Main from "../../components/Main"
88import { config } from "../../utils/config"
9+ import * as gtag from "../../utils/gtag"
910import { parseUser } from "../../utils/parse-user"
1011import { DiscordUser , Reminder } from "../../utils/types"
1112import { parseDuration , send , timeLeft } from "../../utils/utils"
@@ -33,24 +34,6 @@ const modalStyle: ReactModal.Styles = {
3334 borderRadius : "1rem"
3435 }
3536}
36- const erorrModalStyle : ReactModal . Styles = {
37- overlay : {
38- backgroundColor : "rgba(10, 0, 0, 0.66)"
39- } ,
40- content : {
41- position : "absolute" ,
42- top : "max(calc(50% - (10rem/2)), 20px)" ,
43- maxHeight : "10rem" ,
44-
45- width : "min(20rem, calc(100% - 40px))" ,
46- left : "max(calc(50% - (20rem/2)), 20px)" ,
47-
48- border : "1px solid rgb(156, 79, 100)" ,
49- color : "white" ,
50- background : "rgb(156 65 85)" ,
51- borderRadius : "1rem"
52- }
53- }
5437
5538export default class Reminders extends Component < Props , { reminders : Reminder [ ] , createReminderOpen : boolean , disabledTest : boolean } > {
5639 constructor ( props : Props ) {
@@ -129,6 +112,7 @@ async function sendTest() {
129112 headers : { "Content-Type" : "application/json" } ,
130113 method : "POST"
131114 } )
115+ gtag . event ( { action : "reminder_test_message" , category : "reminders" , label : "Send a test message" , value : 1 } )
132116 if ( res . status == 200 )
133117 toast . success ( "Successfully send test message" )
134118 else toast . error ( "An error occurred while sending a test message: " + await res . text ( ) )
@@ -167,6 +151,7 @@ function CreateReminder({ isOpen, requestClose, addReminder }: { isOpen: boolean
167151 addReminder ( await res . json ( ) )
168152
169153 toast . success ( "Created reminder!" )
154+ gtag . event ( { action : "reminder_create" , category : "reminders" , label : "Create reminder" , value : 1 } )
170155
171156 setName ( "" )
172157 setDuration ( "" )
@@ -238,6 +223,7 @@ function formatDuration(duration: number) {
238223function ReminderCard ( { r, onDelete } : { r : Reminder , onDelete : ( ) => void } ) {
239224 const deleteReminder = async ( ) => {
240225 const res = await send ( "/api/reminders/delete" , { r } )
226+ gtag . event ( { action : "reminder_delete" , category : "reminders" , label : "Delete a reminder" , value : 1 } )
241227
242228 if ( ( res . status >= 200 && res . status < 300 ) || res . status == 404 )
243229 onDelete ( )
0 commit comments