2020-06-30 23:54:56 +00:00
|
|
|
import { MultiSwitch } from 'insomnia-components';
|
2021-07-22 23:04:56 +00:00
|
|
|
import React, { FunctionComponent } from 'react';
|
|
|
|
|
2020-06-30 23:54:56 +00:00
|
|
|
import type { GlobalActivity } from '../../common/constants';
|
|
|
|
import { ACTIVITY_DEBUG, ACTIVITY_SPEC, ACTIVITY_UNIT_TEST } from '../../common/constants';
|
|
|
|
import type { Workspace } from '../../models/workspace';
|
|
|
|
|
2021-05-12 06:35:00 +00:00
|
|
|
interface Props {
|
|
|
|
activity: GlobalActivity;
|
2021-09-01 14:50:26 +00:00
|
|
|
handleActivityChange: (options: {workspaceId?: string; nextActivity: GlobalActivity}) => Promise<void>;
|
2021-05-12 06:35:00 +00:00
|
|
|
workspace: Workspace;
|
|
|
|
}
|
2020-06-30 23:54:56 +00:00
|
|
|
|
2021-09-27 13:47:22 +00:00
|
|
|
export const ActivityToggle: FunctionComponent<Props> = ({ activity, handleActivityChange, workspace }) => {
|
2020-06-30 23:54:56 +00:00
|
|
|
const choices = [
|
2021-05-12 06:35:00 +00:00
|
|
|
{
|
|
|
|
label: 'Design',
|
|
|
|
value: ACTIVITY_SPEC,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Debug',
|
|
|
|
value: ACTIVITY_DEBUG,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Test',
|
|
|
|
value: ACTIVITY_UNIT_TEST,
|
|
|
|
},
|
2020-06-30 23:54:56 +00:00
|
|
|
];
|
2021-06-30 07:47:17 +00:00
|
|
|
|
2020-06-30 23:54:56 +00:00
|
|
|
return (
|
|
|
|
<MultiSwitch
|
|
|
|
name="activity-toggle"
|
2021-06-30 07:47:17 +00:00
|
|
|
onChange={(nextActivity: GlobalActivity) => handleActivityChange({ workspaceId: workspace._id, nextActivity })}
|
2020-06-30 23:54:56 +00:00
|
|
|
choices={choices}
|
2020-08-12 18:02:21 +00:00
|
|
|
selectedValue={activity}
|
2020-06-30 23:54:56 +00:00
|
|
|
/>
|
|
|
|
);
|
2021-05-12 06:35:00 +00:00
|
|
|
};
|