Skip to content

Commit

Permalink
changed baner to docs survey
Browse files Browse the repository at this point in the history
  • Loading branch information
LandauRaz committed Nov 11, 2024
2 parents d716e1a + cb399db commit 20e959a
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 11 deletions.
Binary file removed build/ui-bundle.zip
Binary file not shown.
14 changes: 11 additions & 3 deletions src/css/dev-survey-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ background-color: #A4A4EA;
}

.top-announcement-bar {
display: grid;
justify-content: center;
align-items: center;
width: 100%;
Expand All @@ -14,12 +15,12 @@ background-color: #A4A4EA;
/* background-color: var(--bg-banner); */
margin: auto;
/* margin: auto;*/
width: 50%;
/* width: 50%; */
}

.d-flex {
/* .d-flex {
display: flex;
}
} */

p.announcement-bar-title {
/* color: var(--text-primary-inverted); */
Expand All @@ -29,6 +30,11 @@ p.announcement-bar-title {
/* margin-left: auto;*/
}

.body-large-strong {
font: 600 18px/1.5 "Inter", sans-serif;
/* font: 600 14px/1.5 var(--font-Inter);*/
}

.body-xsmall-strong {
font: 600 14px/1.5 "Inter", sans-serif;
/* font: 600 14px/1.5 var(--font-Inter);*/
Expand All @@ -42,6 +48,8 @@ a.announcement-bar-cta {
background-color: #1B1B1B;
border-radius: 8px;
text-align: center;
margin-bottom: 6px;
text-decoration: none;
}

button.top-ann-bar-close {
Expand Down
14 changes: 11 additions & 3 deletions src/css/dev-survey-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ background-color: #0C0C4F;
}

.top-announcement-bar {
display: grid;
justify-content: center;
align-items: center;
width: 100%;
Expand All @@ -14,12 +15,12 @@ background-color: #0C0C4F;
/* background-color: var(--bg-banner); */
margin: auto;
/* margin: auto;*/
width: 50%;
/* width: 50%; */
}

.d-flex {
/* .d-flex {
display: flex;
}
} */

p.announcement-bar-title {
/* color: var(--text-primary-inverted); */
Expand All @@ -29,6 +30,11 @@ p.announcement-bar-title {
/* margin-left: auto;*/
}

.body-large-strong {
font: 600 18px/1.5 "Inter", sans-serif;
/* font: 600 14px/1.5 var(--font-Inter);*/
}

.body-xsmall-strong {
font: 600 14px/1.5 "Inter", sans-serif;
/* font: 600 14px/1.5 var(--font-Inter);*/
Expand All @@ -42,6 +48,8 @@ a.announcement-bar-cta {
background-color: #FFFFFF;
border-radius: 8px;
text-align: center;
margin-bottom: 6px;
text-decoration: none;
}

button.top-ann-bar-close {
Expand Down
2 changes: 1 addition & 1 deletion src/css/nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
top: calc(var(--navbar-height) + var(--toolbar-height));
box-shadow: none;
position: sticky;
height: calc(var(--nav-height--desktop) - var(--footer-height));
height: calc(var(--nav-height--desktop));
}
.nav-panel-menu {
overflow-y: auto;
Expand Down
1 change: 1 addition & 0 deletions src/partials/article.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{!-- {{> contributors}} --}}
{{{page.contents}}}
{{/if}}
{{> pagination}}
Expand Down
189 changes: 189 additions & 0 deletions src/partials/contributors.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<style>
.page-meta-container {
position: relative;
}
.page-meta {
display: flex;
justify-content: flex-end;
align-items: center;
background-color: #fff;
padding: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.last-edit, .contributors {
font-family: Inter, sans-serif;
font-size: .83333rem;
color: #6b7280;
display: flex;
align-items: center;
}
.last-edit-info {
display: flex;
align-items: center;
justify-content: center;
}
.last-edit-info img {
margin-right: 8px;
}
.contributors {
margin-left: 10px;
border-radius: 0.5rem;
}
.contributors-dialog {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
border: 1px solid #ccc;
border-radius: 0.5rem;
padding: 20px;
z-index: 1000;
max-height: 80vh;
overflow: hidden;
}
.contributors-dialog.active {
display: block;
}
.contributors-list {
max-height: 60vh;
overflow-y: auto;
padding-right: 10px;
}
.contributor-item {
display: flex;
align-items: center;
justify-content: flex-start;
margin-bottom: 10px;
}
.contributor-item img {
margin-right: 10px;
vertical-align: middle;
}
.dialog-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
}
.dialog-overlay.active {
display: block;
}
.contributors-button {
border-radius: 0.5rem;
}
</style>

<div class="page-meta-container">
<div class="page-meta">
<div class="last-edit">
<span id="last-edit-info" class="last-edit-info">Last edit</span>
</div>
<div class="contributors">
<button id="show-contributors" class="contributors-button">All contributors</button>
</div>
</div>
</div>

<div class="dialog-overlay" id="overlay"></div>
<div class="contributors-dialog" id="contributors-dialog">
<h2>Contributors</h2>
<div id="contributors-list" class="contributors-list"></div>
<button id="close-dialog" class="contributors-button">Close</button>
</div>

<script>
document.addEventListener('DOMContentLoaded', async function() {
// Extract repo and path information from editUrl
const editUrl = '{{ page.editUrl }}';
const urlParts = editUrl.split('/');
const repoOwner = urlParts[3];
const repoName = urlParts[4];
const filePath = urlParts.slice(7).join('/');
// Fetch commit information
async function fetchAllCommits() {
const commitsUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/commits?path=${filePath}`;
const headers = new Headers();
const response = await fetch(commitsUrl, { headers: headers });
const commits = await response.json();
if (commits.length > 0) {
return commits;
}
return null;
}
const allCommits = await fetchAllCommits();
if (allCommits) {
const lastCommit = allCommits[0];
const author = lastCommit.commit.author;
const authorUrl = lastCommit.author.html_url;
const avatarUrl = lastCommit.author.avatar_url;
const login = lastCommit.author.login;
const lastEditInfo = document.getElementById('last-edit-info');
lastEditInfo.innerHTML = `
<img src="${avatarUrl}" alt="${login}" width="32" height="32">
<span>Last edit:</span>
<a href="${authorUrl}" target="_blank">&nbsp;@${login}&nbsp;</a>
<span>${new Date(author.date).toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' })}</span>
`;
}
// Fetch contributors list and show in dialog
document.getElementById('show-contributors').addEventListener('click', async function() {
if (allCommits) {
// Extract unique contributors from commits
const contributors = allCommits.reduce((uniqueContributors, commit) => {
if (commit.author == null) {
return uniqueContributors;
}
const contributor = {
login: commit.author.login,
avatarUrl: commit.author.avatar_url,
htmlUrl: commit.author.html_url
};
if (!uniqueContributors.some(c => c.login === contributor.login)) {
uniqueContributors.push(contributor);
}
return uniqueContributors;
}, []);
const list = document.getElementById('contributors-list');
list.innerHTML = '';
contributors.forEach(contributor => {
const div = document.createElement('div');
div.className = 'contributor-item';
div.innerHTML = `
<img src="${contributor.avatarUrl}" alt="${contributor.login}" width="32" height="32">
<a href="${contributor.htmlUrl}" target="_blank">${contributor.login}</a>
`;
list.appendChild(div);
});
}
// Show the dialog
document.getElementById('contributors-dialog').classList.add('active');
document.getElementById('overlay').classList.add('active');
});
// Close dialog
document.getElementById('close-dialog').addEventListener('click', function() {
document.getElementById('contributors-dialog').classList.remove('active');
document.getElementById('overlay').classList.remove('active');
});
// Close dialog on overlay click
document.getElementById('overlay').addEventListener('click', function() {
document.getElementById('contributors-dialog').classList.remove('active');
document.getElementById('overlay').classList.remove('active');
});
});
</script>

4 changes: 2 additions & 2 deletions src/partials/developer_survey_link.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="background">
<div class="top-announcement-bar d-flex">
<p class="announcement-bar-title body-xsmall-strong">Starknet Annual Developer Survey</p>
<a class="announcement-bar-cta body-xsmall-strong" href="https://forms.reform.app/starkware/starknet-developer-survey" target="_blank"> Make yourself heard </a>
<p class="announcement-bar-title body-large-strong">📣 The Starknet Docs survey is live! 📣</p>
<a class="announcement-bar-cta body-xsmall-strong" href="https://forms.reform.app/starkware/starknet-docs-survey/9odpkk" target="_blank"> Click here to make your voice heard 🗳️</a>
<!--
<button class="top-ann-bar-close">
<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
Expand Down
2 changes: 1 addition & 1 deletion src/partials/footer-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="vertical-divider desktop-only"></div> --}}
<p>Built with ✨ by the Starknet community</p>
</div>
<div class="footer-network-info">{{> starknet_version}}</div>
{{!-- <div class="footer-network-info">{{> starknet_version}}</div> --}}
<!-- <div class="community-section">
<p class="community-section__text">Follow Lisk on: </p>
<div class="community-section__icons"> -->
Expand Down
1 change: 1 addition & 0 deletions src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<script async src="{{{uiRootPath}}}/js/vendor/tabs-block-behaviour.js?new"></script>
<script async src="{{{uiRootPath}}}/js/vendor/swagger-ui.js?new"></script>
<script async src="{{{uiRootPath}}}/js/vendor/component-versions.js?new"></script>
<script src="https://chatwith.tools/chatbot/04f9f1da-f9bd-46c1-a74d-b72cec2014ea.js" async=""></script>
<script src="{{uiRootPath}}/js/vendor/custom.js?new"></script>
<script async src="{{{uiRootPath}}}/js/vendor/tabs.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
2 changes: 1 addition & 1 deletion src/partials/footer.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{> footer-content}}
{{!-- {{> footer-content}} --}}
{{> footer-scripts}}
{{> algolia-scripts}}
9 changes: 9 additions & 0 deletions src/partials/header-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
<div class="navbar-item">
<a class="navbar-link" href="https://starknet.io/building-on-starknet/tutorials/" target="_blank">Tutorials</a>
</div>
<div class="navbar-item">
<a class="navbar-link" href="https://twitter.com/@Starknet" target="_blank">Twitter</a>
</div>
<div class="navbar-item">
<a class="navbar-link" href="https://starknet.io/discord" target="_blank">Discord</a>
</div>
<div class="navbar-item">
<a class="navbar-link" href="https://github.com/starknet-io/starknet-docs" target="_blank">GitHub</a>
</div>
<div class="theme-toggle-container">
<button onclick="switch_style('toggle')" id="theme-toggle" class="theme-toggle navbar-item"></button>
</div>
Expand Down
Binary file removed ui-bundle.zip
Binary file not shown.

0 comments on commit 20e959a

Please sign in to comment.