(feat): version dump for testing #8

Merged
alois merged 4 commits from dev into main 2026-05-24 19:00:32 +03:00
71 changed files with 585 additions and 108 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 KiB

237
apps/tauri/logo.svg Normal file
View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="90mm"
height="90mm"
viewBox="0 0 90 90"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="logo_raw.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
inkscape:zoom="0.99999999"
inkscape:cx="450"
inkscape:cy="291.5"
inkscape:window-width="1223"
inkscape:window-height="1369"
inkscape:window-x="26"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" /><defs
id="defs1"><linearGradient
id="swatch15"
inkscape:swatch="solid"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop15" /></linearGradient><linearGradient
id="swatch10"
inkscape:swatch="solid"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop10" /></linearGradient><linearGradient
id="swatch3"
inkscape:swatch="solid"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3" /></linearGradient><linearGradient
id="swatch2"
inkscape:swatch="solid"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2" /></linearGradient><linearGradient
id="swatch1"
inkscape:swatch="solid"><stop
style="stop-color:#031616;stop-opacity:1;"
offset="0"
id="stop1" /></linearGradient><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect2"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1 @ F,0,0,1,0,0.79374998,0,1"
radius="3"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><inkscape:path-effect
effect="bspline"
id="path-effect6"
is_visible="true"
lpeversion="1.3"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false"
uniform="false" /><inkscape:path-effect
effect="spiro"
id="path-effect5"
is_visible="true"
lpeversion="1" /><clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1"><path
id="path3"
style="fill:#043b3c;stroke-width:0.320821"
inkscape:label="arrow"
d="m 244.98648,261.60864 -9.19072,26.71639 23.35523,-11.66051 c -4.69011,-5.05439 -10.12762,-9.5023 -14.16451,-15.05588 z m 40.12749,-74.6916 50.72412,18.76364 c 6.70121,39.09457 -10.8946,70.48625 -50.72412,85.29337 z m 0,0 -50.72412,18.76364 c -6.7012,39.09457 10.89461,70.48625 50.72412,85.29337 z"
sodipodi:nodetypes="cccccccccccc" /></clipPath><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient15"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient16"
x1="63.191292"
y1="148.5"
x2="146.82355"
y2="148.5"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient17"
gradientUnits="userSpaceOnUse"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient18"
gradientUnits="userSpaceOnUse"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient19"
gradientUnits="userSpaceOnUse"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient20"
gradientUnits="userSpaceOnUse"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient21"
gradientUnits="userSpaceOnUse"
x1="232.99823"
y1="238.94554"
x2="337.22971"
y2="238.94554" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient22"
gradientUnits="userSpaceOnUse"
x1="63.191292"
y1="148.5"
x2="146.82355"
y2="148.5" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient23"
gradientUnits="userSpaceOnUse"
x1="63.191292"
y1="148.5"
x2="146.82355"
y2="148.5" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient24"
gradientUnits="userSpaceOnUse"
x1="63.191292"
y1="148.5"
x2="146.82355"
y2="148.5" /><linearGradient
inkscape:collect="always"
xlink:href="#swatch1"
id="linearGradient25"
gradientUnits="userSpaceOnUse"
x1="63.191292"
y1="148.5"
x2="146.82355"
y2="148.5" /></defs><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-62.941767,-104.13688)"><g
id="g2"
transform="matrix(0.78671048,0,0,0.83608014,-116.36038,-50.640745)"
inkscape:label="background"
style="display:inline;stroke:url(#linearGradient15);stroke-width:0.616508;stroke-dasharray:none"
clip-path="url(#clipPath1)"><path
id="rect1"
style="fill:#004b4a;stroke:url(#linearGradient17);stroke-width:0.616508;stroke-dasharray:none"
transform="rotate(-75)"
d="m -227.83395,273.59631 h 146.303341 v 24.39636 H -227.83395 Z" /><path
id="rect1-1"
style="fill:#00524e;stroke:url(#linearGradient18);stroke-width:0.616508;stroke-dasharray:none"
transform="rotate(-75)"
d="m -227.83395,297.99268 h 146.303341 v 24.39636 H -227.83395 Z" /><path
id="rect1-1-3"
style="fill:#006560;stroke:url(#linearGradient19);stroke-width:0.616508;stroke-dasharray:none"
transform="rotate(-75)"
d="m -227.83395,322.3891 h 146.303341 v 24.39636 H -227.83395 Z" /><path
id="rect1-1-3-6"
style="fill:#02857d;stroke:url(#linearGradient20);stroke-width:0.616508;stroke-dasharray:none"
transform="rotate(-75)"
d="m -227.83395,346.78546 h 146.303341 v 24.39636 H -227.83395 Z" /><path
id="rect1-1-3-6-2"
style="fill:#12a89e;stroke:url(#linearGradient21);stroke-width:0.616508;stroke-dasharray:none"
transform="rotate(-75)"
d="m -227.83395,371.18179 h 146.303341 v 24.39636 H -227.83395 Z" /></g><g
id="g3"
inkscape:label="foreground"
style="stroke:url(#linearGradient16);stroke-width:0.5;stroke-dasharray:none"
transform="translate(3.3653788,0.84760028)"><g
id="g1"
inkscape:label="outline"
style="stroke:url(#linearGradient23);stroke-width:0.5;stroke-dasharray:none"><path
id="path15-3-5"
style="opacity:0.352;fill:#000000;fill-opacity:1;stroke:url(#linearGradient22);stroke-width:0.5;stroke-dasharray:none"
inkscape:label="filler"
d="m -54.535435,65.443954 -38.869976,15.14533 c -2.902661,17.83718 0.143161,33.687786 8.852689,46.257116 l -5.823934,18.52239 15.016655,-8.2765 c 5.699447,4.98296 12.651108,9.14382 20.824566,12.34447 30.52177,-11.95203 44.00571,-37.29104 38.8705,-68.847476 z m -0.01808,2.85099 36.24585,14.11438 c 4.61111,37.589746 -14.17784,55.293626 -36.24585,64.158876 -21.698042,-8.5864 -40.914886,-26.53641 -36.245337,-64.158876 z"
transform="translate(159.54375,40.87617)" /></g><path
style="opacity:1;fill:#b8f8ff;fill-opacity:1;stroke:url(#linearGradient24);stroke-width:0.5;stroke-dasharray:none"
d="m 98.103726,126.47621 21.412544,0.16758 a 0.41189664,0.41189664 63.022469 0 1 0.33171,0.65164 l -8.29596,11.58914 a 0.41184923,0.41184923 63.019773 0 0 0.33171,0.65157 l 10.05254,0.0777 a 0.3104736,0.3104736 69.080154 0 1 0.20649,0.54017 l -30.495516,27.73194 a 0.15466019,0.15466019 36.691517 0 1 -0.243455,-0.18141 l 10.172421,-21.16912 a 0.50438266,0.50438266 58.099348 0 0 -0.44993,-0.72282 l -11.312564,-0.10524 a 0.52748832,0.52748832 56.926855 0 1 -0.479488,-0.73628 l 7.661544,-17.7722 a 1.1963277,1.1963277 146.88457 0 1 1.107954,-0.72269 z"
id="path2"
sodipodi:nodetypes="cccccccc"
inkscape:label="bolt" /><path
id="path1"
style="fill:#043b3c;stroke:url(#linearGradient25);stroke-width:0.5;stroke-dasharray:none"
inkscape:label="dark_outline"
d="m 104.99968,104.40528 -40.706558,15.90239 c -2.948156,18.16379 0.05742,34.31077 8.566402,47.3046 l -7.438306,22.73763 18.798853,-9.90998 c 5.772204,4.86637 12.68201,8.97564 20.779609,12.15481 31.96374,-12.54919 46.08489,-39.15399 40.70708,-72.28706 z m 0,1.91926 38.88755,15.13603 c 4.9985,39.45937 -15.37196,59.52899 -38.88755,68.8573 -7.461219,-2.95976 -14.605741,-7.00102 -20.723799,-12.39976 l -1.849499,0.95188 -13.267924,7.37991 5.196582,-16.46463 0.704866,-2.3027 c 0.02259,0.0331 0.04422,0.065 0,-5.2e-4 -0.02016,-0.0296 -0.04036,-0.0594 -0.01292,-0.0196 -7.707836,-11.18647 -11.48502,-25.8661 -8.934338,-46.00184 z m 5.2e-4,2.85151 -36.245852,14.11438 c -4.788427,29.4077 7.785188,53.02119 36.245852,64.15939 28.46066,-11.1382 41.03376,-34.75169 36.24533,-64.15939 z m 0,1.70377 34.62527,13.43381 c 4.45069,35.0227 -13.68688,52.83618 -34.62527,61.11564 -20.938395,-8.27946 -39.076477,-26.09294 -34.625796,-61.11564 z" /></g></g></svg>

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -30,7 +30,7 @@
"build:desktop:raw": "tauri build", "build:desktop:raw": "tauri build",
"dev:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:desktop:raw; else bun dev:desktop:raw; fi", "dev:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:desktop:raw; else bun dev:desktop:raw; fi",
"build:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:desktop:raw; else bun build:desktop:raw; fi", "build:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:desktop:raw; else bun build:desktop:raw; fi",
"gen-icons": "tauri icon ./logo.png", "gen-icons": "tauri icon ./logo.svg",
"format": "bunx prettier --write .", "format": "bunx prettier --write .",
"lint": "eslint src" "lint": "eslint src"
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,001 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

