Show public functions on landing page as well
This commit is contained in:
5
app.py
5
app.py
@@ -76,7 +76,10 @@ def map_isolator_response_to_flask_response(response):
|
||||
|
||||
@ app.route("/", methods=["GET"])
|
||||
def landing_page():
|
||||
return render_template("landing_page.html", name='Try me', script=DEFAULT_SCRIPT, environment_info=DEFAULT_ENVIRONMENT)
|
||||
public_functions = db.get_public_http_functions()
|
||||
# Limit to top 6 for the landing page
|
||||
public_functions = public_functions[:6] if public_functions else []
|
||||
return render_template("landing_page.html", name='Try me', script=DEFAULT_SCRIPT, environment_info=DEFAULT_ENVIRONMENT, public_functions=public_functions)
|
||||
|
||||
@app.route("/documentation", methods=["GET"])
|
||||
def documentation():
|
||||
|
||||
@@ -136,6 +136,77 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
{% if public_functions %}
|
||||
<section class="py-12">
|
||||
<div class="container mx-auto px-4">
|
||||
<h2 class="w-full my-2 text-4xl font-black leading-tight text-center text-gray-800">
|
||||
Community Highlights
|
||||
</h2>
|
||||
<div class="w-full mb-8">
|
||||
<div class="h-1 mx-auto gradient w-64 opacity-25 my-0 py-0 rounded-t"></div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
||||
{% for func in public_functions %}
|
||||
<div
|
||||
class="bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200 flex flex-col hover:shadow-xl transition-shadow duration-300">
|
||||
<div class="p-4 border-b border-gray-200 flex justify-between items-center bg-gray-50">
|
||||
<h3 class="font-bold text-lg text-gray-900 truncate" title="{{ func.name }}">
|
||||
{{ func.name }}
|
||||
</h3>
|
||||
<span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded uppercase">
|
||||
{{ func.runtime }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="relative bg-gray-100 aspect-video border-b border-gray-200 group">
|
||||
<iframe
|
||||
src="{{ url_for('execute_http_function', user_id=func.user_id, function=func.name + ('/' + func.path if func.path else '')) }}"
|
||||
class="w-full h-full border-0" loading="lazy" title="Preview of {{ func.name }}">
|
||||
</iframe>
|
||||
<a href="{{ url_for('community.view', function_id=func.id) }}"
|
||||
class="absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-10 transition-all duration-200 flex items-center justify-center">
|
||||
<span
|
||||
class="opacity-0 group-hover:opacity-100 bg-white text-gray-900 font-bold py-2 px-4 rounded shadow-lg transform scale-95 group-hover:scale-100 transition-all duration-200">
|
||||
View Details
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="p-4 flex-grow flex flex-col justify-between">
|
||||
<p class="text-gray-600 text-sm mb-4 line-clamp-3">
|
||||
{{ func.description or "No description provided." }}
|
||||
</p>
|
||||
|
||||
<div class="flex items-center justify-between mt-auto pt-4 border-t border-gray-100">
|
||||
<div class="flex items-center text-xs text-gray-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
||||
</svg>
|
||||
{{ func.username }}
|
||||
</div>
|
||||
<a href="{{ url_for('community.view', function_id=func.id) }}"
|
||||
class="text-blue-600 hover:text-blue-800 text-sm font-medium">
|
||||
View & Fork →
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-10">
|
||||
<a href="{{ url_for('community.index') }}"
|
||||
class="inline-flex items-center justify-center px-5 py-3 text-base font-medium text-white transition-all bg-blue-600 border border-transparent rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 shadow-md">
|
||||
Explore All Functions
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<section class="py-8">
|
||||
<div class="container mx-auto flex flex-wrap pt-4 pb-12">
|
||||
<h2 class="w-full my-2 text-5xl font-black leading-tight text-center text-gray-800">Features</h2>
|
||||
|
||||
Reference in New Issue
Block a user