Skip to content

Commit

Permalink
Add sorted projects, workflow runs every month
Browse files Browse the repository at this point in the history
  • Loading branch information
C2Coder committed May 22, 2024
1 parent 3b90aba commit 5bb69f7
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches:
- master
- main
schedule:
- cron: '0 0 1 * *' # on first day of every month
permissions:
contents: write
jobs:
Expand Down
3 changes: 3 additions & 0 deletions projects/elks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: ESP Learning Kit starter
website: https://elks.robotikabrno.cz/
readme: https://github.com/RoboticsBrno/RB3206-ELKS/blob/master/README.md

# you can turn on both at the same time
frequently_used: False
recent: True

related_repos:
- url: https://github.com/RoboticsBrno/RB3206-ELKS
Expand Down
3 changes: 3 additions & 0 deletions projects/jaculus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: JavaScript runtime for esp32 devices
website: https://jaculus.org/
readme: https://github.com/cubicap/Jaculus-esp32/blob/master/README.md

# you can turn on both at the same time
frequently_used: True
recent: True

related_repos:
- url: https://github.com/cubicap/Jaculus-esp32
Expand Down
3 changes: 3 additions & 0 deletions projects/logic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Logic is a universal programmable toy designed for teaching program
website: https://logic.robotikabrno.cz/
readme: https://github.com/RoboticsBrno/RB3205-Logic/blob/main/README.md

# you can turn on both at the same time
frequently_used: False
recent: False

related_repos:
- url: https://github.com/RoboticsBrno/RB3205-Logic
Expand Down
3 changes: 3 additions & 0 deletions projects/rbcx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: RBCX is a universal controller for hobby robots. It is a successor
website: https://rbcx.robotikabrno.cz/
readme: https://github.com/RoboticsBrno/RB3204-RBCX/blob/master/README.md

# you can turn on both at the same time
frequently_used: True
recent: False

related_repos:
- url: https://github.com/RoboticsBrno/RB3204-RBCX
Expand Down
3 changes: 3 additions & 0 deletions projects/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: ---
website: https://---/
readme: https://github.com/---/README.md

# you can turn on both at the same time
frequently_used: False
recent: False

related_repos:
- url: https://github.com/---
Expand Down
36 changes: 29 additions & 7 deletions src/generate_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,39 @@ def generate_repos_detail(self):

self.render_page('repoDetail.html', path_repo, repo=repo, readme=readme_html, repo_contrib = repo_contrib)

def generate_demo(self):
self.render_page('demo.html', self.paths.get("Demo").get("path"))

# def generate_demo(self):
# self.render_page('demo.html', self.paths.get("Demo").get("path"))

def generate_project_list(self, projects: list):
self.render_page('projectList.html', self.paths.get("Projects").get("path"), projects=projects)
print(projects)

# Initialize the three lists
recent_projects = []
frequently_used_projects = []
both_projects = []
other_projects = []

# Iterate through the list of dictionaries
for item in projects:

if item.get("recent") and item.get("frequently_used"):
both_projects.append(item)
elif item.get("recent"):
recent_projects.append(item)
elif item.get("frequently_used"):
frequently_used_projects.append(item)
else:
other_projects.append(item)

projects_list = [["Recent and frequently used projects:",both_projects],
["Frequently used projects:",frequently_used_projects],
["Recent projects:",recent_projects],
["Other projects",other_projects]]

self.render_page('projectList.html', self.paths.get("Projects").get("path"), projects_list=projects_list)

def generate_projects(self, projects: list):
pprint(projects)
# pprint(projects)

for project in projects:
for i, repo in enumerate(project["related_repos"]):
Expand All @@ -179,8 +203,6 @@ def generate_projects(self, projects: list):
path_project = self.paths.get("Project").get("path").format(project["url"])
self.render_page('projectDetail.html', path_project, project=project, readme=readme_html)



def generate_about(self):
info = self.about_info

Expand Down
21 changes: 15 additions & 6 deletions templates/projectList.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@
{% extends "base.html" %}

{% block content %}
<div class="mx-2 grid grid-cols-1 md:grid-cols-3 gap-2">
{% for project in projects %}
<div class="mx-2">
{% for projects in projects_list %}
<div class="p-4 flex flex-row dark:bg-gray-800 bg-white rounded-lg shadow-md">
<p class="font-bold dark:text-white text-gray-800"> {{projects[0]}} </p>
</div>
<div class="mt-2 mb-4 grid grid-cols-1 md:grid-cols-3 gap-2">
{% for project in projects[1] %}
<!-- Project Card - {{project.name}} -->
<a class="mx-auto dark:bg-gray-800 flex flex-col bg-white p-4 rounded-lg shadow-md justify-between w-full min-w-0 max-w-xl h-full" href="/projects/{{ project.url }}/">
<a class=" dark:bg-gray-800 flex flex-col bg-white p-4 rounded-lg shadow-md justify-between w-full min-w-0 h-full"
href="/projects/{{ project.url }}/">
<div class="flex flex-col h-full w-full flex-grow">
{# <div class="mx-auto p-4 dark:bg-gray-800 flex flex-col bg-white rounded-lg shadow-md max-w-sm"> #}
<h2 class="mb-1 dark:text-white text-xl font-bold text-gray-800">{{ project.name }}</h2>
<p class="mb-2 dark:text-gray-300 text-gray-600">{{ project.description }}</p>

<h2 class="mb-1 dark:text-white text-xl font-bold text-gray-800">{{ project.name }}</h2>
<p class="mb-2 dark:text-gray-300 text-gray-600">{{ project.description }}</p>

{# </div> #}
{# </div> #}
</div>
</a>
{% endfor %}
</div>
{% endfor %}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/repos.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="mx-2 mt-4 grid grid-cols-1 md:grid-cols-4 gap-2">
{% for repo in repos %}
<!-- Repository Card - {{repo.name}} -->
<a class="dark:bg-gray-800 flex flex-col bg-white p-4 rounded-lg shadow-md justify-between mx-auto w-full min-w-0 max-w-xl h-full" href="/repos/{{ repo.name }}/">
<a class="dark:bg-gray-800 flex flex-col bg-white p-4 rounded-lg shadow-md justify-between mx-auto w-full min-w-0 h-full" href="/repos/{{ repo.name }}/">
<div class="flex flex-col h-full w-full flex-grow">
{# <div class="dark:bg-gray-800 flex flex-col bg-white p-4 rounded-lg shadow-md max-w-sm mx-auto"> #}
<h2 class="dark:text-white text-xl font-bold text-gray-800 mb-1">{{ repo.name }}</h2>
Expand Down

0 comments on commit 5bb69f7

Please sign in to comment.