View file

@ -1,5 +1,12 @@
import { Button } from "@tensamin/ui"; import { Button } from "@tensamin/ui";
import { ArrowLeft, House, Phone, Settings, User } from "lucide-react"; import {
ArrowLeft,
ChevronDown,
House,
Phone,
Settings,
User,
} from "lucide-react";
import { useLocation, useNavigate, useSearch } from "@tanstack/react-router"; import { useLocation, useNavigate, useSearch } from "@tanstack/react-router";
import { joinCall, useCall } from "@tensamin/call/store"; import { joinCall, useCall } from "@tensamin/call/store";
import Wrapper from "@tensamin/user/wrapper"; import Wrapper from "@tensamin/user/wrapper";
@ -62,7 +69,16 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) {
<Wrapper <Wrapper
userId={id} userId={id}
component={(user) => ( component={(user) => (
<p className="font-medium text-md">{user?.display}</p> <Button
variant="link"
className="px-0! text-foreground"
style={{
textDecorationLine: "none",
}}
>
<p className="font-medium text-md">{user?.display}</p>
<ChevronDown />
</Button>
)} )}
loading={<Skeleton className="ml-3 w-40 h-5" />} loading={<Skeleton className="ml-3 w-40 h-5" />}
/> />

View file

@ -1,4 +1,4 @@
import { Button } from "@tensamin/ui"; import { Button, cn } from "@tensamin/ui";
import { Input } from "@tensamin/ui"; import { Input } from "@tensamin/ui";
import { Label } from "@tensamin/ui"; import { Label } from "@tensamin/ui";
import { useStorage } from "@tensamin/storage/context"; import { useStorage } from "@tensamin/storage/context";
@ -83,25 +83,18 @@ function parseTuFileContent(rawFileContent: string): {
return { userId, privateKey, domain }; return { userId, privateKey, domain };
} }
/**
* Renders the login form for file upload and manual credential login.
* @returns Login form JSX.
*/
export default function Form() { export default function Form() {
const uploadRef = React.useRef<HTMLInputElement | null>(null); const uploadRef = React.useRef<HTMLInputElement | null>(null);
const [isDragging, setIsDragging] = React.useState(false);
const { save } = useStorage(); const { save } = useStorage();
/** // Process dropped files
* Handles uploaded .tu files and stores resolved credentials. const processDroppedFile = React.useCallback(
* @param event Change event from the hidden file input. async (file: globalThis.File): Promise<void> => {
* @returns Promise that resolves when processing has finished.
*/
const handleFileInputChange = React.useCallback(
async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
try { try {
const file = event.currentTarget.files?.[0]; if (!file.name.endsWith(".tu")) {
if (!file) { toast("error", "Please upload a .tu file");
throw new Error("No file selected"); return;
} }
const raw = await file.text(); const raw = await file.text();
@ -123,13 +116,94 @@ export default function Form() {
[save], [save],
); );
// Handle .tu files
const handleFileInputChange = React.useCallback(
async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
const file = event.currentTarget.files?.[0];
if (!file) {
toast("error", "No file selected");
return;
}
await processDroppedFile(file);
},
[processDroppedFile],
);
// Drag and drop listener
React.useEffect(() => {
let dragCounter = 0;
const handleDragEnter = (event: DragEvent) => {
event.preventDefault();
event.stopPropagation();
dragCounter++;
if (event.dataTransfer?.items?.length) {
setIsDragging(true);
}
};
const handleDragLeave = (event: DragEvent) => {
event.preventDefault();
event.stopPropagation();
dragCounter--;
if (dragCounter <= 0) {
setIsDragging(false);
}
};
const handleDragOver = (event: DragEvent) => {
event.preventDefault();
event.stopPropagation();
if (event.dataTransfer) {
event.dataTransfer.dropEffect = "copy";
}
};
const handleDrop = async (event: DragEvent) => {
event.preventDefault();
event.stopPropagation();
dragCounter = 0;
setIsDragging(false);
const file = event.dataTransfer?.files?.[0];
if (!file) {
toast("error", "No file dropped");
return;
}
await processDroppedFile(file);
};
window.addEventListener("dragenter", handleDragEnter);
window.addEventListener("dragleave", handleDragLeave);
window.addEventListener("dragover", handleDragOver);
window.addEventListener("drop", handleDrop);
return () => {
window.removeEventListener("dragenter", handleDragEnter);
window.removeEventListener("dragleave", handleDragLeave);
window.removeEventListener("dragover", handleDragOver);
window.removeEventListener("drop", handleDrop);
};
}, [processDroppedFile]);
/** /**
* Handles username and private key login submission. * Handles username and private key login submission.
* @param event Form submit event. * @param event Form submit event.
* @returns Promise that resolves after login processing. * @returns Promise that resolves after login processing.
*/ */
const handleCredentialsSubmit = React.useCallback( const handleCredentialsSubmit = React.useCallback(
async (event: React.SubmitEvent<HTMLFormElement>): Promise<void> => { async (event: React.FormEvent<HTMLFormElement>): Promise<void> => {
event.preventDefault(); event.preventDefault();
const formData = new FormData(event.currentTarget); const formData = new FormData(event.currentTarget);
@ -191,7 +265,7 @@ export default function Form() {
); );
return ( return (
<div className="flex md:flex-row flex-col gap-15"> <div className="relative flex md:flex-row flex-col gap-15">
{isTauri() ? ( {isTauri() ? (
<> <>
<QrCodeScanner <QrCodeScanner
@ -199,23 +273,26 @@ export default function Form() {
if (!data.startsWith("tensamin://tu::")) { if (!data.startsWith("tensamin://tu::")) {
toast("error", "Invalid QR code"); toast("error", "Invalid QR code");
return; return;
} else { }
const decoded = data.replace("tensamin://tu::", "");
try { const decoded = data.replace("tensamin://tu::", "");
const { userId, privateKey, domain } =
parseTuFileContent(decoded); try {
await save("session_id", Date.now()); const { userId, privateKey, domain } =
await save("user_id", userId); parseTuFileContent(decoded);
await save("private_key", privateKey);
if (domain) { await save("session_id", Date.now());
await save("ttp_url", `https://${domain}/`); await save("user_id", userId);
} await save("private_key", privateKey);
location.href = "/";
} catch (error) { if (domain) {
log(0, "login", "red", error); await save("ttp_url", `https://${domain}/`);
toast("error", "Failed to parse QR code data");
} }
location.href = "/";
} catch (error) {
log(0, "login", "red", error);
toast("error", "Failed to parse QR code data");
} }
}} }}
/> />
@ -226,10 +303,30 @@ export default function Form() {
) : ( ) : (
<div <div
onClick={() => uploadRef.current?.click()} onClick={() => uploadRef.current?.click()}
className="flex flex-col gap-3 cursor-pointer w-55 aspect-square bg-input/13 hover:bg-input/30 transition-all duration-300 ease-in-out border-3 items-center justify-center rounded-lg" className={cn(
"flex flex-col gap-3 cursor-pointer w-55 aspect-square",
"border-3 items-center justify-center rounded-lg",
"transition-all duration-300 ease-in-out",
"border-input",
"bg-input/13 hover:bg-input/30",
isDragging ? "animate-wiggle" : "",
)}
> >
<File className="text-foreground" size={27} /> <File
<p className="text-md">Select .tu file</p> className={["transition-all duration-300 text-foreground"].join(
" ",
)}
size={27}
/>
<p
className={[
"text-md transition-all duration-300",
isDragging ? "font-medium" : "",
].join(" ")}
>
Select .tu file
</p>
</div> </div>
)} )}
<input <input

View file

@ -36,7 +36,7 @@ export function Switch({
label, label,
id, id,
}: { }: {
label: string; label: React.ReactNode;
id: keyof typeof settingsStorageDefaults & BooleanStorageKey; id: keyof typeof settingsStorageDefaults & BooleanStorageKey;
}) { }) {
const { save, load } = useStorage(); const { save, load } = useStorage();

View file

@ -6,6 +6,20 @@
@source "./**/*.{ts,tsx}"; @source "./**/*.{ts,tsx}";
@source "../../../packages/**/src/**/*.{ts,tsx}"; @source "../../../packages/**/src/**/*.{ts,tsx}";
@theme {
--animate-wiggle: wiggle 0.5s ease-in-out infinite;
@keyframes wiggle {
0%,
100% {
transform: rotate(-2deg);
}
50% {
transform: rotate(2deg);
}
}
}
html, html,
body, body,
#root { #root {
@ -17,3 +31,32 @@ body,
#root { #root {
min-height: 0; min-height: 0;
} }
@layer base {
* {
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background-color: var(--border);
border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
opacity: 0.8;
}
::-webkit-scrollbar-corner {
background: transparent;
}
}

View file

@ -1,12 +1,30 @@
import { Switch } from "@/features/settings/components"; import { Switch } from "@/features/settings/components";
import { Kbd } from "@tensamin/ui";
export default function Page() { export default function Page() {
return ( return (
<div> <div className="flex flex-col gap-2">
<Switch <Switch
label="Reverse Enter Key Behavior" label={
<p>
Change <Kbd>Enter</Kbd> behavior to <Kbd>Shift</Kbd> +{" "}
<Kbd>Enter</Kbd>
</p>
}
id="settings.reverse_enter_behavior" id="settings.reverse_enter_behavior"
/> />
<Switch
label="Enable read confirmations"
id="settings.read_confirmations"
/>
<Switch
label="Enable receive confirmations"
id="settings.receive_confirmations"
/>
<Switch
label="Sidebar message preview"
id="settings.show_start_of_last_message_in_sidebar"
/>
</div> </div>
); );
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "tensamin", "name": "tensamin",
"version": "0.0.2", "version": "0.0.3",
"private": true, "private": true,
"workspaces": [ "workspaces": [
"packages/*", "packages/*",

View file

@ -1,5 +1,5 @@
import { Lock, LockOpen } from "lucide-react"; import { Lock, LockOpen } from "lucide-react";
import { openCallPage, useCall } from "../store"; import { openCallPage, useCall, getRoom } from "../store";
import { import {
Button, Button,
Card, Card,
@ -78,7 +78,7 @@ function ConnectionBar() {
} }
export function TinyPingGraph() { export function TinyPingGraph() {
const room = useCall((store) => store.room); const room = getRoom();
const [mapData, setMapData] = useState<Map<number, number>>(() => new Map()); const [mapData, setMapData] = useState<Map<number, number>>(() => new Map());

View file

@ -1,5 +1,5 @@
import { useUser, type User } from "@tensamin/user/context"; import { useUser, type User } from "@tensamin/user/context";
import { useCall } from "../store"; import { useCall, getRoom } from "../store";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useStorage } from "@tensamin/storage/context"; import { useStorage } from "@tensamin/storage/context";
import { import {
@ -14,7 +14,7 @@ import {
export default function TopBar() { export default function TopBar() {
const { get } = useUser(); const { get } = useUser();
const { load } = useStorage(); const { load } = useStorage();
const room = useCall((state) => state.room); const room = getRoom();
const screenRef = useCall((state) => state.screenRef); const screenRef = useCall((state) => state.screenRef);
const [portalContainer, setPortalContainer] = useState<HTMLElement>(); const [portalContainer, setPortalContainer] = useState<HTMLElement>();

View file

@ -1,6 +1,6 @@
import { VideoTrack, useParticipantTracks } from "@livekit/components-react"; import { VideoTrack, useParticipantTracks } from "@livekit/components-react";
import { TrackPublication } from "livekit-client"; import { TrackPublication } from "livekit-client";
import { useCall } from "../store"; import { getRoom } from "../store";
import { cn } from "@tensamin/ui"; import { cn } from "@tensamin/ui";
import { Loader2 } from "lucide-react"; import { Loader2 } from "lucide-react";
@ -17,7 +17,7 @@ export default function VideoViewer({
publication: TrackPublication; publication: TrackPublication;
participantId: string; participantId: string;
}) { }) {
const room = useCall((state) => state.room); const room = getRoom();
const tracks = useParticipantTracks([publication.source], { const tracks = useParticipantTracks([publication.source], {
participantIdentity: participantId, participantIdentity: participantId,
room, room,

View file

@ -101,27 +101,46 @@ type CallStore = {
callIsPopout: boolean; callIsPopout: boolean;
layoutVersion: number; layoutVersion: number;
screenRef: React.RefObject<HTMLDivElement | null> | null; screenRef: React.RefObject<HTMLDivElement | null> | null;
room: Room;
keyProvider: ExternalE2EEKeyProvider;
e2eeWorker: Worker;
runtime: Runtime | null; runtime: Runtime | null;
speakingParticipantIds: Set<number>; speakingParticipantIds: Set<number>;
micGated: boolean; micGated: boolean;
}; };
const keyProvider = new ExternalE2EEKeyProvider(); let _keyProvider: ExternalE2EEKeyProvider | null = null;
const e2eeWorker = new Worker( let _e2eeWorker: Worker | null = null;
new URL("livekit-client/e2ee-worker", import.meta.url), let _room: Room | null = null;
);
const room = new Room({ function getKeyProvider(): ExternalE2EEKeyProvider {
dynacast: true, if (!_keyProvider) {
adaptiveStream: true, _keyProvider = new ExternalE2EEKeyProvider();
loggerName: "tensamin", }
encryption: { return _keyProvider;
keyProvider, }
worker: e2eeWorker,
}, function getE2EEWorker(): Worker {
}); if (!_e2eeWorker) {
_e2eeWorker = new Worker(
new URL("livekit-client/e2ee-worker", import.meta.url),
);
}
return _e2eeWorker;
}
export function getRoom(): Room {
if (!_room) {
_room = new Room({
dynacast: true,
adaptiveStream: true,
loggerName: "tensamin",
encryption: {
keyProvider: getKeyProvider(),
worker: getE2EEWorker(),
},
});
}
return _room;
}
const remoteAudioElements = new Map<string, HTMLMediaElement>(); const remoteAudioElements = new Map<string, HTMLMediaElement>();
const SCREEN_SHARE_PREVIEW_MAX_WIDTH = 320; const SCREEN_SHARE_PREVIEW_MAX_WIDTH = 320;
@ -170,6 +189,7 @@ export function getParticipantId(identity: string | undefined): number | null {
} }
function getAllParticipants(): Participant[] { function getAllParticipants(): Participant[] {
const room = getRoom();
return [...room.remoteParticipants.values(), room.localParticipant]; return [...room.remoteParticipants.values(), room.localParticipant];
} }
@ -187,7 +207,7 @@ function getTrackPublicationBySource(
} }
function getRemoteParticipant(participantId: number) { function getRemoteParticipant(participantId: number) {
return [...room.remoteParticipants.values()].find( return [...getRoom().remoteParticipants.values()].find(
(participant) => getParticipantId(participant.identity) === participantId, (participant) => getParticipantId(participant.identity) === participantId,
); );
} }
@ -215,7 +235,7 @@ function syncRemoteParticipantTrackSubscriptions(participantId: number) {
} }
function syncAllRemoteTrackSubscriptions() { function syncAllRemoteTrackSubscriptions() {
for (const participant of room.remoteParticipants.values()) { for (const participant of getRoom().remoteParticipants.values()) {
const participantId = getParticipantId(participant.identity); const participantId = getParticipantId(participant.identity);
if (participantId != null) { if (participantId != null) {
@ -256,7 +276,7 @@ function hasParticipant(participantId: number) {
function getLocalScreenShareTrack(): MediaStreamTrack | null { function getLocalScreenShareTrack(): MediaStreamTrack | null {
const track = getTrackPublicationBySource( const track = getTrackPublicationBySource(
room.localParticipant, getRoom().localParticipant,
Track.Source.ScreenShare, Track.Source.ScreenShare,
)?.track; )?.track;
@ -275,7 +295,7 @@ async function updateLocalParticipantAttributes(
screenSharePreviewLength: attributes.screenSharePreview?.length ?? 0, screenSharePreviewLength: attributes.screenSharePreview?.length ?? 0,
}); });
await room.localParticipant.setAttributes(attributes).catch((error) => { await getRoom().localParticipant.setAttributes(attributes).catch((error) => {
log(1, "call", "red", "Failed to update local participant attributes", { log(1, "call", "red", "Failed to update local participant attributes", {
attributes: Object.keys(attributes), attributes: Object.keys(attributes),
error, error,
@ -487,7 +507,7 @@ function requireRuntime(runtime: Runtime | null): Runtime {
} }
export function getRoomMetadata() { export function getRoomMetadata() {
const roomMetadata = room.metadata; const roomMetadata = getRoom().metadata;
try { try {
const data = JSON.parse(roomMetadata || '{"admins": []}'); const data = JSON.parse(roomMetadata || '{"admins": []}');
return data as { admins: number[] }; return data as { admins: number[] };
@ -498,7 +518,8 @@ export function getRoomMetadata() {
// Sync local participant flags and screen-share derived state for the active call UI. // Sync local participant flags and screen-share derived state for the active call UI.
export function syncParticipantState() { export function syncParticipantState() {
const { room, screenShareSession } = useCall.getState(); const { screenShareSession } = useCall.getState();
const room = getRoom();
useCall.setState({ useCall.setState({
micEnabled: room.localParticipant.isMicrophoneEnabled, micEnabled: room.localParticipant.isMicrophoneEnabled,
@ -721,7 +742,7 @@ let screenShareController: ReturnType<
function getScreenShareController() { function getScreenShareController() {
if (!screenShareController) { if (!screenShareController) {
screenShareController = createScreenShareController({ screenShareController = createScreenShareController({
room, room: getRoom(),
getState: () => ({ getState: () => ({
screenShareSession: useCall.getState().screenShareSession, screenShareSession: useCall.getState().screenShareSession,
}), }),
@ -733,7 +754,7 @@ function getScreenShareController() {
); );
}, },
getLocalParticipantId: () => getLocalParticipantId: () =>
getParticipantId(room.localParticipant.identity), getParticipantId(getRoom().localParticipant.identity),
startWatching: startWatchingStream, startWatching: startWatchingStream,
stopWatching: stopWatchingStream, stopWatching: stopWatchingStream,
syncParticipantState, syncParticipantState,
@ -758,7 +779,7 @@ export async function connect(callId: string) {
callSecret: useCall.getState().callSecret, callSecret: useCall.getState().callSecret,
}); });
await room await getRoom()
.connect("wss://call.tensamin.net", token, { .connect("wss://call.tensamin.net", token, {
autoSubscribe: false, autoSubscribe: false,
}) })
@ -774,7 +795,7 @@ export async function connect(callId: string) {
syncAllRemoteTrackSubscriptions(); syncAllRemoteTrackSubscriptions();
await room.localParticipant.setMicrophoneEnabled(true).catch((error) => { await getRoom().localParticipant.setMicrophoneEnabled(true).catch((error) => {
log(1, "call", "red", "Failed to enable microphone", error); log(1, "call", "red", "Failed to enable microphone", error);
toast("error", "Failed to enable microphone."); toast("error", "Failed to enable microphone.");
throw error; throw error;
@ -819,12 +840,12 @@ export async function disconnect() {
micGated: false, micGated: false,
}); });
room.remoteParticipants.forEach((participant) => { getRoom().remoteParticipants.forEach((participant) => {
participant.setVolume(1); participant.setVolume(1);
}); });
try { try {
await room.disconnect(); await getRoom().disconnect();
} catch (error) { } catch (error) {
log(1, "call", "red", "Failed to disconnect from room", error); log(1, "call", "red", "Failed to disconnect from room", error);
} finally { } finally {
@ -867,8 +888,8 @@ export async function joinCall(
callSecret, callSecret,
); );
await keyProvider.setKey(decryptedSecret); await getKeyProvider().setKey(decryptedSecret);
await room.setE2EEEnabled(true); await getRoom().setE2EEEnabled(true);
useCall.setState({ callSecret: decryptedSecret }); useCall.setState({ callSecret: decryptedSecret });
} catch (err) { } catch (err) {
log(1, "call", "red", "Failed getting call secret", err); log(1, "call", "red", "Failed getting call secret", err);
@ -878,8 +899,8 @@ export async function joinCall(
} else { } else {
const random = crypto.randomUUID(); const random = crypto.randomUUID();
await keyProvider.setKey(random); await getKeyProvider().setKey(random);
await room.setE2EEEnabled(true); await getRoom().setE2EEEnabled(true);
useCall.setState({ callSecret: random }); useCall.setState({ callSecret: random });
} }
@ -898,11 +919,11 @@ export async function joinCall(
export async function toggleDeaf() { export async function toggleDeaf() {
const nextDeaf = !useCall.getState().deaf; const nextDeaf = !useCall.getState().deaf;
room.remoteParticipants.forEach((participant) => { getRoom().remoteParticipants.forEach((participant) => {
participant.setVolume(nextDeaf ? 0 : 1); participant.setVolume(nextDeaf ? 0 : 1);
}); });
if (nextDeaf && room.localParticipant.isMicrophoneEnabled) { if (nextDeaf && getRoom().localParticipant.isMicrophoneEnabled) {
await toggleMute(); await toggleMute();
} }
@ -922,7 +943,7 @@ export async function toggleMute() {
await toggleDeaf(); await toggleDeaf();
} }
await room.localParticipant.setMicrophoneEnabled(!micEnabled); await getRoom().localParticipant.setMicrophoneEnabled(!micEnabled);
syncParticipantState(); syncParticipantState();
} }
@ -986,7 +1007,7 @@ export function resetCallState() {
async function ensureNoiseFilter( async function ensureNoiseFilter(
noiseFilter: DeepFilterNoiseFilterProcessor, noiseFilter: DeepFilterNoiseFilterProcessor,
): Promise<void> { ): Promise<void> {
const microphoneTrack = room.localParticipant.getTrackPublication( const microphoneTrack = getRoom().localParticipant.getTrackPublication(
Track.Source.Microphone, Track.Source.Microphone,
)?.track; )?.track;
@ -1001,7 +1022,7 @@ async function ensureNoiseFilter(
log(1, "call", "red", "Failed to enable noise filter", err); log(1, "call", "red", "Failed to enable noise filter", err);
}); });
const participantId = getParticipantId(room.localParticipant.identity); const participantId = getParticipantId(getRoom().localParticipant.identity);
if (participantId != null) { if (participantId != null) {
const processedTrack = microphoneTrack.mediaStreamTrack; const processedTrack = microphoneTrack.mediaStreamTrack;
getSpeakingDetector().addTrack( getSpeakingDetector().addTrack(
@ -1021,8 +1042,8 @@ export const useCall = create<CallStore>(() => ({
livekitToken: null, livekitToken: null,
currentCallData: null, currentCallData: null,
deaf: false, deaf: false,
micEnabled: room.localParticipant.isMicrophoneEnabled, micEnabled: false,
screenShareEnabled: room.localParticipant.isScreenShareEnabled, screenShareEnabled: false,
screenShareSession: null, screenShareSession: null,
focusedParticipantId: null, focusedParticipantId: null,
focusedParticipantType: null, focusedParticipantType: null,
@ -1030,15 +1051,11 @@ export const useCall = create<CallStore>(() => ({
watchedStreamParticipantIds: [], watchedStreamParticipantIds: [],
pendingWatchedParticipantIds: [], pendingWatchedParticipantIds: [],
activeScreenShareParticipantIds: [], activeScreenShareParticipantIds: [],
isEncrypted: isEncrypted: false,
room.localParticipant.isE2EEEnabled && room.localParticipant.isEncrypted,
callIsFullscreen: false, callIsFullscreen: false,
callIsPopout: false, callIsPopout: false,
layoutVersion: 0, layoutVersion: 0,
screenRef: null, screenRef: null,
room,
keyProvider,
e2eeWorker,
runtime: null, runtime: null,
speakingParticipantIds: new Set(), speakingParticipantIds: new Set(),
micGated: false, micGated: false,
@ -1384,6 +1401,7 @@ export function useInitializeCall() {
syncParticipantState(); syncParticipantState();
}; };
const room = getRoom();
room.on(RoomEvent.Connected, onConnected); room.on(RoomEvent.Connected, onConnected);
room.on(RoomEvent.Reconnected, onConnected); room.on(RoomEvent.Reconnected, onConnected);
room.on(RoomEvent.Disconnected, onDisconnected); room.on(RoomEvent.Disconnected, onDisconnected);
@ -1424,7 +1442,7 @@ export function useInitializeCall() {
clearRemoteAudio(); clearRemoteAudio();
listenersRegistered.current = false; listenersRegistered.current = false;
room.disconnect(); room.disconnect();
e2eeWorker.terminate(); if (_e2eeWorker) _e2eeWorker.terminate();
}; };
}, [noiseFilter, load]); }, [noiseFilter, load]);

View file

@ -1,13 +1,13 @@
import { RoomEvent } from "livekit-client"; import { RoomEvent } from "livekit-client";
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { useCall } from "../../store"; import { useCall, getRoom } from "../../store";
import Base from "../../components/modals/base"; import Base from "../../components/modals/base";
const SECONDARY_ROW_HEIGHT_PX = 180; const SECONDARY_ROW_HEIGHT_PX = 180;
const STACK_GAP_PX = 12; const STACK_GAP_PX = 12;
export default function View() { export default function View() {
const room = useCall((state) => state.room); const room = getRoom();
const layoutVersion = useCall((state) => state.layoutVersion); const layoutVersion = useCall((state) => state.layoutVersion);
const usersInFocusedViewHidden = useCall( const usersInFocusedViewHidden = useCall(

View file

@ -1,6 +1,6 @@
import { RoomEvent } from "livekit-client"; import { RoomEvent } from "livekit-client";
import { useEffect, useMemo, useRef, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { useCall } from "../../store"; import { useCall, getRoom } from "../../store";
import Base from "../../components/modals/base"; import Base from "../../components/modals/base";
const TILE_ASPECT_RATIO = 16 / 9; const TILE_ASPECT_RATIO = 16 / 9;
@ -82,7 +82,7 @@ function calculateOptimalGridLayout(
} }
export default function View() { export default function View() {
const room = useCall((state) => state.room); const room = getRoom();
const layoutVersion = useCall((state) => state.layoutVersion); const layoutVersion = useCall((state) => state.layoutVersion);
const activeScreenShareParticipantIds = useCall( const activeScreenShareParticipantIds = useCall(
(state) => state.activeScreenShareParticipantIds, (state) => state.activeScreenShareParticipantIds,

View file

@ -35,6 +35,7 @@ function MessageComponent({
return ( return (
<div <div
// pt-3 is to get a gap between messages
className={`${grouped ? "" : "pt-3"} w-full flex justify-start transition-opacity duration-150 ${actuallyFailed || message.message_state === "awaiting" ? "opacity-50" : ""}`} className={`${grouped ? "" : "pt-3"} w-full flex justify-start transition-opacity duration-150 ${actuallyFailed || message.message_state === "awaiting" ? "opacity-50" : ""}`}
> >
<ContextMenu> <ContextMenu>

View file

@ -438,7 +438,7 @@ export default function Screen() {
className="min-h-0 flex-1 overflow-y-auto" className="min-h-0 flex-1 overflow-y-auto"
style={{ style={{
overflowAnchor: "none", overflowAnchor: "none",
paddingBottom: "8px", paddingBottom: "22px",
}} }}
onScroll={handleContainerScroll} onScroll={handleContainerScroll}
> >
@ -461,7 +461,6 @@ export default function Screen() {
left: 0, left: 0,
width: "100%", width: "100%",
transform: `translateY(${virtualRow.start + verticalOffset}px)`, transform: `translateY(${virtualRow.start + verticalOffset}px)`,
padding: "4px 0",
}} }}
> >
<div className="w-full flex justify-start"> <div className="w-full flex justify-start">

View file

@ -23,7 +23,7 @@ function reduceDisplay(display: string) {
} }
export default function Provider(props: { children: React.ReactNode }) { export default function Provider(props: { children: React.ReactNode }) {
const { subscribePush } = useTTP(); const { subscribePush, send } = useTTP();
const { load } = useStorage(); const { load } = useStorage();
const { get } = useUser(); const { get } = useUser();
const { decryptText, getSharedSecret } = useCrypto(); const { decryptText, getSharedSecret } = useCrypto();
@ -49,7 +49,32 @@ export default function Provider(props: { children: React.ReactNode }) {
message.content, message.content,
); );
console.log(userId, sender_id, userId === sender_id); // Update message state
if (
(await load("settings.read_confirmations")) &&
userId === sender_id
) {
await send(
"message_state",
{
message_state: "read",
},
{
id: ttpMessage.id,
},
);
} else {
await send(
"message_state",
{
message_state: "received",
},
{
id: ttpMessage.id,
},
);
}
if (userId === sender_id) { if (userId === sender_id) {
addLiveMessage({ addLiveMessage({
...message, ...message,
@ -60,7 +85,7 @@ export default function Provider(props: { children: React.ReactNode }) {
return; return;
} }
// add notification symbol to conversation cards // todo: add notification symbol to conversation cards (incl. message start)
moveUserIdToTop(sender_id); moveUserIdToTop(sender_id);
@ -91,6 +116,7 @@ export default function Provider(props: { children: React.ReactNode }) {
addLiveMessage, addLiveMessage,
userId, userId,
moveUserIdToTop, moveUserIdToTop,
send,
]); ]);
return ( return (

View file

@ -167,11 +167,17 @@ export const ttp = {
response: z.object({}), response: z.object({}),
}, },
message_state: { message_state: {
request: z.object({ request: z
chat_partner_id: z.number(), .object({
send_time: z.number(), chat_partner_id: z.number(),
message_state: message.shape.message_state, send_time: z.number(),
}), message_state: message.shape.message_state,
})
.or(
z.object({
message_state: message.shape.message_state,
}),
),
response: z.object({ response: z.object({
chat_partner_id: z.number(), chat_partner_id: z.number(),
message_state: message.shape.message_state, message_state: message.shape.message_state,

View file

@ -28,6 +28,21 @@ const settings = {
type: "boolean", type: "boolean",
default: false, default: false,
}, },
read_confirmations: {
display: "Enable Read Confirmations",
type: "boolean",
default: true,
},
receive_confirmations: {
display: "Enable Receive Confirmations",
type: "boolean",
default: true,
},
show_start_of_last_message_in_sidebar: {
display: "Show Start of Last Message in Sidebar",
type: "boolean",
default: true,
},
}, },
}, },
application: { application: {
@ -35,6 +50,7 @@ const settings = {
}, },
} as const satisfies SettingsSchema; } as const satisfies SettingsSchema;
// Assemble storage defaults
export default settings; export default settings;
type BooleanSettingNames<T extends SettingsSchema> = { type BooleanSettingNames<T extends SettingsSchema> = {