diff --git a/frontend/cypress/integration/bisq/bisq.spec.ts b/frontend/cypress/integration/bisq/bisq.spec.ts index 0271ca775..3cea27781 100644 --- a/frontend/cypress/integration/bisq/bisq.spec.ts +++ b/frontend/cypress/integration/bisq/bisq.spec.ts @@ -59,9 +59,8 @@ describe('Bisq', () => { cy.visit(`${basePath}`); cy.waitForSkeletonGone(); cy.get('li:nth-of-type(5) > a').click().then(() => { - cy.get('.card').should('have.length.at.least', 1); - cy.get('.card').first().click(); - cy.get('.card-body'); + cy.get('.section-header').should('have.length.at.least', 1); + cy.get('.endpoint-container').should('have.length.at.least', 1); }); }); diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 0b7c072f6..d6adebbf1 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -48,9 +48,10 @@ import { FeesBoxComponent } from './components/fees-box/fees-box.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; import { faFilter, faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, faChartArea, faCogs, faCubes, faDatabase, faExchangeAlt, faInfoCircle, - faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook } from '@fortawesome/free-solid-svg-icons'; + faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt, faBook, faListUl } from '@fortawesome/free-solid-svg-icons'; import { ApiDocsComponent } from './components/docs/api-docs.component'; import { DocsComponent } from './components/docs/docs.component'; +import { ApiDocsNavComponent } from './components/docs/api-docs-nav.component'; import { CodeTemplateComponent } from './components/docs/code-template.component'; import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component'; import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component'; @@ -59,6 +60,7 @@ import { StorageService } from './services/storage.service'; import { HttpCacheInterceptor } from './services/http-cache.interceptor'; import { SponsorComponent } from './components/sponsor/sponsor.component'; import { PushTransactionComponent } from './components/push-transaction/push-transaction.component'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [ @@ -102,6 +104,7 @@ import { PushTransactionComponent } from './components/push-transaction/push-tra SponsorComponent, PushTransactionComponent, DocsComponent, + ApiDocsNavComponent, ], imports: [ BrowserModule.withServerTransition({ appId: 'serverApp' }), @@ -111,6 +114,7 @@ import { PushTransactionComponent } from './components/push-transaction/push-tra BrowserAnimationsModule, InfiniteScrollModule, NgbTypeaheadModule, + NgbModule, FontAwesomeModule, SharedModule, NgxEchartsModule.forRoot({ @@ -161,5 +165,6 @@ export class AppModule { library.addIcons(faAngleRight); library.addIcons(faAngleLeft); library.addIcons(faBook); + library.addIcons(faListUl); } } diff --git a/frontend/src/app/components/docs/api-docs-nav.component.html b/frontend/src/app/components/docs/api-docs-nav.component.html new file mode 100644 index 000000000..a4da93428 --- /dev/null +++ b/frontend/src/app/components/docs/api-docs-nav.component.html @@ -0,0 +1,74 @@ + +

General

+ GET Difficulty Adjustment +
+ + +

Markets

+ GET Market Currencies + GET Market Depth + GET Market HLOC + GET Markets + GET Market Offers + GET Market Ticker + GET Market Trades + GET Market Volumes +
+ + +

General

+ GET Stats +
+ +

Addresses

+GET Address +GET Address Transactions +GET Address Transactions Chain +GET Address Transactions Mempool +GET Address UTXO + + +

Assets

+ GET Assets + GET Asset Transactions + GET Asset Supply +
+ +

Blocks

+GET Block +GET Block Header +GET Block Height +GET Block Raw +GET Block Status +GET Block Tip Height +GET Block Tip Hash +GET Block Transaction ID +GET Block Transaction IDs +GET Block Transactions +GET Blocks + + +

Fees

+ GET Mempool Blocks Fees + GET Recommended Fees +
+ + +

Mempool

+ GET Mempool + GET Mempool Transaction IDs + GET Mempool Recent +
+ +

Transactions

+GET Children Pay for Parent +GET Transaction +GET Transaction Hex +GET Transaction Merkleblock Proof +GET Transaction Merkle Proof +GET Transaction Outspend +GET Transaction Outspends +GET Transaction Raw +GET Transaction Status +GET Transactions +POST Transaction diff --git a/frontend/src/app/components/docs/api-docs-nav.component.scss b/frontend/src/app/components/docs/api-docs-nav.component.scss new file mode 100644 index 000000000..225209275 --- /dev/null +++ b/frontend/src/app/components/docs/api-docs-nav.component.scss @@ -0,0 +1,17 @@ +p { + color: #4a68b9; + font-weight: 700; + margin: 10px 0; + margin: 15px 0 10px 0; +} + +p:first-child { + margin-top: 0 +} + +a { + color: #fff; + text-decoration: none; + display: block; + margin: 5px 0; +} diff --git a/frontend/src/app/components/docs/api-docs-nav.component.ts b/frontend/src/app/components/docs/api-docs-nav.component.ts new file mode 100644 index 000000000..967b355f3 --- /dev/null +++ b/frontend/src/app/components/docs/api-docs-nav.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'app-api-docs-nav', + templateUrl: './api-docs-nav.component.html', + styleUrls: ['./api-docs-nav.component.scss'] +}) +export class ApiDocsNavComponent implements OnInit { + + @Input() network: any; + @Input() collapseItem: any; + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/frontend/src/app/components/docs/api-docs.component.html b/frontend/src/app/components/docs/api-docs.component.html index d683676b5..8358129f5 100644 --- a/frontend/src/app/components/docs/api-docs.component.html +++ b/frontend/src/app/components/docs/api-docs.component.html @@ -3,261 +3,212 @@
-

Reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} API service.

- -
-

General

- - - - - GET Difficulty Adjustment - - -
- -
-
Description
-
Returns details about difficulty adjustment.
-
- -
-
-
- -
+
+
-
-

Markets

- +
- - - GET Market Currencies - - - -
-
Description
-
Provides list of available currencies for a given base currency.
-
- -
-
+

Reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} API service.

