Skip to content

Commit

Permalink
Initiated chart home page
Browse files Browse the repository at this point in the history
  • Loading branch information
Saif-Uz-Zaman committed Dec 6, 2023
1 parent bcfdb66 commit 6d7af46
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _site
token: ${{secrets.ACCESS_TOKEN}}
- name: Publish Charts
uses: J12934/helm-gh-pages-action@master
with:
Expand Down
26 changes: 26 additions & 0 deletions _site/HELM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions _site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<title>Ever Helm Charts</title>
<!-- Bootstrap core CSS -->
<link href="https://getbootstrap.com/docs/5.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}

@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>


</head>

<body>
<main>

<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<h1 class="fw-light">Ever Helm Charts</h1>
<p class="lead text-muted">Ever-Gauzy An Open Business Management Platform for Collaborative, On-Demand and
Sharing Economies.</p>
</div>
</div>
</section>

<div class="album py-5 bg-light">
<div class="container">

<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3" id="cardContainer">

</div>
<br>
<hr>
<div id="output"></div>
</div>
</div>



</main>

<footer class="text-muted py-5">
<div class="container">
<p class="float-end mb-1">
<a href="#">Back to top</a>
</p>
<p class="mb-1"> <strong>Copyright &copy;</strong> 2023-present Ever Co. LTD. <strong> All Rights Reserved
</strong> </p>
<p class="mb-1 mt-4">*All product names, logos, and brands are the property of their respective owners. All
company, product and service names used in this website are for identification purposes only. Use of these
names, logos, and brands does not imply endorsement.</p>
</div>
</footer>


<script src="https://getbootstrap.com/docs/5.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.14.1/js-yaml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/11.0.0/marked.min.js"></script>
<script>
const yamlFilePath = 'index.yaml';

function loadYAMLFile(filePath, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
const yamlData = xhr.responseText;
const jsonData = jsyaml.load(yamlData);

callback(null, jsonData);
} else {
callback("Error loading YAML file", null);
}
}
};
xhr.open("GET", filePath, true);
xhr.send();
}


function createCard(chart, chartDescription, chartVersion) {
chartName = chart.split("-").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" ")
const cardHtml = `
<div class="col">
<div class="card" style="width: 18rem;">
<img src="./HELM.svg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">${chartName}</h5>
<p class="card-text">${chartDescription}</p>
<p class="card-text"> <strong> Current Version: ${chartVersion} </strong> </p>
<button onclick="convertMarkdownToHTML('${chart}')" class="btn btn-primary">Details</button>
</div>
</div>
</div>
`
return cardHtml
}


function convertMarkdownToHTML(chart) {
var mdFilePath = `https://raw.githubusercontent.com/ever-co/ever-charts/main/charts/${chart}/README.md`

fetch(mdFilePath)
.then(response => {
if (!response.ok) {
throw new Error('Failed to load Markdown file');
}
return response.text();
})
.then(markdownContent => {
var htmlContent = marked.marked(markdownContent);
document.getElementById('output').innerHTML = htmlContent;
})
.catch(error => {
console.error('Error:', error);
});
}


loadYAMLFile(yamlFilePath, function (error, data) {
if (error) {
console.error(error);
} else {
Object.keys(data.entries).forEach(entry => {
const container = document.getElementById('cardContainer');
chartDescription = data.entries[entry][0]["description"]
chartVersion = data.entries[entry][0]["version"]
const cardHtml = createCard(entry, chartDescription, chartVersion)
container.innerHTML += cardHtml
})
}
});
</script>
</body>

</html>

0 comments on commit 6d7af46

Please sign in to comment.