-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontactus.html
More file actions
211 lines (178 loc) · 7.28 KB
/
contactus.html
File metadata and controls
211 lines (178 loc) · 7.28 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact Us — SwapSkill</title>
<link rel="icon" type="image/png" href="/logo.png">
<style>
:root {
--primary: #3b82f6;
--success: #22c55e;
--danger: #ef4444;
--bg: #0f172a;
--text: #f8fafc;
--glass: rgba(30, 41, 59, 0.6);
--border: rgba(255, 255, 255, 0.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body {
background: radial-gradient(circle at top right, #1e293b, #0f172a);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* --- Header --- */
header {
position: sticky; top: 0; z-index: 50;
background: rgba(15, 23, 42, 0.85);
backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border);
padding: 16px 24px;
display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 20px; font-weight: 700; color: #fff; text-decoration: none; cursor: pointer; }
.btn {
padding: 8px 16px; border-radius: 12px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.btn-ghost { background: rgba(255,255,255,0.05); color: #cbd5e1; border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
/* --- Content --- */
.container {
max-width: 700px; margin: 40px auto; padding: 30px;
background: var(--glass); backdrop-filter: blur(10px);
border: 1px solid var(--border); border-radius: 20px;
box-shadow: 0 20px 50px rgba(0,0,0,0.3);
width: 90%;
}
h2 { text-align: center; margin-bottom: 10px; color: #fff; }
p.sub { text-align: center; color: #94a3b8; font-size: 14px; margin-bottom: 30px; }
/* Form Elements */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; color: #94a3b8; margin-bottom: 6px; font-weight: 600; }
input, textarea, select {
width: 100%; padding: 12px 16px; border-radius: 12px;
background: rgba(0,0,0,0.2); border: 1px solid var(--border);
color: #fff; font-size: 14px; outline: none; transition: 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); background: rgba(0,0,0,0.4); }
/* Dropdown styling */
select option { background: #1e293b; color: #fff; }
button {
width: 100%; padding: 14px; background: var(--primary);
border: none; border-radius: 12px; color: white; font-weight: 600;
cursor: pointer; font-size: 16px; transition: 0.2s;
}
button:hover { background: #2563eb; transform: translateY(-2px); }
/* Messages */
#loginMsg {
text-align: center; color: var(--danger); background: rgba(239, 68, 68, 0.1);
padding: 15px; border-radius: 12px; border: 1px solid rgba(239, 68, 68, 0.2);
display: none;
}
#successMsg {
text-align: center; color: var(--success); background: rgba(34, 197, 94, 0.1);
padding: 15px; border-radius: 12px; border: 1px solid rgba(34, 197, 94, 0.2);
display: none; margin-top: 20px;
}
/* Loader */
#loaderOverlay {
position: fixed; inset: 0; background: #0f172a; z-index: 999;
display: flex; align-items: center; justify-content: center;
transition: opacity 0.5s; pointer-events: none; opacity: 0;
}
.loader { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
</style>
</head>
<body>
<header>
<div class="brand" onclick="location.href='index.html'">SwapSkill</div>
<button class="btn btn-ghost" onclick="location.href='dashboard.html'">Go to Dashboard</button>
</header>
<div class="container">
<h2>Contact Support</h2>
<p class="sub">Report a bug, suggest a feature, or just say hi.</p>
<div id="loginMsg">⚠️ You must be logged in to send a report. <a href="login.html" style="color:#fff;text-decoration:underline">Login here</a></div>
<form id="reportForm" style="display:none">
<div class="form-group">
<label>Your Email</label>
<input type="text" id="reportEmail" readonly style="opacity:0.6; cursor:not-allowed">
</div>
<div class="form-group">
<label>Category</label>
<select id="reportCategory">
<option>General Issue</option>
<option>Account Problem</option>
<option>Bug Report</option>
<option>Feature Request</option>
<option>Other</option>
</select>
</div>
<div class="form-group">
<label>Subject</label>
<input type="text" id="reportSubject" placeholder="Brief summary...">
</div>
<div class="form-group">
<label>Message</label>
<textarea id="reportMessage" rows="5" placeholder="Describe the issue in detail..."></textarea>
</div>
<button type="submit" id="sendBtn">Send Report</button>
</form>
<div id="successMsg">✔ Report sent successfully! We'll check it soon.</div>
</div>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/12.3.0/firebase-app.js";
import { getAuth, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/12.3.0/firebase-auth.js";
import { getFirestore, addDoc, collection, serverTimestamp } from "https://www.gstatic.com/firebasejs/12.3.0/firebase-firestore.js";
const firebaseConfig = {
apiKey: "AIzaSyDwrZVBhR0VSbkbiktvkOsW3iSYJ6PFJ9A",
authDomain: "swapskill.web.app",
projectId: "swapskill-6e456"
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = getFirestore(app);
onAuthStateChanged(auth, (user) => {
if (user) {
document.getElementById("reportForm").style.display = "block";
document.getElementById("reportEmail").value = user.email;
document.getElementById("loginMsg").style.display = "none";
} else {
document.getElementById("reportForm").style.display = "none";
document.getElementById("loginMsg").style.display = "block";
}
});
document.getElementById("reportForm").addEventListener("submit", async (e) => {
e.preventDefault();
const subject = document.getElementById("reportSubject").value.trim();
const message = document.getElementById("reportMessage").value.trim();
const btn = document.getElementById("sendBtn");
if(!subject || !message) return alert("Please fill all fields");
btn.innerText = "Sending...";
btn.disabled = true;
try {
const user = auth.currentUser;
await addDoc(collection(db, "userreport"), {
uid: user.uid,
email: user.email,
category: document.getElementById("reportCategory").value,
subject,
message,
createdAt: serverTimestamp()
});
document.getElementById("reportForm").reset();
document.getElementById("reportForm").style.display = "none";
document.getElementById("successMsg").style.display = "block";
document.getElementById("reportEmail").value = user.email; // restore email after reset
} catch(err) {
console.error(err);
alert("Error sending report. Please try again.");
btn.innerText = "Send Report";
btn.disabled = false;
}
});
</script>
</body>
</html>