Skip to content

Commit

Permalink
Replace email modal with grant application
Browse files Browse the repository at this point in the history
  • Loading branch information
Janaka-Steph committed Jan 31, 2024
1 parent f728184 commit 5464c7f
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 726 deletions.
46 changes: 27 additions & 19 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,35 @@ parse:
{{ '```{committers} ' + env.docname + '.md\n```' }}
<div id="email-modal" class="modal">
<iframe name="ghost-result" style="display: none;"></iframe>
<form class="modal-content" method="post" action="https://state-of-open-source-ai.vercel.app/api/add-member" target="ghost-result" novalidate="">
<img src="https://static.premai.io/book/book-cover.jpg" alt="book cover" />
<div id="grant-modal" class="modal">
<div class="modal-content">
<div class="header">
<h1>Apply for our a Generative AI Startup Program</h1>
<button class="close" onclick="modalButtonClose()">
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.85632 5.64645L6.50277 6L6.85632 6.35355L11.3815 10.8787C11.4448 10.9455 11.4798 11.0343 11.479 11.1264C11.4781 11.2197 11.4407 11.3089
11.3748 11.3748C11.3089 11.4407 11.2197 11.4781 11.1264 11.479C11.0343 11.4798 10.9455 11.4448 10.8787 11.3815L6.35355 6.85632L6 6.50277L5.64645 6.85632L1.11754
11.3852L1.11749 11.3852L1.11145 11.3914C1.07864 11.4254 1.0394 11.4525 0.996011 11.4711C0.952617 11.4898 0.905949 11.4996 0.858732 11.5C0.81151 11.5004 0.764679
11.4914 0.720971 11.4735C0.677266 11.4556 0.637558 11.4292 0.604165 11.3958C0.570773 11.3624 0.544365 11.3227 0.526484 11.279C0.508601 11.2353 0.499603 11.1885
0.500013 11.1413C0.500424 11.094 0.510235 11.0474 0.528873 11.004C0.547512 10.9606 0.574606 10.9214 0.608573 10.8886L0.608625 10.8886L0.614771 10.8825L5.14368 6.35355L5.49723
6L5.14368 5.64645L0.618506 1.12127C0.55521 1.05447 0.520241 0.96569 0.521042 0.873579C0.521852 0.780331 0.559254 0.691132 0.625193 0.625193C0.691132 0.559254 0.780331 0.521852
0.873579 0.521042C0.96569 0.520241 1.05447 0.55521 1.12127 0.618506L5.64645 5.14368L6 5.49723L6.35355 5.14368L10.8825 0.614771L10.8825 0.614824L10.8886 0.608573C10.9214 0.574606
10.9606 0.547512 11.004 0.528874C11.0474 0.510235 11.094 0.500424 11.1413 0.500013C11.1885 0.499603 11.2353 0.508601 11.279 0.526483C11.3227 0.544365 11.3624 0.570773 11.3958
0.604165C11.4292 0.637558 11.4556 0.677266 11.4735 0.720971C11.4914 0.764679 11.5004 0.81151 11.5 0.858732C11.4996 0.905949 11.4898 0.952617 11.4711 0.996008C11.4525 1.0394 11.4254
1.07864 11.3914 1.11145L11.3914 1.11139L11.3852 1.11754L6.85632 5.64645Z" fill="#878787" stroke="#878787"/>
</svg>
</button>
</div>
<img src="https://static.premai.io/book/grant.png" alt="grant cover" />
<div class="modal-text">
<h1>Enter your email to access this book for free</h1>
<p>
We&rsquo;ll send you updates whenever we make major changes<br />
(no spam nor giving your email to anyone else).
</p>
<div class="input-container">
<input type="email" id="email-input" name="email" placeholder="Enter your email..." />
<button type="submit" id="email-submit" class="button" onclick="emailButtonClick()">Subscribe</button>
</div>
<p>
This book is open source; you can also read &amp; contribute at<br />
<a href="https://github.com/premAI-io/state-of-open-source-ai" target="_blank"><i class="fa-brands fa-github"></i>&nbsp;premAI-io/state-of-open-source-ai</a>.
</p>
<span class="email-error"></span>
<ul>
<li>Free usage of OpenAl, Anthropic, Cohere, Llama2, and Mistral APIs for 6 months.</li>
<li>Free Fine-tuning jobs for both closed and open-source models.</li>
<li>Free Models Deployment Made Effortless.</li>
</ul>
<a class="btn-apply" href="https://blog.premai.io/announcing-our-startup-grants-program/" target="_blank">Apply Here</a>
</div>
</form>
</div>
</div>
myst_enable_extensions: # https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
# needs myst-parser>=0.19 <- https://github.com/executablebooks/MyST-NB/issues/530
Expand Down
136 changes: 0 additions & 136 deletions _static/emails.css

This file was deleted.

53 changes: 0 additions & 53 deletions _static/emails.js

This file was deleted.

91 changes: 91 additions & 0 deletions _static/modal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.modal {
display: none;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
display: flex;
flex-direction: column;
margin: 15% auto;
width: 42vw;
padding: 80px 40px;
background-color: rgba(20, 20, 20, 1);
box-shadow: 0 0 22px 1px black;
gap: 30px;
align-items: center;
}

@media only screen and (max-width: 480px) {
.modal-content {
width: 90vw !important;
flex-direction: column !important;
}
}

@media only screen and (min-width: 481px) and (max-width: 1022px) {
.modal-content {
width: 70vw !important;
flex-direction: column !important;
}
}

.modal-content img {
width: 100%;
}

.modal-content .header {
width: 100%;
display: flex;
justify-content: space-between;
}

.modal-content .header button.close {
background: transparent;
border: none;
margin-left: 10px;
}

.modal-content .btn-apply {
float: right;
color: white;
border: none;
text-align: center;
font-size: 0.8rem;
font-style: normal;
font-weight: 600;
line-height: 24px;
border-radius: 6px;
background: #F17B74;
padding: 10px 24px;
text-decoration: none;
}

.modal-content .btn-apply:hover {
color: rgba(255, 255, 255, 0.85);
}

.modal-content h1 {
color: #878787;
font-size: 1.3rem;
font-style: normal;
font-weight: bold;
line-height: normal;
margin-bottom: 0;
}

.modal-content ul {
padding-inline-start: 1rem;
}

.modal-content li {
color: #878787;
font-size: 1rem;
font-style: normal;
font-weight: 600;
line-height: 26px;
}
35 changes: 35 additions & 0 deletions _static/modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/// set/get helpers based on https://www.w3schools.com/js/js_cookies.asp
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
document.cookie = cname + "=" + cvalue + ";expires=" + d.toUTCString() + ";SameSite=Strict;path=/";
}

function getCookie(cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return "";
}

function modalButtonClose() {
let modal = document.getElementById('grant-modal');
modal.style.display = 'none';
setCookie("grant-modal", true, 365); // might fail if cookies disabled
}

document.addEventListener('DOMContentLoaded', function() {
let modal = document.getElementById('grant-modal');
let grantModal = getCookie("grant-modal");
if (grantModal === false || grantModal === "" || grantModal === null) {
modal.style.display = 'block';
}
});
2 changes: 0 additions & 2 deletions backend/.gitignore

This file was deleted.

Loading

0 comments on commit 5464c7f

Please sign in to comment.