From 40882549f756d40f1dc667822fdf81fe6696557c Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Fri, 26 Feb 2021 22:50:33 +0100 Subject: [PATCH] frontend: Small UI improvements --- frontend/src/pages/TrackEditor.tsx | 6 ++-- .../src/pages/TrackPage/TrackComments.tsx | 5 +-- frontend/src/pages/TrackPage/index.tsx | 2 +- frontend/src/pages/UploadPage.tsx | 35 +++++++------------ 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/frontend/src/pages/TrackEditor.tsx b/frontend/src/pages/TrackEditor.tsx index e361a69..db4dbc9 100644 --- a/frontend/src/pages/TrackEditor.tsx +++ b/frontend/src/pages/TrackEditor.tsx @@ -74,8 +74,8 @@ const TrackEditor = connect((state) => ({login: state.login}))(function TrackEdi - -

Edit track

+ +

Edit {track ? (track.title || 'Unnamed track') : 'track'}

@@ -135,7 +135,7 @@ const TrackEditor = connect((state) => ({login: state.login}))(function TrackEdi
- +

Danger zone

You can remove this track from your account and the portal if you like. However, if at any point you have diff --git a/frontend/src/pages/TrackPage/TrackComments.tsx b/frontend/src/pages/TrackPage/TrackComments.tsx index caac8f2..53e842d 100644 --- a/frontend/src/pages/TrackPage/TrackComments.tsx +++ b/frontend/src/pages/TrackPage/TrackComments.tsx @@ -1,10 +1,9 @@ import React from 'react' -import {Segment, Form, Button, Loader, Header, Comment} from 'semantic-ui-react' +import {Message, Segment, Form, Button, Loader, Header, Comment} from 'semantic-ui-react' import Markdown from 'react-markdown' import {FormattedDate} from 'components' - function CommentForm({onSubmit}) { const [body, setBody] = React.useState('') @@ -60,6 +59,8 @@ export default function TrackComments({comments, onSubmit, onDelete, login, hide ))} + {comments != null && !comments.length && Nobody commented... yet} + {login && comments != null && } diff --git a/frontend/src/pages/TrackPage/index.tsx b/frontend/src/pages/TrackPage/index.tsx index 3393424..6a9df98 100644 --- a/frontend/src/pages/TrackPage/index.tsx +++ b/frontend/src/pages/TrackPage/index.tsx @@ -136,7 +136,7 @@ const TrackPage = connect((state) => ({login: state.login}))(function TrackPage( {track && ( <> -

{track.title}
+
{track.title || 'Unnamed track'}
{isAuthor && } diff --git a/frontend/src/pages/UploadPage.tsx b/frontend/src/pages/UploadPage.tsx index e2f2014..77aab2e 100644 --- a/frontend/src/pages/UploadPage.tsx +++ b/frontend/src/pages/UploadPage.tsx @@ -85,7 +85,7 @@ function FileUploadStatus({ return ( - {progress < 1 ? (progress * 100).toFixed(0) + ' %' : 'Processing...'} + {progress < 1 ? `Uploading ${(progress * 100).toFixed(0)}%` : 'Processing...'} ) } @@ -149,9 +149,8 @@ export default function UploadPage() { Filename Size - Status - - + Status / Title + @@ -164,16 +163,6 @@ export default function UploadPage() { {formatFileSize(size)} - {result ? ( - <> - Uploaded - - ) : ( - - )} - - - {/*
{JSON.stringify(result || null, null, 2)}
*/} {result?.errors ? ( {_.sortBy(Object.entries(result.errors)) @@ -185,17 +174,17 @@ export default function UploadPage() { ))} - ) : null} -
- - {result?.track ? ( + ) : result ? ( <> - -