Skip to content

Commit 66d4075

Browse files
Basic frontpage design
1 parent 1d8bf3e commit 66d4075

File tree

6 files changed

+132
-22
lines changed

6 files changed

+132
-22
lines changed

deps.edn

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
nubank/matcher-combinators {:mvn/version "3.9.1"}}
2727

2828
:aliases
29-
{:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.0"}}
29+
{:dev {:extra-paths ["dev"]}
30+
31+
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.0"}}
3032
:ns-default build}
3133

3234
:test {:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1"

dev/user.clj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(ns user)
2+
3+
;; Load all user.clj files (including the system-wide one).
4+
(when *file*
5+
(->> (.getResources (.getContextClassLoader (Thread/currentThread)) "user.clj")
6+
enumeration-seq
7+
rest ; First file in the enumeration will be this file, so skip it.
8+
(run! #(do (println "Loading" (str %))
9+
(clojure.lang.Compiler/load (clojure.java.io/reader %))))))
10+
11+
(defn dev []
12+
(require 'flamebin.main)
13+
(flamebin.main/-main))

res/public/img/thumbnail1.png

353 KB
Loading

res/public/img/thumbnail2.png

239 KB
Loading

res/public/img/thumbnail3.png

307 KB
Loading

src/flamebin/web/pages.clj

Lines changed: 116 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,65 @@
1717
[:link {:rel "icon" :href "/public/img/icon.png" :type "image/png"}]
1818
[:title title]]
1919
(into
20-
[:body {:style "display:flex; flex-direction:column; height:100%;"}
21-
content
22-
[:footer {:style "text-align:right; padding-botton: 20px"}
23-
[:p (format "Build: %s (%s)" (@config :build :version)
24-
(@config :build :git-sha))]]]
20+
[:body {:style "display:flex; justify-content:center;"}
21+
[:div {:style "display:flex; flex-direction:column; justify-content: space-between; width: 1000px; max-width: 100%;"}
22+
content
23+
[:footer {:style "text-align:right; padding-botton: 20px"}
24+
[:p (format "Build: %s (%s)" (@config :build :version)
25+
(@config :build :git-sha))]]]]
2526
rst)])))
2627