- - - GET Market Depth - - -
-
Endpoint
- GET {{ baseNetworkUrl }}/api/depth?market=[:market] +
+ +
+
+
+
-
-
Description
-
Provides list of open offer prices for a single market.
-
- - - +
+
+
- - - GET Market HLOC - - - -
-
Description
-
Provides hi/low/open/close data for a given market. This can be used to generate a candlestick chart.
-
- -
-
+
- - - GET Markets - - - -
-
Description
-
Provides list of available markets.
-
- -
-
+
- - - GET Market Offers - - - -
-
Description
-
Provides list of open offer details for a single market.
-
- -
-
+
+ GET Difficulty Adjustment General + +
+
Description
+
Returns details about difficulty adjustment.
+
+ +
- - - GET Market Ticker - - - -
-
Description
-
Provides 24 hour price ticker for single market or all markets
-
- -
-
+
- - - GET Market Trades - - - -
-
Description
-
Provides list of completed trades for a single market.
-
- -
-
+
- - - GET Market Volumes - - - -
-
Description
-
Provides periodic volume data in terms of base currency for one or all markets.
-
- -
-
+
+ GET Market Currencies Markets + +
+
Description
+
Provides list of available currencies for a given base currency.
+
+ +
- -
+
+ GET Market Depth Markets + +
+
Description
+
Provides list of open offer prices for a single market.
+
+ +
-
-

General

- +
+ GET Market HLOC Markets + +
+
Description
+
Provides hi/low/open/close data for a given market. This can be used to generate a candlestick chart.
+
+ +
- - - GET Stats - - - -
-
Description
-
Returns statistics about all Bisq transactions.
-
- -
-
+
+ GET Markets Markets + +
+
Description
+
Provides list of available markets.
+
+ +
-
-
+
+ GET Market Offers Markets + +
+
Description
+
Provides list of open offer details for a single market.
+
+ +
-
-

Addresses

- +
+ GET Market Ticker Markets + +
+
Description
+
Provides 24 hour price ticker for single market or all markets
+
+ +
- - - GET Address - - - -
-
Description
-
Returns details about an address. Available fields: address, chain_stats, and mempool_stats. {{ '{' }}chain,mempool{{ '}' }}_stats each contain an object with tx_count, funded_txo_count, funded_txo_sum, spent_txo_count, and spent_txo_sum.
-
- -
-
+
+ GET Market Trades Markets + +
+
Description
+
Provides list of completed trades for a single market.
+
+ +
- - - GET Address Transactions - - - -
-
Description
-
Get transaction history for the specified address/scripthash, sorted with newest first. Returns up to 50 mempool transactions plus the first 25 confirmed transactions. You can request more confirmed transactions using :last_seen_txid (see below).
-
- -
-
+
+ GET Market Volumes Markets + +
+
Description
+
Provides periodic volume data in terms of base currency for one or all markets.
+
+ +
- - - GET Address Transactions Chain - - - -
-
Description
-
Get confirmed transaction history for the specified address/scripthash, sorted with newest first. Returns 25 transactions per page. More can be requested by specifying the last txid seen by the previous query.
-
- -
-
+
- - - GET Address Transactions Mempool - - +
+ +
+ GET Stats General + +
+
Description
+
Returns statistics about all Bisq transactions.
+
+ +
+ +
+ +
+ +
+ GET Address Addresses + +
+
Description
+
Returns details about an address. Available fields: address, chain_stats, and mempool_stats. {{ '{' }}chain,mempool{{ '}' }}_stats each contain an object with tx_count, funded_txo_count, funded_txo_sum, spent_txo_count, and spent_txo_sum.
+
+ +
+ +
+ GET Address Transactions Addresses + +
+
Description
+
Get transaction history for the specified address/scripthash, sorted with newest first. Returns up to 50 mempool transactions plus the first 25 confirmed transactions. You can request more confirmed transactions using :last_seen_txid (see below).
+
+ +
+ +
+ GET Address Transactions Chain Addresses + +
+
Description
+
Get confirmed transaction history for the specified address/scripthash, sorted with newest first. Returns 25 transactions per page. More can be requested by specifying the last txid seen by the previous query.
+
+ +
+ +
+ GET Address Transactions Mempool Addresses
Endpoint
GET {{ baseNetworkUrl }}/api/address/:address/txs/mempool @@ -267,588 +218,444 @@
Get unconfirmed transaction history for the specified address/scripthash. Returns up to 50 transactions (no paging).
- - +
- - - GET Address UTXO - - - -
-
Description
-
Get the list of unspent transaction outputs associated with the address/scripthash. Available fields: txid, vout, value, and status (with the status of the funding tx).There is also a valuecommitment field that may appear in place of value, plus the following additional fields: asset/assetcommitment, nonce/noncecommitment, surjection_proof, and range_proof.
-
- -
-
+
+ GET Address UTXO Addresses + +
+
Description
+
Get the list of unspent transaction outputs associated with the address/scripthash. Available fields: txid, vout, value, and status (with the status of the funding tx).There is also a valuecommitment field that may appear in place of value, plus the following additional fields: asset/assetcommitment, nonce/noncecommitment, surjection_proof, and range_proof.
+
+ +
- -
+
-
-

Assets

- +
- - - GET Assets - - - -
-
Description
-
Returns information about a Liquid asset.
-
- -
-
+
+ GET Assets Assets + +
+
Description
+
Returns information about a Liquid asset.
+
+ +
- - - GET Asset Transactions - - - -
-
Description
-
Returns transactions associated with the specified Liquid asset. For the network's native asset, returns a list of peg in, peg out, and burn transactions. For user-issued assets, returns a list of issuance, reissuance, and burn transactions. Does not include regular transactions transferring this asset.
-
- -
-
+
+ GET Asset Transactions Assets + +
+
Description
+
Returns transactions associated with the specified Liquid asset. For the network's native asset, returns a list of peg in, peg out, and burn transactions. For user-issued assets, returns a list of issuance, reissuance, and burn transactions. Does not include regular transactions transferring this asset.
+
+ +
- - - GET Asset Supply - - - -
-
Description
-
Get the current total supply of the specified asset. For the native asset (L-BTC), this is calculated as [chain,mempool]_stats.peg_in_amount - [chain,mempool]_stats.peg_out_amount - [chain,mempool]_stats.burned_amount. For issued assets, this is calculated as [chain,mempool]_stats.issued_amount - [chain,mempool]_stats.burned_amount. Not available for assets with blinded issuances. If /decimal is specified, returns the supply as a decimal according to the asset's divisibility. Otherwise, returned in base units.
-
- -
-
+
+ GET Asset Supply Assets + +
+
Description
+
Get the current total supply of the specified asset. For the native asset (L-BTC), this is calculated as [chain,mempool]_stats.peg_in_amount - [chain,mempool]_stats.peg_out_amount - [chain,mempool]_stats.burned_amount. For issued assets, this is calculated as [chain,mempool]_stats.issued_amount - [chain,mempool]_stats.burned_amount. Not available for assets with blinded issuances. If /decimal is specified, returns the supply as a decimal according to the asset's divisibility. Otherwise, returned in base units.
+
+ +
- -
+
-
-

Blocks

