Обо мне, кнопка назад
This commit is contained in:
parent
ff2f465172
commit
ce9e3d4c15
7 changed files with 123 additions and 69 deletions
32
main.py
32
main.py
|
@ -67,19 +67,24 @@ def load_projects():
|
|||
|
||||
def load_code_stats():
|
||||
while True:
|
||||
try:
|
||||
resp = requests.get('https://waka.mootfrost.ru/api/compat/wakatime/v1/users/Mootfrost/stats/last_7_days').json()
|
||||
global code_stats
|
||||
code_stats.clear()
|
||||
resp = requests.get("https://wakatime.com/api/v1/users/Mootfrost/stats/").json()
|
||||
global code_stats
|
||||
code_stats.clear()
|
||||
|
||||
code_stats['languages'] = {}
|
||||
for lang in resp['data']['languages'][:5]:
|
||||
code_stats['languages'][lang['name']] \
|
||||
= get_declension(lang['hours'], 'час', 'часа', 'часов') + ' ' + \
|
||||
get_declension(lang['minutes'], 'минуту', 'минуты', 'минут')
|
||||
logging.info(f'{datetime.now()}: Code stats updated')
|
||||
except Exception as e:
|
||||
logging.error(f'{datetime.now()}: Error while updating code stats: {e}')
|
||||
total = resp['data']['categories'][0]
|
||||
code_stats['total'] = get_declension(total['hours'], 'час', 'часа', 'часов') + ' ' + \
|
||||
get_declension(total['minutes'], 'минуту', 'минуты', 'минут')
|
||||
|
||||
# WakaTime дает рэйндж только в хьюман ридбил формате, а не в дате...
|
||||
code_stats['since'] = datetime.strptime(resp['data']['human_readable_range']
|
||||
.replace('since ', ''), '%b %d %Y') \
|
||||
.strftime('%d.%m.%Y')
|
||||
|
||||
langs = resp['data']['languages']
|
||||
|
||||
code_stats['languages'] = {}
|
||||
for lang in langs[:5]:
|
||||
code_stats['languages'][lang['name']] = f"{round(lang['percent'])}%"
|
||||
time.sleep(7200)
|
||||
|
||||
|
||||
|
@ -102,8 +107,9 @@ def get_code_stats():
|
|||
@app.get("/api/get_age")
|
||||
def get_age():
|
||||
today = datetime.today()
|
||||
return today.year - config.birthdate.year - (
|
||||
age = today.year - config.birthdate.year - (
|
||||
(today.month, today.day) < (config.birthdate.month, config.birthdate.day))
|
||||
return get_declension(age, 'год', 'года', 'лет')
|
||||
|
||||
|
||||
@app.get("/")
|
||||
|
|
1
static/resources/images/circle-chevron-left-solid.svg
Normal file
1
static/resources/images/circle-chevron-left-solid.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256S114.6 512 256 512s256-114.6 256-256zM271 135c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-87 87 87 87c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L167 273c-9.4-9.4-9.4-24.6 0-33.9L271 135z"/></svg>
|
After Width: | Height: | Size: 475 B |
22
static/resources/styles/about.style.css
Normal file
22
static/resources/styles/about.style.css
Normal file
|
@ -0,0 +1,22 @@
|
|||
@import url(style.css);
|
||||
|
||||
.wrapper {
|
||||
width: 40%;
|
||||
position: relative;
|
||||
margin-top: 40px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.main-title {
|
||||
font-weight: 800;
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-top: 20px;
|
||||
font-size: 1.8rem;
|
||||
word-wrap: break-word;
|
||||
line-height: 2;
|
||||
}
|
|
@ -1,9 +1,5 @@
|
|||
@import url(style.css);
|
||||
|
||||
path {
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.main-title {
|
||||
text-align: center;
|
||||
font-size: 3em;
|
||||
|
@ -18,6 +14,12 @@ path {
|
|||
font-weight: 200;
|
||||
}
|
||||
|
||||
.btn-social {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.lower-buttons {
|
||||
font-size: 1.3em;
|
||||
margin-top: 15px;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
body {
|
||||
font-family: Raleway, sans-serif;
|
||||
background-color: black !important;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
|
@ -11,12 +12,19 @@ body {
|
|||
padding: 50px;
|
||||
}
|
||||
|
||||
.btn-social {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
text-decoration: none;
|
||||
.btn-back {
|
||||
position: relative;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.btn-back svg {
|
||||
margin-left: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
path {
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#particles-js {
|
||||
background-color: transparent;
|
||||
|
@ -39,3 +47,5 @@ body {
|
|||
background-image: url("/static/resources/images/background.png");
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,54 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
|
||||
<!-- Yandex.Metrika counter -->
|
||||
<script type="text/javascript" >
|
||||
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
||||
<!-- Yandex.Metrika counter -->
|
||||
<script type="text/javascript" >
|
||||
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
||||
|
||||
ym(89899712, "init", {
|
||||
clickmap:true,
|
||||
trackLinks:true,
|
||||
accurateTrackBounce:true
|
||||
});
|
||||
</script>
|
||||
<noscript><div><img src="https://mc.yandex.ru/watch/89899712" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||
<!-- /Yandex.Metrika counter -->
|
||||
ym(89899712, "init", {
|
||||
clickmap:true,
|
||||
trackLinks:true,
|
||||
accurateTrackBounce:true
|
||||
});
|
||||
</script>
|
||||
<noscript><div><img src="https://mc.yandex.ru/watch/89899712" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||
<!-- /Yandex.Metrika counter -->
|
||||
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="/static/resources/styles/about.style.css"/>
|
||||
<link rel="icon" type="image/x-icon" href="/static/resources/images/favicon.png">
|
||||
<title>Mootfrost — обо мне</title>
|
||||
<meta name="description" content="About me">
|
||||
</head>
|
||||
<link rel="stylesheet" type="text/css" href="/static/resources/styles/about.style.css"/>
|
||||
<link href="/static/resources/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link rel="icon" type="image/x-icon" href="/static/resources/images/favicon.png">
|
||||
</head>
|
||||
|
||||
<body id="particles-js" ondragstart="return false;" ondrop="return false;" class="no-scrolling">
|
||||
<div class="title-menu top title-container">
|
||||
<div class="title-div">
|
||||
<h1 class="title">обо мне:</h1>
|
||||
</div>
|
||||
<div class="contents-div description-container">
|
||||
<p class="about-contents" id="about">
|
||||
Семейкин Андрей, {age} лет. Живу в Москве<br><br>
|
||||
В основном пишу на C#, Python, JS. Немного знаю C++, Java<br>
|
||||
</p>
|
||||
<p class="about-contents" id="code-stats">
|
||||
За последнюю неделю на:<br>
|
||||
</p>
|
||||
</div>
|
||||
<body>
|
||||
<div id="background"></div>
|
||||
<div id="particles-js"><canvas class="particles-js-canvas-el" style="width: 100%; height: 100%;" width="768" height="922"></canvas></div>
|
||||
|
||||
<a class="btn-back" href="https://mootfrost.ru">
|
||||
<svg ID="back-s" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="40px" height="40px">
|
||||
<path id="pathBack" d="M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256S114.6 512 256 512s256-114.6 256-256zM271 135c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-87 87 87 87c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L167 273c-9.4-9.4-9.4-24.6 0-33.9L271 135z" fill="#ffffff" style="fill: rgb(255, 255, 255);"/>
|
||||
</svg>
|
||||
</a>
|
||||
<div class="wrapper pe-none">
|
||||
<span class="main-title">Обо мне:</span>
|
||||
<p class="content">
|
||||
Семейкин Андрей, <span id="age"></span><br>
|
||||
Живу в Москве, учусь в 1580<br>
|
||||
В основном пишу на C#, python, JS. Немного знаю C++ и Java<br>
|
||||
Разбираюсь в Linux, Docker, Drone CI<br>
|
||||
|
||||
За последнюю неделю писал <span id="code-stats"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<footer class="unselectable">
|
||||
<p class="footer-text">v0.6</p>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
<script src="/static/resources/scripts/plugins/particles/particles.min.js"></script>
|
||||
<script src="/static/resources/scripts/script.js"></script>
|
||||
<script>
|
||||
async function load_code_stats() {
|
||||
<script>
|
||||
let back_s = document.getElementById('back-s');
|
||||
back_s.onmouseenter = () => document.getElementById('pathBack').style.fill = 'lightgray';
|
||||
back_s.onmouseleave = () => document.getElementById('pathBack').style.fill = '#ffffffff';
|
||||
</script>
|
||||
<script>
|
||||
async function load_code_stats() {
|
||||
let resp = await fetch('/api/get_code_stats', {
|
||||
method: 'GET',
|
||||
},
|
||||
|
@ -57,14 +61,15 @@
|
|||
|
||||
let about = document.getElementById('code-stats')
|
||||
|
||||
if(Object.keys(code_stats).length === 0) {
|
||||
if (Object.keys(code_stats).length === 0) {
|
||||
about.innerHTML += '❌Не удалось загрузить❌'
|
||||
return
|
||||
}
|
||||
|
||||
for (let lang in code_stats['languages']) {
|
||||
about.innerHTML += lang + ' - ' + code_stats['languages'][lang] + '<br>'
|
||||
about.innerHTML += `${code_stats['languages'][lang]} на ${lang}, `
|
||||
}
|
||||
about.innerHTML = about.innerHTML.slice(0, -2)
|
||||
}
|
||||
load_code_stats()
|
||||
|
||||
|
@ -75,10 +80,18 @@
|
|||
);
|
||||
let age = await resp.json()
|
||||
|
||||
let about = document.getElementById('about')
|
||||
about.innerHTML = about.innerHTML.replace('{age}', age)
|
||||
if (age.length === 0) {
|
||||
document.getElementById('age').innerHTML = 'age∈(-47; 1287) лет'
|
||||
return
|
||||
}
|
||||
|
||||
let age_container = document.getElementById('age')
|
||||
age_container.innerHTML = age
|
||||
}
|
||||
load_age()
|
||||
</script>
|
||||
</body>
|
||||
</script>
|
||||
<script src="/static/resources/scripts/particles.js"></script>
|
||||
<script src="/static/resources/scripts/app.js"></script>
|
||||
<script src="/static/resources/bootstrap/js/bootstrap.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
</div>
|
||||
<hr class="divider">
|
||||
<div class="lower-buttons flex-column flex-wrap thin text-uppercase">
|
||||
<a href="https://mootfrost.ru/about" class="pe-auto">About me</a>
|
||||
<a href="https://mootfrost.ru/projects" class="pe-auto">Projects</a>
|
||||
<a href="https://mootfrost.ru/about" class="pe-auto">Обо мне</a>
|
||||
<a href="https://mootfrost.ru/projects" class="pe-auto">Проекты</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue