Skip to content

Commit bca9e86

Browse files
committed
[Reco] Unify layout to be similar to the Broadcaster
1 parent 77b907d commit bca9e86

File tree

22 files changed

+256
-336
lines changed

22 files changed

+256
-336
lines changed

broadcaster/mix.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"bunch": {:hex, :bunch, "1.6.1", "5393d827a64d5f846092703441ea50e65bc09f37fd8e320878f13e63d410aec7", [:mix], [], "hexpm", "286cc3add551628b30605efbe2fca4e38cc1bea89bcd0a1a7226920b3364fe4a"},
44
"bunch_native": {:hex, :bunch_native, "0.5.0", "8ac1536789a597599c10b652e0b526d8833348c19e4739a0759a2bedfd924e63", [:mix], [{:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "24190c760e32b23b36edeb2dc4852515c7c5b3b8675b1a864e0715bdd1c8f80d"},
55
"bundlex": {:hex, :bundlex, "1.5.1", "a85890a9d0a70366afa538c8589a4ba75e1319d32a771e1f5f3b7566beea9c26", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:req, "~> 0.4.0", [hex: :req, repo: "hexpm", optional: false]}, {:zarex, "~> 1.0", [hex: :zarex, repo: "hexpm", optional: false]}], "hexpm", "aae447d63230fe1f3b788c429ac02bc696f30163d0f23f52fcfe6ed38372c7ea"},
6-
"castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"},
6+
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
77
"crc": {:hex, :crc, "0.10.5", "ee12a7c056ac498ef2ea985ecdc9fa53c1bfb4e53a484d9f17ff94803707dfd8", [:mix, :rebar3], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3e673b6495a9525c5c641585af1accba59a1eb33de697bedf341e247012c2c7f"},
88
"dns_cluster": {:hex, :dns_cluster, "0.1.3", "0bc20a2c88ed6cc494f2964075c359f8c2d00e1bf25518a6a6c7fd277c9b0c66", [:mix], [], "hexpm", "46cb7c4a1b3e52c7ad4cbe33ca5079fbde4840dedeafca2baf77996c2da1bc33"},
99
"elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"},
1010
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
1111
"esbuild": {:hex, :esbuild, "0.8.1", "0cbf919f0eccb136d2eeef0df49c4acf55336de864e63594adcea3814f3edf41", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "25fc876a67c13cb0a776e7b5d7974851556baeda2085296c14ab48555ea7560f"},
12-
"ex_dtls": {:hex, :ex_dtls, "0.15.1", "34b3600ff13eebf6c96be033005cc110ea5beef98394631365ec26b493df80c5", [:mix], [{:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "9cfebdfe9111c0f68c77667cb9366e4a6f17e8a240975ffd100148de57478a29"},
12+
"ex_dtls": {:hex, :ex_dtls, "0.15.2", "6c8c0f8eb67525216551bd3e0322ab33c9d851d56ef3e065efab4fd277a8fbb9", [:mix], [{:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "6b852bc926bbdc9c1b9c4ecc6cfc73a89d4e106042802cefea2c1503072a9f2a"},
1313
"ex_ice": {:hex, :ex_ice, "0.7.1", "3ad14f7281ece304dfee227e332b8a67d93d5857602a8a4300a826c250af136e", [:mix], [{:elixir_uuid, "~> 1.0", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:ex_stun, "~> 0.2.0", [hex: :ex_stun, repo: "hexpm", optional: false]}, {:ex_turn, "~> 0.1.0", [hex: :ex_turn, repo: "hexpm", optional: false]}], "hexpm", "78e6bc4abb5294dcf0a474d0a91e78a829916291d846a0e255867dc5db8733e7"},
1414
"ex_libsrtp": {:hex, :ex_libsrtp, "0.7.2", "211bd89c08026943ce71f3e2c0231795b99cee748808ed3ae7b97cd8d2450b6b", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.3", [hex: :bundlex, repo: "hexpm", optional: false]}, {:membrane_precompiled_dependency_provider, "~> 0.1.0", [hex: :membrane_precompiled_dependency_provider, repo: "hexpm", optional: false]}, {:unifex, "~> 1.1", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "2e20645d0d739a4ecdcf8d4810a0c198120c8a2f617f2b75b2e2e704d59f492a"},
1515
"ex_rtcp": {:hex, :ex_rtcp, "0.4.0", "f9e515462a9581798ff6413583a25174cfd2101c94a2ebee871cca7639886f0a", [:mix], [], "hexpm", "28956602cf210d692fcdaf3f60ca49681634e1deb28ace41246aee61ee22dc3b"},
@@ -24,10 +24,10 @@
2424
"floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"},
2525
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized"]},
2626
"hpax": {:hex, :hpax, "0.2.0", "5a58219adcb75977b2edce5eb22051de9362f08236220c9e859a47111c194ff5", [:mix], [], "hexpm", "bea06558cdae85bed075e6c036993d43cd54d447f76d8190a8db0dc5893fa2f1"},
27-
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
27+
"jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"},
2828
"membrane_precompiled_dependency_provider": {:hex, :membrane_precompiled_dependency_provider, "0.1.2", "8af73b7dc15ba55c9f5fbfc0453d4a8edfb007ade54b56c37d626be0d1189aba", [:mix], [{:bundlex, "~> 1.4", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "7fe3e07361510445a29bee95336adde667c4162b76b7f4c8af3aeb3415292023"},
29-
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
30-
"mint": {:hex, :mint, "1.6.1", "065e8a5bc9bbd46a41099dfea3e0656436c5cbcb6e741c80bd2bad5cd872446f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4fc518dcc191d02f433393a72a7ba3f6f94b101d094cb6bf532ea54c89423780"},
29+
"mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"},
30+
"mint": {:hex, :mint, "1.6.2", "af6d97a4051eee4f05b5500671d47c3a67dac7386045d87a904126fd4bbcea2e", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "5ee441dffc1892f1ae59127f74afe8fd82fda6587794278d924e4d90ea3d63f9"},
3131
"nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
3232
"nimble_ownership": {:hex, :nimble_ownership, "0.3.1", "99d5244672fafdfac89bfad3d3ab8f0d367603ce1dc4855f86a1c75008bce56f", [:mix], [], "hexpm", "4bf510adedff0449a1d6e200e43e57a814794c8b5b6439071274d248d272a549"},
3333
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},

reco/assets/css/app.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@
33
@import "tailwindcss/utilities";
44

55
/* This file is for your main application CSS */
6+
7+
/* Hiding scrollbar for IE, Edge and Firefox */
8+
main {
9+
scrollbar-width: none; /* Firefox */
10+
-ms-overflow-style: none; /* IE and Edge */
11+
}
12+
13+
main::-webkit-scrollbar {
14+
display: none;
15+
}
16+

reco/assets/js/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ import { Socket } from "phoenix"
2222
import { LiveSocket } from "phoenix_live_view"
2323
import topbar from "../vendor/topbar"
2424

25+
import { Room } from "./room.js"
26+
27+
let Hooks = {}
28+
Hooks.Room = Room
29+
2530
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
26-
let liveSocket = new LiveSocket("/live", Socket, { params: { _csrf_token: csrfToken } })
31+
let liveSocket = new LiveSocket("/live", Socket, { params: { _csrf_token: csrfToken }, hooks: Hooks })
2732

2833
// Show progress bar on live navigation and form submits
2934
topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" })

reco/assets/js/reco.js renamed to reco/assets/js/room.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ let socket;
1616
let channel;
1717
let pc;
1818

19-
async function run() {
20-
console.log("Starting");
19+
async function connect() {
20+
console.log("Connecting");
21+
button.onclick = disconnect;
2122

2223
localStream = await navigator.mediaDevices.getUserMedia({
2324
audio: true,
@@ -34,13 +35,13 @@ async function run() {
3435
socket.connect();
3536

3637
channel = socket.channel("room:" + roomId, {});
37-
channel.onClose(_ => { window.location.href = "/reco" });
38+
channel.onClose(_ => { window.location.href = "/" });
3839

3940
channel.join()
4041
.receive("ok", resp => { console.log("Joined successfully", resp) })
4142
.receive("error", resp => {
4243
console.log("Unable to join", resp);
43-
window.location.href = "/reco";
44+
window.location.href = "/";
4445
})
4546

4647
channel.on("signaling", msg => {
@@ -56,7 +57,7 @@ async function run() {
5657
channel.on("imgReco", msg => {
5758
const pred = msg['predictions'][0];
5859
imgpred.innerText = pred['label'];
59-
imgscore.innerText = pred['score'];
60+
imgscore.innerText = pred['score'].toFixed(3);
6061
})
6162

6263
channel.on("sessionTime", msg => {
@@ -75,8 +76,8 @@ async function run() {
7576
channel.push("signaling", JSON.stringify(offer));
7677
}
7778

78-
button.onclick = () => {
79-
console.log("Leaving");
79+
function disconnect() {
80+
console.log("Disconnecting");
8081
localStream.getTracks().forEach(track => track.stop());
8182
videoPlayer.srcObject = null;
8283

@@ -93,4 +94,8 @@ button.onclick = () => {
9394
}
9495
}
9596

96-
run();
97+
export const Room = {
98+
mounted() {
99+
connect();
100+
}
101+
}

reco/assets/tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
theme: {
1515
extend: {
1616
colors: {
17-
brand: "#FD4F00",
17+
brand: "#4339AC",
1818
}
1919
},
2020
},

reco/config/config.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ config :esbuild,
2626
version: "0.17.11",
2727
default: [
2828
args:
29-
~w(js/app.js js/reco.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
29+
~w(js/app.js js/room.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
3030
cd: Path.expand("../assets", __DIR__),
3131
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
3232
]
3333

3434
# Configure tailwind (the version is required)
3535
config :tailwind,
36-
version: "3.3.2",
36+
version: "3.4.4",
3737
default: [
3838
args: ~w(
3939
--config=tailwind.config.js

reco/lib/reco/application.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ defmodule Reco.Application do
88

99
@max_rooms Application.compile_env!(:reco, :max_rooms)
1010

11+
@version Mix.Project.config()[:version]
12+
13+
@spec version() :: String.t()
14+
def version() do
15+
"v#{@version} #{commit()}"
16+
end
17+
18+
defp commit() do
19+
case System.cmd("git", ["rev-parse", "--short", "HEAD"]) do
20+
{hash, 0} -> "(#{String.trim(hash)})"
21+
_ -> ""
22+
end
23+
end
24+
1125
@impl true
1226
def start(_type, _args) do
1327
children = [
Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
<header class="px-4 sm:px-6 lg:px-8">
2-
<div class="flex items-center justify-center border-b border-zinc-100 py-4 text-sm">
2+
<div class="flex flex-col lg:flex-row items-center justify-between border-b border-brand/15 py-3 text-sm">
33
<div class="flex items-center gap-4">
4-
<a href="https://github.com/elixir-webrtc/ex_webrtc">
5-
<img src={~p"/images/logo.svg"} width="36" />
4+
<a href="/">
5+
<img src={~p"/images/logo.svg"} width="225" />
66
</a>
77
</div>
8-
<div class="flex items-center content-center gap-4 font-semibold leading-6 text-zinc-900">
9-
<a href="https://github.com/elixir-webrtc/ex_webrtc" class="hover:text-zinc-700">
10-
GitHub
11-
</a>
12-
<a href="https://hexdocs.pm/ex_webrtc/" class="hover:text-zinc-700">
13-
Documentation
14-
</a>
8+
<div class="flex">
9+
<div class="flex items-center gap-4 font-semibold leading-6 text-brand/80">
10+
<a href="https://github.com/elixir-webrtc/ex_webrtc" class="hover:text-brand">
11+
GitHub
12+
</a>
13+
<a
14+
href="https://hexdocs.pm/ex_webrtc/readme.html"
15+
class="rounded-lg bg-brand/10 px-2 py-1 hover:bg-brand/20"
16+
>
17+
Docs <span aria-hidden="true">&rarr;</span>
18+
</a>
19+
</div>
1520
</div>
1621
</div>
1722
</header>
18-
<main class="p-72 px-4 py-8 sm:px-6 lg:px-8">
19-
<div class="mx-auto max-w-2xl">
23+
<main class="flex flex-1 justify-center overflow-scroll">
24+
<div class="h-full py-7 px-7 w-[800px]">
2025
<.flash_group flash={@flash} />
2126
<%= @inner_content %>
2227
</div>
2328
</main>
29+
<footer class="flex flex-row px-4 py-2 lg:justify-start justify-center font-semibold text-brand/80">
30+
<%= Reco.Application.version() %>
31+
</footer>

reco/lib/reco_web/components/layouts/root.html.heex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="csrf-token" content={get_csrf_token()} />
7-
<.live_title suffix=" · Phoenix Framework">
8-
<%= assigns[:page_title] || "Reco" %>
7+
<.live_title suffix=" · Reco">
8+
<%= assigns[:page_title] %>
99
</.live_title>
1010
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
1111
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
1212
</script>
1313
</head>
14-
<body class="bg-white antialiased">
14+
<body class="bg-white antialiased h-svh flex flex-col">
1515
<%= @inner_content %>
1616
</body>
1717
</html>

reco/lib/reco_web/controllers/page_controller.ex

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)