From a2e56954bc4a21ebb0b821ce7b389fc4de18ef32 Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:06:08 -0500 Subject: [PATCH 1/5] announcement bar --- docs/tools/flow-cli/flix.md | 8 ++- docusaurus.config.js | 11 ++++ .../AnnouncementBar/CloseButton/index.js | 20 +++++++ .../CloseButton/styles.module.css | 4 ++ src/theme/AnnouncementBar/Content/index.js | 17 ++++++ .../AnnouncementBar/Content/styles.module.css | 10 ++++ src/theme/AnnouncementBar/index.js | 29 ++++++++++ src/theme/AnnouncementBar/styles.module.css | 55 +++++++++++++++++++ 8 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 src/theme/AnnouncementBar/CloseButton/index.js create mode 100644 src/theme/AnnouncementBar/CloseButton/styles.module.css create mode 100644 src/theme/AnnouncementBar/Content/index.js create mode 100644 src/theme/AnnouncementBar/Content/styles.module.css create mode 100644 src/theme/AnnouncementBar/index.js create mode 100644 src/theme/AnnouncementBar/styles.module.css diff --git a/docs/tools/flow-cli/flix.md b/docs/tools/flow-cli/flix.md index e784fc454d..06993cc4d4 100644 --- a/docs/tools/flow-cli/flix.md +++ b/docs/tools/flow-cli/flix.md @@ -60,7 +60,9 @@ flow flix execute ./multiply.template.json 2 3 --network testnet The Flow CLI provides a `flix` command to `package` up generated plain and simple JavaScript. This JavaScript uses FCL (Flow Client Library) to call the cadence the Flow Interaction Templates (FLIX) is based on. :::info + Currently, `flix package` command only supports generating FCL (Flow Client Library) specific JavaScript and TypeScirpt, there are plans to support other languages like golang. + ::: @@ -183,7 +185,9 @@ Example of json prefill file with message metadata Queries can be a FLIX `url` or `path` to a local FLIX file. This command leverages [FCL](../clients/fcl-js/) which will execute FLIX cadence code. Package files can be generated in JavaScript or TypeScript. :::warning + Currently package doesn't support `id`, `name` flix query. + ::: ### Package Usage @@ -281,8 +285,10 @@ export async function transferTokens({amount, to}: TransferTokensParams): Promis } ``` -:::Warning +:::warning + Notice that fcl v1.9.0 is needed to use FLIX v1.1 templates + ::: ## Resources diff --git a/docusaurus.config.js b/docusaurus.config.js index 426a0b435b..102af2a0c4 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -237,6 +237,17 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ + announcementBar: { + id: 'support_us', + content: `⚠ Upgrade to Cadence 1.0
+ The Crescendo network upgrade, including Cadence 1.0, is coming soon. + You may need to update your existing contracts to support this change.
+ Please visit our migration guide here: + https://developers.flow.com/build/cadence-migration-guide`, + backgroundColor: '#fafbfc', + textColor: '#091E42', + isCloseable: false, + }, colorMode: { defaultMode: 'dark', }, diff --git a/src/theme/AnnouncementBar/CloseButton/index.js b/src/theme/AnnouncementBar/CloseButton/index.js new file mode 100644 index 0000000000..7352c3ee2d --- /dev/null +++ b/src/theme/AnnouncementBar/CloseButton/index.js @@ -0,0 +1,20 @@ +import React from 'react'; +import clsx from 'clsx'; +import {translate} from '@docusaurus/Translate'; +import IconClose from '@theme/Icon/Close'; +import styles from './styles.module.css'; +export default function AnnouncementBarCloseButton(props) { + return ( + + ); +} diff --git a/src/theme/AnnouncementBar/CloseButton/styles.module.css b/src/theme/AnnouncementBar/CloseButton/styles.module.css new file mode 100644 index 0000000000..0494ec0d40 --- /dev/null +++ b/src/theme/AnnouncementBar/CloseButton/styles.module.css @@ -0,0 +1,4 @@ +.closeButton { + padding: 0; + line-height: 0; +} diff --git a/src/theme/AnnouncementBar/Content/index.js b/src/theme/AnnouncementBar/Content/index.js new file mode 100644 index 0000000000..a7a8b61b4c --- /dev/null +++ b/src/theme/AnnouncementBar/Content/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import clsx from 'clsx'; +import {useThemeConfig} from '@docusaurus/theme-common'; +import styles from './styles.module.css'; +export default function AnnouncementBarContent(props) { + const {announcementBar} = useThemeConfig(); + const {content} = announcementBar; + return ( +
+ ); +} diff --git a/src/theme/AnnouncementBar/Content/styles.module.css b/src/theme/AnnouncementBar/Content/styles.module.css new file mode 100644 index 0000000000..16635d4b7d --- /dev/null +++ b/src/theme/AnnouncementBar/Content/styles.module.css @@ -0,0 +1,10 @@ +.content { + font-size: 85%; + text-align: center; + padding: 5px 0; +} + +.content a { + color: inherit; + text-decoration: underline; +} diff --git a/src/theme/AnnouncementBar/index.js b/src/theme/AnnouncementBar/index.js new file mode 100644 index 0000000000..d2e6339340 --- /dev/null +++ b/src/theme/AnnouncementBar/index.js @@ -0,0 +1,29 @@ +import React from 'react'; +import {useThemeConfig} from '@docusaurus/theme-common'; +import {useAnnouncementBar} from '@docusaurus/theme-common/internal'; +import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton'; +import AnnouncementBarContent from '@theme/AnnouncementBar/Content'; +import styles from './styles.module.css'; +export default function AnnouncementBar() { + const {announcementBar} = useThemeConfig(); + const {isActive, close} = useAnnouncementBar(); + if (!isActive) { + return null; + } + const {backgroundColor, textColor, isCloseable} = announcementBar; + return ( +
+ {isCloseable &&
} + + {isCloseable && ( + + )} +
+ ); +} diff --git a/src/theme/AnnouncementBar/styles.module.css b/src/theme/AnnouncementBar/styles.module.css new file mode 100644 index 0000000000..f3f2eca539 --- /dev/null +++ b/src/theme/AnnouncementBar/styles.module.css @@ -0,0 +1,55 @@ +:root { + --docusaurus-announcement-bar-height: auto; +} + +.announcementBar { + display: flex; + align-items: center; + height: var(--docusaurus-announcement-bar-height); + background-color: var(--ifm-color-white); + color: var(--ifm-color-black); + + /* + Unfortunately we can't make announcement bar render above the navbar + IE need to use border-bottom instead of shadow + See https://github.com/facebookincubator/infima/issues/275 + + box-shadow: var(--ifm-global-shadow-lw); + z-index: calc(var(--ifm-z-index-fixed) + 1); + */ + border-bottom: 1px solid var(--ifm-color-emphasis-100); +} + +html[data-announcement-bar-initially-dismissed='true'] .announcementBar { + display: none; +} + +.announcementBarPlaceholder { + flex: 0 0 10px; +} + +.announcementBarClose { + flex: 0 0 30px; + align-self: stretch; +} + +.announcementBarContent { + flex: 1 1 auto; +} + +@media print { + .announcementBar { + display: none; + } +} + +@media (min-width: 997px) { + :root { + --docusaurus-announcement-bar-height: auto; + } + + .announcementBarPlaceholder, + .announcementBarClose { + flex-basis: 50px; + } +} From 93095e9ced8deaa423bd47fad2150757a12ecf73 Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:20:57 -0500 Subject: [PATCH 2/5] fix colors --- docusaurus.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 102af2a0c4..3c243f8ac0 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -244,9 +244,9 @@ const config = { You may need to update your existing contracts to support this change.
Please visit our migration guide here: https://developers.flow.com/build/cadence-migration-guide`, - backgroundColor: '#fafbfc', - textColor: '#091E42', - isCloseable: false, + backgroundColor: '#F27360', + textColor: '#585F71', + isCloseable: true, }, colorMode: { defaultMode: 'dark', From 976b07bdf001ee16524c5ae8b76ec5e2221b1dba Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:22:32 -0500 Subject: [PATCH 3/5] fix wording --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 3c243f8ac0..3768c3083e 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -241,7 +241,7 @@ const config = { id: 'support_us', content: `⚠ Upgrade to Cadence 1.0
The Crescendo network upgrade, including Cadence 1.0, is coming soon. - You may need to update your existing contracts to support this change.
+ You most likelike need to update all your contracts/transactions/scripts to support this change.
Please visit our migration guide here: https://developers.flow.com/build/cadence-migration-guide`, backgroundColor: '#F27360', From 1dbea2ee0efc2ec7290832ad6afc976cd862e86b Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:27:50 -0500 Subject: [PATCH 4/5] fix text color --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 3768c3083e..e7e9b5644a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -245,7 +245,7 @@ const config = { Please visit our migration guide here: https://developers.flow.com/build/cadence-migration-guide`, backgroundColor: '#F27360', - textColor: '#585F71', + textColor: '#FFFFFF', isCloseable: true, }, colorMode: { From 1d502e9a2b711aa37aea0e440854de1fdad95b0f Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:34:49 -0500 Subject: [PATCH 5/5] fix typo --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index e7e9b5644a..52098e00a3 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -241,7 +241,7 @@ const config = { id: 'support_us', content: `⚠ Upgrade to Cadence 1.0
The Crescendo network upgrade, including Cadence 1.0, is coming soon. - You most likelike need to update all your contracts/transactions/scripts to support this change.
+ You most likely need to update all your contracts/transactions/scripts to support this change.
Please visit our migration guide here: https://developers.flow.com/build/cadence-migration-guide`, backgroundColor: '#F27360',