console back url (#40)

This commit is contained in:
Arnaud D. Natali 2023-05-10 15:36:45 +02:00 committed by GitHub
commit aca465dd5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -18,6 +18,7 @@ export default abstract class BaseApiService {
} }
protected getBaseUrl() { protected getBaseUrl() {
console.log("BaseApiService.baseUrl", BaseApiService.baseUrl);
return BaseApiService.baseUrl; return BaseApiService.baseUrl;
} }

View File

@ -79,16 +79,35 @@ export default class Modal extends React.Component<IProps, IState> {
willClose: false, willClose: false,
}); });
}, this.props.animationDelay); }, this.props.animationDelay);
document.body.style.overflow = "auto";
} }
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen) { if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen) {
this.setState({ isOpen: true }); this.setState({ isOpen: true });
document.body.style.overflow = "hidden";
} }
this.rootRefElement.current?.style.setProperty("--animation-delay", this.props.animationDelay!.toString().concat("ms")); this.rootRefElement.current?.style.setProperty("--animation-delay", this.props.animationDelay!.toString().concat("ms"));
} }
public override componentDidMount(): void {
document.addEventListener("keydown", this.handleKeyDown);
}
public override componentWillUnmount(): void {
document.body.style.overflow = "auto";
document.removeEventListener("keydown", this.handleKeyDown);
}
protected close() { protected close() {
if (this.props.hasContainerClosable === false) return; if (this.props.hasContainerClosable === false) return;
if (this.state.willClose) return; if (this.state.willClose) return;
this.props.onClose(); this.props.onClose();
} }
private handleKeyDown = (e: KeyboardEvent): void => {
if (e.key === "Escape" || e.key === "Esc" || e.key === "Backspace") {
this.props.onClose();
}
}
} }

View File

@ -138,7 +138,8 @@ export default class UserFolder extends React.Component<IProps, IState> {
private calculateDocumentsPercentageProgress(): number { private calculateDocumentsPercentageProgress(): number {
if (!this.props.customer.documents) return 0; if (!this.props.customer.documents) return 0;
const totalDocuments: number = this.props.customer.documents.length; const documents = this.props.customer.documents.filter((document) => document.folder?.uid === this.props.folder.uid);
const totalDocuments: number = documents.length;
const numberDocumentsRefused: number = this.getDocumentsByStatus(EDocumentStatus.REFUSED)?.length || 0; const numberDocumentsRefused: number = this.getDocumentsByStatus(EDocumentStatus.REFUSED)?.length || 0;
const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0; const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0;
const depositedDocuments: number = totalDocuments - numberDocumentsAsked - numberDocumentsRefused; const depositedDocuments: number = totalDocuments - numberDocumentsAsked - numberDocumentsRefused;