-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contribute to the Frontend #9
Comments
I figured out how to build it. When I execute However, I haven't yet figured out how to open the frontend. When I open |
I found the problem, it was disabled in the config. |
Hello @Aloso, Thank you for your interest for the project, and thanks you for offering your help on the frontend ;) Instructions to build or launch Meuse are in the documentation websites:
The frontend is indeed disabled in the configuration by default. Once enabled, it should be available on How to modify the frontendThe frontend code is mostly in the frontend directory. More specifically, the default layou is in the base.clj namespace, and the pages itself in the pages directory. Pages are generated server side, and I use hiccup as templating engine. Hiccup is simple: Instead of: <div id="foo" class="bar">
<p>Hello</p>
</div> You have a clojure datastructure: [:div {:id "foo" :class "bar"}
[:p "Hello"]] You can then use variables, for loop etc... to generate these datastructures. ExampleLet's take an example with the search.clj page: We start by importing some namespaces (e.g modules) at the beginning of the file. This part is not very important: (ns meuse.front.pages.search
(:require [meuse.api.crate.search :as api-search]
[meuse.db.public.search :as public-search])) Then, I have a function which takes a parameter name (defn format-result
[result]
(->> (group-by :crate-id result)
(map api-search/get-crate-max-version))) Then, I page my page. I extract from the http request the query (which is passed as a query parameter), and I use this query to search crates in the database: (let [{query :q} (:params request)
result (format-result (public-search/search search-db query))] My variable Then, I define my HTML with [:div], [:h1] etc.... As you can see, I loop on crates (with What should be done
I will do it, but probably tomorrow ;) |
Thanks for the detailed explanation! I already looked at the code and tweaked some things. What bothered me the most is the font. Since I tried Work Sans from Google Fonts instead, and it looks very nice IMO: Please also tell me what you think about the white background, the box shadow and the wide search bar! |
It looks nice ! Don't hesitate to make PRs ;) |
I guess I can close this now. |
I read on your blog that you would like help improving the Frontend. I have a bit of free time, so I'd like to offer my help.
About me: I'm a CS student and live in Germany. I'm experienced in writing Java, Kotlin, Javascript, Typescript, HTML, CSS, SQL and Rust.
I'm not yet familiar with Clojure, but I guess I don't have to understand everything to work with the HTML templates :)
Could you create some issues with a
frontend
label, so I know what needs to be implemented?P.S. could you add build instructions to the readme?
The text was updated successfully, but these errors were encountered: