Skip to content

Commit

Permalink
Hotfix/ux review after uat (#174)
Browse files Browse the repository at this point in the history
* removed colour settings menu as requested from ux.

* first and last times are not getting out of bounds

* zoom control resets x as well

* Default placeholders disappear when you click in the editable fields

* removed delete button as per requested in the UX review

* invalid current time labels removed as UX requested
  • Loading branch information
4d4mm authored Oct 23, 2018
1 parent 7e3ac2d commit 5b49888
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { getProjectSettings } from '../../utils/iiifSaver';

const createNewManifest = (manifestDomain, audioUri, duration) => ({
label: {
en: ['Unnamed manifest'],
en: [''],
},
summary: {
en: ['Description of manifest'],
en: [''],
},
type: 'Manifest',
id: `${manifestDomain}/manifest`,
Expand Down Expand Up @@ -45,7 +45,7 @@ const createNewManifest = (manifestDomain, audioUri, duration) => ({
{
id: `${manifestDomain}/range/r0`,
type: 'Range',
label: { en: ['Unnamed range'] },
label: { en: [''] },
items: [
{
id: `${manifestDomain}/canvas/c1#t=0,${duration}`,
Expand Down
4 changes: 2 additions & 2 deletions src/components/CurrentTimeIndicator/CurrentTimeIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CurrentTimeIndicator extends Component {
validateProps(props) {
if (props.currentTime > props.runtime) {
return this.setState({
error: 'Invalid time',
currentFormattedTime: formatDate(new Date(0), 'hh:mm:ss'),
});
}

Expand Down Expand Up @@ -73,7 +73,7 @@ class CurrentTimeIndicator extends Component {
const date = new Date(time);
if (date.toString() === 'Invalid Date') {
return this.setState({
error: 'Invalid current time',
currentFormattedTime: formatDate(new Date(0), 'hh:mm:ss'),
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/MetadataDisplay/MetadataDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const MetadataDisplay = props => (
>
<Grid item>
<Typography variant="title" component="h3">
{props.label}
{props.label || 'Unnamed range'}
</Typography>
</Grid>
<Grid>
Expand All @@ -44,7 +44,7 @@ const MetadataDisplay = props => (
whiteSpace: 'pre-line',
}}
>
{props.summary}
{props.summary || 'Range description'}
</Typography>
</CardContent>
</Card>
Expand Down
10 changes: 5 additions & 5 deletions src/components/MetadataEditor/MetadataEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MetadataEditor extends Component {

static defaultProps = {
isNew: true,
label: 'Unnamed Range',
label: '',
summary: '',
colour: 0,
};
Expand Down Expand Up @@ -110,7 +110,7 @@ class MetadataEditor extends Component {
InputLabelProps={{
shrink: true,
}}
placeholder="Placeholder"
placeholder="Unnamed range"
fullWidth
margin="normal"
value={label}
Expand All @@ -123,7 +123,7 @@ class MetadataEditor extends Component {
InputLabelProps={{
shrink: true,
}}
placeholder="Placeholder"
placeholder="Range description"
fullWidth
multiline={true}
margin="normal"
Expand Down Expand Up @@ -176,9 +176,9 @@ class MetadataEditor extends Component {
flex: 1,
}}
>
<Button disabled={!onDelete} onClick={onDelete}>
{/* <Button disabled={!onDelete} onClick={onDelete}>
<Delete /> Delete
</Button>
</Button> */}
<Button onClick={onCancel}>Cancel</Button>
<PrimaryButton disabled={!this.props.onSave} onClick={this.onSave}>
Save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ProjectMetadataDisplay = props => (
>
<Grid item xs={10}>
<Typography variant="title" component="h3">
{props.manifestLabel}
{props.manifestLabel || 'Unnamed manifest'}
</Typography>
</Grid>
<Grid item xs={2}>
Expand All @@ -29,7 +29,7 @@ const ProjectMetadataDisplay = props => (
whiteSpace: 'pre-line',
}}
>
{props.manifestSummary}
{props.manifestSummary || 'Description of manifest'}
</Typography>
<hr />
<Typography variant="body1" component="p">
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProjectMetadataEditor/ProjectMetadataEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ProjectMetadataEditor extends Component {
InputLabelProps={{
shrink: true,
}}
placeholder="Placeholder"
placeholder="Unnamed manifest"
fullWidth
margin="normal"
value={manifestLabel}
Expand All @@ -68,7 +68,7 @@ class ProjectMetadataEditor extends Component {
InputLabelProps={{
shrink: true,
}}
placeholder="Placeholder"
placeholder="Description of manifest"
fullWidth
multiline={true}
margin="normal"
Expand Down
4 changes: 2 additions & 2 deletions src/components/SettingsPopoup/SettingsPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ export default class SettingsPopup extends React.Component {
</FormGroup>
</FormControl>
</Grid>
<Grid item>
{/* TODO: phase 2... <Grid item>
<FormControl component="fieldset">
<FormLabel component="legend">
Bubble Level Colours
</FormLabel>
<FormGroup>TODO: Colour theme editor</FormGroup>
</FormControl>
</Grid>
</Grid> */}
<Grid item>
<FormControl component="fieldset">
<FormLabel component="legend">Audio Settings</FormLabel>
Expand Down
12 changes: 11 additions & 1 deletion src/components/TimelineScrubber/TimelineScrubber.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ class TimelineScrubber extends Component {
x={this.timeToPercent(timePoint)}
>
{timePoint === timePoints[selectedPoint] || showTimes ? (
<span className="timeline-marker__tooltip">
<span
className="timeline-marker__tooltip"
style={{
transform:
timePointIndex === 0
? 'translate(0)'
: timePointIndex === timePoints.length - 1
? 'translate(-100%)'
: 'translate(-50%)',
}}
>
{this.timeToLabel(timePoint)}
</span>
) : (
Expand Down
2 changes: 2 additions & 0 deletions src/constants/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export const RANGE = {
DEPTH: 'depth',
IS_SELECTED: 'isSelected',
};

export const DEFAULT_COLOURS = [
'#A63993',
'#7D3DB0',
'#3E3D99',
'#417AB0',
'#40A6A2',
];

export const DEFAULT_RANGES_STATE = {
'id-0': {
id: 'id-0',
Expand Down
37 changes: 29 additions & 8 deletions src/containers/BubbleEditor/BubbleEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {

import { RANGE } from '../../constants/range';
import { PROJECT } from '../../constants/project';
import { VIEWSTATE } from '../../constants/viewState';
import { selectRange, splitRangeAt, movePoint } from '../../actions/range';

const isOSX = navigator.userAgent.indexOf('Mac OS X') !== -1;
Expand All @@ -34,7 +35,7 @@ class BubbleEditor extends React.Component {
startX: 0,
deltaX: 0,
viewportX: 0,
viewportStartX: 0,
viewportStartX: -1,
};
}

Expand Down Expand Up @@ -164,25 +165,44 @@ class BubbleEditor extends React.Component {
panEnd = ev => {
document.body.removeEventListener('mousemove', this.panMove);
document.body.removeEventListener('mouseup', this.panEnd);
if (this.state.viewportStartX !== -1) {
this.props.panToPosition(this.state.viewportX);
}
this.setState({
selectedPoint: -1,
viewportStartX: 0,
viewportStartX: -1,
});
};

componentWillReceiveProps(nextProps) {
if (nextProps.x !== this.props.x) {
this.setState({
viewportX: nextProps.x,
viewportStartX: -1,
});
}
}

render() {
const _points = this.props.points;
const {
runTime,
currentTime,
zoom,
x,
onUpdateTime,
splitRange,
bubbleHeight,
bubbleStyle,
blackAndWhiteMode,
} = this.props;
const { dimensions, selectedPoint, deltaX, viewportX } = this.state;
const {
dimensions,
selectedPoint,
deltaX,
viewportX,
viewportStartX,
} = this.state;

const timePoints = this.getTimePoints();

Expand Down Expand Up @@ -231,7 +251,7 @@ class BubbleEditor extends React.Component {
points={_points}
width={this.state.dimensions.width}
height={200}
x={viewportX}
x={viewportStartX !== -1 ? viewportX : x}
zoom={zoom}
bubbleHeight={bubbleHeight}
shape={bubbleStyle}
Expand All @@ -257,7 +277,7 @@ class BubbleEditor extends React.Component {
runTime={runTime}
currentTime={currentTime}
zoom={zoom}
x={viewportX}
x={viewportStartX !== -1 ? viewportX : x}
width={this.state.dimensions.width}
timePoints={timePoints}
onUpdateTime={onUpdateTime}
Expand All @@ -281,10 +301,11 @@ class BubbleEditor extends React.Component {
}

const mapStateProps = state => ({
currentTime: state.viewState.currentTime,
runTime: state.viewState.runTime,
currentTime: state.viewState[VIEWSTATE.CURRENT_TIME],
runTime: state.viewState[VIEWSTATE.RUNTIME],
points: state.range,
zoom: state.viewState.zoom,
zoom: state.viewState[VIEWSTATE.ZOOM],
x: state.viewState[VIEWSTATE.X],
bubbleHeight: state.project[PROJECT.BUBBLE_HEIGHT],
bubbleStyle: state.project[PROJECT.BUBBLE_STYLE],
showTimes: state.project[PROJECT.SHOW_TIMES],
Expand Down
3 changes: 3 additions & 0 deletions src/reducers/viewState.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ const viewState = (state = DEFAULT_VIEWSTATE_STATE, action) => {
[VIEWSTATE.ZOOM]: {
$set: 1.0,
},
[VIEWSTATE.X]: {
$set: 0.0,
},
});
case PAN_TO_POSITION:
return update(state, {
Expand Down

0 comments on commit 5b49888

Please sign in to comment.