Skip to content

Commit db8b85a

Browse files
Merge pull request #4267 from JoinColony/fix/16282689-upgrade-colony-version-banner
fix: display upgrade colony version banner
2 parents 7538ea5 + 779c6e9 commit db8b85a

4 files changed

Lines changed: 29 additions & 15 deletions

File tree

src/components/frame/Extensions/layouts/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const useCalamityBannerInfo = (): UseCalamityBannerInfoReturnType => {
3434
{
3535
key: '1',
3636
linkProps: {
37-
to: 'https://docs.colony.io/use/advanced-features/upgrade-colony-and-extensions',
37+
to: 'https://github.com/JoinColony/colonyNetwork/releases',
3838
text: formatText({ id: 'learn.more' }),
3939
},
4040
buttonProps: {

src/components/v5/common/ActionSidebar/partials/ActionSidebarContent/partials/SidebarBanner.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Extension } from '@colony/colony-js';
2-
import { CheckCircle, WarningCircle } from '@phosphor-icons/react';
2+
import { WarningCircle, PushPin } from '@phosphor-icons/react';
33
import React, { type FC } from 'react';
44
import { useFormContext } from 'react-hook-form';
55
import { FormattedMessage, defineMessages } from 'react-intl';
@@ -28,8 +28,18 @@ const MSG = defineMessages({
2828
defaultMessage:
2929
'The {extensionName} extension is missing some or all of the permissions it needs to work.',
3030
},
31+
newVersionInfo: {
32+
id: `${displayName}.newVersionInfo`,
33+
defaultMessage: `{isNewAvailable, select, true {New version available. View release notes for version details.} other {You are already on the latest version of Colony Network.}}`,
34+
},
35+
viewReleaseNotes: {
36+
id: `${displayName}.viewReleaseNotes`,
37+
defaultMessage: 'View release notes',
38+
},
3139
});
3240

41+
const RELEASE_NOTES = 'https://github.com/JoinColony/colonyNetwork/releases';
42+
3343
export const SidebarBanner: FC = () => {
3444
const { watch } = useFormContext();
3545
const [selectedAction, decisionMethod] = watch([
@@ -60,9 +70,6 @@ export const SidebarBanner: FC = () => {
6070
const canUpgrade = canColonyBeUpgraded(colony, colonyContractVersion);
6171
const isFieldDisabled = useIsFieldDisabled();
6272

63-
const showVersionUpToDateNotification =
64-
selectedAction === Action.UpgradeColonyVersion && !canUpgrade;
65-
6673
return (
6774
<>
6875
{selectedAction && (
@@ -82,13 +89,21 @@ export const SidebarBanner: FC = () => {
8289
</NotificationBanner>
8390
</div>
8491
))}
85-
{showVersionUpToDateNotification && (
86-
<div className="mt-6">
87-
<NotificationBanner icon={CheckCircle} status="success">
88-
<FormattedMessage id="actionSidebar.upToDate" />
89-
</NotificationBanner>
90-
</div>
91-
)}
92+
<div className="mt-6">
93+
<NotificationBanner
94+
icon={PushPin}
95+
status="success"
96+
callToAction={
97+
<a href={RELEASE_NOTES} target="_blank" rel="noreferrer">
98+
{formatText(MSG.viewReleaseNotes)}
99+
</a>
100+
}
101+
>
102+
{formatText(MSG.newVersionInfo, {
103+
isNewAvailable: canUpgrade,
104+
})}
105+
</NotificationBanner>
106+
</div>
92107
</>
93108
);
94109
};

src/i18n/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@
11331133
"actionSidebar.amount": "Amount",
11341134
"actionSidebar.value": "Value",
11351135
"actionSidebar.currentVersion": "Current version",
1136-
"actionSidebar.upToDate": "Your Colony version is up to date",
11371136
"actionSidebar.newVersion": "New version",
11381137
"actionSidebar.notEnoughMembersWithPermissions": "There are not enough members in this or higher teams with the required permissions to approve this action. Select a different team, or assign more users with the required multi-sig permissions.",
11391138
"actionSidebar.availableTokens": "Available tokens",

src/stories/common/CalamityBanner.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const calamityBannerItems: CalamityBannerItemProps[] = [
77
{
88
key: '1',
99
linkProps: {
10-
to: 'https://docs.colony.io/use/advanced-features/upgrade-colony-and-extensions',
10+
to: 'https://github.com/JoinColony/colonyNetwork/releases',
1111
text: 'Learn more',
1212
},
1313
buttonProps: {
@@ -21,7 +21,7 @@ const calamityBannerItems: CalamityBannerItemProps[] = [
2121
{
2222
key: '2',
2323
linkProps: {
24-
to: 'https://docs.colony.io/use/advanced-features/upgrade-colony-and-extensions',
24+
to: 'https://github.com/JoinColony/colonyNetwork/releases',
2525
text: 'Learn more',
2626
},
2727
buttonProps: {

0 commit comments

Comments
 (0)