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

26 lines
689 B
TypeScript
Raw 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';
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 (
<>
{visible &&
<TaskDetailsModal
schedule={schedule}
onDismissed={() => setVisible(false)}
/>
2020-03-19 05:36:19 +00:00
}
<button className={'btn btn-primary btn-sm'} onClick={() => setVisible(true)}>
2020-03-19 05:36:19 +00:00
New Task
</button>
</>
);
};