types#TaskStatuses TypeScript Examples

The following examples show how to use types#TaskStatuses. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx    From RareCamp with Apache License 2.0 6 votes vote down vote up
statusMeta = {
  [TaskStatuses.COMPLETED]: {
    bgColor: '#389e0d',
    label: 'Completed',
  },
  [TaskStatuses.IN_PROGRESS]: {
    bgColor: '#fa8c16',
    label: 'In Progress',
  },
  [TaskStatuses.NOT_STARTED]: {
    bgColor: '#bfbfbf',
    label: 'Not Started',
  },
}
Example #2
Source File: index.tsx    From RareCamp with Apache License 2.0 5 votes vote down vote up
export default function TaskStatus({ task, programId }) {
  const taskMutation = useEditTaskMutation({
    taskId: task.taskId,
    programId,
    projectId: task.projectId,
  })
  const menu = (
    <Menu>
      {Object.values(TaskStatuses).map((status) => (
        <Menu.Item
          key={status}
          style={{
            backgroundColor:
              status !== task.status ? 'transparent' : '#eee',
          }}
        >
          <Button
            type="text"
            onClick={() => {
              if (status !== task.status)
                taskMutation.mutate({ ...task, status })
            }}
          >
            <Tag color={statusMeta[status].bgColor}>
              {statusMeta[status].label}
            </Tag>
          </Button>
        </Menu.Item>
      ))}
    </Menu>
  )

  return (
    <Dropdown overlay={menu}>
      <Tag
        style={{ cursor: 'pointer' }}
        color={statusMeta[task.status].bgColor}
      >
        {taskMutation.isLoading ? (
          <LoadingOutlined />
        ) : (
          statusMeta[task.status].label
        )}
      </Tag>
    </Dropdown>
  )
}