-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
189 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from fastapi import FastAPI | ||
from fastapi.staticfiles import StaticFiles | ||
from fastapi.templating import Jinja2Templates | ||
from fastapi import Request | ||
import uvicorn | ||
import requests | ||
import time | ||
import asyncio | ||
|
||
app = FastAPI() | ||
app.mount("/static", StaticFiles(directory="static"), name="static") | ||
templates = Jinja2Templates(directory="static/templates") | ||
|
||
|
||
def load_projects(): | ||
print("Loading projects...") | ||
try: | ||
repos = requests.get("https://api.github.com/users/Mootfrost777/repos").json() | ||
res = [] | ||
for repo in repos: | ||
res.append(Project(repo["name"], repo["description"], repo["html_url"])) | ||
return res | ||
except: | ||
print("Error loading projects. API request failed.") | ||
return Project('Error', 'Error', 'Error') | ||
|
||
|
||
class Project: | ||
name: str | ||
description: str | ||
url: str | ||
|
||
def __init__(self, name, description, url): | ||
self.name = name | ||
self.description = description | ||
self.url = url | ||
|
||
|
||
@app.get("/api/get_repos") | ||
def get_repos(): | ||
return load_projects() | ||
|
||
|
||
@app.get("/") | ||
def main_page(request: Request): | ||
return templates.TemplateResponse("index.html", {"request": request}) | ||
|
||
|
||
@app.get("/about") | ||
def main_page(request: Request): | ||
return templates.TemplateResponse("about.html", {"request": request}) | ||
|
||
|
||
@app.get("/projects") | ||
def main_page(request: Request): | ||
return templates.TemplateResponse("projects.html", {"request": request}) | ||
|
||
|
||
uvicorn.run(app) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@import url(style.css); | ||
|
||
|
||
.title-div { | ||
|
||
} | ||
|
||
.projects-container { | ||
box-sizing: border-box; | ||
width: 1320px; | ||
overflow-wrap: anywhere; | ||
font-family: "Tisa Sans Pro"; | ||
} | ||
|
||
.project-container { | ||
flex-flow: row wrap; | ||
width: 300px; | ||
height: 150px; | ||
background-color: black; | ||
text-align: left; | ||
} | ||
|
||
.project-container:hover { | ||
transform: scale(1.1); | ||
} | ||
|
||
.projects-contents { | ||
color: white; | ||
text-decoration: none; | ||
font-size: 16px; | ||
font-weight: lighter; | ||
} | ||
|
||
.projects-title { | ||
font-size: 21px; | ||
font-weight: bolder; | ||
} | ||
|
||
@media (max-width: 1330px) { | ||
.projects-container { | ||
width: 1000px; | ||
} | ||
} | ||
|
||
|
||
@media (max-width: 1000px) { | ||
.projects-container { | ||
width: 700px; | ||
} | ||
} | ||
|
||
@media (max-width: 700px) { | ||
.projects-container { | ||
width: 400px; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', path='/resources/styles/projects.style.css') }}"/> | ||
<link rel="icon" type="image/x-icon" href="{{ url_for('static', path='/resources/images/favicon.png') }}"> | ||
<title>Mootfrost</title> | ||
<meta name="description" content="mootfrost."> | ||
</head> | ||
<body id="particles-js"> | ||
<div class="title-menu top"> | ||
<div class="title-div title-container"> | ||
<h1 class="title unselectable">projects:</h1> | ||
<div class="contents-div projects-container horizontal-container" id="projects-list"> | ||
<!-- <a href="https://google.com" class="projects-contents"><div class="button-div project-container"> | ||
<h2 class="projects-title">Name</h2> | ||
<p class="projects-contents">Description</p> | ||
</div></a> --> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer> | ||
<p class="footer-text">v.0.1</a></p> | ||
</footer> | ||
|
||
<script src="{{ url_for('static', path='/resources/scripts/plugins/particles/particles.min.js ') }}"></script> | ||
<script src="{{ url_for('static', path='/resources/scripts/script.js') }}"></script> | ||
<script> | ||
async function load_projects() | ||
{ | ||
let resp = await fetch('/api/get_repos', { | ||
method: 'GET', | ||
}, | ||
); | ||
let projects = await resp.json() | ||
console.log(projects) | ||
let proj_list = document.getElementById('projects-list') | ||
for (let i = 0; i < projects.length; i++) { | ||
let project = projects[i] | ||
let h2 = document.createElement('h2') | ||
h2.textContent = project['name'] | ||
h2.classList.add('projects-title') | ||
let p = document.createElement('p') | ||
p.classList.add('projects-contents') | ||
p.textContent = project['description'] | ||
let div = document.createElement('div') | ||
div.classList.add('button-div') | ||
div.classList.add('project-container') | ||
div.appendChild(h2) | ||
div.appendChild(p) | ||
let a = document.createElement('a') | ||
a.classList.add('projects-contents') | ||
a.href = project['url'] | ||
a.appendChild(div) | ||
proj_list.appendChild(a) | ||
} | ||
} | ||
load_projects() | ||
</script> | ||
</body> | ||
</html> |