<!DOCTYPE html>
<html>
<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 mootfrost.">
</head>

<body id="particles-js" ondragstart="return false;" ondrop="return false;">
    <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++<br/>
            </p>
            <p class="about-contents" id="code-stats">
            </p>
        </div>
    </div>

    <footer class="unselectable">
        <p class="footer-text">v0.5</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() {
       let resp = await fetch('/api/get_code_stats', {
                method: 'GET',
            },
       );
       let code_stats = await resp.json()
       console.log(code_stats)
       let about = document.getElementById('code-stats')

       about.innerHTML += `С ${code_stats['since']}: ` + code_stats['total'] + '<br/>'

       about.innerHTML += 'Из них на:' + '<br/>'
       for (let language in code_stats['languages']) {
           about.innerHTML += language + ' - ' + code_stats['languages'][language] + '<br/>'
       }
       about.innerHTML += ''
    }
    load_code_stats()

    async function load_age() {
        let resp = await fetch('/api/get_age', {
                method: 'GET',
            },
        );
        let age = await resp.json()
        console.log(age)
        let about = document.getElementById('about')

        about.innerHTML = about.textContent.replace('{age}', age)
    }
    load_age()
</script>
</body>
</html>
