Skip to content

Commit

Permalink
release analytics (#171)
Browse files Browse the repository at this point in the history
* release analytics

* save

* add macro to ignore lowercase _paq

* fix linter

* oxxo

* comment leptos from check
  • Loading branch information
darioalessandro authored Sep 1, 2024
1 parent 0fdb32e commit 2292627
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ clippy-fix:

fmt:
docker compose -f docker/docker-compose.yaml run yew-ui bash -c "cd /app/yew-ui && cargo fmt"
docker compose -f docker/docker-compose.yaml run websocket-api bash -c "cd /app/actix-api && cargo fmt"
docker compose -f docker/docker-compose.yaml run websocket-api bash -c "cd /app/actix-api && cargo fmt""

check:
docker compose -f docker/docker-compose.yaml run websocket-api bash -c "cd /app/actix-api && cargo clippy --all -- --deny warnings && cargo fmt --check"
docker compose -f docker/docker-compose.yaml run yew-ui bash -c "cd /app/yew-ui && cargo clippy --all -- --deny warnings && cargo fmt --check"
# docker compose -f docker/docker-compose.yaml run website bash -c "cd /app/leptos-website && cargo clippy --features ssr --all -- --deny warnings"
16 changes: 16 additions & 0 deletions docker/Dockerfile.website.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM rust:1.80-slim-bookworm as builder

RUN rustup default nightly-2024-08-21
RUN rustup target add wasm32-unknown-unknown

RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
g++ \
&& rm -rf /var/lib/apt/lists/*

RUN cargo install cargo-leptos --version 0.2.20

WORKDIR /app


21 changes: 19 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ services:
- /app/target
- rustlemania-yew-ui-cargo-registry-cache:/usr/local/cargo/registry
- rustlemania-yew-ui-cache:/app/yew-ui/target


build:
dockerfile: ../docker/Dockerfile.yew
working_dir: /app/yew-ui
Expand All @@ -29,6 +27,23 @@ services:
ports:
- "${TRUNK_SERVE_PORT:-80}:${TRUNK_SERVE_PORT:-80}"

website:
volumes:
- type: bind
source: ../
target: /app
- /app/target
- rustlemania-leptos-ui-cargo-registry-cache:/usr/local/cargo/registry
- rustlemania-leptos-ui-cache:/app/leptos-website/target
build:
dockerfile: ../docker/Dockerfile.website.dev
working_dir: /app/leptos-website
command: bash -c "trunk serve --address 0.0.0.0 --port ${TRUNK_SERVE_PORT:-80}"
environment:
- LEPTOS_SITE_ADDR="0.0.0.0:91"
ports:
- "91:91"

websocket-api:
build:
dockerfile: ../docker/Dockerfile.actix
Expand Down Expand Up @@ -117,3 +132,5 @@ volumes:
rustlemania-actix-web-target-cache:
rustlemania-actix-webtransport-cache:
rustlemania-yew-ui-cache:
rustlemania-leptos-ui-cargo-registry-cache:
rustlemania-leptos-ui-cache:
2 changes: 2 additions & 0 deletions leptos-website/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly-2023-12-01"
2 changes: 0 additions & 2 deletions leptos-website/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub fn App() -> impl IntoView {
<Route path="" view=Home ssr=SsrMode::Async/>
</Routes>
</Router>
<!-- Matomo -->
<script>
"var _paq = window._paq = window._paq || [];
_paq.push([\"setDocumentTitle\", document.domain + \"/\" + document.title]);
Expand All @@ -36,6 +35,5 @@ pub fn App() -> impl IntoView {
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();"
</script>
<!-- End Matomo Code -->
}
}
2 changes: 2 additions & 0 deletions leptos-website/src/components/HeroHeader.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

use crate::components::SphereLogo::*;
use leptos::*;
use leptos_meta::Style;
Expand Down
1 change: 0 additions & 1 deletion leptos-website/src/error_template.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::errors::TodoAppError;
use cfg_if::cfg_if;
use leptos::{Errors, *};
#[cfg(feature = "ssr")]
use leptos_axum::ResponseOptions;
Expand Down
6 changes: 0 additions & 6 deletions leptos-website/src/pages/Home.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
use crate::components::CodeExample::*;
use crate::components::ExampleServerFunction::*;
use crate::components::ExampleTailwind::*;
use crate::components::FeatureList::*;
use crate::components::HeroHeader::*;
use crate::components::InteractiveCodeExample::*;
use crate::components::Page::*;
use crate::components::SpeedStats::*;
use leptos::*;
use leptos_meta::*;

Expand Down
3 changes: 1 addition & 2 deletions yew-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>Rusty Conf</title>
<title>VideoCall.rs</title>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link data-trunk rel="copy-dir" href="./assets" />
<link data-trunk rel="css" href="./static/tailwind.css" />
Expand All @@ -12,7 +12,6 @@
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.videocall.rs"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
Expand Down
6 changes: 4 additions & 2 deletions yew-ui/src/components/matomo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(non_upper_case_globals)]

use gloo_utils::window;
use js_sys::Array;
use js_sys::Reflect;
Expand All @@ -8,7 +10,7 @@ use web_sys::js_sys;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = window)]
static _PAQ: Array;
static _paq: Array;
}

pub struct MatomoTracker {}
Expand All @@ -19,7 +21,7 @@ impl MatomoTracker {
}

pub fn push(&self, args: &JsValue) {
let method: js_sys::Function = js_sys::Reflect::get(&_PAQ, &"push".into()).unwrap().into();
let method: js_sys::Function = js_sys::Reflect::get(&_paq, &"push".into()).unwrap().into();
let _ = method.call1(&JsValue::NULL, args);
}

Expand Down
2 changes: 1 addition & 1 deletion yew-ui/static/tailwind.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
! tailwindcss v3.4.7 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
*/

/*
Expand Down

0 comments on commit 2292627

Please sign in to comment.