File size: 4,114 Bytes
f1a0148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{% extends "admin/base.html" %}

{% block admin_content %}
<div class="admin-header">
    <div class="admin-title">User Details</div>
    <a href="{{ url_for('admin.users') }}" class="btn-secondary">Back to Users</a>
</div>

<div class="admin-card">
    <div class="admin-card-header">
        <div class="admin-card-title">User Information</div>
    </div>
    <div class="user-info">
        <div class="user-detail-row">
            <div class="user-detail-label">Username:</div>
            <div class="user-detail-value">{{ user.username }}</div>
        </div>
        <div class="user-detail-row">
            <div class="user-detail-label">Hugging Face ID:</div>
            <div class="user-detail-value">{{ user.hf_id }}</div>
        </div>
        <div class="user-detail-row">
            <div class="user-detail-label">Join Date:</div>
            <div class="user-detail-value">{{ user.join_date.strftime('%Y-%m-%d %H:%M:%S') }}</div>
        </div>
    </div>
    
    <div class="user-stats">
        <div class="stat-card">
            <div class="stat-title">Total Votes</div>
            <div class="stat-value">{{ total_votes }}</div>
        </div>
        <div class="stat-card">
            <div class="stat-title">TTS Votes</div>
            <div class="stat-value">{{ tts_votes }}</div>
        </div>
        <div class="stat-card">
            <div class="stat-title">Conversational Votes</div>
            <div class="stat-value">{{ conversational_votes }}</div>
        </div>
    </div>
</div>

{% if favorite_models %}
<div class="admin-card">
    <div class="admin-card-header">
        <div class="admin-card-title">Favorite Models</div>
    </div>
    <div class="table-responsive">
        <table class="admin-table">
            <thead>
                <tr>
                    <th>Model</th>
                    <th>Votes</th>
                </tr>
            </thead>
            <tbody>
                {% for model in favorite_models %}
                <tr>
                    <td>{{ model.name }}</td>
                    <td>{{ model.count }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}

{% if recent_votes %}
<div class="admin-card">
    <div class="admin-card-header">
        <div class="admin-card-title">Recent Votes</div>
    </div>
    <div class="table-responsive">
        <table class="admin-table">
            <thead>
                <tr>
                    <th>Date</th>
                    <th>Type</th>
                    <th>Chosen Model</th>
                    <th>Rejected Model</th>
                    <th>Text</th>
                </tr>
            </thead>
            <tbody>
                {% for vote in recent_votes %}
                <tr>
                    <td>{{ vote.vote_date.strftime('%Y-%m-%d %H:%M') }}</td>
                    <td>{{ vote.model_type }}</td>
                    <td>{{ vote.chosen.name }}</td>
                    <td>{{ vote.rejected.name }}</td>
                    <td>
                        <div class="text-truncate" title="{{ vote.text }}">
                            {{ vote.text }}
                        </div>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}

<style>
    .user-detail-row {
        display: flex;
        margin-bottom: 10px;
    }
    
    .user-detail-label {
        font-weight: 600;
        min-width: 150px;
    }
    
    .user-detail-value {
        flex: 1;
    }
    
    .user-stats {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
        margin-top: 24px;
    }
    
    .text-truncate {
        max-width: 300px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    @media (max-width: 576px) {
        .user-detail-row {
            flex-direction: column;
        }
        
        .user-detail-label {
            margin-bottom: 4px;
        }
    }
</style>
{% endblock %}