mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
31 lines
913 B
JavaScript
31 lines
913 B
JavaScript
// @flow
|
|
|
|
import React from 'react';
|
|
import { MultiSwitch } from 'insomnia-components';
|
|
import type { GlobalActivity } from '../../common/constants';
|
|
import { ACTIVITY_DEBUG, ACTIVITY_SPEC, ACTIVITY_UNIT_TEST } from '../../common/constants';
|
|
import type { Workspace } from '../../models/workspace';
|
|
|
|
type Props = {
|
|
activity: GlobalActivity,
|
|
handleActivityChange: (workspaceId: string, activity: GlobalActivity) => Promise<void>,
|
|
workspace: Workspace,
|
|
};
|
|
|
|
export default function ActivityToggle({ activity, handleActivityChange, workspace }: Props) {
|
|
const choices = [
|
|
{ label: 'Design', value: ACTIVITY_SPEC },
|
|
{ label: 'Debug', value: ACTIVITY_DEBUG },
|
|
{ label: 'Test', value: ACTIVITY_UNIT_TEST },
|
|
];
|
|
|
|
return (
|
|
<MultiSwitch
|
|
name="activity-toggle"
|
|
onChange={a => handleActivityChange(workspace._id, a)}
|
|
choices={choices}
|
|
selectedValue={activity}
|
|
/>
|
|
);
|
|
}
|