Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix ics download #2554 #2555

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading