<commit_before>import React, { MutableRefObject } from 'react';
import { c } from 'ttag';
import { Calendar } from 'proton-shared/lib/interfaces/calendar';
import { Alert, PrimaryButton, useModals } from 'react-components';

import { CalendarsEventsCache } from '../../calendar/eventStore/interface';
import ImportModal from '../../../components/import/ImportModal';

interface Props {
    defaultCalendar?: Calendar;
    activeCalendars: Calendar[];
    calendarsEventsCacheRef: MutableRefObject<CalendarsEventsCache>;
}

const ImportSection = ({ activeCalendars, defaultCalendar, calendarsEventsCacheRef }: Props) => {
    const canImport = !!activeCalendars.length;
    const { createModal } = useModals();
    const handleImport = () =>
        canImport && defaultCalendar
            ? createModal(
                  <ImportModal
                      defaultCalendar={defaultCalendar}
                      calendars={activeCalendars}
                      calendarsEventsCacheRef={calendarsEventsCacheRef}
                  />
              )
            : undefined;

    return (
        <>
            {canImport ? null : (
                <Alert type="warning">{c('Info').t`You need to have an active calendar to import your events.`}</Alert>
            )}
            <Alert learnMore="https://protonmail.com/support/knowledge-base/import-calendar-to-protoncalendar/">{c(
                'Info'
            )
                .t`You can import ICS files from another calendar to ProtonCalendar. This lets you quickly import one event or your entire agenda.`}</Alert>
            <div>
                <PrimaryButton onClick={handleImport} disabled={!canImport}>{c('Action').t`Import`}</PrimaryButton>
            </div>
        </>
    );
};

export default ImportSection;
<commit_msg>Text improvements<commit_after>import React, { MutableRefObject } from 'react';
import { c } from 'ttag';
import { Calendar } from 'proton-shared/lib/interfaces/calendar';
import { Alert, PrimaryButton, useModals } from 'react-components';

import { CalendarsEventsCache } from '../../calendar/eventStore/interface';
import ImportModal from '../../../components/import/ImportModal';

interface Props {
    defaultCalendar?: Calendar;
    activeCalendars: Calendar[];
    calendarsEventsCacheRef: MutableRefObject<CalendarsEventsCache>;
}

const ImportSection = ({ activeCalendars, defaultCalendar, calendarsEventsCacheRef }: Props) => {
    const canImport = !!activeCalendars.length;
    const { createModal } = useModals();
    const handleImport = () =>
        canImport && defaultCalendar
            ? createModal(
                  <ImportModal
                      defaultCalendar={defaultCalendar}
                      calendars={activeCalendars}
                      calendarsEventsCacheRef={calendarsEventsCacheRef}
                  />
              )
            : undefined;

    return (
        <>
            {canImport ? null : (
                <Alert type="warning">{c('Info').t`You need to have an active calendar to import your events.`}</Alert>
            )}
            <Alert learnMore="https://protonmail.com/support/knowledge-base/import-calendar-to-protoncalendar/">{c(
                'Info'
            )
                .t`You can import ICS files from another calendar to ProtonCalendar. This lets you quickly import one event or your entire agenda.`}</Alert>
            <div>
                <PrimaryButton onClick={handleImport} disabled={!canImport}>{c('Action').t`Import calendar`}</PrimaryButton>
            </div>
        </>
    );
};

export default ImportSection;

{'fraction_non_alphanumeric': 0.11582155721806595, 'fraction_numerical': 0.0, 'mean_word_length': 2.408876298394712, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3958839', 'n_tokens_mistral': 947, 'n_tokens_neox': 916, 'n_words': 210}