-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Refactor file cluster page * Refacto VideoInformationPane * Make video details elements collapsible * Move distance element to common package * Add comparable file component * Implement reusable file summary * Implement match file list * Implement mother file view * Fetch matched files scenes * Setup comparison page routing * Reset video player on file change * Fix matched file header * Improve distance style * Hook up compare button * Fix match duplication * Fix linting issues * Make compare button primary-colored
- Loading branch information
1 parent
f995086
commit c3b80f4
Showing
47 changed files
with
1,481 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
web/src/collection/components/FileComparisonPage/FileComparisonPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
import clsx from "clsx"; | ||
import PropTypes from "prop-types"; | ||
import { makeStyles } from "@material-ui/styles"; | ||
import Grid from "@material-ui/core/Grid"; | ||
import MotherFile from "./MotherFile/MotherFile"; | ||
import MatchFiles from "./MatchFiles/MatchFiles"; | ||
import { useParams } from "react-router-dom"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
paddingTop: theme.dimensions.content.padding * 2, | ||
}, | ||
})); | ||
|
||
function FileComparisonPage(props) { | ||
const { className } = props; | ||
const classes = useStyles(); | ||
const { id: rawId } = useParams(); | ||
const id = Number(rawId); | ||
|
||
return ( | ||
<div className={clsx(classes.root, className)}> | ||
<Grid container spacing={0}> | ||
<Grid item xs={12} lg={6}> | ||
<MotherFile motherFileId={id} /> | ||
</Grid> | ||
<Grid item xs={12} lg={6}> | ||
<MatchFiles motherFileId={id} /> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
); | ||
} | ||
|
||
FileComparisonPage.propTypes = { | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default FileComparisonPage; |
89 changes: 89 additions & 0 deletions
89
web/src/collection/components/FileComparisonPage/FileDetails/FileDescriptionPane.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React, { useCallback, useState } from "react"; | ||
import clsx from "clsx"; | ||
import PropTypes from "prop-types"; | ||
import { makeStyles } from "@material-ui/styles"; | ||
import { FileType } from "../../FileBrowserPage/FileType"; | ||
import Paper from "@material-ui/core/Paper"; | ||
import CollapseButton from "../../../../common/components/CollapseButton"; | ||
import { useIntl } from "react-intl"; | ||
import Collapse from "@material-ui/core/Collapse"; | ||
import VideoInformation from "../../VideoDetailsPage/VideoInformation"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
boxShadow: "0 12px 18px 0 rgba(0,0,0,0.08)", | ||
display: "flex", | ||
flexDirection: "column", | ||
alignItems: "stretch", | ||
}, | ||
header: { | ||
padding: theme.spacing(2), | ||
display: "flex", | ||
alignItems: "center", | ||
}, | ||
title: { | ||
...theme.mixins.title3, | ||
fontWeight: "bold", | ||
flexGrow: 1, | ||
}, | ||
collapseButton: { | ||
flexGrow: 0, | ||
}, | ||
})); | ||
|
||
/** | ||
* Get i18n text. | ||
*/ | ||
function useMessages() { | ||
const intl = useIntl(); | ||
return { | ||
title: intl.formatMessage({ id: "file.details" }), | ||
}; | ||
} | ||
|
||
function FileDescriptionPane(props) { | ||
const { file, onJump, collapsible, className, ...other } = props; | ||
const classes = useStyles(); | ||
const messages = useMessages(); | ||
const [collapsed, setCollapsed] = useState(false); | ||
|
||
const handleCollapse = useCallback(() => setCollapsed(!collapsed), [ | ||
collapsed, | ||
]); | ||
|
||
return ( | ||
<Paper className={clsx(classes.root, className)} {...other}> | ||
<div className={classes.header}> | ||
<div className={classes.title}>{messages.title}</div> | ||
{collapsible && ( | ||
<CollapseButton | ||
collapsed={collapsed} | ||
onClick={handleCollapse} | ||
size="small" | ||
/> | ||
)} | ||
</div> | ||
<Collapse in={!collapsed}> | ||
<VideoInformation file={file} onJump={onJump} /> | ||
</Collapse> | ||
</Paper> | ||
); | ||
} | ||
|
||
FileDescriptionPane.propTypes = { | ||
/** | ||
* Video file | ||
*/ | ||
file: FileType.isRequired, | ||
/** | ||
* Jump to a particular object | ||
*/ | ||
onJump: PropTypes.func, | ||
/** | ||
* Enable or disable pane collapse feature. | ||
*/ | ||
collapsible: PropTypes.bool, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default FileDescriptionPane; |
52 changes: 52 additions & 0 deletions
52
web/src/collection/components/FileComparisonPage/FileDetails/FileDetails.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useCallback, useState } from "react"; | ||
import clsx from "clsx"; | ||
import PropTypes from "prop-types"; | ||
import { makeStyles } from "@material-ui/styles"; | ||
import { FileType } from "../../FileBrowserPage/FileType"; | ||
import VideoPlayerPane from "../../VideoDetailsPage/VideoPlayerPane"; | ||
import { seekTo } from "../../VideoDetailsPage/seekTo"; | ||
import FileDescriptionPane from "./FileDescriptionPane"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
// display: "block", | ||
}, | ||
pane: { | ||
margin: theme.spacing(2), | ||
}, | ||
})); | ||
|
||
function FileDetails(props) { | ||
const { file, className } = props; | ||
const classes = useStyles(); | ||
const [player, setPlayer] = useState(null); | ||
|
||
const handleJump = useCallback(seekTo(player, file), [player, file]); | ||
|
||
return ( | ||
<div className={clsx(classes.root, className)}> | ||
<VideoPlayerPane | ||
collapsible | ||
file={file} | ||
onPlayerReady={setPlayer} | ||
className={classes.pane} | ||
/> | ||
<FileDescriptionPane | ||
collapsible | ||
file={file} | ||
onJump={handleJump} | ||
className={classes.pane} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
FileDetails.propTypes = { | ||
/** | ||
* Video file to be displayed | ||
*/ | ||
file: FileType.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default FileDetails; |
1 change: 1 addition & 0 deletions
1
web/src/collection/components/FileComparisonPage/FileDetails/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./FileDetails"; |
54 changes: 54 additions & 0 deletions
54
web/src/collection/components/FileComparisonPage/LoadingHeader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
import clsx from "clsx"; | ||
import PropTypes from "prop-types"; | ||
import { makeStyles } from "@material-ui/styles"; | ||
import Paper from "@material-ui/core/Paper"; | ||
import Loading from "../../../common/components/Loading"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
boxShadow: "0 12px 18px 0 rgba(0,0,0,0.08)", | ||
minHeight: theme.spacing(12), | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
})); | ||
|
||
function LoadingHeader(props) { | ||
const { error, errorMessage, onRetry, progress, className, ...other } = props; | ||
const classes = useStyles(); | ||
return ( | ||
<Paper className={clsx(classes.root, className)} {...other}> | ||
<Loading | ||
error={error} | ||
errorMessage={errorMessage} | ||
onRetry={onRetry} | ||
progress={progress} | ||
/> | ||
</Paper> | ||
); | ||
} | ||
|
||
LoadingHeader.propTypes = { | ||
/** | ||
* Indicate loading error | ||
*/ | ||
error: PropTypes.bool, | ||
/** | ||
* The value of the progress indicator for the determinate and static variants. | ||
* Value between 0 and 1. | ||
*/ | ||
progress: PropTypes.number, | ||
/** | ||
* Trigger loading of the next portion of files | ||
*/ | ||
onRetry: PropTypes.func.isRequired, | ||
/** | ||
* Message displayed when error=true | ||
*/ | ||
errorMessage: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default LoadingHeader; |
Oops, something went wrong.