Skip to content

Commit

Permalink
🐛 Fix ics download #2554 (#2555)
Browse files Browse the repository at this point in the history
  • Loading branch information
padms authored Oct 9, 2024
1 parent d6744f3 commit cf76de3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/pageComponents/topicPages/AddToCalendar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react'
import { isAfter } from 'date-fns'
import { getEventDates, toUTCDateParts } from '../../common/helpers/dateUtilities'

import type { EventDateType } from '../../types/index'
import { useIntl } from 'react-intl'
import { Button } from '@core/Button'
import { twMerge } from 'tailwind-merge'
import { commonButtonStyling, getVariant } from '@core/Button'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const ics = require('ics')
Expand Down Expand Up @@ -80,7 +80,6 @@ const AddToCalendar = ({ eventDate, title, location }: AddToCalendarProps) => {
title: title,
location: location || '',
}

setFileData(createICS(eventData))
}
}, [eventDate, location, title])
Expand All @@ -95,14 +94,15 @@ const AddToCalendar = ({ eventDate, title, location }: AddToCalendarProps) => {
{ eventTitle: title },
)
return (
<Button
<a
aria-label={atcAriaLabel}
id="atc"
className={twMerge(commonButtonStyling, getVariant('contained'))}
{...(fileData && { href: fileData as string, download: `${title.replace(/ /g, '_')}.ics` })}
>
{/* <Icon data={add} /> */}
{atc}
</Button>
</a>
)
}

Expand Down

0 comments on commit cf76de3

Please sign in to comment.