@ -1,3 +1,9 @@
import { DownloadIcon } from '@heroicons/react/outline' ;
import {
CheckIcon ,
InformationCircleIcon ,
XIcon ,
} from '@heroicons/react/solid' ;
import axios from 'axios' ;
import React , { useState } from 'react' ;
import { defineMessages , useIntl } from 'react-intl' ;
@ -117,22 +123,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
setShowRequestModal ( true ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "none"
stroke = "currentColor"
viewBox = "0 0 24 24"
xmlns = "http://www.w3.org/2000/svg"
>
< path
strokeLinecap = "round"
strokeLinejoin = "round"
strokeWidth = { 2 }
d = "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/ >
< / svg >
) ,
svg : < DownloadIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -150,22 +141,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
setShowRequestModal ( true ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "none"
stroke = "currentColor"
viewBox = "0 0 24 24"
xmlns = "http://www.w3.org/2000/svg"
>
< path
strokeLinecap = "round"
strokeLinejoin = "round"
strokeWidth = { 2 }
d = "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/ >
< / svg >
) ,
svg : < DownloadIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -183,22 +159,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
setShowRequest4kModal ( true ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "none"
stroke = "currentColor"
viewBox = "0 0 24 24"
xmlns = "http://www.w3.org/2000/svg"
>
< path
strokeLinecap = "round"
strokeLinejoin = "round"
strokeWidth = { 2 }
d = "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/ >
< / svg >
) ,
svg : < DownloadIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -218,22 +179,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
setShowRequest4kModal ( true ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "none"
stroke = "currentColor"
viewBox = "0 0 24 24"
xmlns = "http://www.w3.org/2000/svg"
>
< path
strokeLinecap = "round"
strokeLinejoin = "round"
strokeWidth = { 2 }
d = "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/ >
< / svg >
) ,
svg : < DownloadIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -246,20 +192,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
id : 'active-request' ,
text : intl.formatMessage ( messages . viewrequest ) ,
action : ( ) = > setShowRequestModal ( true ) ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < InformationCircleIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -273,20 +206,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
id : 'active-4k-request' ,
text : intl.formatMessage ( messages . viewrequest4k ) ,
action : ( ) = > setShowRequest4kModal ( true ) ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < InformationCircleIcon className = "w-5 h-5 mr-1" / > ,
} ) ;
}
@ -302,20 +222,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequest ( activeRequest , 'approve' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < CheckIcon className = "w-5 h-5 mr-1" / > ,
} ,
{
id : 'decline-request' ,
@ -323,20 +230,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequest ( activeRequest , 'decline' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < XIcon className = "w-5 h-5 mr-1" / > ,
}
) ;
}
@ -356,20 +250,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequests ( activeRequests , 'approve' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < CheckIcon className = "w-5 h-5 mr-1" / > ,
} ,
{
id : 'decline-request-batch' ,
@ -379,20 +260,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequests ( activeRequests , 'decline' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < XIcon className = "w-5 h-5 mr-1" / > ,
}
) ;
}
@ -409,20 +277,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequest ( active4kRequest , 'approve' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < CheckIcon className = "w-5 h-5 mr-1" / > ,
} ,
{
id : 'decline-4k-request' ,
@ -430,20 +285,7 @@ const RequestButton: React.FC<RequestButtonProps> = ({
action : ( ) = > {
modifyRequest ( active4kRequest , 'decline' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < XIcon className = "w-5 h-5 mr-1" / > ,
}
) ;
}
@ -456,50 +298,24 @@ const RequestButton: React.FC<RequestButtonProps> = ({
) {
buttons . push (
{
id : 'approve- request-batch',
id : 'approve- 4k- request-batch',
text : intl.formatMessage ( messages . approve4krequests , {
requestCount : active4kRequests.length ,
} ) ,
action : ( ) = > {
modifyRequests ( active4kRequests , 'approve' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < CheckIcon className = "w-5 h-5 mr-1" / > ,
} ,
{
id : 'decline- request-batch',
id : 'decline-4k-request-batch' ,
text : intl.formatMessage ( messages . decline4krequests , {
requestCount : active4kRequests.length ,
} ) ,
action : ( ) = > {
modifyRequests ( active4kRequests , 'decline' ) ;
} ,
svg : (
< svg
className = "w-4 mr-1"
fill = "currentColor"
viewBox = "0 0 20 20"
xmlns = "http://www.w3.org/2000/svg"
>
< path
fillRule = "evenodd"
d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule = "evenodd"
/ >
< / svg >
) ,
svg : < XIcon className = "w-5 h-5 mr-1" / > ,
}
) ;
}