import { useState } from 'react'; import { Tag } from 'antd'; import { EditOutlined } from '@ant-design/icons'; import dayjs from 'dayjs'; import { ScheduleDTO } from '../../../types/schedule'; import { i18nText } from '../../../i18nKeys'; import { getCurrentTime, getTimeString } from '../../../utils/time'; import { ExpertData } from '../../../types/profile'; import { LinkButton } from '../../view/LinkButton'; import { EditExpertScheduleModal } from '../../Modals/EditExpertScheduleModal'; type ExpertScheduleProps = { locale: string; data?: ScheduleDTO; updateExpert: (key: keyof ExpertData) => void; }; export const ExpertSchedule = ({ locale, data, updateExpert }: ExpertScheduleProps) => { const [showEdit, setShowEdit] = useState(false); return (

{i18nText('schedule', locale)}

} onClick={() => setShowEdit(true)} />
{data && data?.workingTimes?.map((date, index) => { const { startDay, startTimeMin, endTimeMin } = getCurrentTime(date, dayjs().format('Z')); return (
{i18nText(startDay, locale)}
{startTimeMin ? getTimeString(startTimeMin) : '00:00'}
-
{endTimeMin ? getTimeString(endTimeMin) : '00:00'}
) })}
setShowEdit(false)} locale={locale} data={data} refresh={() => updateExpert('schedule')} />
); };