Skip to content

Commit 89a74ad

Browse files
committed
feat(Frontend): 🍱 Add new favicon
A ugly icon that I draw by myself
1 parent b3dac66 commit 89a74ad

File tree

6 files changed

+10
-17
lines changed

6 files changed

+10
-17
lines changed

frontend/assets/favicon.ico

-15 KB
Binary file not shown.

frontend/assets/favicon.png

1.23 KB
Loading

frontend/assets/favicon.svg

Lines changed: 6 additions & 0 deletions
Loading

frontend/src/app.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub fn App() -> impl IntoView {
2121
view! {
2222
<Stylesheet id="leptos" href="/pkg/mdoj.css" />
2323
<Title text="MDOJ" />
24+
<Link rel="icon" type_="image/svg+xml" href="/assets/favicon.svg" />
25+
<Link rel="icon" type_="image/png" href="/assets/favicon.png" />
2426
<ProvideConfig>
2527
<ProvideToast>
2628
<div class="bg-black-950 w-full min-h-dvh flex flex-col text-text">

frontend/src/components/navbar.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn Navbar() -> impl IntoView {
1111
<nav class="bg-black-900 sticky top-0 p-2 flex flex-row justify-between border-b-2 border-black-400 z-10">
1212
<div class="flex flex-row flex-nowrap">
1313
<A href="/">
14-
<img src="https://placehold.co/100" class="h-12 aspect-square mx-5" />
14+
<img src="/assets/favicon.svg" class="h-12 aspect-square mx-5" />
1515
</A>
1616
<ul class="flex flex-row flex-nowrap justify-between items-center text-base">
1717
<NavbarLink href="/problems">Problems</NavbarLink>
@@ -32,8 +32,7 @@ pub fn Navbar() -> impl IntoView {
3232
}
3333
}
3434
>
35-
36-
<img src="https://placehold.co/100" class="h-12 aspect-square mx-5" />
35+
Username Here
3736
</Show>
3837
</div>
3938
</nav>

frontend/src/main.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
3030
.service(Files::new("/pkg", format!("{site_root}/pkg")))
3131
// serve other assets from the `assets` directory
3232
.service(Files::new("/assets", site_root))
33-
// serve the favicon from /favicon.ico
34-
.service(favicon)
3533
.leptos_routes(leptos_options.to_owned(), routes.to_owned(), App)
3634
.app_data(web::Data::new(leptos_options.to_owned()))
3735
.wrap_fn(|mut req, srv| {
@@ -60,18 +58,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
6058
Ok(())
6159
}
6260

63-
#[cfg(feature = "ssr")]
64-
#[actix_web::get("favicon.ico")]
65-
async fn favicon(
66-
leptos_options: actix_web::web::Data<leptos::LeptosOptions>,
67-
) -> actix_web::Result<actix_files::NamedFile> {
68-
let leptos_options = leptos_options.into_inner();
69-
let site_root = &leptos_options.site_root;
70-
Ok(actix_files::NamedFile::open(format!(
71-
"{site_root}/favicon.ico"
72-
))?)
73-
}
74-
7561
#[cfg(not(any(feature = "ssr", feature = "csr")))]
7662
pub fn main() {
7763
// no client-side main function

0 commit comments

Comments
 (0)