misc_pterodactyl-panel/resources/scripts/components/server/schedules/NewTaskButton.tsx

23 lines
689 B
TypeScript
Raw Permalink Normal View History

2020-03-19 05:36:19 +00:00
import React, { useState } from 'react';
import { Schedule } from '@/api/server/schedules/getServerSchedules';
2020-03-19 05:36:19 +00:00
import TaskDetailsModal from '@/components/server/schedules/TaskDetailsModal';
2020-07-05 00:00:19 +00:00
import Button from '@/components/elements/Button';
2020-10-15 03:13:36 +00:00
import tw from 'twin.macro';
2020-03-19 05:36:19 +00:00
interface Props {
schedule: Schedule;
2020-03-19 05:36:19 +00:00
}
export default ({ schedule }: Props) => {
const [ visible, setVisible ] = useState(false);
2020-03-19 05:36:19 +00:00
return (
<>
<TaskDetailsModal schedule={schedule} visible={visible} onModalDismissed={() => setVisible(false)}/>
2020-10-15 03:13:36 +00:00
<Button onClick={() => setVisible(true)} css={tw`flex-1`}>
2020-03-19 05:36:19 +00:00
New Task
2020-07-05 00:00:19 +00:00
</Button>
2020-03-19 05:36:19 +00:00
</>
);
};