Files
threshold/website/components/downloader/utils/downloader.js
T
dcb609b831 [Website] Public Launch Assembly (#438)
* Reduce hero size for placeholder

* Clean up Sticky Footer

- Increase the specificity of the selector to prevent any accidental
collisions
- Account for the meganav that exists

* [Website] Add Boundary Features section to homepage (#436)

* Install and implement ProductFeaturesList

* Add images and content

* Inline the product features

* [Website] Add use cases section (#445)

* Commit to illustrate UseCases error

* update react image

* Add in content from design

* Tweaks

* Apply handy edits

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>
Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* [Website] Add SectionBreakCta component (#452)

* Create implement barebones component

* Build structure/add content

* Get CSS up to spec

- Typography
- spacing
- Layout
- box-shadow
- Accent line

* Mobile treatment

* Update URL

* Add a break-section to give bg on page

* Change link to outbound

Design is incorrect for this link

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* Reduce CSS selectors

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* [Website] Add branded CTA section (#450)

* Create skeleton for component

* Bring in line with CallToAction styles

* Set up background

* Typography and layout (and mobile)

* Button polish

* Changes to prep for updates

These will keep the homepage ready for component updates 
and the upcoming docs and download pages.

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* Address feedback

- Reduce button hackiness
- Adjust pattern position on mobile to not overlap button

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* Upgrade button, minor tweaks to BrandedCTA (#481)

* Updates dependencies

* [Website] Homepage hero updates (#503)

* Adjustments to align and lay out left side

* Implement hero background

* Adjust hero URLs

* Implement mobile hero pattern/tweaks

* Add video!

* Mobile tweaks

* Remove mobile bg

* Center the text/buttons on mobile

* Remove mobile hero pattern

* Address visual nits

* Adjust interface for video

* [Website] Add "How it works" section (#483)

* Create skeleton and implement component

* Add sections

* Add CSS and adjust structure

* Remove sections ternary

* Change nomenclature for clarity

* Mobile tweaks

* Tweaks inspired by HCP

* Create LogoList component skeleton

* Implement LogoList on main component

- Shift footertext responsibility to it
- Assume logos will be passed in, because it doesn't render otherwise
  anyway with the right checks

* Implement some logos/restructure LogoList

* CSS adjustments to logolist/section layout

* Show example for too many integrations

* Remove cutoff logic

* Add SVGs for diagram stack

* Combine SVGs into a component

This is necessary to act on various parts of the image independently.

* Fully combine SVG and remove unneeded CSS

* Further CSS cleanup

* Implement stickyness

* Set up active example checks for graphic

* Implement reactivity

- Apply styles based on inactivity or activity, whichever fits best
  per-element
- Add expected state to the general HowItWorks component, where it will
  be managed and passed into the diagram
- Make icon and arrow spacers use the same spacer class

* CSS tweaks for design/organization

* Implement scroll-to-animate functionality!

* Fill out icons for integrations

* Feature updates

- Move LogoList into folder
- Give descriptions some margin

* Mobile treatment tweaks

* Import logic from the cloud-platform page on .com

This fixes a bug in which the in-view example would not update in an
expected manner.

* Remove max-width adjustment on UL

* Fix need for height on the graphic

* Padding/margin tweaks

* Minor CSS tweaks

* Final padding adjustments

* Plugging in proper content into the landing page (#545)

* Misc content updates to align with copy doc

* Plug in feature SVGs

* Move use cases up

* Remove the MegaNav - to be replaced soon

* Updates the nav

* Add footer content, security page

* Remove react-mega-nav from styles

* Downloads Page (#541)

* [Website] Add use cases section (#445)

* Commit to illustrate UseCases error

* update react image

* Add in content from design

* Tweaks

* Apply handy edits

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>
Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* Port new downloader page to Boundary

* update placeholder data

* missing css property

* Fix the weird rebase

* Fix padding

Co-authored-by: Noel Quiles <3746694+EnMod@users.noreply.github.com>
Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>
Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* [Website] Add alert banner (#557)

* Bring over waypoint's implementation

* Prove that it works/theme to boundary

* revert to hidden for now

* [Website] README polish (#558)

* Adjust readme for boundary

* Correct URL in first paragraph

* [Website] Add community page (#555)

* Just import files from Consul

* Revert CSS paradigm for VerticalBlockList

* Adds community to the nav

Co-authored-by: Brandon Romano <BrandonRRomano@gmail.com>

* A few small content / bug tweaks (#563)

* adds HashiStackMenu

* Fix platform agnostic copy

* Reduce padding between sections

* Fix Subnav indicator for docs page

* Fix features padding

* Adds Favicon

* Update how it works content

* Adds share image

* Updates use cases

* Styling to community page

* Remove some color overrides

* Add SVGO option to nextconfig (#565)

* Add press kit to footer (#567)

* Plug in proper link for onboard users

* Plug in proper video URL (#584)

* Bump HSM version (#582)

* Downloads Page Content (#585)

* Wire up Boundary Downloads content

* Plug in remaining downloads content

* Download via Product slug

* Tweak with transition timing (#587)

* Plug in proper logo into the downloads page (#589)

* Content tweaks (#590)

* Remove border top from footer (#591)

* More content tweaks (#608)

* Updates the hero to support UI/CLI previews (#609)

* Updates the hero to support UI/CLI previews

* Updates video

* More content tweaks (#634)

* Plugs in light theme UI video

* Update infra as code feature

* Remove Auth (#636)

* Remove auth-related files

* Remove auth-related config

* Remove auth provider and next-auth pkgs

* Remove *env.local from gitignore

* Swtich og:image to have a www subdomain

Co-authored-by: Noel Quiles <3746694+EnMod@users.noreply.github.com>

* Elevate prop destructuring to function call

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>

* Update website/pages/community/index.jsx

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>

Co-authored-by: Noel Quiles <3746694+EnMod@users.noreply.github.com>
Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: Jimmy Merritello <7191639+jmfury@users.noreply.github.com>
2020-10-12 15:56:27 -07:00

124 lines
3.1 KiB
JavaScript

import semverRSort from 'semver/functions/rsort'
import semverPrerelease from 'semver/functions/prerelease'
import semverValid from 'semver/functions/valid'
export function getVersionLabel(version, latestVersion) {
if (version === latestVersion) {
return `${version} (latest)`
}
return version
}
export function sortAndFilterReleases(releases) {
const validReleases = releases.filter(semverValid)
// descending sort on releases, while filtering out pre-releases
return semverRSort(validReleases).filter(
(version) => !semverPrerelease(version)
)
}
/** TODO: Below utils directly from Product-Downloader component.
* Should either be exported, or migrated back to web-components */
export function prettyArch(arch) {
switch (arch) {
case 'all':
return 'Universal (32 and 64-bit)'
case 'i686':
case 'i386':
case '686':
case '386':
return '32-bit'
case 'x86_64':
case '86_64':
case 'amd64':
return '64-bit'
default:
if (/-/.test(arch)) {
const parts = arch.split(/-(.+)/)
return `${prettyArch(parts[0])} (${parts[1]})`
} else {
const parts = arch.split('_')
if (parts.length > 0) {
return (
parts[parts.length - 1].charAt(0).toUpperCase() +
parts[parts.length - 1].slice(1)
)
}
}
}
}
export function detectOs(platform) {
for (let key in platformMap) {
if (platform.indexOf(key) !== -1) {
return platformMap[key]
}
}
return null
}
export function prettyOs(os) {
switch (os) {
case 'darwin':
return 'Mac OS X'
case 'freebsd':
return 'FreeBSD'
case 'openbsd':
return 'OpenBSD'
case 'netbsd':
return 'NetBSD'
case 'archlinux':
return 'Arch Linux'
case 'linux':
return 'Linux'
case 'windows':
return 'Windows'
default:
return os.charAt(0).toUpperCase() + os.slice(1)
}
}
const platformMap = {
Mac: 'darwin',
Win: 'windows',
Linux: 'linux',
}
export function sortPlatforms(releaseData) {
// first we pull the platforms out of the release data object and format it the way we want
const platforms = releaseData.builds.reduce((acc, build) => {
if (!acc[build.os]) acc[build.os] = {}
acc[build.os][build.arch] = build.url
return acc
}, {})
const platformKeys = Object.keys(platforms)
// create array of sorted values to base the order on
const sortedValues = Object.keys(platformMap)
.map((e) => platformMap[e])
// join the lists together to make sure
// all items are accounted for when sorting
.concat(platformKeys)
// filter our any duplicates and unneeded items
.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos && platformKeys.indexOf(elem) > -1
})
return (
platformKeys
// sort items based on platformMap order
.sort((a, b) => {
return sortedValues.indexOf(a) - sortedValues.indexOf(b)
})
// create new sorted object to return
.reduce((result, key) => {
result[key] = platforms[key]
return result
}, {})
)
}