From 47fb0fe6afec6029d96505d17d474bcc2217d65a Mon Sep 17 00:00:00 2001 From: TeeVeeEss Date: Wed, 13 Sep 2023 20:27:18 +0200 Subject: [PATCH 1/5] Update using_docker.md HTTP section --- .../hornet/2.0.0-rc.6/docs/how_tos/using_docker.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md b/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md index 1bfae53221f..82e9d8f5c28 100644 --- a/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md +++ b/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md @@ -104,6 +104,16 @@ If you want to change the port to a different value you can create a file named ``` HTTP_PORT=9000 ``` +If you don't have a dns name for your node, you can use the (external) ip address for NODE_HOST, for example 192.168.1.123 or your public ip address. +With this setting you can reach the dashboard of the node from within your network or from internet. +COMPOSE_FILE and ACME_EMAIL are not needed for HTTP. You can remove them from your `.env` file or place a `#` before it to make it a remark: + +``` +#COMPOSE_FILE=docker-compose.yml:docker-compose-https.yml +#ACME_EMAIL=your-email@example.com + +NODE_HOST=your-external-ip-address +``` ### 2. Setup neighbors From a13310b10b2a9c205fe3e6cbc457bbd1a353e126 Mon Sep 17 00:00:00 2001 From: TeeVeeEss Date: Wed, 13 Sep 2023 20:50:45 +0200 Subject: [PATCH 2/5] Update docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md Co-authored-by: Lucas Tortora <85233773+lucas-tortora@users.noreply.github.com> --- .../maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md b/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md index 82e9d8f5c28..3bf472d0787 100644 --- a/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md +++ b/docs/maintain/hornet/2.0.0-rc.6/docs/how_tos/using_docker.md @@ -104,9 +104,9 @@ If you want to change the port to a different value you can create a file named ``` HTTP_PORT=9000 ``` -If you don't have a dns name for your node, you can use the (external) ip address for NODE_HOST, for example 192.168.1.123 or your public ip address. -With this setting you can reach the dashboard of the node from within your network or from internet. -COMPOSE_FILE and ACME_EMAIL are not needed for HTTP. You can remove them from your `.env` file or place a `#` before it to make it a remark: +If you don't have a DNS name for your node, you can use the (external) IP address for `NODE_HOST`, for example, `192.168.1.123`, or your public IP address. +With this setting, you can reach the node dashboard from within your network or the internet. +You don’t need `COMPOSE_FILE` and `ACME_EMAIL` for HTTP. You can remove them from your `.env` file or place a `#` before it to make it a remark: ``` #COMPOSE_FILE=docker-compose.yml:docker-compose-https.yml From 21fe18df2dad0c83c89b03cd747d705a7c3c1b5a Mon Sep 17 00:00:00 2001 From: Lucas Tortora Date: Thu, 14 Sep 2023 06:23:39 -0300 Subject: [PATCH 3/5] changed static codeblocks for imports --- .../1.0.0/docs/getting-started/nodejs.mdx | 42 ++----------- .../1.0.0/docs/getting-started/python.mdx | 32 ++-------- .../1.0.0/docs/getting-started/rust.mdx | 60 ++----------------- .../1.0.0/docs/getting-started/wasm.mdx | 42 ++----------- 4 files changed, 16 insertions(+), 160 deletions(-) diff --git a/docs/build/iota-sdk/1.0.0/docs/getting-started/nodejs.mdx b/docs/build/iota-sdk/1.0.0/docs/getting-started/nodejs.mdx index 6fd6a711f8b..84f30438c6c 100644 --- a/docs/build/iota-sdk/1.0.0/docs/getting-started/nodejs.mdx +++ b/docs/build/iota-sdk/1.0.0/docs/getting-started/nodejs.mdx @@ -121,50 +121,16 @@ Prebuild requires that the binary is in `build/Release` as though it was built w After you [installed the library](#install-the-iota-sdk), you can create a `Client` instance and interface with it. -```javascript -const { Client, initLogger } = require('@iota/sdk'); - -async function run() { - initLogger(); - - const client = new Client({ - nodes: ['https://api.testnet.shimmer.network'], - localPow: true, - }); - - try { - const nodeInfo = await client.getInfo(); - console.log('Node info: ', nodeInfo); - } catch (error) { - console.error('Error: ', error); - } -} - -run().then(() => process.exit()); +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/client/getting-started.ts#L4-L23 ``` ### Wallet After you [installed the library](#installing-the-iota-sdk), you can create a `Wallet` instance and interact with it. -```javascript -import { Wallet, CoinType, WalletOptions } from '@iota/sdk'; - -const walletOptions: WalletOptions = { - storagePath: `Alice`, // A name to associate with the created account. - clientOptions: { - nodes: ['https://api.testnet.shimmer.network'], // The node to connect to. - }, - coinType: CoinType.Shimmer, - secretManager: { - // Setup Stronghold secret manager - stronghold: { - snapshotPath: 'vault.stronghold', // The path to store the account snapshot. - password: 'a-secure-password', // A password to encrypt the stored data. WARNING: Never hardcode passwords in production code. - }, - }, -}; -const wallet = new Wallet(walletOptions); +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/wallet/getting-started.ts#L4-L60 ``` ## What's next? diff --git a/docs/build/iota-sdk/1.0.0/docs/getting-started/python.mdx b/docs/build/iota-sdk/1.0.0/docs/getting-started/python.mdx index 15a87d1d898..d1f0e07a908 100644 --- a/docs/build/iota-sdk/1.0.0/docs/getting-started/python.mdx +++ b/docs/build/iota-sdk/1.0.0/docs/getting-started/python.mdx @@ -92,40 +92,16 @@ deactivate After you [installed the library](#install-the-iota-sdk), you can create a `Client` instance and interface with it. -```python -from iota_sdk import Client - -# Create a Client instance -client = Client(nodes=['https://api.testnet.shimmer.network']) - -# Get the node info -node_info = client.get_info() -print(f'{node_info}') +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/client/getting_started.py ``` ### Wallet After you [installed the library](#install-the-iota-sdk), you can create a `Wallet` instance and interact with it. -```python -from iota_sdk import Wallet, StrongholdSecretManager, CoinType - -# This example creates a new database and account - -wallet_options = { - 'nodes': ['https://api.testnet.shimmer.network'], -} - -secret_manager = StrongholdSecretManager("wallet.stronghold", "some_hopefully_secure_password") - -wallet = Wallet('./alice-database', wallet_options, coin_type=CoinType.SHIMMER, secret_manager) - -# Store the mnemonic in the Stronghold snapshot. This only needs to be done once -account = wallet.store_mnemonic("flame fever pig forward exact dash body idea link scrub tennis minute " + - "surge unaware prosper over waste kitten ceiling human knife arch situate civil") - -account = wallet.create_account('Alice') -print(account) +```python reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/python/examples/wallet/getting_started.py#L4-L48 ``` ## What's next? diff --git a/docs/build/iota-sdk/1.0.0/docs/getting-started/rust.mdx b/docs/build/iota-sdk/1.0.0/docs/getting-started/rust.mdx index 956a47aab98..98bb968b710 100644 --- a/docs/build/iota-sdk/1.0.0/docs/getting-started/rust.mdx +++ b/docs/build/iota-sdk/1.0.0/docs/getting-started/rust.mdx @@ -137,21 +137,8 @@ iota-sdk = "1.0.0" To use the Client module, you simply need to create a `Client`. -```rust -use iota_sdk::client::{Client, Result}; - -#[tokio::main] -async fn main() -> Result<()> { - let client = Client::builder() - .with_node("https://api.testnet.shimmer.network")? // Insert your node URL here - .finish() - .await?; - - let info = client.get_info().await?; - println!("Node Info: {info:?}"); - - Ok(()) -} +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/client/getting_started.rs#L10-L23 ``` ### Wallet @@ -159,47 +146,8 @@ async fn main() -> Result<()> { To use the Wallet module, you need to create a `Wallet`. For this example to work `features = ["stronghold"]` is needed in the Cargo.toml import. To persist the wallet in a database, `"rocksdb"` can be added. -```rust -use iota_sdk::{ - client::{ - constants::SHIMMER_COIN_TYPE, - secret::{stronghold::StrongholdSecretManager, SecretManager}, - }, - wallet::{ClientOptions, Result, Wallet}, -}; - -#[tokio::main] -async fn main() -> Result<()> { - // Setup Stronghold secret manager. - // WARNING: Never hardcode passwords in production code. - let secret_manager = StrongholdSecretManager::builder() - .password("password".to_owned()) // A password to encrypt the stored data. - .build("vault.stronghold")?; // The path to store the account snapshot. - - let client_options = ClientOptions::new().with_node("https://api.testnet.shimmer.network")?; - - // Set up and store the wallet. - let wallet = Wallet::builder() - .with_secret_manager(SecretManager::Stronghold(secret_manager)) - .with_client_options(client_options) - .with_coin_type(SHIMMER_COIN_TYPE) - .finish() - .await?; - - // Generate a mnemonic and store it in the Stronghold vault. - // INFO: It is best practice to back up the mnemonic somewhere secure. - let mnemonic = wallet.generate_mnemonic()?; - wallet.store_mnemonic(mnemonic).await?; - - // Create an account. - let account = wallet - .create_account() - .with_alias("Alice") // A name to associate with the created account. - .finish() - .await?; - - Ok(()) -} +```rust reference +https://github.com/iotaledger/iota-sdk/blob/develop/sdk/examples/wallet/getting_started.rs#L12-L56 ``` ## What's next? diff --git a/docs/build/iota-sdk/1.0.0/docs/getting-started/wasm.mdx b/docs/build/iota-sdk/1.0.0/docs/getting-started/wasm.mdx index 56459bde145..f76c4ee356e 100644 --- a/docs/build/iota-sdk/1.0.0/docs/getting-started/wasm.mdx +++ b/docs/build/iota-sdk/1.0.0/docs/getting-started/wasm.mdx @@ -147,50 +147,16 @@ A bundler such as [webpack](https://webpack.js.org/) or [rollup](https://rollupj After you [installed the library](#install-the-iota-sdk), you can create a `Client` instance and interface with it. -```javascript -const { Client, initLogger } = require('@iota/sdk'); - -async function run() { - initLogger(); - - const client = new Client({ - nodes: ['https://api.testnet.shimmer.network'], - localPow: true, - }); - - try { - const nodeInfo = await client.getInfo(); - console.log('Node info: ', nodeInfo); - } catch (error) { - console.error('Error: ', error); - } -} - -run().then(() => process.exit()); +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/client/getting-started.ts#L4-L23 ``` ### Wallet After you [installed the library](#installing-the-iota-sdk), you can create a `Wallet` instance and interact with it. -```javascript -import { Wallet, CoinType, WalletOptions } from '@iota/sdk'; - -const walletOptions: WalletOptions = { - storagePath: `Alice`, // A name to associate with the created account. - clientOptions: { - nodes: ['https://api.testnet.shimmer.network'], // The node to connect to. - }, - coinType: CoinType.Shimmer, - secretManager: { - // Setup Stronghold secret manager - stronghold: { - snapshotPath: 'vault.stronghold', // The path to store the account snapshot. - password: 'a-secure-password', // A password to encrypt the stored data. WARNING: Never hardcode passwords in production code. - }, - }, -}; -const wallet = new Wallet(walletOptions); +```typescript reference +https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/examples/wallet/getting-started.ts#L4-L60 ``` ### Web Usage From 7d8a498892bc632a0894eba869ac21636548c84f Mon Sep 17 00:00:00 2001 From: Lucas Tortora Date: Thu, 14 Sep 2023 07:27:01 -0300 Subject: [PATCH 4/5] out of scope, but why not? --- .../core_concepts/core_contracts/accounts.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/learn/smart-contracts/core_concepts/core_contracts/accounts.md b/docs/learn/smart-contracts/core_concepts/core_contracts/accounts.md index 6b086d90b01..2f350e90e86 100644 --- a/docs/learn/smart-contracts/core_concepts/core_contracts/accounts.md +++ b/docs/learn/smart-contracts/core_concepts/core_contracts/accounts.md @@ -126,7 +126,6 @@ This operation cannot be reverted. - `s` (`uint32`): The serial number of the foundry. - ### `mintNFT(I ImmutableData, a AgentID, C CollectionID, w WithdrawOnMint)` Mints an NFT with ImmutableData `I` that will be owned by the AgentID `a`. @@ -144,8 +143,6 @@ The mint can be done directly to any L1 address (it is not necessary for the tar - `D` (`MintID`): the internal ID of the NFT at the time of minting that can be used by users/contracts to obtain the resulting NFTID on the next block - - --- ## Views @@ -307,7 +304,6 @@ Returns the NFTID `z` for a given MintID `D`. - `z` (`NFTID`): The ID of the NFT - ### `getAccountNonce(a AgentID)` Returns the current account nonce for a give AgentID `a`. @@ -335,7 +331,6 @@ FoundrySerialNumber = uint32 TokenID = [38]byte ``` - ### `NFTID` ``` @@ -348,8 +343,6 @@ NFTID = [32]byte MintID = [6]byte ``` - - ### `NFTData` `NFTData` is encoded as the concatenation of: From 528984ce22d86b48e530df8e82cf8cc98e6c2092 Mon Sep 17 00:00:00 2001 From: Jeroen van den Hout Date: Fri, 15 Sep 2023 00:40:57 +0200 Subject: [PATCH 5/5] Move icons --- cli/package.json | 2 +- .../CustomNetworkDropdown/index.tsx | 4 +- src/common/components/Social/index.tsx | 1 + src/common/components/Switcher/index.tsx | 13 +++-- src/common/icons/index.ts | 2 - src/common/icons/iota/index.ts | 22 --------- src/common/icons/socials/index.ts | 8 ---- .../HomeLayout/AppLibrariesSection.tsx | 9 ++-- .../HomeLayout/CoreLibrariesSection.tsx | 4 +- src/components/HomeLayout/index.tsx | 10 ++-- src/icons/index.ts | 7 +++ src/icons/iota/index.ts | 47 +++++++++++++++++++ src/icons/socials/index.ts | 19 ++++++++ src/switcher.config.ts | 40 ++++++---------- src/utils/socials.ts | 45 +++++++----------- {src/common => static}/icons/iota/bee.svg | 0 .../icons/iota/chronicle.svg | 0 .../icons/iota/chrysalis.svg | 0 .../icons/iota/getting_started.svg | 0 .../icons/iota/go_shimmer.svg | 0 {src/common => static}/icons/iota/hornet.svg | 0 .../common => static}/icons/iota/identity.svg | 0 .../icons/iota/integration_services.svg | 0 {src/common => static}/icons/iota/iota_20.svg | 0 .../icons/iota/iota_core.svg | 0 .../icons/iota/iota_token.svg | 0 {src/common => static}/icons/iota/next.svg | 0 .../icons/iota/pick_a_wallet.svg | 0 {src/common => static}/icons/iota/search.svg | 0 {src/common => static}/icons/iota/shimmer.svg | 0 .../icons/iota/smart_contracts.svg | 0 {src/common => static}/icons/iota/streams.svg | 0 .../icons/iota/stronghold.svg | 0 {src/common => static}/icons/iota/tips.svg | 0 {src/common => static}/icons/iota/tools.svg | 0 .../icons/iota/tutorials.svg | 0 {src/common => static}/icons/iota/wallet.svg | 0 {src/common => static}/icons/iota/wasp.svg | 0 .../icons/socials/discord.svg | 0 .../icons/socials/facebook.svg | 0 .../icons/socials/github.svg | 0 .../icons/socials/instagram.svg | 0 .../icons/socials/linkedin.svg | 0 .../icons/socials/reddit.svg | 0 .../icons/socials/twitter.svg | 0 .../icons/socials/youtube.svg | 0 46 files changed, 130 insertions(+), 103 deletions(-) delete mode 100644 src/common/icons/index.ts delete mode 100644 src/common/icons/iota/index.ts delete mode 100644 src/common/icons/socials/index.ts create mode 100644 src/icons/index.ts create mode 100644 src/icons/iota/index.ts create mode 100644 src/icons/socials/index.ts rename {src/common => static}/icons/iota/bee.svg (100%) rename {src/common => static}/icons/iota/chronicle.svg (100%) rename {src/common => static}/icons/iota/chrysalis.svg (100%) rename {src/common => static}/icons/iota/getting_started.svg (100%) rename {src/common => static}/icons/iota/go_shimmer.svg (100%) rename {src/common => static}/icons/iota/hornet.svg (100%) rename {src/common => static}/icons/iota/identity.svg (100%) rename {src/common => static}/icons/iota/integration_services.svg (100%) rename {src/common => static}/icons/iota/iota_20.svg (100%) rename {src/common => static}/icons/iota/iota_core.svg (100%) rename {src/common => static}/icons/iota/iota_token.svg (100%) rename {src/common => static}/icons/iota/next.svg (100%) rename {src/common => static}/icons/iota/pick_a_wallet.svg (100%) rename {src/common => static}/icons/iota/search.svg (100%) rename {src/common => static}/icons/iota/shimmer.svg (100%) rename {src/common => static}/icons/iota/smart_contracts.svg (100%) rename {src/common => static}/icons/iota/streams.svg (100%) rename {src/common => static}/icons/iota/stronghold.svg (100%) rename {src/common => static}/icons/iota/tips.svg (100%) rename {src/common => static}/icons/iota/tools.svg (100%) rename {src/common => static}/icons/iota/tutorials.svg (100%) rename {src/common => static}/icons/iota/wallet.svg (100%) rename {src/common => static}/icons/iota/wasp.svg (100%) rename {src/common => static}/icons/socials/discord.svg (100%) rename {src/common => static}/icons/socials/facebook.svg (100%) rename {src/common => static}/icons/socials/github.svg (100%) rename {src/common => static}/icons/socials/instagram.svg (100%) rename {src/common => static}/icons/socials/linkedin.svg (100%) rename {src/common => static}/icons/socials/reddit.svg (100%) rename {src/common => static}/icons/socials/twitter.svg (100%) rename {src/common => static}/icons/socials/youtube.svg (100%) diff --git a/cli/package.json b/cli/package.json index 56ef0272fac..8f6ed040eaa 100644 --- a/cli/package.json +++ b/cli/package.json @@ -15,7 +15,7 @@ "clean": "rm -rf ./dist", "build": "npx tsc --build && tsc-alias && yarn copy", "copy:internal": "copyfiles \"src/**/!(*.ts|*.js|*.tsx)\" dist/cli", - "copy:external": "copyfiles \"../src/common/css/**/!(*.ts|*.js|*.tsx)\" \"../src/common/icons/**/!(*.ts|*.js|*.tsx)\" \"../src/next/css/**/!(*.ts|*.js|*.tsx)\" dist/cli", + "copy:external": "copyfiles \"../src/common/css/**/!(*.ts|*.js|*.tsx)\" \"../src/icons/**/(*.ts|*.js|*.tsx)\" \"../static/icons/**/!(*.ts|*.js|*.tsx)\" \"../src/next/css/**/!(*.ts|*.js|*.tsx)\" dist/cli", "copy": "yarn copy:internal && yarn copy:external", "watch": "nodemon --watch src --ext '*' --exec yarn build", "prepack": "yarn build" diff --git a/src/common/components/CustomNetworkDropdown/index.tsx b/src/common/components/CustomNetworkDropdown/index.tsx index 948d39e04f4..f4e10d70c6e 100644 --- a/src/common/components/CustomNetworkDropdown/index.tsx +++ b/src/common/components/CustomNetworkDropdown/index.tsx @@ -12,12 +12,14 @@ import type { } from '@theme/NavbarItem/DropdownNavbarItem'; import './styles.css'; -import { IotaCore, Shimmer, Next } from '../../icons'; +import icons from '@site/src/icons'; import { fetchSitemapUrlsFromNetwork, getBestNetworkUrlMatch, } from '@site/src/utils/networkUtils'; +const { IotaCore, Shimmer, Next } = icons; + interface NetworkDropdownItem { label: string; routeBasePath: string; diff --git a/src/common/components/Social/index.tsx b/src/common/components/Social/index.tsx index 1837a0a89d9..1c508633249 100644 --- a/src/common/components/Social/index.tsx +++ b/src/common/components/Social/index.tsx @@ -15,6 +15,7 @@ export interface SocialsConfig extends ThemeConfig { function SocialLink({ url, backgroundColor }: Social) { const { name, Icon } = get_socials_data(url); + return ( >; + icon?: string; }; export type Version = Item; @@ -52,6 +52,11 @@ enum SwitcherMenuState { Versions, } +function Icon({ icon, className }: { icon: string; className: string }) { + const Comp = icons[icon]; + return ; +} + type SwitcherMenuDropdownProps = { items: MenuItem[]; active: boolean }; function SwitcherMenuDropdown(props: SwitcherMenuDropdownProps) { @@ -64,7 +69,7 @@ function SwitcherMenuDropdown(props: SwitcherMenuDropdownProps) { >
    {props.items.map( - ({ id, label, to, active, icon: Icon, description, badges = [] }) => ( + ({ id, label, to, active, icon, description, badges = [] }) => (
  • - {Icon && } + {icon && }
    {label} diff --git a/src/common/icons/index.ts b/src/common/icons/index.ts deleted file mode 100644 index 41a717d63a9..00000000000 --- a/src/common/icons/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './iota'; -export * from './socials'; diff --git a/src/common/icons/iota/index.ts b/src/common/icons/iota/index.ts deleted file mode 100644 index 2dcbccd9501..00000000000 --- a/src/common/icons/iota/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -export { default as Chronicle } from './chronicle.svg'; -export { default as Chrysalis } from './chrysalis.svg'; -export { default as GettingStarted } from './getting_started.svg'; -export { default as GoShimmer } from './go_shimmer.svg'; -export { default as Hornet } from './hornet.svg'; -export { default as Identity } from './identity.svg'; -export { default as IntegrationServices } from './integration_services.svg'; -export { default as Iota20 } from './iota_20.svg'; -export { default as IotaCore } from './iota_core.svg'; -export { default as IotaToken } from './iota_token.svg'; -export { default as Next } from './next.svg'; -export { default as PickAWallet } from './pick_a_wallet.svg'; -export { default as Search } from './search.svg'; -export { default as Shimmer } from './shimmer.svg'; -export { default as SmartContracts } from './smart_contracts.svg'; -export { default as Streams } from './streams.svg'; -export { default as Stronghold } from './stronghold.svg'; -export { default as Tips } from './tips.svg'; -export { default as Tools } from './tools.svg'; -export { default as Tutorials } from './tutorials.svg'; -export { default as Wallet } from './wallet.svg'; -export { default as Wasp } from './wasp.svg'; diff --git a/src/common/icons/socials/index.ts b/src/common/icons/socials/index.ts deleted file mode 100644 index 0359178b283..00000000000 --- a/src/common/icons/socials/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { default as Discord } from './discord.svg'; -export { default as Facebook } from './facebook.svg'; -export { default as Github } from './github.svg'; -export { default as Instagram } from './instagram.svg'; -export { default as LinkedIn } from './linkedin.svg'; -export { default as Reddit } from './reddit.svg'; -export { default as Twitter } from './twitter.svg'; -export { default as Youtube } from './youtube.svg'; diff --git a/src/components/HomeLayout/AppLibrariesSection.tsx b/src/components/HomeLayout/AppLibrariesSection.tsx index be9f31ff2dd..f0d59962e58 100644 --- a/src/components/HomeLayout/AppLibrariesSection.tsx +++ b/src/components/HomeLayout/AppLibrariesSection.tsx @@ -1,11 +1,8 @@ import React, { FC } from 'react'; import Link from '@docusaurus/Link'; -import { - Identity, - SmartContracts, - Streams, - Stronghold, -} from '@site/src/common/icons'; +import icons from '@site/src/icons'; + +const { Identity, SmartContracts, Streams, Stronghold } = icons; interface LanguagesProps { languages?: { [key: string]: string }; diff --git a/src/components/HomeLayout/CoreLibrariesSection.tsx b/src/components/HomeLayout/CoreLibrariesSection.tsx index a58c5ef7bf6..a14912c4528 100644 --- a/src/components/HomeLayout/CoreLibrariesSection.tsx +++ b/src/components/HomeLayout/CoreLibrariesSection.tsx @@ -3,7 +3,9 @@ import CoreLibImgDark from '@site/static/img/homepage/section_core_libraries_dar import ThemedImage from '@theme/ThemedImage'; import React, { FC } from 'react'; import Link from '@docusaurus/Link'; -import { Shimmer } from '@site/src/common/icons'; +import icons from '@site/src/icons'; + +const { Shimmer } = icons; interface LanguagesProps { languages?: { [key: string]: string }; diff --git a/src/components/HomeLayout/index.tsx b/src/components/HomeLayout/index.tsx index e9f3c6f7e63..b42138e0398 100644 --- a/src/components/HomeLayout/index.tsx +++ b/src/components/HomeLayout/index.tsx @@ -7,7 +7,11 @@ import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import clsx from 'clsx'; import './styles.css'; -import { +import icons from '@site/src/icons'; +import CoreLibrariesSection from './CoreLibrariesSection'; +import AppLibrariesSection from './AppLibrariesSection'; + +const { Chronicle, Discord, Hornet, @@ -19,9 +23,7 @@ import { Tips, Tutorials, Wasp, -} from '@site/src/common/icons'; -import CoreLibrariesSection from './CoreLibrariesSection'; -import AppLibrariesSection from './AppLibrariesSection'; +} = icons; interface HomepageSectionProps { header?: string; diff --git a/src/icons/index.ts b/src/icons/index.ts new file mode 100644 index 00000000000..6a987f3cab4 --- /dev/null +++ b/src/icons/index.ts @@ -0,0 +1,7 @@ +import iota from './iota'; +import socials from './socials'; + +export default { + ...iota, + ...socials, +}; diff --git a/src/icons/iota/index.ts b/src/icons/iota/index.ts new file mode 100644 index 00000000000..a293356ca85 --- /dev/null +++ b/src/icons/iota/index.ts @@ -0,0 +1,47 @@ +import { default as Chronicle } from '@site/static/icons/iota/chronicle.svg'; +import { default as Chrysalis } from '@site/static/icons/iota/chrysalis.svg'; +import { default as GettingStarted } from '@site/static/icons/iota/getting_started.svg'; +import { default as GoShimmer } from '@site/static/icons/iota/go_shimmer.svg'; +import { default as Hornet } from '@site/static/icons/iota/hornet.svg'; +import { default as Identity } from '@site/static/icons/iota/identity.svg'; +import { default as IntegrationServices } from '@site/static/icons/iota/integration_services.svg'; +import { default as Iota20 } from '@site/static/icons/iota/iota_20.svg'; +import { default as IotaCore } from '@site/static/icons/iota/iota_core.svg'; +import { default as IotaToken } from '@site/static/icons/iota/iota_token.svg'; +import { default as Next } from '@site/static/icons/iota/next.svg'; +import { default as PickAWallet } from '@site/static/icons/iota/pick_a_wallet.svg'; +import { default as Search } from '@site/static/icons/iota/search.svg'; +import { default as Shimmer } from '@site/static/icons/iota/shimmer.svg'; +import { default as SmartContracts } from '@site/static/icons/iota/smart_contracts.svg'; +import { default as Streams } from '@site/static/icons/iota/streams.svg'; +import { default as Stronghold } from '@site/static/icons/iota/stronghold.svg'; +import { default as Tips } from '@site/static/icons/iota/tips.svg'; +import { default as Tools } from '@site/static/icons/iota/tools.svg'; +import { default as Tutorials } from '@site/static/icons/iota/tutorials.svg'; +import { default as Wallet } from '@site/static/icons/iota/wallet.svg'; +import { default as Wasp } from '@site/static/icons/iota/wasp.svg'; + +export default { + Chronicle, + Chrysalis, + GettingStarted, + GoShimmer, + Hornet, + Identity, + IntegrationServices, + Iota20, + IotaCore, + IotaToken, + Next, + PickAWallet, + Search, + Shimmer, + SmartContracts, + Streams, + Stronghold, + Tips, + Tools, + Tutorials, + Wallet, + Wasp, +}; diff --git a/src/icons/socials/index.ts b/src/icons/socials/index.ts new file mode 100644 index 00000000000..4efce74e544 --- /dev/null +++ b/src/icons/socials/index.ts @@ -0,0 +1,19 @@ +import { default as Discord } from '@site/static/icons/socials/discord.svg'; +import { default as Facebook } from '@site/static/icons/socials/facebook.svg'; +import { default as Github } from '@site/static/icons/socials/github.svg'; +import { default as Instagram } from '@site/static/icons/socials/instagram.svg'; +import { default as LinkedIn } from '@site/static/icons/socials/linkedin.svg'; +import { default as Reddit } from '@site/static/icons/socials/reddit.svg'; +import { default as Twitter } from '@site/static/icons/socials/twitter.svg'; +import { default as Youtube } from '@site/static/icons/socials/youtube.svg'; + +export default { + Discord, + Facebook, + Github, + Instagram, + LinkedIn, + Reddit, + Twitter, + Youtube, +}; diff --git a/src/switcher.config.ts b/src/switcher.config.ts index be452ab186a..dae9567fefe 100644 --- a/src/switcher.config.ts +++ b/src/switcher.config.ts @@ -1,23 +1,11 @@ import type { Config } from './common/components/Switcher'; -import { - Chronicle, - GoShimmer, - Hornet, - Identity, - IotaCore, - SmartContracts, - Streams, - Stronghold, - Tools, - Wallet, -} from './common/icons'; const buildDocs = [ { id: 'iota-sdk-1-0-0', label: 'IOTA SDK', description: 'Seamlessly integrate IOTA into your app.', - icon: IotaCore, + icon: 'IotaCore', subsection: 'build-layer-1', versions: [ { @@ -31,7 +19,7 @@ const buildDocs = [ id: 'identity-rs-0-5', label: 'Identity', description: 'Trustless digital identity management.', - icon: Identity, + icon: 'Identity', subsection: 'build-layer-1', versions: [ { @@ -60,7 +48,7 @@ const buildDocs = [ id: 'stronghold-rs', label: 'Stronghold', description: 'Securely store secrets.', - icon: Stronghold, + icon: 'Stronghold', subsection: 'build-layer-1', versions: [ { @@ -74,7 +62,7 @@ const buildDocs = [ id: 'cli-wallet', label: 'CLI Wallet', description: 'Command line wallet.', - icon: Wallet, + icon: 'Wallet', subsection: 'build-layer-1', versions: [ { @@ -88,7 +76,7 @@ const buildDocs = [ id: 'apis', label: 'APIs', description: 'All available APIs.', - icon: Tools, + icon: 'Tools', subsection: 'build-layer-1', versions: [ { @@ -100,7 +88,7 @@ const buildDocs = [ id: 'iota-rs-1-4-0', label: 'iota.rs (deprecated)', description: 'Legacy client SDK.', - icon: IotaCore, + icon: 'IotaCore', subsection: 'build-layer-1', versions: [ { @@ -119,7 +107,7 @@ const buildDocs = [ id: 'iotajs', label: 'iota.js (deprecated)', description: 'Legacy JavaScript SDK.', - icon: IotaCore, + icon: 'IotaCore', subsection: 'build-layer-1', versions: [ { @@ -133,7 +121,7 @@ const buildDocs = [ id: 'wallet-rs-0-1-0', label: 'wallet.rs (deprecated)', description: 'Legacy wallet SDK.', - icon: Wallet, + icon: 'Wallet', subsection: 'build-layer-1', versions: [ { @@ -152,7 +140,7 @@ const buildDocs = [ id: 'iota-streams', label: 'Streams (deprecated)', description: 'Secure data channels over the Tangle.', - icon: Streams, + icon: 'Streams', subsection: 'build-layer-1', versions: [ { @@ -166,7 +154,7 @@ const buildDocs = [ id: 'smart-contract-0-7-0', label: 'Smart Contracts', description: 'Create smart contracts.', - icon: SmartContracts, + icon: 'SmartContracts', subsection: 'build-layer-2', versions: [ { @@ -183,7 +171,7 @@ const maintainDocs = [ id: 'hornet-1-2-4', label: 'Hornet', description: 'The primary node software for IOTA.', - icon: Hornet, + icon: 'Hornet', subsection: 'maintain-layer-1', versions: [ { @@ -202,7 +190,7 @@ const maintainDocs = [ id: 'wasp-0-7-0', label: 'Wasp', description: 'The node software to run an ISC network', - icon: SmartContracts, + icon: 'SmartContracts', subsection: 'maintain-layer-2', versions: [ { @@ -216,7 +204,7 @@ const maintainDocs = [ id: 'chronicle-rs', label: 'Chronicle', description: 'Indexer, archival node, analytics.', - icon: Chronicle, + icon: 'Chronicle', subsection: 'maintain-layer-1', versions: [ { @@ -235,7 +223,7 @@ const maintainDocs = [ id: 'goshimmer', label: 'GoShimmer', description: 'Research node implementation for IOTA 2.0', - icon: GoShimmer, + icon: 'GoShimmer', subsection: 'maintain-layer-1', versions: [ { diff --git a/src/utils/socials.ts b/src/utils/socials.ts index 72ab0fb0ef7..1222e7955d6 100644 --- a/src/utils/socials.ts +++ b/src/utils/socials.ts @@ -1,36 +1,25 @@ import { ComponentType, SVGProps } from 'react'; -import { - Youtube, - Github, - Discord, - Twitter, - Reddit, - LinkedIn, - Instagram, - Facebook, -} from '../common/icons'; +import icons from '@site/src/icons'; -const map: Array<{ - name: string; - Icon: ComponentType>; -}> = [ - { name: 'Youtube', Icon: Youtube }, - { name: 'GitHub', Icon: Github }, - { name: 'Discord', Icon: Discord }, - { name: 'Twitter', Icon: Twitter }, - { name: 'Reddit', Icon: Reddit }, - { name: 'LinkedIn', Icon: LinkedIn }, - { name: 'Instagram', Icon: Instagram }, - { name: 'Facebook', Icon: Facebook }, +const socials = [ + 'Discord', + 'Facebook', + 'Github', + 'Instagram', + 'LinkedIn', + 'Reddit', + 'Twitter', + 'Youtube', ]; // Returns an object with icon and name for given url -export default function get_socials_data(url: string): (typeof map)[number] { - for (let i = 0; i < map.length; i++) { - if (url.toLowerCase().includes(map[i].name.toLowerCase())) { - return map[i]; +export default function get_socials_data(url: string): { + name: string; + Icon: ComponentType>; +} { + for (const social of socials) { + if (url.toLowerCase().includes(social.toLowerCase())) { + return { name: social, Icon: icons[social] }; } } - - return null; } diff --git a/src/common/icons/iota/bee.svg b/static/icons/iota/bee.svg similarity index 100% rename from src/common/icons/iota/bee.svg rename to static/icons/iota/bee.svg diff --git a/src/common/icons/iota/chronicle.svg b/static/icons/iota/chronicle.svg similarity index 100% rename from src/common/icons/iota/chronicle.svg rename to static/icons/iota/chronicle.svg diff --git a/src/common/icons/iota/chrysalis.svg b/static/icons/iota/chrysalis.svg similarity index 100% rename from src/common/icons/iota/chrysalis.svg rename to static/icons/iota/chrysalis.svg diff --git a/src/common/icons/iota/getting_started.svg b/static/icons/iota/getting_started.svg similarity index 100% rename from src/common/icons/iota/getting_started.svg rename to static/icons/iota/getting_started.svg diff --git a/src/common/icons/iota/go_shimmer.svg b/static/icons/iota/go_shimmer.svg similarity index 100% rename from src/common/icons/iota/go_shimmer.svg rename to static/icons/iota/go_shimmer.svg diff --git a/src/common/icons/iota/hornet.svg b/static/icons/iota/hornet.svg similarity index 100% rename from src/common/icons/iota/hornet.svg rename to static/icons/iota/hornet.svg diff --git a/src/common/icons/iota/identity.svg b/static/icons/iota/identity.svg similarity index 100% rename from src/common/icons/iota/identity.svg rename to static/icons/iota/identity.svg diff --git a/src/common/icons/iota/integration_services.svg b/static/icons/iota/integration_services.svg similarity index 100% rename from src/common/icons/iota/integration_services.svg rename to static/icons/iota/integration_services.svg diff --git a/src/common/icons/iota/iota_20.svg b/static/icons/iota/iota_20.svg similarity index 100% rename from src/common/icons/iota/iota_20.svg rename to static/icons/iota/iota_20.svg diff --git a/src/common/icons/iota/iota_core.svg b/static/icons/iota/iota_core.svg similarity index 100% rename from src/common/icons/iota/iota_core.svg rename to static/icons/iota/iota_core.svg diff --git a/src/common/icons/iota/iota_token.svg b/static/icons/iota/iota_token.svg similarity index 100% rename from src/common/icons/iota/iota_token.svg rename to static/icons/iota/iota_token.svg diff --git a/src/common/icons/iota/next.svg b/static/icons/iota/next.svg similarity index 100% rename from src/common/icons/iota/next.svg rename to static/icons/iota/next.svg diff --git a/src/common/icons/iota/pick_a_wallet.svg b/static/icons/iota/pick_a_wallet.svg similarity index 100% rename from src/common/icons/iota/pick_a_wallet.svg rename to static/icons/iota/pick_a_wallet.svg diff --git a/src/common/icons/iota/search.svg b/static/icons/iota/search.svg similarity index 100% rename from src/common/icons/iota/search.svg rename to static/icons/iota/search.svg diff --git a/src/common/icons/iota/shimmer.svg b/static/icons/iota/shimmer.svg similarity index 100% rename from src/common/icons/iota/shimmer.svg rename to static/icons/iota/shimmer.svg diff --git a/src/common/icons/iota/smart_contracts.svg b/static/icons/iota/smart_contracts.svg similarity index 100% rename from src/common/icons/iota/smart_contracts.svg rename to static/icons/iota/smart_contracts.svg diff --git a/src/common/icons/iota/streams.svg b/static/icons/iota/streams.svg similarity index 100% rename from src/common/icons/iota/streams.svg rename to static/icons/iota/streams.svg diff --git a/src/common/icons/iota/stronghold.svg b/static/icons/iota/stronghold.svg similarity index 100% rename from src/common/icons/iota/stronghold.svg rename to static/icons/iota/stronghold.svg diff --git a/src/common/icons/iota/tips.svg b/static/icons/iota/tips.svg similarity index 100% rename from src/common/icons/iota/tips.svg rename to static/icons/iota/tips.svg diff --git a/src/common/icons/iota/tools.svg b/static/icons/iota/tools.svg similarity index 100% rename from src/common/icons/iota/tools.svg rename to static/icons/iota/tools.svg diff --git a/src/common/icons/iota/tutorials.svg b/static/icons/iota/tutorials.svg similarity index 100% rename from src/common/icons/iota/tutorials.svg rename to static/icons/iota/tutorials.svg diff --git a/src/common/icons/iota/wallet.svg b/static/icons/iota/wallet.svg similarity index 100% rename from src/common/icons/iota/wallet.svg rename to static/icons/iota/wallet.svg diff --git a/src/common/icons/iota/wasp.svg b/static/icons/iota/wasp.svg similarity index 100% rename from src/common/icons/iota/wasp.svg rename to static/icons/iota/wasp.svg diff --git a/src/common/icons/socials/discord.svg b/static/icons/socials/discord.svg similarity index 100% rename from src/common/icons/socials/discord.svg rename to static/icons/socials/discord.svg diff --git a/src/common/icons/socials/facebook.svg b/static/icons/socials/facebook.svg similarity index 100% rename from src/common/icons/socials/facebook.svg rename to static/icons/socials/facebook.svg diff --git a/src/common/icons/socials/github.svg b/static/icons/socials/github.svg similarity index 100% rename from src/common/icons/socials/github.svg rename to static/icons/socials/github.svg diff --git a/src/common/icons/socials/instagram.svg b/static/icons/socials/instagram.svg similarity index 100% rename from src/common/icons/socials/instagram.svg rename to static/icons/socials/instagram.svg diff --git a/src/common/icons/socials/linkedin.svg b/static/icons/socials/linkedin.svg similarity index 100% rename from src/common/icons/socials/linkedin.svg rename to static/icons/socials/linkedin.svg diff --git a/src/common/icons/socials/reddit.svg b/static/icons/socials/reddit.svg similarity index 100% rename from src/common/icons/socials/reddit.svg rename to static/icons/socials/reddit.svg diff --git a/src/common/icons/socials/twitter.svg b/static/icons/socials/twitter.svg similarity index 100% rename from src/common/icons/socials/twitter.svg rename to static/icons/socials/twitter.svg diff --git a/src/common/icons/socials/youtube.svg b/static/icons/socials/youtube.svg similarity index 100% rename from src/common/icons/socials/youtube.svg rename to static/icons/socials/youtube.svg