- +
- - - GET Block - - - -
-
Description
-
Returns details about a block. Available fields: id, height, version, timestamp, bits, nonce, merkle_root, tx_count, size, weight, proof, and previousblockhash.
-
- -
-
+
+ GET Block Blocks + +
+
Description
+
Returns details about a block. Available fields: id, height, version, timestamp, bits, nonce, merkle_root, tx_count, size, weight, proof, and previousblockhash.
+
+ +
- - - GET Block Header - - - -
-
Description
-
Returns the hex-encoded block header.
-
- -
-
+
+ GET Block Header Blocks + +
+
Description
+
Returns the hex-encoded block header.
+
+ +
- - - GET Block Height - - - -
-
Description
-
Returns the hash of the block currently at :height.
-
- -
-
+
+ GET Block Height Blocks + +
+
Description
+
Returns the hash of the block currently at :height.
+
+ +
- - - GET Block Raw - - - -
-
Description
-
Returns the raw block representation in binary.
-
- -
-
+
+ GET Block Raw Blocks + +
+
Description
+
Returns the raw block representation in binary.
+
+ +
- - - GET Block Status - - -
Get Block Status
- -
-
Description
-
Returns the confirmation status of a block. Available fields: in_best_chain (boolean, false for orphaned blocks), next_best (the hash of the next block, only available for blocks in the best chain).
-
- -
-
+
+ GET Block Status Blocks + +
+
Description
+
Returns the confirmation status of a block. Available fields: in_best_chain (boolean, false for orphaned blocks), next_best (the hash of the next block, only available for blocks in the best chain).
+
+ +
- - - GET Block Tip Height - - - -
-
Description
-
Returns the height of the last block.
-
- -
-
+
+ GET Block Tip Height Blocks + +
+
Description
+
Returns the height of the last block.
+
+ +
- - - GET Block Tip Hash - - - -
-
Description
-
Returns the hash of the last block.
-
- -
-
+
+ GET Block Tip Hash Blocks + +
+
Description
+
Returns the hash of the last block.
+
+ +
- - - GET Block Transaction ID - - - -
-
Description
-
Returns the transaction at index :index within the specified block.
-
- -
-
+
+ GET Block Transaction ID Blocks + +
+
Description
+
Returns the transaction at index :index within the specified block.
+
+ +
- - - GET Block Transaction IDs - - - -
-
Description
-
Returns a list of all txids in the block.
-
- -
-
+
+ GET Block Transaction IDs Blocks + +
+
Description
+
Returns a list of all txids in the block.
+
+ +
- - - GET Block Transactions - - - -
-
Description
-
Returns a list of transactions in the block (up to 25 transactions beginning at start_index). Transactions returned here do not have the status field, since all the transactions share the same block and confirmation status.
-
- -
-
+
+ GET Block Transactions Blocks + +
+
Description
+
Returns a list of transactions in the block (up to 25 transactions beginning at start_index). Transactions returned here do not have the status field, since all the transactions share the same block and confirmation status.
+
+ +
- - - GET Blocks - - - -
-
Description
-
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
-
- -
-
+
+ GET Blocks Blocks + +
+
Description
+
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
+
+ +
- - - GET Blocks - - - -
-
Description
-
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
-
- -
-
+
+ GET Blocks Blocks + +
+
Description
+
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
+
+ +
- -
+
-
-

Fees

- +
- - - GET Mempool Blocks Fees - - - -
-
Description
-
Returns current mempool as projected blocks.
-
- -
-
+
+ GET Mempool Blocks Fees Fees + +
+
Description
+
Returns current mempool as projected blocks.
+
+ +
- - - GET Recommended Fees - - - -
-
Description
-
Returns our currently suggested fees for new transactions.
-
- -
-
+ - -
+
-
-

Mempool

- +
- - - GET Mempool - - - -
-
Description
-
Returns current mempool backlog statistics.
-
- -
-
+
+ GET Mempool Fees + +
+
Description
+
Returns current mempool backlog statistics.
+
+ +
- - - GET Mempool Transactions IDs - - - -
-
Description
-
Get the full list of txids in the mempool as an array. The order of the txids is arbitrary and does not match bitcoind.
-
- -
-
+
+ GET Mempool Transactions IDs Fees + +
+
Description
+
Get the full list of txids in the mempool as an array. The order of the txids is arbitrary and does not match bitcoind.
+
+ +
- - - GET Mempool Recent - - - -
-
Description
-
Get a list of the last 10 transactions to enter the mempool. Each transaction object contains simplified overview data, with the following fields: txid, fee, vsize, and value.
-
- -
-
+
+ GET Mempool Recent Fees + +
+
Description
+
Get a list of the last 10 transactions to enter the mempool. Each transaction object contains simplified overview data, with the following fields: txid, fee, vsize, and value.
+
+ +
- -
+
-
-

