Skip to content

Commit

Permalink
Merge branch 'master' into fix/dynamicImport
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalvivekm authored Dec 4, 2024
2 parents e1087f5 + 271c726 commit 7406b09
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 301 deletions.
82 changes: 35 additions & 47 deletions .github/workflows/feature-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ name: Feature List

on:
workflow_dispatch:
inputs:
spreadsheet_uri:
description: 'Link of the spreadsheet containing subscription details.'
type: string
required: true
schedule:
- cron: '0 0 * * *'
- cron: '30 0 * * *'

permissions:
contents: write
Expand All @@ -18,7 +13,8 @@ jobs:
trigger-feature-list:
runs-on: ubuntu-latest
env:
FEATURES_FILE: 'feature_data.json'
FEATURES_FILE: 'src/sections/Pricing/feature_data.json'
SPREADSHEET_URL: 'http://docs.google.com/spreadsheets/d/1Ck_5q7U_vLSIDTtplugG3pCVC5zugXgTHtO7T7-yL8g/export?format=csv&gid=829069645&single=true&output=csv'

steps:
- name: Checkout current repository
Expand All @@ -32,47 +28,39 @@ jobs:
key: feature-data-sha
restore-keys: |
feature-data-sha
- name: Check for updates in source repository
id: check-updates
uses: actions/github-script@v7
- name: Install Node.js
uses: actions/setup-node@v3
with:
script: |
const { data: sourceFile } = await github.rest.repos.getContent({
owner: 'layer5labs',
repo: 'meshery-extensions-packages',
path: 'feature_data.json',
ref: 'master'
});
// Store the latest commit SHA
const latestSHA = sourceFile.sha;
const fs = require('fs');
// Check if we have a previous SHA
let hasUpdates = true;
const shaCachePath = '.sha-cache/latest-sha';
if (fs.existsSync(shaCachePath)) {
const lastSHA = fs.readFileSync(shaCachePath, 'utf8');
hasUpdates = lastSHA !== latestSHA;
}
if (hasUpdates) {
// Save the new SHA
fs.mkdirSync('.sha-cache', { recursive: true });
fs.writeFileSync(shaCachePath, latestSHA);
// Decode and save the content
const content = Buffer.from(sourceFile.content, 'base64').toString('utf8');
// Write the new content
fs.writeFileSync(process.env.FEATURES_FILE, content);
core.setOutput('has-updates', 'true');
} else {
core.setOutput('has-updates', 'false');
}
node-version: 18

- name: Install dependencies
run: |
npm install csvtojson --legacy-peer-deps
- name: Fetch spreadsheet and check for updates
run: |
# Download the spreadsheet
curl -L $SPREADSHEET_URL -o spreadsheet.csv
# Generate a SHA hash of the file
sha256sum spreadsheet.csv > .sha-cache/latest-sha
# Compare the hash with the previously stored hash
if [ -f ".sha-cache/last-sha" ] && cmp --silent .sha-cache/latest-sha .sha-cache/last-sha; then
echo "No updates detected."
echo "has-updates=false" >> $GITHUB_OUTPUT
else
echo "Updates detected. Processing..."
cp .sha-cache/latest-sha .sha-cache/last-sha
# Convert CSV to JSON (Assume a script or tool to do this is present)
node -e "
const fs = require('fs');
const csv = require('csvtojson');
csv()
.fromFile('spreadsheet.csv')
.then(json => fs.writeFileSync(process.env.FEATURES_FILE, JSON.stringify(json, null, 2)));
"
echo "has-updates=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.check-updates.outputs.has-updates == 'true'
Expand Down
58 changes: 43 additions & 15 deletions src/components/PlanCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,55 @@ const PlanCard = ({ planData }) => {
return (
<PlanCardWrapper>
<Container>
<Row $Hcenter={true}>
<Row $Hcenter>
{planData.map((x) => (
<Col lg={4} md={6} key={x.tier}>
<div className={`${x.featured ? "featured" : ""} pricing-table`}>
{x.featured && <div className="pricing-label">Free Forever</div>}
<div className="pricing_coming_soon">
{x.pricing_coming_soon}
</div>

{x.tier === "Personal" ? <div className="pricing-label">Free Forever</div> : null}

{x.pricing_coming_soon && (
<div className="pricing_coming_soon">
{x.pricing_coming_soon}
</div>
)}

<h2>{x.tier}</h2>
<h5 className="byline">{x.byline}</h5>
<div className="pricing-features">
{x.summary && x.summary.map((t) => (
<div className="feature" key={t.id}>
<FeatureDetails
category={t.category}
description={t.description}
tier={t.tier}
/>

<div className="price-container">
{x.monthlyprice !== undefined ? (
<div className="price">
<span className="currency-symbol">$</span>
<span className="price-value">
{x.monthlyprice === 0
? "0"
: x.monthlyprice.toFixed(0)}
</span>
<span className="price-text">
USD <sup className="usd-sup">per user/month</sup>
</span>
</div>
))}
) : (
<div className="pricing_coming_soon">
{x.pricing_coming_soon}
</div>
)}
</div>

<div className="pricing-features">
{x.summary &&
x.summary.map((t) => (
<div className="feature" key={t.id}>
<FeatureDetails
category={t.category}
description={t.description}
tier={t.tier}
/>
</div>
))}
</div>

<Button
$primary
className={
Expand All @@ -53,4 +81,4 @@ const PlanCard = ({ planData }) => {
);
};

export default PlanCard;
export default PlanCard;
Loading

0 comments on commit 7406b09

Please sign in to comment.