webcodelab commited on
Commit
21584b7
Β·
verified Β·
1 Parent(s): 9e1a061

Create api_keys.html

Browse files
Files changed (1) hide show
  1. app/templates/api_keys.html +149 -0
app/templates/api_keys.html ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.html" %}
2
+ {% block title %}My API Keys – Resume Ranker API{% endblock %}
3
+
4
+ {% block extra_head %}
5
+ {# Link any specific CSS for this page here if separate from dashboard.css #}
6
+ {% endblock %}
7
+
8
+ {% block content %}
9
+ <div class="dashboard-wrapper">
10
+ <aside class="sidebar" id="sidebar">
11
+ <div class="sidebar-header">
12
+ <div class="logo">ResumeRanker<span style="color:var(--accent)">.API</span></div>
13
+ <button class="close-sidebar" id="closeSidebar" aria-label="Close menu">
14
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
15
+ </button>
16
+ </div>
17
+ <nav class="sidebar-nav">
18
+ {# Highlight active link: Use Flask's request.endpoint to set 'active' class #}
19
+ <a href="{{ url_for('auth.dashboard') }}" class="nav-item">
20
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-grid"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>
21
+ <span>Dashboard</span>
22
+ </a>
23
+ <a href="{{ url_for('auth.generate_api') }}" class="nav-item active"> {# Active #}
24
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-key"><path d="M19 10H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2z"></path><circle cx="12" cy="16" r="2"></circle><path d="M15 10V4.5a2.5 2.5 0 0 0-5 0V10"></path></svg>
25
+ <span>My API Keys</span>
26
+ </a>
27
+ <a href="{{ url_for('api.rank_resumes') }}" class="nav-item">
28
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-award"><circle cx="12" cy="8" r="7"></circle><polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.89"></polyline></svg>
29
+ <span>Resume Rankings</span>
30
+ </a>
31
+ <a href="{{ url_for('auth.try_api') }}" class="nav-item">
32
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-play-circle"><circle cx="12" cy="12" r="10"></circle><polygon points="10 8 16 12 10 16 10 8"></polygon></svg>
33
+ <span>Try It Now</span>
34
+ </a>
35
+ <a href="{{ url_for('auth.try_api') }}" class="nav-item">
36
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l-.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
37
+ <span>Settings</span>
38
+ </a>
39
+ <a href="{{ url_for('auth.logout') }}" class="nav-item logout-item">
40
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="17 16 22 12 17 8"></polyline><line x1="22" y1="12" x2="10" y2="12"></line></svg>
41
+ <span>Logout</span>
42
+ </a>
43
+ </nav>
44
+ </aside>
45
+
46
+ <div class="main-content-area" id="mainContentArea">
47
+ <header class="dashboard-header">
48
+ <button class="hamburger-dashboard" id="hamburgerDashboard" aria-label="Open sidebar menu">
49
+ <span></span><span></span><span></span>
50
+ </button>
51
+ <div class="user-settings">
52
+ <span class="user-name">{{ user.username }}</span>
53
+ <div class="user-avatar">
54
+ <img src="https://ui-avatars.com/api/?name={{ user.username | urlencode }}&background=2563eb&color=fff&size=30" alt="User Avatar">
55
+ </div>
56
+ <button class="theme-toggle" id="themeToggleDashboard" aria-label="Toggle dark mode">πŸŒ™</button>
57
+ </div>
58
+ </header>
59
+
60
+ <div class="content-padding">
61
+ <h1 class="welcome-title">My API Keys</h1>
62
+ <p class="subtitle">Manage your API key for integrating with ResumeRanker API.</p>
63
+
64
+ {% if error %}
65
+ <div class="error-message">{{ error }}</div>
66
+ {% endif %}
67
+
68
+ {% if success %}
69
+ <div class="success-message">{{ success }}</div>
70
+ {% endif %}
71
+
72
+ <div class="section-card api-key-full-section">
73
+ <h3 class="section-title">Your API Key</h3>
74
+ <p class="section-description">This is your unique API key. Keep it secure and do not share it publicly.</p>
75
+ <div class="input-group">
76
+ <input type="text" class="form-input" id="apiKey" value="{{ user.api_key }}" readonly>
77
+ <button class="btn primary-btn copy-btn" type="button" onclick="copyApiKey()">Copy</button>
78
+ </div>
79
+ <form method="POST" action="{{ url_for('generate_api') }}" class="api-key-form">
80
+ <button class="btn secondary-btn">Regenerate API Key</button>
81
+ </form>
82
+ <p class="docs-link"><a href="{{ url_for('auth.docs') }}">πŸ“˜ View API Documentation</a></p>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ {% endblock %}
88
+
89
+ {% block extra_scripts %}
90
+ <script>
91
+ // Theme toggle (specific to dashboard header)
92
+ const themeToggleDashboard = document.getElementById('themeToggleDashboard');
93
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
94
+ function setTheme(theme) {
95
+ document.documentElement.setAttribute('data-theme', theme);
96
+ localStorage.setItem('theme', theme);
97
+ themeToggleDashboard.textContent = theme === 'dark' ? 'β˜€οΈ' : 'πŸŒ™';
98
+ }
99
+ const savedTheme = localStorage.getItem('theme');
100
+ setTheme(savedTheme || (prefersDark ? 'dark' : 'light'));
101
+ themeToggleDashboard.onclick = () => {
102
+ const current = document.documentElement.getAttribute('data-theme');
103
+ setTheme(current === 'dark' ? 'light' : 'dark');
104
+ };
105
+
106
+ // Sidebar toggle for mobile
107
+ const hamburgerDashboard = document.getElementById('hamburgerDashboard');
108
+ const sidebar = document.getElementById('sidebar');
109
+ const mainContentArea = document.getElementById('mainContentArea');
110
+ const closeSidebarBtn = document.getElementById('closeSidebar');
111
+
112
+ hamburgerDashboard.onclick = () => {
113
+ sidebar.classList.add('open');
114
+ mainContentArea.classList.add('shifted');
115
+ };
116
+ closeSidebarBtn.onclick = () => {
117
+ sidebar.classList.remove('open');
118
+ mainContentArea.classList.remove('shifted');
119
+ };
120
+ mainContentArea.onclick = (event) => {
121
+ if (sidebar.classList.contains('open') && !sidebar.contains(event.target) && !hamburgerDashboard.contains(event.target)) {
122
+ sidebar.classList.remove('open');
123
+ mainContentArea.classList.remove('shifted');
124
+ }
125
+ };
126
+ Array.from(sidebar.getElementsByClassName('nav-item')).forEach(item => {
127
+ item.onclick = () => {
128
+ if (window.innerWidth <= 900) {
129
+ sidebar.classList.remove('open');
130
+ mainContentArea.classList.remove('shifted');
131
+ }
132
+ };
133
+ });
134
+
135
+ // API Key Copy function (only on this page now)
136
+ function copyApiKey() {
137
+ const input = document.getElementById("apiKey");
138
+ input.select();
139
+ input.setSelectionRange(0, 99999);
140
+ document.execCommand("copy");
141
+ const originalText = document.querySelector('.copy-btn').textContent;
142
+ document.querySelector('.copy-btn').textContent = 'Copied!';
143
+ setTimeout(() => {
144
+ document.querySelector('.copy-btn').textContent = originalText;
145
+ }, 1500);
146
+ }
147
+ </script>
148
+ {% endblock %}
149
+