From 48cc0bec90e2af7e55fbca2d72dcddf6c488cadc Mon Sep 17 00:00:00 2001 From: Kaustubh Maske Patil <37668193+nikochiko@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:57:43 +0530 Subject: [PATCH] Update header and footer --- daras_ai_v2/footer_widget.py | 76 ++++++++++++++++++++++++++++++++++++ routers/root.py | 3 +- templates/footer.html | 15 ------- templates/header.html | 17 +++----- 4 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 daras_ai_v2/footer_widget.py delete mode 100644 templates/footer.html diff --git a/daras_ai_v2/footer_widget.py b/daras_ai_v2/footer_widget.py new file mode 100644 index 000000000..44859733f --- /dev/null +++ b/daras_ai_v2/footer_widget.py @@ -0,0 +1,76 @@ +import gooey_ui as st + +DISCORD_LOGO = """ + + + +""" + +FOOTER_CONTENT = { + "GET STARTED": [ + ("Home", "/"), + ("Explore Workflows", "/explore/"), + ("Sign In / Your Account", "/account/"), + ("Pricing", "/pricing"), + ], + "LEARN": [ + ("Docs", "/docs"), + ("Blog", "/blog/"), + ("FAQ", "/faq/"), + ("Videos", "https://www.youtube.com/@gooeyAI"), + ], + "DEVELOPERS": [ + ("How to Guides", "/docs/"), + ("Get a Gooey.AI Key", "/docs/developer-resources/api-reference"), + ("GitHub", "https://github.com/GooeyAI"), + ("API Endpoints", "https://api.gooey.ai/docs#operation"), + ], + "SOCIAL": [ + ("LinkedIn", "https://in.linkedin.com/company/gooeyai"), + ("Twitter/X", "https://twitter.com/GooeyAI"), + ("Insta", "https://www.instagram.com/gooeyai/"), + ], + "CONNECT": [ + ("support@gooey.ai", "mailto:support@gooey.ai"), + (f"{DISCORD_LOGO} Discord", "https://discord.com/invite/7C84UyzVDg"), + ("Book a Demo", "https://www.help.gooey.ai/contact#book-demo"), + ], + "EXTRAS": [ + ("Team", "/team"), + ("Jobs", "/jobs"), + ("Privacy", "/privacy"), + ("Terms", "/terms"), + ], +} + + +def footer(): + with st.div(className="w-100 mt-5 pt-5 bg-light gui-footer"): + with st.div(className="container"): + columns = st.columns(len(FOOTER_CONTENT)) + for (title, links), st_col in zip(FOOTER_CONTENT.items(), columns): + with st_col: + render_column(title, links) + + with center(className="mt-5"): + st.caption("©2023 by Gooey.AI / Dara.network Inc") + + +def render_column(title, links): + st.write(f"###### {title}") + for content, to in links: + target = "_blank" if to.startswith("http") else False + with st.link(to=to, target=target): + custom_caption(content) + + +def custom_caption(content): + with st.tag("p", className="text-muted mb-0"): + st.html(content) + + +def center(**props): + className = props.pop("className", "") + " text-center" + return st.div(className=className, **props) diff --git a/routers/root.py b/routers/root.py index c8cc71295..942cf0293 100644 --- a/routers/root.py +++ b/routers/root.py @@ -30,6 +30,7 @@ ) from daras_ai_v2.copy_to_clipboard_button_widget import copy_to_clipboard_scripts from daras_ai_v2.db import FIREBASE_SESSION_COOKIE +from daras_ai_v2.footer_widget import footer from daras_ai_v2.meta_content import build_meta_tags, raw_build_meta_tags from daras_ai_v2.query_params_util import extract_query_params from daras_ai_v2.settings import templates @@ -334,5 +335,5 @@ def page_wrapper(request: Request, render_fn: typing.Callable, **kwargs): with st.div(id="main-content", className="container"): render_fn(**kwargs) - st.html(templates.get_template("footer.html").render(**context)) + footer() st.html(templates.get_template("login_scripts.html").render(**context)) diff --git a/templates/footer.html b/templates/footer.html deleted file mode 100644 index 211cb32a5..000000000 --- a/templates/footer.html +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/templates/header.html b/templates/header.html index 9c1c19f36..b88e187e9 100644 --- a/templates/header.html +++ b/templates/header.html @@ -7,22 +7,15 @@ class="img-fluid logo" alt="img">
- Home Explore + Docs + Blog {% if not request.user %} - Pricing + Pricing {% endif %} - Learn - - - - - Connect - + Contact {% include 'login_container.html' %}
- \ No newline at end of file +