2020-02-12 07:23:06 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Schedule } from '@/api/server/schedules/getServerSchedules';
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
2020-07-05 01:46:09 +00:00
|
|
|
import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { format } from 'date-fns';
|
2020-07-05 00:00:19 +00:00
|
|
|
import tw from 'twin.macro';
|
2020-02-12 07:23:06 +00:00
|
|
|
|
|
|
|
export default ({ schedule }: { schedule: Schedule }) => (
|
|
|
|
<>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`hidden md:block`}>
|
2020-07-05 00:00:19 +00:00
|
|
|
<FontAwesomeIcon icon={faCalendarAlt} fixedWidth/>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`flex-1 md:ml-4`}>
|
2020-02-12 07:23:06 +00:00
|
|
|
<p>{schedule.name}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-xs text-neutral-400`}>
|
2020-02-12 07:23:06 +00:00
|
|
|
Last run
|
2020-07-30 03:23:46 +00:00
|
|
|
at: {schedule.lastRunAt ? format(schedule.lastRunAt, 'MMM do \'at\' h:mma') : 'never'}
|
2020-02-12 07:23:06 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div>
|
|
|
|
<p
|
|
|
|
css={[
|
|
|
|
tw`py-1 px-3 rounded text-xs uppercase text-white sm:hidden`,
|
|
|
|
schedule.isActive ? tw`bg-green-600` : tw`bg-neutral-400`,
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
{schedule.isActive ? 'Active' : 'Inactive'}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div css={tw`flex items-center mx-auto sm:mx-8 w-full sm:w-auto mt-4 sm:mt-0`}>
|
|
|
|
<div css={tw`w-1/5 sm:w-auto text-center`}>
|
|
|
|
<p css={tw`font-medium`}>{schedule.cron.minute}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Minute</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`w-1/5 sm:w-auto text-center ml-4`}>
|
|
|
|
<p css={tw`font-medium`}>{schedule.cron.hour}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Hour</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`w-1/5 sm:w-auto text-center ml-4`}>
|
|
|
|
<p css={tw`font-medium`}>{schedule.cron.dayOfMonth}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Day (Month)</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`w-1/5 sm:w-auto text-center ml-4`}>
|
|
|
|
<p css={tw`font-medium`}>*</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Month</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`w-1/5 sm:w-auto text-center ml-4`}>
|
|
|
|
<p css={tw`font-medium`}>{schedule.cron.dayOfWeek}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Day (Week)</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p
|
2020-07-05 00:00:19 +00:00
|
|
|
css={[
|
2020-09-13 17:02:25 +00:00
|
|
|
tw`py-1 px-3 rounded text-xs uppercase text-white hidden sm:block`,
|
2020-07-05 00:00:19 +00:00
|
|
|
schedule.isActive ? tw`bg-green-600` : tw`bg-neutral-400`,
|
|
|
|
]}
|
2020-02-12 07:23:06 +00:00
|
|
|
>
|
|
|
|
{schedule.isActive ? 'Active' : 'Inactive'}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|