<commit_before>import React, { useMemo } from 'react';
import { Icon, classnames } from 'react-components';

import { useReadCalendarEvent, useReadEvent } from './useReadCalendarEvent';
import { bestColor } from '../../helpers/color';

const FullDayEvent = ({
    style,
    formatTime,
    className = 'calendar-dayeventcell absolute alignleft',
    event: { start, data: { Calendar } = {}, data: targetEventData, isAllDay, isAllPartDay, tmpData },
    isSelected,
    isBeforeNow,
    eventRef,
    onClick
}) => {
    const [value, loading, error] = useReadCalendarEvent(targetEventData);
    const model = useReadEvent(value);

    const calendarColor = Calendar.Color;

    const eventStyle = useMemo(() => {
        if (!isAllDay) {
            return {};
        }
        const background = calendarColor;
        return {
            background,
            color: bestColor(background)
        };
    }, [calendarColor, isAllDay, isSelected]);

    const timeString = useMemo(() => {
        return formatTime(start);
    }, [start]);

    const titleString = tmpData && tmpData.title || !loading && model.title || '';

    const content = (() => {
        if (error) {
            return <Icon name="lock" className="fill-currentColor" />;
        }

        return (
            <div className="flex flex-nowrap bg-inherit">
                <span
                    className={classnames([
                        'flex-item-fluid flex flex-nowrap flex-items-center',
                        loading && 'calendar-skeleton-loading'
                    ])}
                >
                    {!isAllDay ? (
                        <Icon className="mr0-25 flex-item-noshrink" size={12} name="circle" color={calendarColor} />
                    ) : null}
                    {loading ? '' : <span className="flex-item-fluid ellipsis">{titleString}</span>}
                </span>
                {isAllPartDay ? <span className="">{timeString}</span> : null}
            </div>
        );
    })();

    const isBeforeNowClassModifier = isBeforeNow ? 'calendar-dayeventcell--isBefore' : '';

    return (
        <div style={style} className={classnames([className, isBeforeNowClassModifier])} data-ignore-create="1">
            <div
                onClick={onClick}
                className={classnames([
                    'calendar-dayeventcell-inner alignleft inbl w100 pl0-5 pr0-5',
                    !isAllDay && 'calendar-dayeventcell-inner--notAllDay'
                ])}
                style={eventStyle}
                ref={eventRef}
            >
                {content}
            </div>
        </div>
    );
};

export default FullDayEvent;<commit_msg>Fix - Safari display bug when creating event<commit_after>import React, { useMemo } from 'react';
import { Icon, classnames } from 'react-components';

import { useReadCalendarEvent, useReadEvent } from './useReadCalendarEvent';
import { bestColor } from '../../helpers/color';

const FullDayEvent = ({
    style,
    formatTime,
    className = 'calendar-dayeventcell absolute alignleft',
    event: { start, data: { Calendar } = {}, data: targetEventData, isAllDay, isAllPartDay, tmpData },
    isSelected,
    isBeforeNow,
    eventRef,
    onClick
}) => {
    const [value, loading, error] = useReadCalendarEvent(targetEventData);
    const model = useReadEvent(value);

    const calendarColor = Calendar.Color;

    const eventStyle = useMemo(() => {
        if (!isAllDay) {
            return {};
        }
        const background = calendarColor;
        return {
            background,
            color: bestColor(background)
        };
    }, [calendarColor, isAllDay, isSelected]);

    const timeString = useMemo(() => {
        return formatTime(start);
    }, [start]);

    const titleString = (tmpData && tmpData.title) || (!loading && model.title) || '';

    const content = (() => {
        if (error) {
            return <Icon name="lock" className="fill-currentColor" />;
        }

        return (
            <div className="flex flex-nowrap bg-inherit">
                <span
                    className={classnames([
                        'flex-item-fluid flex flex-nowrap w100 flex-items-center',
                        loading && 'calendar-skeleton-loading'
                    ])}
                >
                    {!isAllDay ? (
                        <Icon className="mr0-25 flex-item-noshrink" size={12} name="circle" color={calendarColor} />
                    ) : null}
                    {loading ? '' : <span className="flex-item-fluid ellipsis">{titleString}</span>}
                </span>
                {isAllPartDay ? <span className="">{timeString}</span> : null}
            </div>
        );
    })();

    const isBeforeNowClassModifier = isBeforeNow ? 'calendar-dayeventcell--isBefore' : '';

    return (
        <div style={style} className={classnames([className, isBeforeNowClassModifier])} data-ignore-create="1">
            <div
                onClick={onClick}
                className={classnames([
                    'calendar-dayeventcell-inner alignleft flex w100 pl0-5 pr0-5',
                    !isAllDay && 'calendar-dayeventcell-inner--notAllDay'
                ])}
                style={eventStyle}
                ref={eventRef}
            >
                {content}
            </div>
        </div>
    );
};

export default FullDayEvent;
{'fraction_non_alphanumeric': 0.12933579335793358, 'fraction_numerical': 0.005350553505535056, 'mean_word_length': 1.8591772151898733, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, 'https://': 0, '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': '2368894', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1420, 'n_words': 300}