diff --git a/package-lock.json b/package-lock.json
index 9fb4766..7b3cdf2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bbc/digital-paper-edit-storybook",
- "version": "1.6.0",
+ "version": "1.7.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 5887957..b878f36 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@bbc/digital-paper-edit-storybook",
- "version": "1.6.0",
+ "version": "1.7.0",
"description": "",
"main": "index.js",
"scripts": {
diff --git a/src/ItemsContainer/stories/index.stories.js b/src/ItemsContainer/stories/index.stories.js
index 6aaffee..1f0ff6d 100644
--- a/src/ItemsContainer/stories/index.stories.js
+++ b/src/ItemsContainer/stories/index.stories.js
@@ -15,7 +15,7 @@ storiesOf('ItemsContainer - Demo only (not published on NPM)', module)
return (
diff --git a/src/TranscriptCard/index.js b/src/TranscriptCard/index.js
index 5e38872..e052813 100644
--- a/src/TranscriptCard/index.js
+++ b/src/TranscriptCard/index.js
@@ -10,6 +10,7 @@ import { LinkContainer } from 'react-router-bootstrap';
import ProgressBar from '../ProgressBar';
import Spinner from 'react-bootstrap/Spinner';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+
import {
faTrash,
faCheck,
@@ -18,75 +19,8 @@ import {
} from '@fortawesome/free-solid-svg-icons';
const TranscriptCard = props => {
- const statusSwitch = status => {
- switch (status) {
- case 'error':
- return {
- variant: 'danger',
- icon: ,
- message: props.message,
- text: 'Error',
- title: props.title,
- border: 'danger'
- };
- case 'in-progress':
- return {
- variant: 'info',
- text: 'In progress',
- icon: (
-
- ),
- title: props.title,
- border: 'info'
- };
- case 'uploading':
- return {
- variant: 'info',
- text: 'In progress',
- icon: ,
- title: props.title,
- border: 'info',
- message:
- 'Do not move away from or refresh this page until upload is complete!'
- };
- case 'done':
- return {
- variant: 'success',
- text: 'Done',
- icon: ,
- // border: "secondary",
- title: props.title
- // url: `${props.url}`
- // title: {props.title}
- };
- default:
- return {
- variant: 'info',
- text: '',
- icon: (
-
- ),
- title: props.title,
- // border: "info"
- };
- }
- };
- // const [progress, setProgress] = useState(0)
-
- const handleDeleteClick = () => {
+ const handleDelete = () => {
const confirmDeleteText = 'Are you sure you want to delete?';
const cancelDeleteText = 'Cancelled delete';
@@ -101,98 +35,261 @@ const TranscriptCard = props => {
}
};
- const handleEditClick = () => {
+ const handleEdit = () => {
props.handleEditItem(props.id);
};
- const setDescription = () => {
- let Message;
-
- if (statusConfig.message) {
- Message = (
-
- {statusConfig.icon} {statusConfig.message}
- {props.status === 'uploading' ? (
-
- ) : null}
-
- );
- }
+ const ErrorCard = () => {
+ return (
+
+
+
+
+
+ {props.title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {props.description}
+
+
+
+
+
+
+ {props.message}
+
+ Error
+
+
+
+
+ );
+ };
+ const InProgressCard = () => {
return (
- <>
- {Message ? Message : null}
- {statusConfig.text}
- >
+
+
+
+
+
+ {props.title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {props.description}
+
+
+
+
+
+ In progress
+
+
+
+
);
};
- const statusConfig = statusSwitch(props.status);
- let TranscriptCardTitle;
- if (props.status === 'done') {
- TranscriptCardTitle = (
-
-
-
- {props.icon ? props.icon : ''} {statusConfig.title}
-
-
+ const UploadingCard = () => {
+ return (
+
+
+
+
+
+ {props.icon ? props.icon : ''} {props.title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {props.description}
+
+
+
+
+
+
+ Do not move away from or refresh this page until upload is complete!
+
+
+ In progress
+
+
+
+
);
- } else {
- TranscriptCardTitle = (
-
-
- {props.icon ? props.icon : ''} {statusConfig.title}
-
-
+ };
+
+ const DoneCard = () => {
+ return (
+
+
+
+
+
+
+ {props.title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {props.description}
+
+
+
+
+
+ Done
+
+
+
+
);
+ };
+
+ let card;
+
+ if (props.status === 'done') {
+ card = DoneCard();
+ } else if (props.status === 'in-progress') {
+ card = InProgressCard();
+ } else if (props.status === 'error') {
+ card = ErrorCard();
+ } else if (props.status === 'uploading') {
+ card = UploadingCard();
}
return (
-
-
-
- {TranscriptCardTitle}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {props.description}
-
-
-
-
- {setDescription()}
-
-
-
+ <>
+ {card}
+ >
);
};