Skip to content

Commit

Permalink
feat(refactor): Add assets package, move svgs to package (#2361)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbulat authored Dec 5, 2024
1 parent 8c3dbc3 commit 15c08b1
Show file tree
Hide file tree
Showing 40 changed files with 46 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@w3ux/react-polkicon": "^2.0.1-alpha.0",
"@w3ux/validator-assets": "^0.2.0",
"@zondax/ledger-substrate": "^1.0.0",
"assets": "workspace:*",
"bn.js": "^5.2.1",
"buffer": "^6.0.3",
"chart.js": "^4.4.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/config/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import KusamaSVG from 'assets/svg/ledger/kusama.svg?react'
import PolkadotSVG from 'assets/svg/ledger/polkadot.svg?react'
import type { LedgerChain } from 'contexts/LedgerHardware/types'
import KusamaSVG from 'img/appIcons/kusama.svg?react'
import PolkadotSVG from 'img/appIcons/polkadot.svg?react'

export const LedgerChains: LedgerChain[] = [
{
Expand Down
12 changes: 6 additions & 6 deletions packages/app/src/config/networks.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import KusamaIconSVG from 'assets/svg/kusamaIcon.svg?react'
import KusamaInlineSVG from 'assets/svg/kusamaInline.svg?react'
import PolkadotIconSVG from 'assets/svg/polkadotIcon.svg?react'
import PolkadotInlineSVG from 'assets/svg/polkadotInline.svg?react'
import WestendIconSVG from 'assets/svg/westendIcon.svg?react'
import WestendInlineSVG from 'assets/svg/westendInline.svg?react'
import BigNumber from 'bignumber.js'
import type { Networks, SystemChain } from 'common-types'
import PolkadotTokenSVG from 'config/tokens/svg/DOT.svg?react'
import KusamaTokenSVG from 'config/tokens/svg/KSM.svg?react'
import WestendTokenSVG from 'config/tokens/svg/WND.svg?react'
import KusamaIconSVG from 'img/kusama_icon.svg?react'
import KusamaInlineSVG from 'img/kusama_inline.svg?react'
import PolkadotIconSVG from 'img/polkadot_icon.svg?react'
import PolkadotInlineSVG from 'img/polkadot_inline.svg?react'
import WestendIconSVG from 'img/westend_icon.svg?react'
import WestendInlineSVG from 'img/westend_inline.svg?react'

export const NetworkList: Networks = {
polkadot: {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/library/Modal/Close.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import CrossSVG from 'img/cross.svg?react'
import CrossSVG from 'assets/svg/cross.svg?react'
import { useOverlay } from 'kits/Overlay/Provider'
import { CloseWrapper } from './Wrappers'

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/library/Modal/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import type { IconProp } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import type { AnyJson } from '@w3ux/types'
import CrossSVG from 'assets/svg/cross.svg?react'
import { useHelp } from 'contexts/Help'
import CrossSVG from 'img/cross.svg?react'
import { useOverlay } from 'kits/Overlay/Provider'
import type { FunctionComponent, SVGProps } from 'react'
import type { CSSProperties } from 'styled-components'
Expand Down
18 changes: 9 additions & 9 deletions packages/app/src/library/SideMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import { faCompressAlt, faExpandAlt } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { useOnResize, useOutsideAlerter } from '@w3ux/hooks'
import { capitalizeFirstLetter } from '@w3ux/utils'
import BookSVG from 'assets/svg/book.svg?react'
import CogOutlineSVG from 'assets/svg/cogOutline.svg?react'
import DiscordSVG from 'assets/svg/discord.svg?react'
import EnvelopeSVG from 'assets/svg/envelope.svg?react'
import LanguageSVG from 'assets/svg/language.svg?react'
import LogoSVG from 'assets/svg/logo.svg?react'
import LogoGithubSVG from 'assets/svg/logoGithub.svg?react'
import MoonOutlineSVG from 'assets/svg/moonOutline.svg?react'
import SunnyOutlineSVG from 'assets/svg/sunnyOutline.svg?react'
import { PageWidthMediumThreshold, SideMenuMaximisedWidth } from 'consts'
import { useApi } from 'contexts/Api'
import { useHelp } from 'contexts/Help'
import { useNetwork } from 'contexts/Network'
import { useTheme } from 'contexts/Themes'
import { useUi } from 'contexts/UI'
import type { UIContextInterface } from 'contexts/UI/types'
import BookSVG from 'img/book.svg?react'
import CogOutlineSVG from 'img/cog-outline.svg?react'
import DiscordSVG from 'img/discord.svg?react'
import EnvelopeSVG from 'img/envelope.svg?react'
import LanguageSVG from 'img/language.svg?react'
import LogoGithubSVG from 'img/logo-github.svg?react'
import LogoSVG from 'img/logo.svg?react'
import MoonOutlineSVG from 'img/moon-outline.svg?react'
import SunnyOutlineSVG from 'img/sunny-outline.svg?react'
import { useOverlay } from 'kits/Overlay/Provider'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/modals/ChooseLanguage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import LanguageSVG from 'img/language.svg?react'
import LanguageSVG from 'assets/svg/language.svg?react'
import { useOverlay } from 'kits/Overlay/Provider'
import { ModalPadding } from 'kits/Overlay/structure/ModalPadding'
import { Title } from 'library/Modal/Title'
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/modals/DiscordSupport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import DiscordOutlineSvg from 'assets/svg/discordOutline.svg?react'
import { DiscordSupportUrl } from 'consts'
import DiscordOutlineSvg from 'img/discord_outline.svg?react'
import { ModalPadding } from 'kits/Overlay/structure/ModalPadding'
import { Title } from 'library/Modal/Title'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/modals/MailSupport/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import MailSVG from 'assets/svg/mail.svg?react'
import { MailSupportAddress } from 'consts'
import MailSVG from 'img/mail.svg?react'
import { ModalPadding } from 'kits/Overlay/structure/ModalPadding'
import { Title } from 'library/Modal/Title'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/modals/Networks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { faChevronRight, faGlobe } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { capitalizeFirstLetter } from '@w3ux/utils'
import BraveIconSVG from 'assets/svg/braveLogo.svg?react'
import type { NetworkId } from 'common-types'
import { NetworkList } from 'config/networks'
import { useApi } from 'contexts/Api'
Expand All @@ -16,7 +17,6 @@ import { Title } from 'library/Modal/Title'
import { useEffect } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { ButtonTertiary } from 'ui-buttons'
import BraveIconSVG from '../../img/brave-logo.svg?react'
import { ProvidersPrompt } from './ProvidersPrompt'
import {
BraveWarning,
Expand Down
13 changes: 13 additions & 0 deletions packages/assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "assets",
"version": "1.0.0",
"license": "GPL-3.0-only",
"type": "module",
"scripts": {
"clear": "rm -rf build dist",
"reset": "yarn run clear && rm -rf node_modules yarn.lock && yarn"
},
"exports": {
"./svg/*": "./src/svg/*"
}
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion packages/styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "src/",
"scripts": {
"clear": "rm -rf build tsconfig.tsbuildinfo dist",
"clear": "rm -rf build dist",
"reset": "yarn run clear && rm -rf node_modules yarn.lock && yarn"
}
}
1 change: 1 addition & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include-component-in-tag": true,
"packages": {
"packages/app": {},
"packages/assets": {},
"packages/consts": {},
"packages/locales": {},
"packages/styles": {},
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4744,6 +4744,7 @@ __metadata:
"@w3ux/react-polkicon": "npm:^2.0.1-alpha.0"
"@w3ux/validator-assets": "npm:^0.2.0"
"@zondax/ledger-substrate": "npm:^1.0.0"
assets: "workspace:*"
bn.js: "npm:^5.2.1"
buffer: "npm:^6.0.3"
chart.js: "npm:^4.4.7"
Expand Down Expand Up @@ -4905,6 +4906,12 @@ __metadata:
languageName: node
linkType: hard

"assets@workspace:*, assets@workspace:packages/assets":
version: 0.0.0-use.local
resolution: "assets@workspace:packages/assets"
languageName: unknown
linkType: soft

"async-mutex@npm:^0.2.6":
version: 0.2.6
resolution: "async-mutex@npm:0.2.6"
Expand Down

0 comments on commit 15c08b1

Please sign in to comment.