- {isTauri() ? (
+
+ {isTauriEnv ? (
<>
{
if (!data.startsWith("tensamin://tu::")) {
toast("error", "Invalid QR code");
return;
- }
+ } else {
+ const decoded = data.replace("tensamin://tu::", "");
- const decoded = data.replace("tensamin://tu::", "");
-
- try {
- const { userId, privateKey, domain } =
- parseTuFileContent(decoded);
-
- await save("session_id", Date.now());
- await save("user_id", userId);
- await save("private_key", privateKey);
-
- if (domain) {
- await save("ttp_url", `https://${domain}/`);
+ try {
+ const { userId, privateKey, domain } =
+ parseTuFileContent(decoded);
+ await save("session_id", Date.now());
+ await save("user_id", userId);
+ await save("private_key", privateKey);
+ if (domain) {
+ await save("ttp_url", `https://${domain}/`);
+ }
+ location.href = "/";
+ } catch (error) {
+ log(0, "login", "red", error);
+ 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");
}
}}
/>
@@ -303,30 +228,10 @@ export default function Form() {
) : (
uploadRef.current?.click()}
- 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" : "",
- )}
+ 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"
>
-
-
-
- Select .tu file
-
+
+
Select .tu file
)}
+
- Change Enter behavior to Shift +{" "}
- Enter
-
- }
+ label="Reverse Enter Key Behavior"
id="settings.reverse_enter_behavior"
/>
-
-
-
);
}
diff --git a/apps/web/src/routes/settings/security.tsx b/apps/web/src/routes/settings/security.tsx
index 86c580e..15a6155 100644
--- a/apps/web/src/routes/settings/security.tsx
+++ b/apps/web/src/routes/settings/security.tsx
@@ -46,7 +46,6 @@ function QrCodeLogin() {
const [qrCodeBase64, setQrCodeBase64] = useState(
undefined,
);
- const [connectionString, setConnectionString] = useState(null);
useEffect(() => {
load("private_key").then((value) => {
@@ -59,25 +58,15 @@ function QrCodeLogin() {
setUserId(value);
}
});
- load("ttp_url")
- .then((value) => {
- if (value) {
- const url = new URL(value);
- setConnectionString(`@${url.host}`);
- } else {
- setConnectionString("");
- }
- })
- .catch(() => setConnectionString(""));
}, [load]);
useEffect(() => {
- if (userId && privateKey && connectionString !== null) {
- generateQR(
- `tensamin://tu::${userId}${connectionString}::${privateKey}`,
- ).then(setQrCodeBase64);
+ if (userId && privateKey) {
+ generateQR(`tensamin://tu::${userId}::${privateKey}`).then(
+ setQrCodeBase64,
+ );
}
- }, [userId, privateKey, connectionString]);
+ }, [userId, privateKey]);
const [qrCodeVisible, setQrCodeVisible] = useState(false);
diff --git a/bun.lock b/bun.lock
index 1f1b34a..ff51499 100644
--- a/bun.lock
+++ b/bun.lock
@@ -40,7 +40,6 @@
},
"devDependencies": {
"@tauri-apps/cli": "^2",
- "@types/node": "^25.9.1",
},
},
"apps/web": {
@@ -171,7 +170,6 @@
"name": "@tensamin/notifications",
"version": "0.0.0",
"dependencies": {
- "@tanstack/react-router": "^1.169.1",
"@tauri-apps/api": "^2.11.0",
"@tensamin/chat": "workspace:*",
"@tensamin/crypto": "workspace:*",
@@ -1663,8 +1661,6 @@
"@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
- "@tensamin/tauri/@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="],
-
"@tensamin/ui/recharts": ["recharts@3.8.0", "", { "dependencies": { "@reduxjs/toolkit": "^1.9.0 || 2.x.x", "clsx": "^2.1.1", "decimal.js-light": "^2.5.1", "es-toolkit": "^1.39.3", "eventemitter3": "^5.0.1", "immer": "^10.1.1", "react-redux": "8.x.x || 9.x.x", "reselect": "5.1.1", "tiny-invariant": "^1.3.3", "use-sync-external-store": "^1.2.2", "victory-vendor": "^37.0.2" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Z/m38DX3L73ExO4Tpc9/iZWHmHnlzWG4njQbxsF5aSjwqmHNDDIm0rdEBArkwsBvR8U6EirlEHiQNYWCVh9sGQ=="],
"@tensamin/ui/shadcn": ["shadcn@3.8.5", "", { "dependencies": { "@antfu/ni": "^25.0.0", "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-jPRx44e+eyeV7xwY3BLJXcfrks00+M0h5BGB9l6DdcBW4BpAj4x3lVmVy0TXPEs2iHEisxejr62sZAAw6B1EVA=="],
@@ -1725,8 +1721,6 @@
"@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
- "@tensamin/tauri/@types/node/undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
-
"@tensamin/ui/shadcn/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
"ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
diff --git a/package.json b/package.json
index d408353..b0dfc08 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "tensamin",
- "version": "0.0.3",
+ "version": "0.0.2",
"private": true,
"workspaces": [
"packages/*",
diff --git a/packages/call/src/components/sidebarBox.tsx b/packages/call/src/components/sidebarBox.tsx
index ac715e9..6a850f0 100644
--- a/packages/call/src/components/sidebarBox.tsx
+++ b/packages/call/src/components/sidebarBox.tsx
@@ -1,5 +1,5 @@
import { Lock, LockOpen } from "lucide-react";
-import { openCallPage, useCall, getRoom } from "../store";
+import { openCallPage, useCall } from "../store";
import {
Button,
Card,
@@ -78,7 +78,7 @@ function ConnectionBar() {
}
export function TinyPingGraph() {
- const room = getRoom();
+ const room = useCall((store) => store.room);
const [mapData, setMapData] = useState
}
/>
diff --git a/packages/chat/src/screen.tsx b/packages/chat/src/screen.tsx
index f72580d..a23760d 100644
--- a/packages/chat/src/screen.tsx
+++ b/packages/chat/src/screen.tsx
@@ -8,7 +8,6 @@ import Message from "./components/message";
import { PAGE_SIZE } from "./values";
import { useIsMobile } from "@tensamin/ui";
-import { Loader2 } from "lucide-react";
function getDistanceFromBottom(element: HTMLDivElement) {
return element.scrollHeight - (element.scrollTop + element.clientHeight);
@@ -361,38 +360,9 @@ export default function Screen() {
return;
}
- let rafId: number;
- let stableFrames = 0;
- let lastScrollHeight = 0;
-
- const settleToBottom = () => {
- if (!scrollRef.current || hasScrolledToBottomInitially) {
- return;
- }
-
- scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
- const currentScrollHeight = scrollRef.current.scrollHeight;
-
- if (currentScrollHeight === lastScrollHeight) {
- stableFrames++;
- } else {
- stableFrames = 0;
- lastScrollHeight = currentScrollHeight;
- }
-
- if (stableFrames >= 2) {
- isAtBottomRef.current = true;
- setHasScrolledToBottomInitially(true);
- } else {
- rafId = requestAnimationFrame(settleToBottom);
- }
- };
-
- settleToBottom();
-
- return () => {
- cancelAnimationFrame(rafId);
- };
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
+ isAtBottomRef.current = true;
+ setHasScrolledToBottomInitially(true);
}, [hasScrolledToBottomInitially, virtualRowCount]);
React.useLayoutEffect(() => {
@@ -465,26 +435,13 @@ export default function Screen() {
- {messagesQuery.isPending && (
-
- )}
- {messagesQuery.isFetchingNextPage && (
-
-
-
- )}
-
- Conversation start
+
+ This is the start of your conversation with{" "}
@@ -523,13 +481,6 @@ export default function Screen() {
return null;
}
- const lastMessage = messages[messageIndex - 1];
- const isGrouped =
- lastMessage &&
- lastMessage.sent_by_self === message.sent_by_self &&
- Math.round(lastMessage.send_time / 10000) ===
- Math.round(message.send_time / 10000);
-
return (
-
+
);
})}
@@ -557,25 +509,17 @@ export default function Screen() {
className="pointer-events-none absolute left-0 top-0 -z-10 overflow-hidden opacity-0"
style={{ width: scrollWidth > 0 ? `${scrollWidth}px` : "100%" }}
>
- {messages.map((message, messageIndex) => {
- const lastMessage = messages[messageIndex - 1];
- const isGrouped =
- lastMessage &&
- lastMessage.sent_by_self === message.sent_by_self &&
- Math.round(lastMessage.send_time / 10000) ===
- Math.round(message.send_time / 10000);
-
- return (
-
{
- setMeasurementRef(message.send_time, element);
- }}
- >
-
-
- );
- })}
+ {messages.map((message) => (
+
{
+ setMeasurementRef(message.send_time, element);
+ }}
+ style={{ padding: "4px 0" }}
+ >
+
+
+ ))}
);
diff --git a/packages/chat/todo.md b/packages/chat/todo.md
deleted file mode 100644
index 122f14e..0000000
--- a/packages/chat/todo.md
+++ /dev/null
@@ -1 +0,0 @@
-- Add context menu to messages
diff --git a/packages/markdown/src/markdown.tsx b/packages/markdown/src/markdown.tsx
index 46ebb92..59d0a6a 100644
--- a/packages/markdown/src/markdown.tsx
+++ b/packages/markdown/src/markdown.tsx
@@ -560,7 +560,7 @@ export function renderBlocks(blocks: MarkdownBlock[]): React.ReactElement {
}
return (
-
+
{block.text.split("\n").map((line, lineIndex) => (
{lineIndex > 0 ?
: null}
@@ -645,6 +645,7 @@ export const markdownStyles = `
.tm-md-h4 { font-size: 1.1rem; }
.tm-md-h5 { font-size: 1rem; }
.tm-md-h6 { font-size: 0.95rem; opacity: 0.9; }
+.tm-md-p { margin: 0.25rem 0; }
.tm-md-blockquote { margin: 0.45rem 0; padding-left: 0.75rem; opacity: 0.95; }
.tm-md-blockquote p { margin: 0.2rem 0; }
.tm-md-pre { margin: 0.45rem 0; padding: 0.65rem 0.75rem; border-radius: 0.5rem; background: hsl(var(--muted)); overflow-x: auto; }
diff --git a/packages/notifications/package.json b/packages/notifications/package.json
index a6b06be..af90c45 100644
--- a/packages/notifications/package.json
+++ b/packages/notifications/package.json
@@ -12,7 +12,6 @@
"build": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@tanstack/react-router": "^1.169.1",
"@tauri-apps/api": "^2.11.0",
"@tensamin/crypto": "workspace:*",
"@tensamin/shared": "workspace:*",
diff --git a/packages/notifications/src/context.tsx b/packages/notifications/src/context.tsx
index 8da45f4..4e433a3 100644
--- a/packages/notifications/src/context.tsx
+++ b/packages/notifications/src/context.tsx
@@ -10,27 +10,25 @@ import { message as messageSchema } from "@tensamin/shared/data";
import { Avatar, AvatarFallback, AvatarImage } from "@tensamin/ui";
import { isTauri } from "@tauri-apps/api/core";
import { useSession } from "@tensamin/storage/session";
-import { useNavigate } from "@tanstack/react-router";
export const context = createContext(undefined);
-async function requestNotificationPermission() {
- if (!("Notification" in window)) return false;
-
- if (Notification.permission === "granted") return true;
-
- const permission = await Notification.requestPermission();
- return permission === "granted";
+function reduceDisplay(display: string) {
+ const words = display.split(" ");
+ if (words.length === 1) {
+ return display.slice(0, 2).toUpperCase();
+ } else {
+ return words[0].charAt(0).toUpperCase() + words[1].charAt(0).toUpperCase();
+ }
}
export default function Provider(props: { children: React.ReactNode }) {
- const { subscribePush, send } = useTTP();
+ const { subscribePush } = useTTP();
const { load } = useStorage();
const { get } = useUser();
const { decryptText, getSharedSecret } = useCrypto();
const { addLiveMessage, userId } = useChat();
const { moveUserIdToTop } = useSession();
- const navigate = useNavigate();
useEffect(() => {
return subscribePush(async (ttpMessage) => {
@@ -51,32 +49,7 @@ export default function Provider(props: { children: React.ReactNode }) {
message.content,
);
- // Update message state
- if (
- (await load("settings.read_confirmations")) &&
- userId === sender_id
- ) {
- void send(
- "message_state",
- {
- message_state: "read",
- },
- {
- id: ttpMessage.id,
- },
- );
- } else {
- void send(
- "message_state",
- {
- message_state: "received",
- },
- {
- id: ttpMessage.id,
- },
- );
- }
-
+ console.log(userId, sender_id, userId === sender_id);
if (userId === sender_id) {
addLiveMessage({
...message,
@@ -87,48 +60,25 @@ export default function Provider(props: { children: React.ReactNode }) {
return;
}
- // todo: add notification symbol to conversation cards (incl. message start)
+ // add notification symbol to conversation cards
moveUserIdToTop(sender_id);
if (isTauri()) {
console.log("weewoo");
} else {
- const hasPermissions = await requestNotificationPermission();
-
- if (hasPermissions) {
- const notification = new Notification(user.display, {
- body: decryptedContent,
- icon: user.avatar || user.display.slice(0, 2).toUpperCase(),
- badge: user.avatar || user.display.slice(0, 2).toUpperCase(),
- tag: `message-${user.user_id}`,
- silent: true,
- });
-
- notification.onclick = () => {
- window.focus();
- navigate({
- to: `/chat?id=${user.user_id}`,
- });
-
- notification.close();
- };
- } else {
- sonnerToast(user.display, {
- classNames: {
- content: "pl-4",
- },
- description: decryptedContent,
- icon: (
-
-
-
- {user.display.slice(0, 2).toUpperCase()}
-
-
- ),
- });
- }
+ sonnerToast(user.display, {
+ classNames: {
+ content: "pl-4",
+ },
+ description: decryptedContent,
+ icon: (
+
+
+ {reduceDisplay(user.display)}
+
+ ),
+ });
}
}
});
@@ -141,8 +91,6 @@ export default function Provider(props: { children: React.ReactNode }) {
addLiveMessage,
userId,
moveUserIdToTop,
- send,
- navigate,
]);
return (
diff --git a/packages/shared/src/data.ts b/packages/shared/src/data.ts
index 2210192..58851ce 100644
--- a/packages/shared/src/data.ts
+++ b/packages/shared/src/data.ts
@@ -167,17 +167,11 @@ export const ttp = {
response: z.object({}),
},
message_state: {
- request: z
- .object({
- chat_partner_id: z.number(),
- send_time: z.number(),
- message_state: message.shape.message_state,
- })
- .or(
- z.object({
- message_state: message.shape.message_state,
- }),
- ),
+ request: z.object({
+ chat_partner_id: z.number(),
+ send_time: z.number(),
+ message_state: message.shape.message_state,
+ }),
response: z.object({
chat_partner_id: z.number(),
message_state: message.shape.message_state,
diff --git a/packages/shared/src/settings.ts b/packages/shared/src/settings.ts
index aacc162..0099f64 100644
--- a/packages/shared/src/settings.ts
+++ b/packages/shared/src/settings.ts
@@ -28,21 +28,6 @@ const settings = {
type: "boolean",
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: {
@@ -50,7 +35,6 @@ const settings = {
},
} as const satisfies SettingsSchema;
-// Assemble storage defaults
export default settings;
type BooleanSettingNames = {
diff --git a/packages/ttp/src/context.tsx b/packages/ttp/src/context.tsx
index d33313d..0a2ea2c 100644
--- a/packages/ttp/src/context.tsx
+++ b/packages/ttp/src/context.tsx
@@ -191,7 +191,6 @@ export function Provider(props: {
typeof createTransportClient
> | null>(null);
const identificationStartedRef = useRef(false);
- const identificationCancelRef = useRef(false);
// Load ttp url
const [ttpUrl, setTtpUrl] = useState(null);
@@ -243,23 +242,6 @@ export function Provider(props: {
return client.subscribePush(handler);
}, []);
- // Check for error_no_iota
- useEffect(() => {
- if (!connected) return;
-
- return subscribePush((message) => {
- if (message.type !== "error_no_iota") return;
-
- identificationCancelRef.current = true;
- setIdentified(false);
- setIdentifying(false);
- setError("We couldn't reach your Iota");
- setErrorDescription(
- "You could try to restart your Iota, check for updates or check your network connection.",
- );
- });
- }, [connected, subscribePush]);
-
useEffect(() => {
if (!connected || !identified) {
return;
@@ -381,7 +363,6 @@ export function Provider(props: {
clearReconnectTimer();
scheduleReconnectReset();
identificationStartedRef.current = false;
- identificationCancelRef.current = false;
setConnected(true);
setIdentified(false);
setError("");
@@ -502,11 +483,6 @@ export function Provider(props: {
return;
}
- if (identificationCancelRef.current) {
- identificationStartedRef.current = false;
- return;
- }
-
if (identificationStartedRef.current) {
return;
}
@@ -575,12 +551,10 @@ export function Provider(props: {
const finalResponse = await send("challenge_response", {
challenge: decryptedChallenge,
}).catch((error) => {
- if (!identificationCancelRef.current) {
- setError("Identification Failed");
- setErrorDescription(
- "Unable to complete secure identification. Please verify your credentials and try again.",
- );
- }
+ setError("Identification Failed");
+ setErrorDescription(
+ "Unable to complete secure identification. Please verify your credentials and try again.",
+ );
throw error;
});
@@ -588,7 +562,7 @@ export function Provider(props: {
setFreshContacts(finalResponse.data.contacts);
setFreshCommunities(finalResponse.data.communities);
setFreshCalls(finalResponse.data.calls);
- if (cancelled || identificationCancelRef.current) {
+ if (cancelled) {
return;
}
@@ -600,10 +574,6 @@ export function Provider(props: {
return;
}
- if (identificationCancelRef.current) {
- return;
- }
-
if (isStopSendingError(identificationError)) {
setError("Connection closed");
setErrorDescription(
@@ -634,7 +604,7 @@ export function Provider(props: {
: "Unable to complete secure identification because the transport request failed.",
);
} finally {
- if (!cancelled && !identificationCancelRef.current) {
+ if (!cancelled) {
setIdentifying(false);
}
}