Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Display uploaded file name in the document title (#244) (#326)
Vadym06d4d946d919
diff --git a/src/components/compress/index.tsx b/src/components/compress/index.tsxindex 89912bb4..acd7d392 100644--- a/src/components/compress/index.tsx+++ b/src/components/compress/index.tsx@@ -162,6 +162,8 @@ const resultTitles = ['Top', 'Bottom'];const buttonPositions =['download-left', 'download-right'] as ('download-left' | 'download-right')[];+const originalDocumentTitle = document.title;+export default class Compress extends Component<Props, State> {widthQuery = window.matchMedia('(max-width: 599px)');@@ -226,12 +228,22 @@ export default class Compress extends Component<Props, State> {});}+ private updateDocumentTitle(filename: string = '') {+ const newTitle: string = filename ? `${filename} - ${originalDocumentTitle}` : originalDocumentTitle;++ document.title = newTitle;+ }+componentWillReceiveProps(nextProps: Props): void {if (nextProps.file !== this.props.file) {this.updateFile(nextProps.file);}}+ componentWillUnmount(): void {+ this.updateDocumentTitle();+ }+componentDidUpdate(prevProps: Props, prevState: State): void {const { source, images } = this.state;@@ -328,6 +340,7 @@ export default class Compress extends Component<Props, State> {});}+ this.updateDocumentTitle(file.name);this.setState(newState);} catch (err) {if (err.name === 'AbortError') return;