From 5a58ce0ab3d9965189c32f9bf9cf9f53600df6f7 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Mon, 14 Mar 2022 14:33:41 -0400 Subject: [PATCH] Fix loose ends Add space above footer, add better delay for height adjustment, and add conditions to prevent errors for websocket endpoint and no endpoint. --- frontend/src/app/components/docs/api-docs.component.scss | 8 ++++---- frontend/src/app/components/docs/api-docs.component.ts | 6 +++--- .../src/app/components/docs/code-template.component.ts | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/components/docs/api-docs.component.scss b/frontend/src/app/components/docs/api-docs.component.scss index de9374969..cb3770622 100644 --- a/frontend/src/app/components/docs/api-docs.component.scss +++ b/frontend/src/app/components/docs/api-docs.component.scss @@ -188,15 +188,16 @@ h3 { .doc-content { width: 100%; margin-top: -20px; + float: unset; } - + .endpoint-container { position: relative; overflow: hidden; height: auto; transition: 0.5s height ease; } - + .endpoint-container .section-header { margin: 0; font-size: 18px; @@ -226,9 +227,8 @@ h3 { .hide-on-desktop { display: none; } - + h3 { display: none; } - } diff --git a/frontend/src/app/components/docs/api-docs.component.ts b/frontend/src/app/components/docs/api-docs.component.ts index 42ea7f80c..5e2300fed 100644 --- a/frontend/src/app/components/docs/api-docs.component.ts +++ b/frontend/src/app/components/docs/api-docs.component.ts @@ -77,9 +77,9 @@ export class ApiDocsComponent implements OnInit { } this.openEndpointContainer( targetId ); } - + openEndpointContainer( targetId ) { - if( window.innerWidth <= 992 ) { + if( ( window.innerWidth <= 992 ) && this.restTabActivated && targetId ) { const endpointContainerEl = document.querySelector( "#" + targetId ); const endpointContentEl = document.querySelector( "#" + targetId + " .endpoint-content" ); const endPointContentElHeight = endpointContentEl.clientHeight; @@ -95,7 +95,7 @@ export class ApiDocsComponent implements OnInit { endpointContentEl.style.opacity = "1"; endpointContentEl.classList.add( "open" ); } - } + } } wrapUrl(network: string, code: any, websocket: boolean = false) { diff --git a/frontend/src/app/components/docs/code-template.component.ts b/frontend/src/app/components/docs/code-template.component.ts index d19124dec..cc7b8254e 100644 --- a/frontend/src/app/components/docs/code-template.component.ts +++ b/frontend/src/app/components/docs/code-template.component.ts @@ -21,15 +21,15 @@ export class CodeTemplateComponent implements OnInit { ngOnInit(): void { this.env = this.stateService.env; } - + adjustContainerHeight( event ) { - if( window.innerWidth <= 992 ) { + if( ( window.innerWidth <= 992 ) && ( this.method !== "websocket" ) ) { const urlObj = new URL( window.location + "" ); const endpointContainerEl = document.querySelector( urlObj.hash ); const endpointContentEl = document.querySelector( urlObj.hash + " .endpoint-content" ); window.setTimeout( function() { endpointContainerEl.style.height = endpointContentEl.clientHeight + 90 + "px"; - }, 400); + }, 550); } }