28+
(defn header [upload?]
29+
[:div {:style {:display "flex"
30+
:justify-content "space-between"
31+
:width "100%"
32+
;; :max-width "100%"
33+
:align-items "center"
34+
:margin-bottom "40px"}}
35+
;; Logo container
36+
[:a {:href "/"
37+
:style "text-decoration:none; color:inherit;"}
38+
[:div {:style {:display "flex"
39+
:align-items "center"
40+
:gap "10px"}}
41+
[:img {:src "/public/img/icon.png"
42+
:alt "Flamebin logo"
43+
:style {:width "32px"
44+
:height "32px"}}]
45+
[:span {:style {:font-size "24px"
46+
:font-weight "500"}}
47+
"Flamebin"]]]
48+
49+
;; Upload button
50+
[:a {:href "/profiles/upload"
51+
:style {:visibility (if upload?
52+
"visible" "hidden")}}
53+
[:button {:href "/profiles/upload"
54+
:style {:background-color "#2F4F4F"
55+
:color "white"
56+
:padding "8px 16px"
57+
:border "none"
58+
:border-radius "6px"
59+
:cursor "pointer"
60+
:font-size "15px"}}
61+
"UPLOAD"]]])
62+
2763
(defn upload-page []
2864
(base
2965
"Upload profile - Flamebin"
30-
[:div {:style "flex:1;"}
31-
[:div {:style "display:flex; justify-content:center"}
32-
[:div
33-
[:h1 "Upload collapsed stacks file (.txt)"]
34-
(form/form-to {:enctype "multipart/form-data"
35-
:id "uploadForm"}
36-
[:post "this-is-ignored-the-url-is-set-in-javascript"]
37-
(form/file-upload {:id "fileInput"} "file")
38-
(form/submit-button "Upload"))
39-
[:div#status]
40-
[:a {:href "/"} "↰ Home"]]]]
66+
[:div {:style {:font-family "system-ui, -apple-system, sans-serif"
67+
:padding "20px"}}
68+
(header false)
69+
[:div {:style "flex:1;"}
70+
[:div {:style "display:flex; justify-content:center"}
71+
[:div
72+
[:h1 "Upload collapsed stacks file (.txt)"]
73+
(form/form-to {:enctype "multipart/form-data"
74+
:id "uploadForm"}
75+
[:post "this-is-ignored-the-url-is-set-in-javascript"]
76+
(form/file-upload {:id "fileInput"} "file")
77+
(form/submit-button "Upload"))
78+
[:div#status]]]]]
4179
[:script (h/raw (render-template
4280
(slurp (io/resource "site/upload.js"))
4381
{:upload-url "/api/v1/upload-profile?type=cpu&format=collapsed"}))]))
@@ -52,11 +90,68 @@
5290
(defn index-page []
5391
(base
5492
"Flamebin"
55-
[:div {:style "flex:1;"}
56-
[:center [:h1 "Flamebin"]]
57-
[:center [:h5 "Pastebin for your flamegraphs"]]
93+
[:div {:style {:font-family "system-ui, -apple-system, sans-serif"
94+
;; :max-width "1200px"
95+
;; :margin "0 auto"
96+
:padding "20px"}}
97+
(header true)
98+
99+
;; Main heading
100+
[:h1 {:style {:font-size "48px"
101+
:font-weight "300"
102+
:text-align "center"
103+
:margin "100px 0"
104+
:color "#000000"}}
105+
"Pastebin for your flamegraphs 🔥📈"]
106+
107+
[:div
108+
[:h2 {:style {:font-size "24px"
109+
:font-weight "600"
110+
:margin-bottom "30px"}}
111+
"EXAMPLES"]
112+
113+
;; Grid of uploads - hardcode for now
114+
[:div {:style {:display "grid"
115+
:grid-template-columns "repeat(3, 1fr)"
116+
:gap "20px"
117+
:margin-bottom "30px"}}
118+
(for [{:keys [i date url desc]}
119+
[{:i 1
120+
:date "01.11.2024"
121+
:desc "Aleph client and server"
122+
:url "/Rmxt9P"}
123+
{:i 2
124+
:date "09.11.2024"
125+
:desc "Recursive functions"
126+
:url "/3anDLN"}
127+
{:i 3
128+
:date "21.11.2024"
129+
:desc "Clojure start-up"
130+
:url "/8mVw7b"}]]
131+
[:a {:href url
132+
:style "text-decoration:none; color:inherit;"}
133+
[:div
134+
[:div {:key i
135+
:style {:border "1px solid #eee"
136+
:border-radius "8px"
137+
:overflow "hidden"}}
138+
[:div {:style {:padding "15px"}}
139+
[:div {:style {:font-size "18px"
140+
:font-weight "500"}}
141+
date]
142+
[:div {:style {:color "#666"
143+
:margin-top "5px"}}
144+
desc]]
145+
[:img {:src (format "/public/img/thumbnail%d.png" i)
146+
:style {:width "300px"
147+
:height "auto"}}]]]])]]
148+
149+
[:h2 {:style {:font-size "24px"
150+
:font-weight "600"
151+
:margin-bottom "30px"}}
152+
"PUBLIC UPLOADS"]
153+
58154
[:div {:style "display:flex; justify-content:center"}
59155
[:ul {:id "flamegraph-list"}
60156
(for [p (core/list-public-profiles)]
61-
[:li (format-ts (:upload_ts p)) " - " [:a {:href (format "/%s" (:id p))} (:id p)] ])]]
62-
[:center [:p [:a {:href "/profiles/upload"} "Upload another"]]]]))
157+
[:li (format-ts (:upload_ts p)) " - " [:a {:href (format "/%s" (:id p))} (:id p)] ])]]]))

0 commit comments

Comments
 (0)