(feat): big call and chatting stuff #23

Merged
alois merged 33 commits from dev into main 2026-08-01 03:05:40 +03:00
28 changed files with 585 additions and 513 deletions
Showing only changes of commit 17db895203 - Show all commits

(feat): add custom lint rules
Some checks failed
/ build-web (push) Successful in 7m4s
/ build-desktop (linux) (push) Successful in 11m31s
/ build-mobile (push) Successful in 18m12s
/ release (push) Failing after 3m2s

(qol): update todo
(chore): update licenses
Alois 2026-07-24 12:44:08 +02:00
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24

View file

@ -4,7 +4,14 @@ import { Label } from "@tensamin/ui";
import { useStorage } from "@tensamin/storage/context";
import { log, toast } from "@tensamin/shared/log";
import { File } from "lucide-react";
import * as React from "react";
import {
type ChangeEvent,
type FormEvent,
useCallback,
useEffect,
useRef,
useState,
} from "react";
import { z } from "zod";
import { isTauri } from "@tauri-apps/api/core";
import QrCodeScanner from "@tensamin/tauri/qrCodeScanner";
@ -78,13 +85,13 @@ function parseTuFileContent(rawFileContent: string): {
export default function Form() {
const isMobile = useIsMobile();
const uploadRef = React.useRef<HTMLInputElement | null>(null);
const [isDragging, setIsDragging] = React.useState(false);
const uploadRef = useRef<HTMLInputElement | null>(null);
const [isDragging, setIsDragging] = useState(false);
const { save } = useStorage();
const navigate = useNavigate();
const loginPendingRef = React.useRef(false);
const loginPendingRef = useRef(false);
const persistLogin = React.useCallback(
const persistLogin = useCallback(
async (userId: number, privateKey: string, domain?: string | null) => {
if (loginPendingRef.current) return false;
loginPendingRef.current = true;
@ -103,7 +110,7 @@ export default function Form() {
);
// Process dropped files
const processDroppedFile = React.useCallback(
const processDroppedFile = useCallback(
async (file: globalThis.File): Promise<void> => {
try {
if (!file.name.endsWith(".tu")) {
@ -124,8 +131,8 @@ export default function Form() {
);
// Handle .tu files
const handleFileInputChange = React.useCallback(
async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
const handleFileInputChange = useCallback(
async (event: ChangeEvent<HTMLInputElement>): Promise<void> => {
const file = event.currentTarget.files?.[0];
if (!file) {
@ -139,7 +146,7 @@ export default function Form() {
);
// Drag and drop listener
React.useEffect(() => {
useEffect(() => {
let dragCounter = 0;
const handleDragEnter = (event: DragEvent) => {
@ -209,8 +216,8 @@ export default function Form() {
* @param event Form submit event.
* @returns Promise that resolves after login processing.
*/
const handleCredentialsSubmit = React.useCallback(
async (event: React.FormEvent<HTMLFormElement>): Promise<void> => {
const handleCredentialsSubmit = useCallback(
async (event: FormEvent<HTMLFormElement>): Promise<void> => {
event.preventDefault();
const formData = new FormData(event.currentTarget);

View file

@ -1,4 +1,4 @@
import * as React from "react";
import { useRef, useState } from "react";
import { useVirtualizer } from "@tanstack/react-virtual";
import Switch from "./switch";
@ -8,14 +8,14 @@ import { Loader2 } from "lucide-react";
import { useSession } from "@tensamin/storage/session";
export default function List() {
const [category, setCategory] = React.useState<
"conversations" | "communities"
>("conversations");
const [category, setCategory] = useState<"conversations" | "communities">(
"conversations",
);
const { contacts, communities } = useSession();
const items = category === "conversations" ? contacts : communities;
const scrollRef = React.useRef<HTMLDivElement | null>(null);
const scrollRef = useRef<HTMLDivElement | null>(null);
// TanStack Virtual is intentionally used here; React Compiler memoization is skipped.
// eslint-disable-next-line react-hooks/incompatible-library

View file

@ -5,6 +5,10 @@ import reactHooks from "eslint-plugin-react-hooks";
import * as tsParser from "@typescript-eslint/parser";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import {
noReactNamespaceImport,
noWindowLocationReload,
} from "./utils/eslint-rules/index.js";
const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));
@ -28,10 +32,18 @@ export default [
},
plugins: {
"react-hooks": reactHooks,
tensamin: {
rules: {
"no-react-namespace-import": noReactNamespaceImport,
"no-window-location-reload": noWindowLocationReload,
},
},
},
rules: {
...reactHooks.configs.recommended.rules,
"react-hooks/set-state-in-effect": "off",
"tensamin/no-react-namespace-import": "error",
"tensamin/no-window-location-reload": "error",
},
},
];

View file

@ -1,9 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) 2022 Paul Miller (https://paulmillr.com)
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@ -12,10 +12,10 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.

View file

@ -1,9 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) 2022 Paul Miller (https://paulmillr.com)
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@ -12,10 +12,10 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.

View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2022present Jason Sofonia & Justine De Caires
Copyright (c) 20142021 Twitter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -31,6 +31,15 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/@base-ui_utils@0.3.1`
- Source package dir: `apps/web/node_modules/@base-ui/utils`
## @codemirror/autocomplete@6.20.3
- License: MIT
- Repository: git+https://code.haverbeke.berlin/codemirror/autocomplete.git
- Description: Autocompletion for the CodeMirror code editor
- Included files: LICENSE
- Folder: `licenses/@codemirror_autocomplete@6.20.3`
- Source package dir: `packages/markdown/node_modules/@codemirror/autocomplete`
## @codemirror/commands@6.10.4
- License: MIT
@ -49,6 +58,15 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/@codemirror_lang-markdown@6.5.0`
- Source package dir: `packages/markdown/node_modules/@codemirror/lang-markdown`
## @codemirror/language@6.12.4
- License: MIT
- Repository: git+https://code.haverbeke.berlin/codemirror/language.git
- Description: Language support infrastructure for the CodeMirror code editor
- Included files: LICENSE
- Folder: `licenses/@codemirror_language@6.12.4`
- Source package dir: `packages/markdown/node_modules/@codemirror/language`
## @codemirror/state@6.7.0
- License: MIT
@ -145,26 +163,6 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/@livekit_components-react@2.9.21`
- Source package dir: `packages/call/node_modules/@livekit/components-react`
## @noble/curves@2.2.0
- License: MIT
- Homepage: https://paulmillr.com/noble/
- Repository: git+https://github.com/paulmillr/noble-curves.git
- Description: Audited & minimal JS implementation of elliptic curve cryptography
- Included files: LICENSE
- Folder: `licenses/@noble_curves@2.2.0`
- Source package dir: `packages/crypto/node_modules/@noble/curves`
## @noble/hashes@2.2.0
- License: MIT
- Homepage: https://paulmillr.com/noble/
- Repository: git+https://github.com/paulmillr/noble-hashes.git
- Description: Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt
- Included files: LICENSE
- Folder: `licenses/@noble_hashes@2.2.0`
- Source package dir: `packages/crypto/node_modules/@noble/hashes`
## @radix-ui/primitive@1.1.4
- License: MIT
@ -494,13 +492,23 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/@tauri-apps_plugin-notification@2.3.3`
- Source package dir: `apps/tauri/node_modules/@tauri-apps/plugin-notification`
## @tensamin/ui@0.0.39
## @tensamin/ui@0.0.41
- License: UNKNOWN
- Included files: none found
- Folder: `licenses/@tensamin_ui@0.0.39`
- Folder: `licenses/@tensamin_ui@0.0.41`
- Source package dir: `apps/tauri/node_modules/@tensamin/ui`
## @twemoji/api@17.0.3
- License: MIT AND CC-BY-4.0
- Homepage: https://github.com/jdecked/twemoji
- Repository: git://github.com/jdecked/twemoji.git
- Description: A Unicode standard based way to implement emoji across all platforms.
- Included files: LICENSE
- Folder: `licenses/@twemoji_api@17.0.3`
- Source package dir: `packages/markdown/node_modules/@twemoji/api`
## @types/node@25.9.4
- License: MIT
@ -599,15 +607,6 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/cmdk@1.1.1`
- Source package dir: `apps/web/node_modules/cmdk`
## comlink@4.4.2
- License: Apache-2.0
- Repository: https://github.com/GoogleChromeLabs/comlink.git
- Description: Comlink makes WebWorkers enjoyable
- Included files: LICENSE
- Folder: `licenses/comlink@4.4.2`
- Source package dir: `packages/crypto/node_modules/comlink`
## cookie-es@3.1.1
- License: MIT
@ -823,6 +822,15 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/embla-carousel-reactive-utils@8.6.0`
- Source package dir: `apps/web/node_modules/embla-carousel-reactive-utils`
## emojibase-data@17.0.0
- License: MIT
- Repository: git@github.com:milesj/emojibase.git
- Description: Evergreen emoji datasets.
- Included files: LICENSE
- Folder: `licenses/emojibase-data@17.0.0`
- Source package dir: `packages/markdown/node_modules/emojibase-data`
## es-toolkit@1.49.0
- License: MIT
@ -958,12 +966,21 @@ Generated from pnpm-lock.yaml and installed packages in workspace node_modules f
- Folder: `licenses/lucide-react@1.23.0`
- Source package dir: `apps/web/node_modules/lucide-react`
## mtp@0.1.0
## motion@12.42.2
- License: MIT
- Repository: https://github.com/motiondivision/motion
- Description: An animation library for JavaScript and React.
- Included files: LICENSE.md
- Folder: `licenses/motion@12.42.2`
- Source package dir: `packages/chat/node_modules/motion`
## mtp@0.2.0
- License: UNKNOWN
- Description: MTP TypeScript SDK
- Included files: none found
- Folder: `licenses/mtp@0.1.0`
- Folder: `licenses/mtp@0.2.0`
- Source package dir: `packages/mtp/node_modules/mtp`
## next-themes@0.4.6

View file

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017-2019 Miles Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -3,7 +3,7 @@
"specVersion": "1.5",
"version": 1,
"metadata": {
"timestamp": "2026-07-03T19:50:00.640Z",
"timestamp": "2026-07-24T10:43:11.914Z",
"tools": [
{
"vendor": "OpenAI",
@ -117,6 +117,37 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40codemirror/autocomplete@6.20.3",
"name": "@codemirror/autocomplete",
"version": "6.20.3",
"purl": "pkg:npm/%40codemirror/autocomplete@6.20.3",
"description": "Autocompletion for the CodeMirror code editor",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "git+https://code.haverbeke.berlin/codemirror/autocomplete.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@codemirror_autocomplete@6.20.3"
},
{
"name": "local:sourcePackageDir",
"value": "packages/markdown/node_modules/@codemirror/autocomplete"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40codemirror/commands@6.10.4",
@ -179,6 +210,37 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40codemirror/language@6.12.4",
"name": "@codemirror/language",
"version": "6.12.4",
"purl": "pkg:npm/%40codemirror/language@6.12.4",
"description": "Language support infrastructure for the CodeMirror code editor",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "git+https://code.haverbeke.berlin/codemirror/language.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@codemirror_language@6.12.4"
},
{
"name": "local:sourcePackageDir",
"value": "packages/markdown/node_modules/@codemirror/language"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40codemirror/state@6.7.0",
@ -516,76 +578,6 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40noble/curves@2.2.0",
"name": "@noble/curves",
"version": "2.2.0",
"purl": "pkg:npm/%40noble/curves@2.2.0",
"description": "Audited & minimal JS implementation of elliptic curve cryptography",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "website",
"url": "https://paulmillr.com/noble/"
},
{
"type": "vcs",
"url": "git+https://github.com/paulmillr/noble-curves.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@noble_curves@2.2.0"
},
{
"name": "local:sourcePackageDir",
"value": "packages/crypto/node_modules/@noble/curves"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40noble/hashes@2.2.0",
"name": "@noble/hashes",
"version": "2.2.0",
"purl": "pkg:npm/%40noble/hashes@2.2.0",
"description": "Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "website",
"url": "https://paulmillr.com/noble/"
},
{
"type": "vcs",
"url": "git+https://github.com/paulmillr/noble-hashes.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@noble_hashes@2.2.0"
},
{
"name": "local:sourcePackageDir",
"value": "packages/crypto/node_modules/@noble/hashes"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40radix-ui/primitive@1.1.4",
@ -1780,15 +1772,15 @@
},
{
"type": "library",
"bomRef": "pkg:npm/%40tensamin/ui@0.0.39",
"bomRef": "pkg:npm/%40tensamin/ui@0.0.41",
"name": "@tensamin/ui",
"version": "0.0.39",
"purl": "pkg:npm/%40tensamin/ui@0.0.39",
"version": "0.0.41",
"purl": "pkg:npm/%40tensamin/ui@0.0.41",
"externalReferences": [],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@tensamin_ui@0.0.39"
"value": "licenses/@tensamin_ui@0.0.41"
},
{
"name": "local:sourcePackageDir",
@ -1796,6 +1788,41 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40twemoji/api@17.0.3",
"name": "@twemoji/api",
"version": "17.0.3",
"purl": "pkg:npm/%40twemoji/api@17.0.3",
"description": "A Unicode standard based way to implement emoji across all platforms.",
"licenses": [
{
"license": {
"name": "MIT AND CC-BY-4.0"
}
}
],
"externalReferences": [
{
"type": "website",
"url": "https://github.com/jdecked/twemoji"
},
{
"type": "vcs",
"url": "git://github.com/jdecked/twemoji.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/@twemoji_api@17.0.3"
},
{
"name": "local:sourcePackageDir",
"value": "packages/markdown/node_modules/@twemoji/api"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/%40types/node@25.9.4",
@ -2141,37 +2168,6 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/comlink@4.4.2",
"name": "comlink",
"version": "4.4.2",
"purl": "pkg:npm/comlink@4.4.2",
"description": "Comlink makes WebWorkers enjoyable",
"licenses": [
{
"license": {
"id": "Apache-2.0"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "https://github.com/GoogleChromeLabs/comlink.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/comlink@4.4.2"
},
{
"name": "local:sourcePackageDir",
"value": "packages/crypto/node_modules/comlink"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/cookie-es@3.1.1",
@ -2925,6 +2921,37 @@
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/emojibase-data@17.0.0",
"name": "emojibase-data",
"version": "17.0.0",
"purl": "pkg:npm/emojibase-data@17.0.0",
"description": "Evergreen emoji datasets.",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "git@github.com:milesj/emojibase.git"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/emojibase-data@17.0.0"
},
{
"name": "local:sourcePackageDir",
"value": "packages/markdown/node_modules/emojibase-data"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/es-toolkit@1.49.0",
@ -3397,16 +3424,47 @@
},
{
"type": "library",
"bomRef": "pkg:npm/mtp@0.1.0",
"bomRef": "pkg:npm/motion@12.42.2",
"name": "motion",
"version": "12.42.2",
"purl": "pkg:npm/motion@12.42.2",
"description": "An animation library for JavaScript and React.",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "https://github.com/motiondivision/motion"
}
],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/motion@12.42.2"
},
{
"name": "local:sourcePackageDir",
"value": "packages/chat/node_modules/motion"
}
]
},
{
"type": "library",
"bomRef": "pkg:npm/mtp@0.2.0",
"name": "mtp",
"version": "0.1.0",
"purl": "pkg:npm/mtp@0.1.0",
"version": "0.2.0",
"purl": "pkg:npm/mtp@0.2.0",
"description": "MTP TypeScript SDK",
"externalReferences": [],
"properties": [
{
"name": "local:licenseFolder",
"value": "licenses/mtp@0.1.0"
"value": "licenses/mtp@0.2.0"
},
{
"name": "local:sourcePackageDir",
@ -4851,4 +4909,4 @@
]
}
]
}
}

View file

@ -1,6 +1,6 @@
{
"generatedAt": "2026-07-03T19:50:00.637Z",
"packageCount": 143,
"generatedAt": "2026-07-24T10:43:11.913Z",
"packageCount": 145,
"packages": [
{
"name": "@babel/runtime",
@ -41,6 +41,19 @@
"licenseFolder": "licenses/@base-ui_utils@0.3.1",
"sourcePackageDir": "apps/web/node_modules/@base-ui/utils"
},
{
"name": "@codemirror/autocomplete",
"version": "6.20.3",
"license": "MIT",
"homepage": null,
"repository": "git+https://code.haverbeke.berlin/codemirror/autocomplete.git",
"description": "Autocompletion for the CodeMirror code editor",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/@codemirror_autocomplete@6.20.3",
"sourcePackageDir": "packages/markdown/node_modules/@codemirror/autocomplete"
},
{
"name": "@codemirror/commands",
"version": "6.10.4",
@ -67,6 +80,19 @@
"licenseFolder": "licenses/@codemirror_lang-markdown@6.5.0",
"sourcePackageDir": "packages/markdown/node_modules/@codemirror/lang-markdown"
},
{
"name": "@codemirror/language",
"version": "6.12.4",
"license": "MIT",
"homepage": null,
"repository": "git+https://code.haverbeke.berlin/codemirror/language.git",
"description": "Language support infrastructure for the CodeMirror code editor",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/@codemirror_language@6.12.4",
"sourcePackageDir": "packages/markdown/node_modules/@codemirror/language"
},
{
"name": "@codemirror/state",
"version": "6.7.0",
@ -197,32 +223,6 @@
"licenseFolder": "licenses/@livekit_components-react@2.9.21",
"sourcePackageDir": "packages/call/node_modules/@livekit/components-react"
},
{
"name": "@noble/curves",
"version": "2.2.0",
"license": "MIT",
"homepage": "https://paulmillr.com/noble/",
"repository": "git+https://github.com/paulmillr/noble-curves.git",
"description": "Audited & minimal JS implementation of elliptic curve cryptography",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/@noble_curves@2.2.0",
"sourcePackageDir": "packages/crypto/node_modules/@noble/curves"
},
{
"name": "@noble/hashes",
"version": "2.2.0",
"license": "MIT",
"homepage": "https://paulmillr.com/noble/",
"repository": "git+https://github.com/paulmillr/noble-hashes.git",
"description": "Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/@noble_hashes@2.2.0",
"sourcePackageDir": "packages/crypto/node_modules/@noble/hashes"
},
{
"name": "@radix-ui/primitive",
"version": "1.1.4",
@ -368,7 +368,7 @@
},
{
"name": "@radix-ui/react-slot",
"version": "1.2.1",
"version": "1.3.0",
"license": "MIT",
"homepage": "https://radix-ui.com/primitives",
"repository": "git+https://github.com/radix-ui/primitives.git",
@ -682,15 +682,28 @@
},
{
"name": "@tensamin/ui",
"version": "0.0.39",
"version": "0.0.41",
"license": "UNKNOWN",
"homepage": null,
"repository": null,
"description": null,
"files": [],
"licenseFolder": "licenses/@tensamin_ui@0.0.39",
"licenseFolder": "licenses/@tensamin_ui@0.0.41",
"sourcePackageDir": "apps/tauri/node_modules/@tensamin/ui"
},
{
"name": "@twemoji/api",
"version": "17.0.3",
"license": "MIT AND CC-BY-4.0",
"homepage": "https://github.com/jdecked/twemoji",
"repository": "git://github.com/jdecked/twemoji.git",
"description": "A Unicode standard based way to implement emoji across all platforms.",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/@twemoji_api@17.0.3",
"sourcePackageDir": "packages/markdown/node_modules/@twemoji/api"
},
{
"name": "@types/node",
"version": "25.9.4",
@ -821,19 +834,6 @@
"licenseFolder": "licenses/cmdk@1.1.1",
"sourcePackageDir": "apps/web/node_modules/cmdk"
},
{
"name": "comlink",
"version": "4.4.2",
"license": "Apache-2.0",
"homepage": null,
"repository": "https://github.com/GoogleChromeLabs/comlink.git",
"description": "Comlink makes WebWorkers enjoyable",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/comlink@4.4.2",
"sourcePackageDir": "packages/crypto/node_modules/comlink"
},
{
"name": "cookie-es",
"version": "3.1.1",
@ -1018,7 +1018,7 @@
},
{
"name": "deepfilternet3-noise-filter",
"version": "1.3.0",
"version": "1.2.1",
"license": "(Apache-2.0 OR MIT)",
"homepage": "https://github.com/mezonai/mezon-noise-suppression#readme",
"repository": "git+https://github.com/mezonai/mezon-noise-suppression.git",
@ -1115,6 +1115,19 @@
"licenseFolder": "licenses/embla-carousel-reactive-utils@8.6.0",
"sourcePackageDir": "apps/web/node_modules/embla-carousel-reactive-utils"
},
{
"name": "emojibase-data",
"version": "17.0.0",
"license": "MIT",
"homepage": null,
"repository": "git@github.com:milesj/emojibase.git",
"description": "Evergreen emoji datasets.",
"files": [
"LICENSE"
],
"licenseFolder": "licenses/emojibase-data@17.0.0",
"sourcePackageDir": "packages/markdown/node_modules/emojibase-data"
},
{
"name": "es-toolkit",
"version": "1.49.0",
@ -1293,15 +1306,28 @@
"licenseFolder": "licenses/lucide-react@1.23.0",
"sourcePackageDir": "apps/web/node_modules/lucide-react"
},
{
"name": "motion",
"version": "12.42.2",
"license": "MIT",
"homepage": null,
"repository": "https://github.com/motiondivision/motion",
"description": "An animation library for JavaScript and React.",
"files": [
"LICENSE.md"
],
"licenseFolder": "licenses/motion@12.42.2",
"sourcePackageDir": "packages/chat/node_modules/motion"
},
{
"name": "mtp",
"version": "0.1.0",
"version": "0.2.0",
"license": "UNKNOWN",
"homepage": null,
"repository": null,
"description": "MTP TypeScript SDK",
"files": [],
"licenseFolder": "licenses/mtp@0.1.0",
"licenseFolder": "licenses/mtp@0.2.0",
"sourcePackageDir": "packages/mtp/node_modules/mtp"
},
{
@ -1847,4 +1873,4 @@
"sourcePackageDir": "packages/call/node_modules/zustand"
}
]
}
}

View file

@ -10,14 +10,14 @@
"type": "module",
"scripts": {
"format": "pnpm exec prettier --write .",
"lint": "node scripts/lint-packages.ts",
"lint": "node utils/scripts/lint-packages.ts",
"check": "fallow && pnpm run lint",
"copy-licenses": "node scripts/copy-licenses.ts",
"copy-releases": "node scripts/copy-releases.ts",
"copy-licenses": "node utils/scripts/copy-licenses.ts",
"copy-releases": "node utils/scripts/copy-releases.ts",
"pre-build": "pnpm run lint && pnpm run build:packages",
"build:apps": "pnpm run copy-licenses && pnpm run pre-build && pnpm run build:mobile && pnpm run build:desktop && pnpm run copy-releases",
"build:packages": "node scripts/build-packages.ts",
"update:packages": "node scripts/update-packages.ts",
"build:packages": "node utils/scripts/build-packages.ts",
"update:packages": "node utils/scripts/update-packages.ts",
"dev:web": "cd apps/web && pnpm dev",
"build:web": "cd apps/web && pnpm run build",
"preview:web": "cd apps/web && pnpm run preview",

View file

@ -1,8 +1,7 @@
import * as React from "react";
import type { RawMessage } from "../values";
import Text from "@tensamin/markdown/text";
import { AlertTriangle, Check, Ellipse, RefreshCw } from "lucide-react";
import { useCallback, useEffect, useState } from "react";
import { memo, useCallback, useEffect, useState } from "react";
import type { User } from "@tensamin/user/context";
import {
@ -384,7 +383,7 @@ function MessageComponent({
);
}
export default React.memo(MessageComponent, (prev, next) => {
export default memo(MessageComponent, (prev, next) => {
return (
prev.message.SendTime === next.message.SendTime &&
prev.message.Content === next.message.Content &&

View file

@ -1,4 +1,11 @@
import * as React from "react";
import {
useCallback,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react";
import { useInfiniteQuery } from "@tanstack/react-query";
import { useVirtualizer } from "@tanstack/react-virtual";
@ -82,21 +89,21 @@ export default function Screen() {
error,
errorDescription,
} = useChat();
const scrollRef = React.useRef<HTMLDivElement | null>(null);
const topSentinelRef = React.useRef<HTMLDivElement | null>(null);
const didInitialScrollRef = React.useRef(false);
const userScrolledUpRef = React.useRef(false);
const isAtBottomRef = React.useRef(true);
const smoothScrollFrameRef = React.useRef<number | null>(null);
const smoothScrollTargetRef = React.useRef(0);
const hasNextPageRef = React.useRef(false);
const isFetchingNextPageRef = React.useRef(false);
const fetchNextPageRef = React.useRef<(() => void) | null>(null);
const scrollRef = useRef<HTMLDivElement | null>(null);
const topSentinelRef = useRef<HTMLDivElement | null>(null);
const didInitialScrollRef = useRef(false);
const userScrolledUpRef = useRef(false);
const isAtBottomRef = useRef(true);
const smoothScrollFrameRef = useRef<number | null>(null);
const smoothScrollTargetRef = useRef(0);
const hasNextPageRef = useRef(false);
const isFetchingNextPageRef = useRef(false);
const fetchNextPageRef = useRef<(() => void) | null>(null);
const [lastLiveMessageCount, setLastLiveMessageCount] = React.useState(0);
const [didInitialScroll, setDidInitialScroll] = React.useState(false);
const [viewportHeight, setViewportHeight] = React.useState(0);
const [value, setValue] = React.useState("");
const [lastLiveMessageCount, setLastLiveMessageCount] = useState(0);
const [didInitialScroll, setDidInitialScroll] = useState(false);
const [viewportHeight, setViewportHeight] = useState(0);
const [value, setValue] = useState("");
const hasValidChatUser = Number.isSafeInteger(userId) && userId > 0;
const hasChatSecret = chatSecret !== null;
@ -120,7 +127,7 @@ export default function Screen() {
isFetchingNextPage: isFetchingMessagesNextPage,
} = messagesQuery;
React.useEffect(() => {
useEffect(() => {
hasNextPageRef.current = hasMessagesNextPage;
isFetchingNextPageRef.current = isFetchingMessagesNextPage;
fetchNextPageRef.current = () => {
@ -128,7 +135,7 @@ export default function Screen() {
};
}, [fetchMessagesNextPage, hasMessagesNextPage, isFetchingMessagesNextPage]);
React.useEffect(() => {
useEffect(() => {
clearLiveMessages();
didInitialScrollRef.current = false;
userScrolledUpRef.current = false;
@ -137,7 +144,7 @@ export default function Screen() {
setLastLiveMessageCount(0);
}, [clearLiveMessages, userId]);
const historicalMessages = React.useMemo(() => {
const historicalMessages = useMemo(() => {
const pages = messagesQuery.data?.pages ?? [];
const seenSendTimes = new Set<number>();
const dedupedMessages: RawMessage[] = [];
@ -156,7 +163,7 @@ export default function Screen() {
const liveMessagesSnapshot = liveMessages();
const liveWithoutDuplicates = React.useMemo(() => {
const liveWithoutDuplicates = useMemo(() => {
const historicalSendTimes = new Set(
historicalMessages.map((message) => message.SendTime),
);
@ -166,15 +173,15 @@ export default function Screen() {
);
}, [historicalMessages, liveMessagesSnapshot]);
const messages = React.useMemo(() => {
const messages = useMemo(() => {
return [...historicalMessages, ...liveWithoutDuplicates];
}, [historicalMessages, liveWithoutDuplicates]);
const historicalMessageChunks = React.useMemo(() => {
const historicalMessageChunks = useMemo(() => {
return buildMessageChunks(historicalMessages, "history");
}, [historicalMessages]);
const liveMessageChunks = React.useMemo(() => {
const liveMessageChunks = useMemo(() => {
return buildMessageChunks(
liveWithoutDuplicates,
"live",
@ -182,18 +189,18 @@ export default function Screen() {
);
}, [historicalMessages.length, liveWithoutDuplicates]);
const messageChunks = React.useMemo(() => {
const messageChunks = useMemo(() => {
return [...liveMessageChunks, ...historicalMessageChunks];
}, [historicalMessageChunks, liveMessageChunks]);
const virtualRowCount = messageChunks.length;
const getItemKey = React.useCallback(
const getItemKey = useCallback(
(index: number) => messageChunks[index]?.key ?? index,
[messageChunks],
);
const estimateSize = React.useCallback(() => FALLBACK_MESSAGE_HEIGHT, []);
const estimateSize = useCallback(() => FALLBACK_MESSAGE_HEIGHT, []);
// eslint-disable-next-line react-hooks/incompatible-library
const virtualizer = useVirtualizer({
@ -207,7 +214,7 @@ export default function Screen() {
const contentHeight = Math.max(totalSize, viewportHeight);
const verticalOffset = Math.max(0, viewportHeight - totalSize);
React.useLayoutEffect(() => {
useLayoutEffect(() => {
const element = scrollRef.current;
if (!element || typeof ResizeObserver === "undefined") {
return;
@ -227,7 +234,7 @@ export default function Screen() {
};
}, []);
React.useLayoutEffect(() => {
useLayoutEffect(() => {
if (didInitialScrollRef.current || virtualRowCount === 0) {
return;
}
@ -244,7 +251,7 @@ export default function Screen() {
});
}, [virtualizer, virtualRowCount]);
React.useLayoutEffect(() => {
useLayoutEffect(() => {
const count = liveMessagesSnapshot.length;
if (count > lastLiveMessageCount && isAtBottomRef.current) {
@ -263,7 +270,7 @@ export default function Screen() {
virtualizer,
]);
React.useEffect(() => {
useEffect(() => {
if (
viewportHeight === 0 ||
totalSize > viewportHeight ||
@ -276,7 +283,7 @@ export default function Screen() {
void messagesQuery.fetchNextPage();
}, [didInitialScroll, messagesQuery, totalSize, viewportHeight]);
React.useLayoutEffect(() => {
useLayoutEffect(() => {
if (
!didInitialScroll ||
userScrolledUpRef.current ||
@ -292,7 +299,7 @@ export default function Screen() {
});
}, [didInitialScroll, virtualRowCount]);
React.useEffect(() => {
useEffect(() => {
const root = scrollRef.current;
const sentinel = topSentinelRef.current;
@ -324,7 +331,7 @@ export default function Screen() {
};
}, [didInitialScroll, messagesQuery, virtualRowCount]);
const handleContainerScroll = React.useCallback(() => {
const handleContainerScroll = useCallback(() => {
if (!scrollRef.current) {
return;
}
@ -336,7 +343,7 @@ export default function Screen() {
}
}, []);
React.useEffect(() => {
useEffect(() => {
const element = scrollRef.current;
if (!element) {
return;

View file

@ -1,4 +1,4 @@
import * as React from "react";
import { Fragment, type ReactElement, type ReactNode } from "react";
import Emoji from "./emoji";
import { findEmojiShortcodes } from "./emojiData";
@ -392,7 +392,7 @@ export function parseMarkdownBlocks(markdown: string): MarkdownBlock[] {
* @param nodes Parameter nodes.
* @returns React.ReactNode[].
*/
function renderInline(nodes: InlineNode[]): React.ReactNode[] {
function renderInline(nodes: InlineNode[]): ReactNode[] {
return nodes.map((node, index) => {
if (node.type === "text") {
return node.value;
@ -468,7 +468,7 @@ function renderInline(nodes: InlineNode[]): React.ReactNode[] {
* @param blocks Parameter blocks.
* @returns React.ReactElement.
*/
export function renderBlocks(blocks: MarkdownBlock[]): React.ReactElement {
export function renderBlocks(blocks: MarkdownBlock[]): ReactElement {
return (
<>
{blocks.map((block, blockIndex) => {
@ -591,10 +591,10 @@ export function renderBlocks(blocks: MarkdownBlock[]): React.ReactElement {
return (
<p key={blockIndex}>
{block.text.split("\n").map((line, lineIndex) => (
<React.Fragment key={lineIndex}>
<Fragment key={lineIndex}>
{lineIndex > 0 ? <br /> : null}
{renderInline(parseInlineNodes(line))}
</React.Fragment>
</Fragment>
))}
</p>
);

View file

@ -1,4 +1,4 @@
import * as React from "react";
import { useMemo } from "react";
import {
ensureMarkdownStyles,
@ -18,11 +18,8 @@ export type TextProps = {
export default function Text(props: TextProps) {
ensureMarkdownStyles();
const blocks = React.useMemo(
() => parseMarkdownBlocks(props.value),
[props.value],
);
const renderedBlocks = React.useMemo(() => renderBlocks(blocks), [blocks]);
const blocks = useMemo(() => parseMarkdownBlocks(props.value), [props.value]);
const renderedBlocks = useMemo(() => renderBlocks(blocks), [blocks]);
return <div className="tm-md-root">{renderedBlocks}</div>;
}

View file

@ -0,0 +1 @@
- Make the legal loader use ldrs line wobble to better fit to the LoadingScreen from @tensamin/ui

View file

@ -1,4 +1,13 @@
import * as React from "react";
import {
createContext,
type ReactNode,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import {
type Storage as StorageSchema,
storageDefaults as defaults,
@ -31,7 +40,7 @@ interface StorageContextValue {
secureStorage: SecureStorageStatus | null;
}
const StorageContext = React.createContext<StorageContextValue | undefined>(
const StorageContext = createContext<StorageContextValue | undefined>(
undefined,
);
@ -42,29 +51,29 @@ const isIndexedDBSupported = typeof indexedDB !== "undefined";
* @param props Parameter props.
* @returns unknown.
*/
export default function StorageProvider(props: { children: React.ReactNode }) {
const [storage, setStorage] = React.useState<StorageSchema>(defaults);
const storageRef = React.useRef(storage);
const loadedKeys = React.useRef(new Set<keyof StorageSchema>());
const loadPromises = React.useRef(
export default function StorageProvider(props: { children: ReactNode }) {
const [storage, setStorage] = useState<StorageSchema>(defaults);
const storageRef = useRef(storage);
const loadedKeys = useRef(new Set<keyof StorageSchema>());
const loadPromises = useRef(
new Map<keyof StorageSchema, Promise<StorageSchema[keyof StorageSchema]>>(),
);
const generations = React.useRef(new Map<keyof StorageSchema, number>());
const generations = useRef(new Map<keyof StorageSchema, number>());
const [secureStorage, setSecureStorage] =
React.useState<SecureStorageStatus | null>(null);
const secureStorageRef = React.useRef<SecureStorageStatus | null>(null);
useState<SecureStorageStatus | null>(null);
const secureStorageRef = useRef<SecureStorageStatus | null>(null);
const [error, setError] = React.useState("");
const [errorDescription, setErrorDescription] = React.useState("");
const [error, setError] = useState("");
const [errorDescription, setErrorDescription] = useState("");
React.useEffect(() => {
useEffect(() => {
void getSecureStorageStatus().then((status) => {
secureStorageRef.current = status;
setSecureStorage(status);
});
}, []);
const commit = React.useCallback(
const commit = useCallback(
<K extends keyof StorageSchema>(key: K, nextValue: StorageSchema[K]) => {
const next = { ...storageRef.current, [key]: nextValue };
storageRef.current = next;
@ -74,7 +83,7 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
[],
);
const load = React.useCallback(
const load = useCallback(
async <K extends keyof StorageSchema>(
key: K,
): Promise<StorageSchema[K]> => {
@ -127,7 +136,7 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
[commit],
);
const save = React.useCallback(
const save = useCallback(
async <K extends keyof StorageSchema>(
key: K,
value: StorageSchema[K],
@ -163,14 +172,12 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
[commit],
);
const clear = React.useCallback(async () => {
const clear = useCallback(async () => {
const keys = Object.keys(defaults) as (keyof StorageSchema)[];
for (const key of keys) {
generations.current.set(key, (generations.current.get(key) ?? 0) + 1);
}
await Promise.all(
keys.map((key) => deleteDatabaseEntry("storage", key)),
);
await Promise.all(keys.map((key) => deleteDatabaseEntry("storage", key)));
await window.tensaminDesktop?.secureStorage
?.clear?.()
.catch(() => undefined);
@ -180,7 +187,7 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
setStorage(defaults);
}, []);
const value = React.useMemo<StorageContextValue>(
const value = useMemo<StorageContextValue>(
() => ({
load,
save,
@ -216,7 +223,7 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
* @returns StorageContextValue.
*/
export function useStorage(): StorageContextValue {
const context = React.useContext(StorageContext);
const context = useContext(StorageContext);
if (!context) {
throw new Error("useStorage must be used within a StorageProvider");
}

View file

@ -1,4 +1,12 @@
import * as React from "react";
import {
createContext,
type ReactNode,
useCallback,
useContext,
useEffect,
useRef,
useState,
} from "react";
import { useMTP } from "@tensamin/mtp";
import { mtp as schemas } from "@tensamin/shared/data";
@ -13,25 +21,23 @@ interface contextValue {
get(userId: number): Promise<User>;
}
const UserContext = React.createContext<contextValue | undefined>(undefined);
const UserContext = createContext<contextValue | undefined>(undefined);
/**
* Executes UserProvider.
* @param props Parameter props.
* @returns unknown.
*/
export default function UserProvider(props: { children: React.ReactNode }) {
const storageRef = React.useRef<Record<number, User>>({});
const pendingRef = React.useRef<Record<number, Promise<User> | undefined>>(
{},
);
export default function UserProvider(props: { children: ReactNode }) {
const storageRef = useRef<Record<number, User>>({});
const pendingRef = useRef<Record<number, Promise<User> | undefined>>({});
const { send } = useMTP();
const { load } = useStorage();
const { contacts } = useSession();
const [accountId, setAccountId] = React.useState<number | null>(null);
const [accountId, setAccountId] = useState<number | null>(null);
React.useEffect(() => {
useEffect(() => {
void load("user_id").then((accountId) => {
setAccountId(accountId);
});
@ -42,7 +48,7 @@ export default function UserProvider(props: { children: React.ReactNode }) {
* @param userId Parameter userId.
* @returns Promise<User>.
*/
const get = React.useCallback(
const get = useCallback(
async (userId: number): Promise<User> => {
if (userId == null) {
throw new Error("userId is required");
@ -85,7 +91,7 @@ export default function UserProvider(props: { children: React.ReactNode }) {
[accountId, send],
);
React.useEffect(() => {
useEffect(() => {
if (!accountId) return;
for (const contact of contacts) void get(contact.UserId);
}, [accountId, contacts, get]);
@ -103,7 +109,7 @@ export default function UserProvider(props: { children: React.ReactNode }) {
* @returns contextValue.
*/
export function useUser(): contextValue {
const context = React.useContext(UserContext);
const context = useContext(UserContext);
if (!context) {
throw new Error("useUser must be used within a UserProvider");
}

View file

@ -1,4 +1,3 @@
- Move legal to extra onboarding package
- Add a bunch of tests
- Add packages/hotkeys/
- Full accessability

View file

@ -12,6 +12,6 @@
"moduleResolution": "nodenext",
"types": ["node"]
},
"include": ["scripts", "eslint.config.ts"],
"include": ["utils", "eslint.config.ts"],
"exclude": ["node_modules", "dist"]
}

View file

@ -0,0 +1,74 @@
import type { Rule } from "eslint";
export const noReactNamespaceImport: Rule.RuleModule = {
meta: {
type: "suggestion",
docs: {
description: "Require named imports from React",
},
messages: {
namespaceImport:
"Import only the React exports used by this module instead of using a namespace import.",
},
schema: [],
},
create(context) {
return {
ImportDeclaration(node) {
if (
node.source.value === "react" &&
node.specifiers.some(
(specifier) => specifier.type === "ImportNamespaceSpecifier",
)
) {
context.report({ node, messageId: "namespaceImport" });
}
},
};
},
};
function isPropertyNamed(
member: {
computed: boolean;
property: { type: string; name?: string; value?: unknown };
},
name: string,
): boolean {
return member.computed
? member.property.type === "Literal" && member.property.value === name
: member.property.type === "Identifier" && member.property.name === name;
}
export const noWindowLocationReload: Rule.RuleModule = {
meta: {
type: "problem",
docs: {
description: "Disallow reloads that bypass TanStack Router",
},
messages: {
reload:
"Do not use window.location.reload(); use TanStack Router navigation instead.",
},
schema: [],
},
create(context) {
return {
CallExpression(node) {
const callee = node.callee;
if (
callee.type !== "MemberExpression" ||
!isPropertyNamed(callee, "reload") ||
callee.object.type !== "MemberExpression" ||
!isPropertyNamed(callee.object, "location") ||
callee.object.object.type !== "Identifier" ||
callee.object.object.name !== "window"
) {
return;
}
context.report({ node, messageId: "reload" });
},
};
},
};

View file

@ -7,7 +7,7 @@ import { dirname } from "node:path";
const _dirname = dirname(fileURLToPath(import.meta.url));
const packagesDir = join(_dirname, "..", "packages");
const packagesDir = join(_dirname, "..", "..", "packages");
function getPackageDirs(dir: string): string[] {
const entries = readdirSync(dir);

View file

@ -11,7 +11,7 @@ import {
} from "node:fs";
import { createHash } from "node:crypto";
import { basename, join } from "node:path";
import packageJson from "../package.json" with { type: "json" };
import packageJson from "../../package.json" with { type: "json" };
const { version } = packageJson;
const releaseVersion = process.env.TENSAMIN_RELEASE_VERSION || version;

View file

@ -7,7 +7,7 @@ import { dirname } from "node:path";
const _dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = join(_dirname, "..");
const rootDir = join(_dirname, "..", "..");
const targetDirs = [join(rootDir, "packages"), join(rootDir, "apps")];
function getPackageDirs(dir: string): string[] {

View file

@ -7,7 +7,7 @@ import { dirname } from "node:path";
const _dirname = dirname(fileURLToPath(import.meta.url));
const packagesDir = join(_dirname, "..", "packages");
const packagesDir = join(_dirname, "..", "..", "packages");
function getPackageDirs(dir: string): string[] {
const entries = readdirSync(dir);