Transactions

- +
- - - GET Children Pay for Parent - - - -
-
Description
-
Returns the ancestors and the best descendant fees for a transaction.
-
- -
-
+
+ GET Children Pay for Parent Transactions + +
+
Description
+
Returns the ancestors and the best descendant fees for a transaction.
+
+ +
- - - GET Transaction - - - -
-
Description
-
Returns details about a transaction. Available fields: txid, version, locktime, size, weight, fee, vin, vout, and status.
-
- -
-
+
+ GET Transaction Transactions + +
+
Description
+
Returns details about a transaction. Available fields: txid, version, locktime, size, weight, fee, vin, vout, and status.
+
+ +
- - - GET Transaction Hex - - - -
-
Description
-
Returns a transaction serialized as hex.
+
+ GET Transaction Hex Transactions + - - - +
+
Description
+
Returns a transaction serialized as hex.
+
+ +
- - - GET Transaction Merkleblock Proof - - - -
-
Description
-
Returns a merkle inclusion proof for the transaction using bitcoind's merkleblock format.
-
- -
-
+
+ GET Transaction Merkleblock Proof Transactions + +
+
Description
+
Returns a merkle inclusion proof for the transaction using bitcoind's merkleblock format.
+
+ +
- - - GET Transaction Merkle Proof - - - -
-
Description
-
Returns a merkle inclusion proof for the transaction using Electrum's blockchain.transaction.get_merkle format.
-
- -
-
+
+ GET Transaction Merkle Proof Transactions + +
+
Description
+
Returns a merkle inclusion proof for the transaction using Electrum's blockchain.transaction.get_merkle format.
+
+ +
- - - GET Transaction Outspend - - - -
-
Description
-
Returns the spending status of a transaction output. Available fields: spent (boolean), txid (optional), vin (optional), and status (optional, the status of the spending tx).
-
- -
-
+
+ GET Transaction Outspend Transactions + +
+
Description
+
Returns the spending status of a transaction output. Available fields: spent (boolean), txid (optional), vin (optional), and status (optional, the status of the spending tx).
+
+ +
- - - GET Transaction Outspends - - - -
-
Description
-
Returns the spending status of all transaction outputs.
-
- -
-
+
+ GET Transaction Outspends Transactions + +
+
Description
+
Returns the spending status of all transaction outputs.
+
+ +
- - - GET Transaction Raw - - - -
-
Description
-
Returns a transaction as binary data.
-
- -
-
+
+ GET Transaction Raw Transactions + +
+
Description
+
Returns a transaction as binary data.
+
+ +
- - - GET Transaction Status - - - -
-
Description
-
Returns the confirmation status of a transaction. Available fields: confirmed (boolean), block_height (optional), and block_hash (optional).
-
- -
-
+
+ GET Transaction Status Transactions + +
+
Description
+
Returns the confirmation status of a transaction. Available fields: confirmed (boolean), block_height (optional), and block_hash (optional).
+
+ +
- - - GET Transactions - - -
Get Mempool Txids
- -
-
Description
-
Returns :length of latest Bisq transactions, starting from :index.
-
- -
-
+
+ GET Transactions Transactions + +
+
Description
+
Returns :length of latest Bisq transactions, starting from :index.
+
+ +
- - - POST Transaction - - -
-
Endpoint
-
POST /api/tx
-
-
-
Description
-
Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The txid will be returned on success.
-
- -
-
+
+ POST Transaction Transactions +
+
Endpoint
+
POST /api/tx
+
+
+
Description
+
Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The txid will be returned on success.
+
+ +
- +
@@ -868,13 +675,5 @@
-
- - -
diff --git a/frontend/src/app/components/docs/api-docs.component.scss b/frontend/src/app/components/docs/api-docs.component.scss index e9d2cf52e..d03608e92 100644 --- a/frontend/src/app/components/docs/api-docs.component.scss +++ b/frontend/src/app/components/docs/api-docs.component.scss @@ -22,6 +22,10 @@ li.nav-item { } } +.no-bottom-space { + margin-bottom: 0; +} + .nav-tabs .nav-link.active { border-bottom: 1px solid #fff; @media (min-width: 676px){ @@ -72,10 +76,131 @@ li.nav-item { padding: 15px; } -#restAPI .api-category { - margin: 30px 0; +#doc-nav-desktop { + width: 300px; } -.api-category h4 { - margin-bottom: 15px; +#doc-nav-desktop.relative { + float: left; + overflow: hidden; +} + +#doc-nav-desktop.fixed { + float: unset; + position: fixed; + top: 20px; + overflow-y: auto; + height: calc(100vh - 50px); + scrollbar-color: #2d3348 #11131f; + scrollbar-width: thin; +} +::-webkit-scrollbar { + width: 3px; +} +::-webkit-scrollbar-track { + background: #11131f; +} +::-webkit-scrollbar-thumb { + background-color: #2d3348; + border-radius: 5px; + border: none; +} + +.doc-content { + width: calc(100% - 330px); + float: right; +} + +.endpoint-container:before { + display: block; + content: " "; + height: 1px; + margin-top: -1px; + visibility: hidden; +} + +.endpoint-container .section-header { + display: block; + background-color: #2d3348; + color: #1bd8f4; + padding: 1rem 1.3rem 1rem 1.3rem; + font-weight: bold; + border-radius: 0.25rem; + margin: 20px 0 20px 0; + font-size: 24px; + position: relative; +} +.endpoint-container .section-header:hover { + text-decoration: none; +} + +.endpoint-container .section-header span { + color: #fff; + background-color: #653b9c; + font-size: 12px; + text-transform: uppercase; + font-weight: 400; + padding: 8px 10px; + letter-spacing: 1px; + border-radius: 0.25rem; + font-family: monospace; + float: right; +} + +#doc-nav-mobile { + position: fixed; + top: 20px; + width: calc(100% - 60px); + z-index: 100; +} + +#doc-nav-mobile > div { + background-color: #2d3348; + z-index: 100; + border-radius: 0 0 0.5rem 0.5rem; + height: 55vh; + overflow-y: auto; +} + +#doc-nav-mobile button { + width: 100%; + background-color: #105fb0; + color: #fff; + border-color: #105fb0; + border-radius: 0.5rem 0.5rem 0 0; +} + +@media (max-width: 992px) { + + .hide-on-mobile { + display: none; + } + + .doc-content { + width: 100%; + } + + .endpoint-container .section-header { + margin: 40px 0 70px 0; + } + + .endpoint-container .section-header span { + float: none; + position: absolute; + top: unset; + left: 0; + bottom: -50px; + } + + .endpoint-container:before { + height: 30px; + margin-top: -12px; + } + +} + +@media (min-width: 992px) { + .hide-on-desktop { + 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 a38ded836..bbc8cad76 100644 --- a/frontend/src/app/components/docs/api-docs.component.ts +++ b/frontend/src/app/components/docs/api-docs.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core'; import { Env, StateService } from 'src/app/services/state.service'; import { Observable, merge, of } from 'rxjs'; import { SeoService } from 'src/app/services/seo.service'; @@ -17,12 +17,26 @@ export class ApiDocsComponent implements OnInit { code: any; baseNetworkUrl = ''; @Input() restTabActivated: Boolean; + @ViewChild( "mobileFixedApiNav", { static: false } ) mobileFixedApiNav: ElementRef; + desktopDocsNavPosition = "relative"; + showFloatingDocsNav = false; + mobileMenuOpen = true; constructor( private stateService: StateService, private seoService: SeoService, ) { } + ngAfterViewInit() { + const that = this; + setTimeout( () => { + window.addEventListener('scroll', function() { + that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; + that.showFloatingDocsNav = ( window.pageYOffset > ( that.mobileFixedApiNav.nativeElement.offsetHeight + 188 ) ) ? true : false; + }); + }, 1 ); + } + ngOnInit(): void { this.env = this.stateService.env; this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`); diff --git a/frontend/src/app/components/docs/docs.component.html b/frontend/src/app/components/docs/docs.component.html index f67ed8e32..8dc4a9e72 100644 --- a/frontend/src/app/components/docs/docs.component.html +++ b/frontend/src/app/components/docs/docs.component.html @@ -27,5 +27,13 @@
+
+ + +
diff --git a/frontend/src/app/components/docs/docs.component.scss b/frontend/src/app/components/docs/docs.component.scss index 404782585..6398c5602 100644 --- a/frontend/src/app/components/docs/docs.component.scss +++ b/frontend/src/app/components/docs/docs.component.scss @@ -1,4 +1,9 @@ #main-tab-content { text-align: left; padding-top: 10px; + scroll-behavior: smooth; +} + +#footer { + clear: both; }