@bufferapp/analyze-export-picker
Advanced tools
Comparing version 1.56.0 to 1.74.1
@@ -1,33 +0,53 @@ | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
import PropTypes from "prop-types"; | ||
import Select from "@bufferapp/ui/Select"; | ||
class ExportPicker extends React.Component { | ||
render() { | ||
const { exporting, exportToCSV, exportToPNG, filename } = this.props; | ||
import { Can, Cant, EXPORT } from "@bufferapp/analyze-account"; | ||
import { Button } from '@bufferapp/analyze-shared-components'; | ||
import UpgradeToPro from '@bufferapp/upgrade-to-pro'; | ||
const exportOptions = [ | ||
{ | ||
id: "csv", | ||
title: "Export as CSV", | ||
onItemClick: () => exportToCSV(filename), | ||
}, | ||
{ | ||
id: "png", | ||
title: "Export as Images", | ||
onItemClick: () => exportToPNG(filename), | ||
}, | ||
]; | ||
return ( | ||
<Select | ||
onSelectClick={(selectedItem) => | ||
selectedItem.onItemClick() | ||
} | ||
label={exporting ? "Exporting..." : "Export as..."} | ||
items={exportOptions} | ||
disabled={exporting} | ||
hideSearch | ||
xPosition="right" | ||
/> | ||
); | ||
} | ||
function ExportPicker({ | ||
exporting, | ||
exportToCSV, | ||
exportToPNG, | ||
filename, | ||
}) { | ||
const [showUpgrade, setShowUpgrade] = useState(false); | ||
const exportOptions = [ | ||
{ | ||
id: "csv", | ||
title: "Export as CSV", | ||
onItemClick: () => exportToCSV(filename), | ||
}, | ||
{ | ||
id: "png", | ||
title: "Export as Images", | ||
onItemClick: () => exportToPNG(filename), | ||
}, | ||
]; | ||
return ( | ||
<React.Fragment> | ||
<Can {...{EXPORT}}> | ||
<Select | ||
onSelectClick={(selectedItem) => | ||
selectedItem.onItemClick() | ||
} | ||
label={exporting ? "Exporting..." : "Export as..."} | ||
items={exportOptions} | ||
disabled={exporting} | ||
hideSearch | ||
xPosition="right" | ||
/> | ||
</Can> | ||
<Cant {...{EXPORT}}> | ||
<Button onClick={() => {setShowUpgrade(true)}}>Export as...</Button> | ||
</Cant> | ||
{showUpgrade && <UpgradeToPro | ||
hide={() => {setShowUpgrade(false)}} | ||
title="Unlock Charts Export" | ||
description="Upgrade to get the most out of Buffers Analytics, and unlock PNG and CSV charts export!" | ||
/>} | ||
</React.Fragment> | ||
); | ||
} | ||
@@ -34,0 +54,0 @@ |
@@ -26,2 +26,3 @@ import React from 'react'; | ||
exportPicker: {}, | ||
account: {}, | ||
}); | ||
@@ -28,0 +29,0 @@ const wrapper = mount( |
{ | ||
"name": "@bufferapp/analyze-export-picker", | ||
"version": "1.56.0", | ||
"version": "1.74.1", | ||
"description": "Export Dropdown", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "cc22a98fe20db394dc94c4d849391971fab903f3" | ||
"gitHead": "b4c7c64f1287f4b33ecc792471af2d2f4978d595" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28320
10
172
1