Theming
This commit is contained in:
parent
367f53062d
commit
3fe367ef38
|
@ -3,23 +3,93 @@
|
|||
|
||||
<head>
|
||||
<title>Dashboard</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 20px 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 80%;
|
||||
margin: 20px auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #4CAF50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.create-new-link {
|
||||
display: block;
|
||||
width: fit-content;
|
||||
margin: 20px auto;
|
||||
padding: 10px 20px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.create-new-link:hover {
|
||||
background-color: #367c39;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Tracking Pixel Dashboard</h1>
|
||||
<a href="/new" class="create-new-link">Create New Tracking Pixel</a>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Total Views</th>
|
||||
<th>Unique Views</th>
|
||||
<th>Link</th>
|
||||
<th>UUID</th>
|
||||
</tr>
|
||||
{{range .}}
|
||||
<tr>
|
||||
<td>{{.Title}}</td>
|
||||
<td>{{.TotalViews}}</td>
|
||||
<td>{{.UniqueViews}}</td>
|
||||
<td><a href="/p/{{.UUID}}" target="_blank">link</a></td>
|
||||
<td>
|
||||
<a href='/p/{{.UUID}}'>
|
||||
{{.UUID}}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
|
@ -20,9 +22,15 @@
|
|||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
background-color: white;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #4CAF50;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -37,7 +45,7 @@
|
|||
|
||||
button {
|
||||
padding: 10px;
|
||||
background-color: #007bff;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
|
@ -45,7 +53,7 @@
|
|||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
background-color: #367c39;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
|
|
@ -46,7 +46,7 @@ func createPixelHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
http.Redirect(w, r, "/dashboard", http.StatusSeeOther)
|
||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func pixelHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -85,6 +85,11 @@ func pixelHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func dashboardHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
query := `
|
||||
SELECT p.title, p.uuid, COUNT(s.id) AS total_views, COUNT(DISTINCT s.ip) AS unique_views
|
||||
FROM pixels p
|
||||
|
|
|
@ -22,7 +22,7 @@ func Server() {
|
|||
http.HandleFunc("/new", newPixelPageHandler)
|
||||
http.HandleFunc("/create-pixel", createPixelHandler)
|
||||
http.HandleFunc("/p/", pixelHandler)
|
||||
http.HandleFunc("/dashboard", dashboardHandler)
|
||||
http.HandleFunc("/", dashboardHandler)
|
||||
|
||||
port := getenv("PORT", "80")
|
||||
|
||||
|
|
Loading…
Reference in New Issue