-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up PageBannerPortal and how /account/payment uses it
- Loading branch information
Showing
4 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,55 @@ | ||
import * as React from 'react'; | ||
|
||
const sunsetStartEnv = process.env.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START ?? '2023-01-09T00:00:00Z'; | ||
const sunsetStartDate = new Date(Date.parse(sunsetStartEnv)); | ||
|
||
/** | ||
* If this isn't set, no announcements will appear | ||
*/ | ||
const sunsetAnnouncementStartEnv = process.env.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START; | ||
|
||
/** | ||
* after this datetime, show announcements that web3.storage is sunset | ||
* and end-users should switch to w3up/console.web3.storage | ||
*/ | ||
const sunsetAnnouncementStartDate = sunsetAnnouncementStartEnv | ||
? new Date(Date.parse(sunsetAnnouncementStartEnv)) | ||
: undefined; | ||
|
||
export const w3upLaunchContextDefaults = { | ||
stages: { | ||
sunsetAnnouncement: { | ||
start: sunsetAnnouncementStartDate, | ||
}, | ||
}, | ||
}; | ||
|
||
/** | ||
* Return whether sunset announcements related to w3up-launch should be shown. | ||
* An announcement date must be explicitly configured via env var, and now must be after that date. | ||
* @param {Date} at - time at which to return whether to show the announcement | ||
* @param {Date|undefined} [announcementStartDate] - when to begin showing announcements. | ||
* If not provided, always return false. | ||
*/ | ||
export const shouldShowSunsetAnnouncement = (at = new Date(), announcementStartDate = sunsetAnnouncementStartDate) => { | ||
return announcementStartDate && at > announcementStartDate; | ||
}; | ||
|
||
/** | ||
* copy for banner message across top of some web3.storage pages when w3up ships | ||
*/ | ||
export const W3upMigrationRecommendationCopy = () => { | ||
console.log('rendering W3upMigrationRecommendationCopy', w3upLaunchContextDefaults); | ||
const createNewAccountHref = 'https://console.web3.storage/?intent=create-account'; | ||
const learnWhatsNewHref = 'https://console.web3.storage/?intent=learn-new-web3storage-experience'; | ||
const sunsetDateFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }); | ||
return ( | ||
<> | ||
This web3.storage product will sunset on January 9, 2024. We recommend migrating your usage of web3.storage to the | ||
new web3.storage. <a href={createNewAccountHref}>Click here to create a new account</a> and | ||
This web3.storage product will sunset on {sunsetDateFormatter.format(sunsetStartDate)}. We recommend migrating | ||
your usage of web3.storage to the new web3.storage. | ||
<br /> | ||
<a href={createNewAccountHref}>Click here to create a new account</a> and | ||
<a href={learnWhatsNewHref}>here to read about what’s awesome</a> about the new web3.storage experience. | ||
</> | ||
); | ||
}; | ||
|
||
const prelaunchStartEnv = process.env.NEXT_PUBLIC_W3UP_PRELAUNCH_START; | ||
|
||
export const w3upLaunchContextDefaults = { | ||
stages: { | ||
prelaunch: { | ||
start: prelaunchStartEnv ? new Date(Date.parse(prelaunchStartEnv)) : undefined, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters