Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh log #8

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions examples/github_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from splashgen import launch
from splashgen.components import SplashSite
from splashgen.integrations import GithubSignin

site = SplashSite(title="Splashgen - Splash Pages Built In Python",
theme="dark")
site.headline = "Build your splash page in python effortlessly"
site.subtext = """
In less than 20 lines of python, create clean and beautiful splash pages with
Splashgen. Don't waste time with no-code tools when you already know how to
code.
"""
site.call_to_action = GithubSignin(
"https://github.com/true3dco/splashgen", "View on GitHub")

launch(site)
10 changes: 10 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Nginx HTTP Server on Amazon Linux</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body>
<h1>FILES HOSTED ON S3 LEGOOO</h1>
</body>
</html>
8 changes: 8 additions & 0 deletions python-api/base-page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from zenweb import WebPage

class BasePage(WebPage):
def branding(self):
return {
"primary_color": "#32CBEA",
"secondary_color": "#063F1B"
}
35 changes: 35 additions & 0 deletions python-api/create-app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from base-page import BasePage


class CreateAppPage(BasePage):

def config(self):
return {
"route": "/apps/{self.full_name}/delete"
}

def render(self):
if LOCAL_STORAGE.jwt_token != None:
return REDIRECT(LoggedInHomePage.ROUTE)


response = Request(
"https://cxpme86mmi.execute-api.us-east-2.amazonaws.com/repos",
body={"jwt_token": LOCAL_STORAGE.jwt_token})

repo_list = []
for repo in response.data:
repo_list.append(
{
"name": repo.name,
"branch": repo.default_branch,
"createButton": Request("https://cxpme86mmi.execute-api.us-east-2.amazonaws.com/zenweb-github-create-webhook", body={"repo": repo.full_name}) # URL Param
}
)


return """
<layout_d>
<h1>Which repo would you like to deploy?</h1>
{repo_list}
</layout_c>"""
31 changes: 31 additions & 0 deletions python-api/delete-app-page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from base-page import BasePage


class DeleteAppPage(BasePage):

def config(self):
return {
"route": "/apps/{self.full_name}/delete"
}

def render(self):
if LOCAL_STORAGE.jwt_token != None:
return REDIRECT(LoggedInHomePage.ROUTE)


delete_button = """(
<Button
onClick=({})
text="Yes">)"""
back_out_button = """(
<Button
onClick=({})
text="No">)"""


return """
<layout_c>
<h1>Are you sure you want to delete {self.full_name}?</h1>
{delete_button}
{back_out_button}
</layout_c>"""
35 changes: 35 additions & 0 deletions python-api/home-page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from base-page import BasePage



class SplashPage(BasePage):

def config(self):
return {
"route": "/"
}

def render(self):
if LOCAL_STORAGE.jwt_token != None:
return REDIRECT(LoggedInHomePage.ROUTE)


call_to_action = """(
<Button
onClick=({})
text="Deploy in less than a minute">)"""

secondary_call_to_action = """
<Button
onClick=({})
text="Deploy in less than a minute"/>"""
logo = """<Image source="" />""""
video = """<Video source="https://youtu.be/dQw4w9WgXcQ"/>"""

return """
<layout_a>
{logo}
{call_to_action}
{secondary_call_to_action}
{video}
</layout_a>"""
48 changes: 48 additions & 0 deletions python-api/logged-in-homepage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

from base-page import BasePage

class LoggedInHomePage(BasePage):

def config(self):
return {
"route": "/apps"
}

def render(self):
if LOCAL_STORAGE.jwt_token == None:
return REDIRECT(SplashGenHomePage.ROUTE)



response = Request(
"https://cxpme86mmi.execute-api.us-east-2.amazonaws.com/apps",
body={"jwt_token": LOCAL_STORAGE.jwt_token})

app_list = []
for app in response.data:
app_list.append(
{
"name": app.name,
"branch": app.default_branch,
"deleteButton": REDIRECT(DeleteAppPage.Route(full_name=full_name)) # URL Param
}
)

deploy_app = """(
<Button
onClick=({REDIRECT(CreateAppPage.Route)})
text="New Web App">)"""



app_table = """
<Table
TopRightButton={deploy_app}
Contents={app_list}>
</Table>
"""

return """
<layout_b>
{app_table}
</layout_b>"""
Empty file added python-api/nav-bar.py
Empty file.
Binary file added splashgen/assets/SplashGen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions splashgen/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ def _parse_signup_url(self, url: str) -> Tuple[ParseResult, dict]:
ps = ps._replace(path=f"{ps.path}/post")
qs = query_string.parse(ps.query)
return ps, qs

class GithubSignin(Component):

def __init__(self, link: str, text: str) -> None:
self.link = link
self.text = text

def render(self) -> str:
client_id = "589a43a0032c52da65b4"
redirect_uri = "http://localhost:8000"

