File size: 1,693 Bytes
a6db6a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{% extends "base.html" %} {% block title %}Dashboard - Grimvault{% endblock %}
{% block content %}
<div class="container">
    <h1>My Files</h1>
    <div class="storage-info">
        <p>
            Used storage: {{ (used_storage / 1024 / 1024) | round(2) }} MB / {{
            (storage_limit / 1024 / 1024 / 1024) | round(2) }} GB
        </p>
        <progress
            value="{{ used_storage }}"
            max="{{ storage_limit }}"
        ></progress>
    </div>
    <div class="file-actions">
        <form id="upload-form" enctype="multipart/form-data">
            <input type="file" id="file-input" name="file" required />
            <button type="submit" class="btn btn-primary">Upload</button>
        </form>
        <button id="empty-vault" class="btn btn-danger">Empty Vault</button>
        <a
            href="{{ url_for('auth.logout') }}"
            class="btn btn-secondary"
            id="logout-btn"
            >Logout</a
        >
    </div>
    <ul id="file-list">
        {% for file in files %}
        <li>
            <span>{{ file.filename }}</span>
            <span>{{ file.size | filesizeformat }}</span>
            <button
                class="btn btn-secondary download-btn"
                data-filename="{{ file.filename }}"
            >
                Download
            </button>
            <button
                class="btn btn-danger delete-btn"
                data-filename="{{ file.filename }}"
            >
                Delete
            </button>
        </li>
        {% endfor %}
    </ul>
</div>
{% endblock %} {% block scripts %}
<script src="{{ url_for('static', filename='js/dashboard.js') }}"></script>
{% endblock %}