return f"""
<a id="githubSignup"
class="btn btn-primary btn-lg px-4"
href="https://github.com/login/oauth/authorize?scope=user,repo&client_id={client_id}&redirect_uri={redirect_uri}">
Start Deploying with Github
</a>"""

136 changes: 136 additions & 0 deletions splashgen/templates/github_log_template.html.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ title }}</title>
{% for favicon in favicons %}
<link rel="{{favicon['rel']}}" type="{{favicon['type']}}" sizes="{{favicon['size']}}" href="{{favicon['filename']}}" />
{% endfor %}
<meta name="theme-color" content="{% if theme == 'dark' %}#1eaee0{% else %}#ffffff{% endif %}" />
{% if meta %}
<meta name="title" content="{{ meta.title }}" />
<meta name="description" content="{{ meta.description }}" />

<meta property="og:type" content="website" />
<meta property="twitter:card" content="summary_large_image" />
{% if meta.canonical_url %}
<meta property="og:url" content="{{ meta.canonical_url }}" />
<meta property="twitter:url" content="{{ meta.canonical_url }}" />
{% endif %}

<meta property="og:title" content="{{ meta.title }}" />
<meta property="og:description" content="{{ meta.description }}" />
<meta property="twitter:title" content="{{ meta.title }}" />
<meta property="twitter:description" content="{{ meta.description }}" />

{% if meta.image %}
<meta property="og:image" content="{{ meta.image }}" />
<meta property="twitter:image" content="{{ meta.image }}" />
{% endif %} {% endif %}

<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous"
/>
<style>
html,
body {
height: 100%;
{% if theme == "dark" %}
background: var(--bs-dark);
color: var(--bs-white);
{% endif %}
}

{% if hero_image %}
#hero-image-container {
max-height: 40vh;
}

@media screen and (max-height: 660px) {
#hero-image-container {
display: none;
}
}

@media screen and (max-width: 768px) {
#hero-image-container {
display: none;
}
}
{% endif %}
</style>
{% if enable_splashgen_analytics %}
<script>(function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(e,f,c){function g(a,d){var b=d.split(".");2==b.length&&(a=a[b[0]],d=b[1]);a[d]=function(){a.push([d].concat(Array.prototype.slice.call(arguments,0)))}}var a=b;"undefined"!==typeof c?a=b[c]=[]:c="mixpanel";a.people=a.people||[];a.toString=function(a){var d="mixpanel";"mixpanel"!==c&&(d+="."+c);a||(d+=" (stub)");return d};a.people.toString=function(){return a.toString(1)+".people (stub)"};i="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" ");
for(h=0;h<i.length;h++)g(a,i[h]);var j="set set_once union unset remove delete".split(" ");a.get_group=function(){function b(c){d[c]=function(){call2_args=arguments;call2=[c].concat(Array.prototype.slice.call(call2_args,0));a.push([e,call2])}}for(var d={},e=["get_group"].concat(Array.prototype.slice.call(arguments,0)),c=0;c<j.length;c++)b(j[c]);return d};b._i.push([e,f,c])};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?
MIXPANEL_CUSTOM_LIB_URL:"file:"===f.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]);
mixpanel.init("de3f5d107b7d40401a23cb003a69a492", {
batch_requests: true,
ip: false,
property_blacklist: ['$browser', '$browser_version', '$device', '$device_id', '$user_id', '$current_url', '$initial_referrer', '$initial_referring_domain', '$os', '$referrer', '$referring_domain', '$screen_height', '$screen_width', '$search_engine', 'mp_keyword', 'utm_source', 'utm_referrer', 'utm_campaign']
});
</script>
<script>
mixpanel.track('site', {'host': window.location.hostname});
</script>
<script>
var url = new URL(url_string);
var c = url.searchParams.get("code");
console.log(c);
</script>
{% endif %}
</head>
<body style="display: grid; place-content: center">
<div
class="
d-flex
flex-column
align-items-center
justify-content-center
px-4
py-lg-3
min-vw-100
text-center
"
>
{% if logo %}
<img
class="d-block mx-auto mb-4"
src="{{ logo }}"
alt=""
width="56"
height="56"
/>
{% endif %}
<h1 class="display-5 fw-bold">
{{ headline }}
</h1>
<div class="col-lg-6 mx-auto">
<p
class="lead mb-4{% if theme == 'light' %} text-muted{% endif %}"
{% if theme == "dark" %}style="color: rgba(255, 255, 255, 0.7)"{% endif %}
>
{{ subtext }}
</p>
</div>

{% if call_to_action %}
{{ call_to_action }}
{% endif %}
{% if hero_image %}
<div class="container px-2 overflow-hidden" id="hero-image-container">
<img
src="{{ hero_image }}"
class="img-fluid"
alt="Image depicting the product"
loading="lazy"
/>
</div>
{% endif %}
</div>
</body>
</html>
Loading