diff --git a/.forgejo/workflows/deploy-dev.yml b/.forgejo/workflows/deploy-dev.yml index eca2545..26053ff 100644 --- a/.forgejo/workflows/deploy-dev.yml +++ b/.forgejo/workflows/deploy-dev.yml @@ -4,31 +4,20 @@ on: - dev jobs: - build-web: + deploy: runs-on: docker + steps: - name: Check out repo uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v30 - - - name: Install Bun + - name: Setup Bun uses: oven-sh/setup-bun@v2 - name: Install dependencies run: bun install --frozen-lockfile - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - - name: Build web + - name: Build run: bun run build:web - name: Install rsync @@ -36,204 +25,3 @@ jobs: - name: Deploy run: rsync -a --delete apps/web/dist/ /var/lib/www/tensamin-web-dev/ - - build-mobile: - runs-on: docker - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v30 - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - - name: Setup Android Keystore - env: - KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} - KEYSTORE_PROPERTIES: ${{ secrets.ANDROID_KEYSTORE_PROPERTIES }} - run: | - bun -e "require('fs').writeFileSync('keystore.jks', Buffer.from(process.env.KEYSTORE_BASE64.replace(/\s+/g, ''), 'base64'))" - bun -e "const content = process.env.KEYSTORE_PROPERTIES.replace(/\\n/g, '\n').replace(/\r/g, '').split('\n').map(l => l.trim()).filter(l => l).join('\n'); require('fs').writeFileSync('keystore.properties', content)" - - - name: Build mobile - run: bun run build:mobile - - - name: Upload mobile artifact - uses: https://data.forgejo.org/actions/upload-artifact@v3 - with: - name: mobile-apk - path: apps/tauri/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk - - build-desktop: - runs-on: docker - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v30 - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - - name: Build desktop - run: bun run build:desktop - - - name: Upload desktop artifacts - uses: https://data.forgejo.org/actions/upload-artifact@v3 - with: - name: desktop-bundles - path: apps/tauri/src-tauri/target/release/bundle/ - - release: - runs-on: docker - needs: [build-web, build-mobile, build-desktop] - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Download mobile artifact - uses: https://data.forgejo.org/actions/download-artifact@v3 - with: - name: mobile-apk - path: apps/tauri/src-tauri/gen/android/app/build/outputs/apk/universal/release/ - - - name: Download desktop artifacts - uses: https://data.forgejo.org/actions/download-artifact@v3 - with: - name: desktop-bundles - path: apps/tauri/src-tauri/target/release/bundle/ - - - name: Copy releases - run: bun --bun run copy-releases - - - name: Read version and hash - id: version - run: | - VERSION="$(node -p "require('./package.json').version")" - SHORT_SHA="$(git rev-parse --short HEAD)" - echo "version=$VERSION" >> "$FORGEJO_OUTPUT" - echo "short_sha=$SHORT_SHA" >> "$FORGEJO_OUTPUT" - echo "tag=${VERSION}-dev-${SHORT_SHA}" >> "$FORGEJO_OUTPUT" - echo "title=${VERSION}-dev-${SHORT_SHA}" >> "$FORGEJO_OUTPUT" - - - name: Create pre-release and upload files - env: - TOKEN: ${{ forgejo.token }} - API: ${{ forgejo.api_url }} - REPO: ${{ forgejo.repository }} - SHA: ${{ forgejo.sha }} - TAG: ${{ steps.version.outputs.tag }} - TITLE: ${{ steps.version.outputs.title }} - run: | - set -eu - - test -d releases - find releases -type f | grep -q . - - LATEST_PROD_TAG="$(git tag --sort=-v:refname | head -n 1 || true)" - - if [ -n "$LATEST_PROD_TAG" ]; then - RAW_LOG="$(git log "$LATEST_PROD_TAG"..HEAD --pretty=format:'- %s')" - else - RAW_LOG="$(git log --pretty=format:'- %s')" - fi - - export RAW_LOG LATEST_PROD_TAG API REPO TAG - BODY="$(node -e ' - const raw = process.env.RAW_LOG; - const lines = raw.split("\n"); - const commits = []; - for (const line of lines) { - const msg = line.replace(/^- /, ""); - const parts = msg.split(/(?=\([^)]+\):)/).filter(Boolean).map(s => s.trim()).filter(s => s); - for (const part of parts) { - commits.push(part); - } - } - const priority = { "(feat):": 1, "(fix):": 2, "(qol):": 3 }; - commits.sort((a, b) => { - const tagA = a.match(/^(\([^)]+\):)/)?.[1] || ""; - const tagB = b.match(/^(\([^)]+\):)/)?.[1] || ""; - return (priority[tagA] || 99) - (priority[tagB] || 99); - }); - const log = commits.map(c => "- " + c).join("\n"); - const latestTag = process.env.LATEST_PROD_TAG; - if (latestTag) { - const serverUrl = process.env.API.replace(/\/api\/v1.*/, ""); - const compareUrl = serverUrl + "/" + process.env.REPO + "/compare/" + latestTag + "..." + process.env.TAG; - console.log(log + "\n\n[View changes](" + compareUrl + ")"); - } else { - console.log(log); - } - ')" - - HTTP_STATUS=$(curl -s -w "%{http_code}" -o release_out.json -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/tags/$TAG") - - if [ "$HTTP_STATUS" = "200" ]; then - echo "Release $TAG already exists." - RELEASE_ID="$(jq -r .id release_out.json)" - else - echo "Creating new pre-release for $TAG" - RELEASE_JSON="$(curl -f -sS -X POST "$API/repos/$REPO/releases" \ - -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d "$(jq -n \ - --arg tag "$TAG" \ - --arg name "$TITLE" \ - --arg body "$BODY" \ - --arg target "$SHA" \ - '{ - tag_name: $tag, - name: $name, - body: $body, - target_commitish: $target, - draft: false, - prerelease: true - }')")" - RELEASE_ID="$(echo "$RELEASE_JSON" | jq -r .id)" - fi - - find releases -type f -print0 | while IFS= read -r -d '' file; do - name="$(basename "$file")" - curl -fsS -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \ - -H "Authorization: token $TOKEN" \ - -F "attachment=@$file" - done diff --git a/.forgejo/workflows/deploy-prod.yml b/.forgejo/workflows/deploy-prod.yml index 3463fca..1df5b60 100644 --- a/.forgejo/workflows/deploy-prod.yml +++ b/.forgejo/workflows/deploy-prod.yml @@ -4,8 +4,9 @@ on: - main jobs: - build-web: + deploy: runs-on: docker + steps: - name: Check out repo uses: https://data.forgejo.org/actions/checkout@v4 @@ -22,132 +23,29 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - - name: Build web - run: bun run build:web - - - name: Install rsync - run: apt-get update && apt-get install -y rsync - - - name: Deploy - run: rsync -a --delete apps/web/dist/ /var/lib/www/tensamin-web-prod/ - - build-mobile: - runs-on: docker - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v30 - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - name: Setup Android Keystore env: KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} KEYSTORE_PROPERTIES: ${{ secrets.ANDROID_KEYSTORE_PROPERTIES }} run: | bun -e "require('fs').writeFileSync('keystore.jks', Buffer.from(process.env.KEYSTORE_BASE64.replace(/\s+/g, ''), 'base64'))" - bun -e "const content = process.env.KEYSTORE_PROPERTIES.replace(/\\n/g, '\n').replace(/\r/g, '').split('\n').map(l => l.trim()).filter(l => l).join('\n'); require('fs').writeFileSync('keystore.properties', content)" + bun -e "const content = process.env.KEYSTORE_PROPERTIES.replace(/\\\\n/g, '\n').replace(/\\r/g, '').split('\n').map(l => l.trim()).filter(l => l).join('\n'); require('fs').writeFileSync('keystore.properties', content)" - - name: Build mobile - run: bun run build:mobile + - name: Build + run: bun run build:apps - - name: Upload mobile artifact - uses: https://data.forgejo.org/actions/upload-artifact@v3 - with: - name: mobile-apk - path: apps/tauri/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk + - name: Install rsync + run: apt-get update && apt-get install -y rsync - build-desktop: - runs-on: docker - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Nix - uses: https://github.com/cachix/install-nix-action@v30 - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Copy licenses - run: bun run copy-licenses - - - name: Build packages - run: bun run build:packages - - - name: Build desktop - run: bun run build:desktop - - - name: Upload desktop artifacts - uses: https://data.forgejo.org/actions/upload-artifact@v3 - with: - name: desktop-bundles - path: apps/tauri/src-tauri/target/release/bundle/ - - release: - runs-on: docker - needs: [build-web, build-mobile, build-desktop] - steps: - - name: Check out repo - uses: https://data.forgejo.org/actions/checkout@v4 - - - name: Install Packages - run: apt-get update && apt-get install -y sudo curl jq - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Download mobile artifact - uses: https://data.forgejo.org/actions/download-artifact@v3 - with: - name: mobile-apk - path: apps/tauri/src-tauri/gen/android/app/build/outputs/apk/universal/release/ - - - name: Download desktop artifacts - uses: https://data.forgejo.org/actions/download-artifact@v3 - with: - name: desktop-bundles - path: apps/tauri/src-tauri/target/release/bundle/ - - - name: Copy releases - run: bun --bun run copy-releases + - name: Deploy + run: rsync -a --delete apps/web/dist/ /var/lib/www/tensamin-web-prod/ - name: Read version id: version run: | VERSION="$(node -p "require('./package.json').version")" echo "version=$VERSION" >> "$FORGEJO_OUTPUT" - echo "tag=$VERSION" >> "$FORGEJO_OUTPUT" + echo "tag=v$VERSION" >> "$FORGEJO_OUTPUT" - name: Create release and upload files env: @@ -156,40 +54,39 @@ jobs: REPO: ${{ forgejo.repository }} SHA: ${{ forgejo.sha }} TAG: ${{ steps.version.outputs.tag }} + VERSION: ${{ steps.version.outputs.version }} run: | set -eu test -d releases find releases -type f | grep -q . - COMMIT_MSG="$(git log -1 --pretty=%B | sed 's/$/ /')" - HTTP_STATUS=$(curl -s -w "%{http_code}" -o release_out.json -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/tags/$TAG") if [ "$HTTP_STATUS" = "200" ]; then echo "Release $TAG already exists." - exit 0 + RELEASE_ID="$(jq -r .id release_out.json)" + else + echo "Creating new release for $TAG" + RELEASE_JSON="$(curl -f -sS -X POST "$API/repos/$REPO/releases" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$(jq -n \ + --arg tag "$TAG" \ + --arg name "$TAG" \ + --arg body "Release $VERSION" \ + --arg target "$SHA" \ + '{ + tag_name: $tag, + name: $name, + body: $body, + target_commitish: $target, + draft: false, + prerelease: false + }')")" + RELEASE_ID="$(echo "$RELEASE_JSON" | jq -r .id)" fi - echo "Creating new release for $TAG" - RELEASE_JSON="$(curl -f -sS -X POST "$API/repos/$REPO/releases" \ - -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d "$(jq -n \ - --arg tag "$TAG" \ - --arg name "$TAG" \ - --arg body "$COMMIT_MSG" \ - --arg target "$SHA" \ - '{ - tag_name: $tag, - name: $name, - body: $body, - target_commitish: $target, - draft: false, - prerelease: false - }')")" - RELEASE_ID="$(echo "$RELEASE_JSON" | jq -r .id)" - find releases -type f -print0 | while IFS= read -r -d '' file; do name="$(basename "$file")" curl -fsS -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 34ff437..5bb82f5 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "tauri-apps.tauri-vscode", "rust-lang.rust-analyzer", - "bradlc.vscode-tailwindcss" + "bradlc.vscode-tailwindcss", + "antfu.vite" ] } diff --git a/apps/tauri/android.png b/apps/tauri/android.png deleted file mode 100644 index f77258e..0000000 Binary files a/apps/tauri/android.png and /dev/null differ diff --git a/apps/tauri/background.png b/apps/tauri/background.png deleted file mode 100644 index e6157bd..0000000 Binary files a/apps/tauri/background.png and /dev/null differ diff --git a/apps/tauri/logo.json b/apps/tauri/logo.json deleted file mode 100644 index 9cd2fcb..0000000 --- a/apps/tauri/logo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "default": "./logo.svg", - - "android_fg": "./android.png", - "android_bg": "./background.png", - "android_fg_scale": 100, - "android_monochrome": "./monochrome.png" -} \ No newline at end of file diff --git a/apps/tauri/logo.png b/apps/tauri/logo.png new file mode 100644 index 0000000..7cb66f6 Binary files /dev/null and b/apps/tauri/logo.png differ diff --git a/apps/tauri/logo.svg b/apps/tauri/logo.svg deleted file mode 100644 index e40aa0f..0000000 --- a/apps/tauri/logo.svg +++ /dev/null @@ -1,237 +0,0 @@ - - - - diff --git a/apps/tauri/monochrome.png b/apps/tauri/monochrome.png deleted file mode 100644 index 04d3abd..0000000 Binary files a/apps/tauri/monochrome.png and /dev/null differ diff --git a/apps/tauri/package.json b/apps/tauri/package.json index a89a309..db9894e 100644 --- a/apps/tauri/package.json +++ b/apps/tauri/package.json @@ -25,12 +25,12 @@ "dev:mobile:raw": "tauri android dev", "build:mobile:raw": "tauri android build", "dev:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:mobile:raw; else bun dev:mobile:raw; fi", - "build:mobile": "bun run render-version.ts && if command -v nix >/dev/null 2>&1; then nix develop --command bun build:mobile:raw; else bun build:mobile:raw; fi && bun run render-version.ts --unrender", + "build:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:mobile:raw; else bun build:mobile:raw; fi", "dev:desktop:raw": "tauri dev", "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", "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.json", + "gen-icons": "tauri icon ./logo.png", "format": "bunx prettier --write .", "lint": "eslint src" }, @@ -46,7 +46,6 @@ "react-dom": "^19.2.0" }, "devDependencies": { - "@tauri-apps/cli": "^2", - "@types/node": "^25.9.1" + "@tauri-apps/cli": "^2" } } diff --git a/apps/tauri/render-version.ts b/apps/tauri/render-version.ts deleted file mode 100644 index 0bd3fca..0000000 --- a/apps/tauri/render-version.ts +++ /dev/null @@ -1,65 +0,0 @@ -import fs from "fs"; -import path from "path"; - -// Config -const PLACEHOLDER_VERSION = "0.0.0"; - -const rootPackageJsonPath = path.resolve(__dirname, "../../package.json"); -const cargoTomlPath = path.resolve(__dirname, "./src-tauri/Cargo.toml"); -const tauriConfigPath = path.resolve(__dirname, "./src-tauri/tauri.conf.json"); - -// Args -const isUnrender = process.argv.includes("--unrender"); - -// Version Source -const packageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath, "utf8")); - -const packageVersion: string = packageJson.version; - -if (!packageVersion && !isUnrender) { - throw new Error("No version found in package.json"); -} - -const targetVersion = isUnrender ? PLACEHOLDER_VERSION : packageVersion; - -// Helpers -function updateCargoToml(content: string): string { - const regex = /^version\s*=\s*".*"$/m; - - if (!regex.test(content)) { - throw new Error("Could not find version field in Cargo.toml"); - } - - return content.replace(regex, `version = "${targetVersion}"`); -} - -function updateTauriConfig(content: string): string { - const regex = /"version"\s*:\s*".*"/; - - if (!regex.test(content)) { - throw new Error("Could not find version field in tauri.conf.json"); - } - - return content.replace(regex, `"version": "${targetVersion}"`); -} - -// Update Cargo.toml -const cargoToml = fs.readFileSync(cargoTomlPath, "utf8"); - -const updatedCargoToml = updateCargoToml(cargoToml); - -fs.writeFileSync(cargoTomlPath, updatedCargoToml, "utf8"); - -// Update tauri.conf.json -const tauriConfig = fs.readFileSync(tauriConfigPath, "utf8"); - -const updatedTauriConfig = updateTauriConfig(tauriConfig); - -fs.writeFileSync(tauriConfigPath, updatedTauriConfig, "utf8"); - -// Finished -if (isUnrender) { - console.log(`Unrendered versions back to ${PLACEHOLDER_VERSION}`); -} else { - console.log(`Rendered version ${targetVersion}`); -} diff --git a/apps/tauri/src-tauri/Cargo.lock b/apps/tauri/src-tauri/Cargo.lock index 77d465a..e65d82e 100644 --- a/apps/tauri/src-tauri/Cargo.lock +++ b/apps/tauri/src-tauri/Cargo.lock @@ -4838,7 +4838,7 @@ dependencies = [ [[package]] name = "tensamin" -version = "0.0.0" +version = "0.1.0" dependencies = [ "base64 0.22.1", "image 0.25.10", diff --git a/apps/tauri/src-tauri/Cargo.toml b/apps/tauri/src-tauri/Cargo.toml index c5b2b18..90b9504 100644 --- a/apps/tauri/src-tauri/Cargo.toml +++ b/apps/tauri/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tensamin" -version = "0.0.0" +version = "0.1.0" description = "Privacy focused messanger" authors = ["methanium"] edition = "2021" diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 0343c28..2ffbf24 100644 --- a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,6 +1,5 @@ - - + \ No newline at end of file diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index fbd7184..6de2c44 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png deleted file mode 100644 index b038821..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 0eac8d0..c6da8ae 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png deleted file mode 100644 index b1a2c84..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 7b90201..c42517c 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 10832d3..1d61eb2 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png deleted file mode 100644 index 5635294..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index b2a3603..eceb132 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png deleted file mode 100644 index b13236e..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index f5fb52c..be24593 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 4a07614..5aeb1dc 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png deleted file mode 100644 index 16908ba..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index ac4b850..cebe007 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png deleted file mode 100644 index c929b14..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 7ed0607..1b7aa3d 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 7aee207..14abb66 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png deleted file mode 100644 index 15cf062..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index 6ab46b6..a918033 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png deleted file mode 100644 index 21f0293..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index f596b89..5bd12fa 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 1030031..4583924 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png deleted file mode 100644 index 0b02649..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index f20325b..f480384 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png deleted file mode 100644 index 8c3f92e..0000000 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png and /dev/null differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index d70a938..17279d6 100644 Binary files a/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/apps/tauri/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/apps/tauri/src-tauri/gen/android/app/src/main/res/values/strings.xml b/apps/tauri/src-tauri/gen/android/app/src/main/res/values/strings.xml index 2551e9e..e9951d1 100644 --- a/apps/tauri/src-tauri/gen/android/app/src/main/res/values/strings.xml +++ b/apps/tauri/src-tauri/gen/android/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - Tensamin - Tensamin + tensamin + tensamin \ No newline at end of file diff --git a/apps/tauri/src-tauri/icons/128x128.png b/apps/tauri/src-tauri/icons/128x128.png index 425ffb4..2e64037 100644 Binary files a/apps/tauri/src-tauri/icons/128x128.png and b/apps/tauri/src-tauri/icons/128x128.png differ diff --git a/apps/tauri/src-tauri/icons/128x128@2x.png b/apps/tauri/src-tauri/icons/128x128@2x.png index 9fe4117..d379bfa 100644 Binary files a/apps/tauri/src-tauri/icons/128x128@2x.png and b/apps/tauri/src-tauri/icons/128x128@2x.png differ diff --git a/apps/tauri/src-tauri/icons/32x32.png b/apps/tauri/src-tauri/icons/32x32.png index 3c9a880..c98f4e9 100644 Binary files a/apps/tauri/src-tauri/icons/32x32.png and b/apps/tauri/src-tauri/icons/32x32.png differ diff --git a/apps/tauri/src-tauri/icons/64x64.png b/apps/tauri/src-tauri/icons/64x64.png index 0f9e690..e579c32 100644 Binary files a/apps/tauri/src-tauri/icons/64x64.png and b/apps/tauri/src-tauri/icons/64x64.png differ diff --git a/apps/tauri/src-tauri/icons/Square107x107Logo.png b/apps/tauri/src-tauri/icons/Square107x107Logo.png index 1ec3cb3..32c273f 100644 Binary files a/apps/tauri/src-tauri/icons/Square107x107Logo.png and b/apps/tauri/src-tauri/icons/Square107x107Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square142x142Logo.png b/apps/tauri/src-tauri/icons/Square142x142Logo.png index 5b92228..b344198 100644 Binary files a/apps/tauri/src-tauri/icons/Square142x142Logo.png and b/apps/tauri/src-tauri/icons/Square142x142Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square150x150Logo.png b/apps/tauri/src-tauri/icons/Square150x150Logo.png index e1c1b1b..a055b76 100644 Binary files a/apps/tauri/src-tauri/icons/Square150x150Logo.png and b/apps/tauri/src-tauri/icons/Square150x150Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square284x284Logo.png b/apps/tauri/src-tauri/icons/Square284x284Logo.png index 2d33951..322f113 100644 Binary files a/apps/tauri/src-tauri/icons/Square284x284Logo.png and b/apps/tauri/src-tauri/icons/Square284x284Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square30x30Logo.png b/apps/tauri/src-tauri/icons/Square30x30Logo.png index 686bcb7..563a719 100644 Binary files a/apps/tauri/src-tauri/icons/Square30x30Logo.png and b/apps/tauri/src-tauri/icons/Square30x30Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square310x310Logo.png b/apps/tauri/src-tauri/icons/Square310x310Logo.png index 20207a5..2c05099 100644 Binary files a/apps/tauri/src-tauri/icons/Square310x310Logo.png and b/apps/tauri/src-tauri/icons/Square310x310Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square44x44Logo.png b/apps/tauri/src-tauri/icons/Square44x44Logo.png index 7fcb138..9e7d8cb 100644 Binary files a/apps/tauri/src-tauri/icons/Square44x44Logo.png and b/apps/tauri/src-tauri/icons/Square44x44Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square71x71Logo.png b/apps/tauri/src-tauri/icons/Square71x71Logo.png index 6be9a53..949270a 100644 Binary files a/apps/tauri/src-tauri/icons/Square71x71Logo.png and b/apps/tauri/src-tauri/icons/Square71x71Logo.png differ diff --git a/apps/tauri/src-tauri/icons/Square89x89Logo.png b/apps/tauri/src-tauri/icons/Square89x89Logo.png index 84bab9e..2e7bf91 100644 Binary files a/apps/tauri/src-tauri/icons/Square89x89Logo.png and b/apps/tauri/src-tauri/icons/Square89x89Logo.png differ diff --git a/apps/tauri/src-tauri/icons/StoreLogo.png b/apps/tauri/src-tauri/icons/StoreLogo.png index df2463e..4b82c14 100644 Binary files a/apps/tauri/src-tauri/icons/StoreLogo.png and b/apps/tauri/src-tauri/icons/StoreLogo.png differ diff --git a/apps/tauri/src-tauri/icons/icon.icns b/apps/tauri/src-tauri/icons/icon.icns index daf2362..dbdc5e3 100644 Binary files a/apps/tauri/src-tauri/icons/icon.icns and b/apps/tauri/src-tauri/icons/icon.icns differ diff --git a/apps/tauri/src-tauri/icons/icon.ico b/apps/tauri/src-tauri/icons/icon.ico index fc67bfb..7b2783e 100644 Binary files a/apps/tauri/src-tauri/icons/icon.ico and b/apps/tauri/src-tauri/icons/icon.ico differ diff --git a/apps/tauri/src-tauri/icons/icon.png b/apps/tauri/src-tauri/icons/icon.png index 8e56359..33853b3 100644 Binary files a/apps/tauri/src-tauri/icons/icon.png and b/apps/tauri/src-tauri/icons/icon.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@1x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@1x.png index d7880c7..294193c 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@1x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@1x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x-1.png b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x-1.png index a447149..02a5874 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x-1.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x-1.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x.png index a447149..02a5874 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@3x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@3x.png index 3524382..3453672 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@3x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-20x20@3x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@1x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@1x.png index 5aa9fac..10af386 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@1x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@1x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x-1.png b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x-1.png index 36d8549..a13e395 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x-1.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x-1.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x.png index 36d8549..a13e395 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@3x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@3x.png index 4ece183..f4f2ccf 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@3x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-29x29@3x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@1x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@1x.png index a447149..02a5874 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@1x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@1x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x-1.png b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x-1.png index 8b4aaa8..5414b1d 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x-1.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x-1.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x.png index 8b4aaa8..5414b1d 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@3x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@3x.png index dd1ff43..aa8cbd8 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@3x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-40x40@3x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-512@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-512@2x.png index 25d9e54..1beaa86 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-512@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-512@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@2x.png index dd1ff43..aa8cbd8 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@3x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@3x.png index e46366a..17aa19b 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@3x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-60x60@3x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@1x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@1x.png index c732ee4..67faaf8 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@1x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@1x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@2x.png index 52368fe..c00d463 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-76x76@2x.png differ diff --git a/apps/tauri/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png b/apps/tauri/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png index d328f97..f3ca0dd 100644 Binary files a/apps/tauri/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png and b/apps/tauri/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png differ diff --git a/apps/tauri/src-tauri/tauri.conf.json b/apps/tauri/src-tauri/tauri.conf.json index 5651486..c416f81 100644 --- a/apps/tauri/src-tauri/tauri.conf.json +++ b/apps/tauri/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Tensamin", - "version": "0.0.0", + "version": "0.1.0", "mainBinaryName": "tensamin", "identifier": "net.tensamin.client", "build": { diff --git a/apps/tauri/src/deeplinkHandler.tsx b/apps/tauri/src/deeplinkHandler.tsx index 1053ea3..36def6d 100644 --- a/apps/tauri/src/deeplinkHandler.tsx +++ b/apps/tauri/src/deeplinkHandler.tsx @@ -7,7 +7,6 @@ import { } from "react"; import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link"; import { isTauri } from "@tauri-apps/api/core"; -import { useIsMobile } from "@tensamin/ui"; type DeeplinkContextValue = { deeplinks: readonly string[]; @@ -32,10 +31,10 @@ export default function DeeplinkProvider({ children: ReactNode; }) { const [deeplinks, setDeeplinks] = useState([]); - const isMobile = useIsMobile(); + const isTauriEnv = isTauri(); useEffect(() => { - if (!isTauri() || !isMobile) return; + if (!isTauriEnv) return; let mounted = true; let unlisten: (() => void) | undefined; @@ -58,7 +57,7 @@ export default function DeeplinkProvider({ mounted = false; unlisten?.(); }; - }, [isMobile]); + }, [isTauriEnv]); return ( -
- - - - {user.display.slice(0, 2).toUpperCase()} - - - - -
-
- } - /> - - {user.online_status - .split("_") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" ")} - -
-
+ + + {reduceDisplay(props.user.display)} +
-

{user.display}

+

{props.user.display}

-
{extra}
); diff --git a/apps/web/src/components/modals/profile.tsx b/apps/web/src/components/modals/profile.tsx deleted file mode 100644 index 6a31e36..0000000 --- a/apps/web/src/components/modals/profile.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { User } from "@tensamin/user/context"; -import { Avatar, AvatarFallback, AvatarImage } from "@tensamin/ui"; -import Text from "@tensamin/markdown/text"; - -export default function Profile({ user }: { user: User }) { - return ( -
-
- - - - {user.display.slice(0, 2).toUpperCase()} - - -
-

{user.display}

-

{user.username}

-
-
- -
-

- iota: {user.iota_id} -

-

- user: {user.user_id} -

-

- pub key: {user.public_key} -

-
-
- ); -} diff --git a/apps/web/src/components/modals/utils.ts b/apps/web/src/components/modals/utils.ts new file mode 100644 index 0000000..248dcd5 --- /dev/null +++ b/apps/web/src/components/modals/utils.ts @@ -0,0 +1,13 @@ +/** + * Executes reduceDisplay. + * @param display Parameter display. + * @returns unknown. + */ +export 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(); + } +} diff --git a/apps/web/src/components/navbar.tsx b/apps/web/src/components/navbar.tsx index a49a318..162a057 100644 --- a/apps/web/src/components/navbar.tsx +++ b/apps/web/src/components/navbar.tsx @@ -1,13 +1,5 @@ -import { Button, Popover, PopoverContent, PopoverTrigger } from "@tensamin/ui"; -import { - ArrowLeft, - ChevronDown, - ChevronUp, - House, - Phone, - Settings, - User, -} from "lucide-react"; +import { Button } from "@tensamin/ui"; +import { ArrowLeft, House, Phone, Settings, User } from "lucide-react"; import { useLocation, useNavigate, useSearch } from "@tanstack/react-router"; import { joinCall, useCall } from "@tensamin/call/store"; import Wrapper from "@tensamin/user/wrapper"; @@ -18,7 +10,6 @@ import { useState } from "react"; import { SidebarTrigger, useSidebar } from "@tensamin/ui"; import { WindowControls as Controls } from "@tensamin/ui"; import { useSession } from "@tensamin/storage/session"; -import Profile from "./modals/profile"; export default function Navbar({ forMobile }: { forMobile: boolean }) { const navigate = useNavigate(); @@ -32,11 +23,10 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) { const currentCalls = calls.filter((call) => call.call_members.some((member) => member === id), ); + //const currentCalls = ["leck", "schleck", "und", "eck"]; const [selectOpen, setSelectOpen] = useState(false); - const [userInfoOpen, setUserInfoOpen] = useState(false); - return (
( - <> - - -

{user?.display}

- {userInfoOpen ? : } - - } - /> - - - -
- +

{user?.display}

)} loading={} /> @@ -156,7 +126,7 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) { )} )} - +
); diff --git a/apps/web/src/components/screens/login/form.tsx b/apps/web/src/components/screens/login/form.tsx index e318c4b..da5726c 100644 --- a/apps/web/src/components/screens/login/form.tsx +++ b/apps/web/src/components/screens/login/form.tsx @@ -1,4 +1,4 @@ -import { Button, cn, useIsMobile } from "@tensamin/ui"; +import { Button } from "@tensamin/ui"; import { Input } from "@tensamin/ui"; import { Label } from "@tensamin/ui"; import { useStorage } from "@tensamin/storage/context"; @@ -23,7 +23,7 @@ const fetchedUser = z.object({ }); const formSchema = z.object({ - username: z.string().min(1).max(255), + username: z.string().min(1).max(15), private_key: z.string().min(1).max(92), }); @@ -35,7 +35,6 @@ const formSchema = z.object({ function parseTuFileContent(rawFileContent: string): { userId: number; privateKey: string; - domain: string | null; } { if (rawFileContent.trim().length === 0) { throw new Error("File is empty"); @@ -43,59 +42,42 @@ function parseTuFileContent(rawFileContent: string): { throw new Error("Invalid file"); } else if (rawFileContent.split("::").length !== 2) { throw new Error("Invalid file"); - } - - const left = rawFileContent.split("::")[0]; - const right = rawFileContent.split("::")[1]; - - if (left.length === 0) { + } else if (rawFileContent.split("::")[0].length === 0) { throw new Error("Invalid file"); - } else if (right.length === 0) { + } else if (rawFileContent.split("::")[1].length === 0) { throw new Error("Invalid file"); - } else if (isNaN(Number(left)) && !left.includes("@")) { + } else if (isNaN(Number(rawFileContent.split("::")[0]))) { throw new Error("Invalid file"); } const [userIdString, privateKey] = rawFileContent.split("::"); - const userId = isNaN(Number(userIdString)) - ? Number(userIdString.split("@")[0]) - : Number(userIdString); - - const rawDomain = userIdString.includes("@") - ? userIdString.split("@")[1] - : null; - const domain = rawDomain - ? rawDomain.includes(":") - ? rawDomain - : rawDomain + ":1984" - : null; - + const userId = Number(userIdString); if (!userId || !privateKey) { throw new Error("Invalid file"); } - console.log({ - domain, - rawDomain, - userId, - }); - - return { userId, privateKey, domain }; + return { userId, privateKey }; } +/** + * Renders the login form for file upload and manual credential login. + * @returns Login form JSX. + */ export default function Form() { - const isMobile = useIsMobile(); const uploadRef = React.useRef(null); - const [isDragging, setIsDragging] = React.useState(false); const { save } = useStorage(); - // Process dropped files - const processDroppedFile = React.useCallback( - async (file: globalThis.File): Promise => { + /** + * Handles uploaded .tu files and stores resolved credentials. + * @param event Change event from the hidden file input. + * @returns Promise that resolves when processing has finished. + */ + const handleFileInputChange = React.useCallback( + async (event: React.ChangeEvent): Promise => { try { - if (!file.name.endsWith(".tu")) { - toast("error", "Please upload a .tu file"); - return; + const file = event.currentTarget.files?.[0]; + if (!file) { + throw new Error("No file selected"); } const raw = await file.text(); @@ -104,9 +86,6 @@ export default function Form() { await save("session_id", Date.now()); await save("user_id", parsed.userId); await save("private_key", parsed.privateKey); - if (parsed.domain) { - await save("ttp_url", `https://${parsed.domain}/`); - } location.href = "/"; } catch (error) { @@ -117,94 +96,13 @@ export default function Form() { [save], ); - // Handle .tu files - const handleFileInputChange = React.useCallback( - async (event: React.ChangeEvent): Promise => { - 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. * @param event Form submit event. * @returns Promise that resolves after login processing. */ const handleCredentialsSubmit = React.useCallback( - async (event: React.FormEvent): Promise => { + async (event: React.SubmitEvent): Promise => { event.preventDefault(); const formData = new FormData(event.currentTarget); @@ -216,22 +114,9 @@ export default function Form() { return; } - const inputUsername = inputParse.data.username; - const actualUsername = inputUsername.includes("@") - ? inputUsername.split("@")[0] - : inputUsername; - const rawDomain = inputUsername.includes("@") - ? inputUsername.split("@")[1] - : null; - const domain = rawDomain - ? rawDomain.includes(":") - ? rawDomain - : rawDomain + ":1984" - : null; - try { const response = await fetch( - `https://omega.tensamin.net/api/get/id/${actualUsername}`, + `https://omega.tensamin.net/api/get/id/${inputParse.data.username}`, ); const rawData = await response.arrayBuffer(); @@ -252,9 +137,6 @@ export default function Form() { await save("session_id", Date.now()); await save("user_id", user.user_id); await save("private_key", inputParse.data.private_key); - if (domain) { - await save("ttp_url", `https://${domain}/`); - } location.href = "/"; } catch (error) { @@ -265,35 +147,30 @@ export default function Form() { [save], ); + const isTauriEnv = isTauri(); + return ( -
- {isTauri() && isMobile ? ( +
+ {isTauriEnv ? ( <> { + onData={(data) => { 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 } = parseTuFileContent(decoded); + save("session_id", Date.now()); + save("user_id", userId); + save("private_key", privateKey); + 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"); } }} /> @@ -304,30 +181,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

)} ; - -const onlineStatusLabels: Record = { - user_online: "Online", - user_offline: "Offline", - user_dnd: "Do not disturb", - user_idle: "Idle", - user_wc: "Away", - user_borked: "Borked", - iota_offline: "Iota offline", - iota_online: "Iota online", - iota_borked: "Iota borked", -}; - -function StatusDialog({ - user, - open, - onOpenChange, - send, - draftStatus, - setDraftStatus, - draftOnlineStatus, - setDraftOnlineStatus, - errorMessage, - setErrorMessage, - saveSucceeded, - setSaveSucceeded, -}: { - user: User; - open: boolean; - onOpenChange: (open: boolean) => void; - send: ReturnType["send"]; - draftStatus: string; - setDraftStatus: (value: string) => void; - draftOnlineStatus: OnlineStatus; - setDraftOnlineStatus: (value: OnlineStatus) => void; - errorMessage: string; - setErrorMessage: (value: string) => void; - saveSucceeded: boolean; - setSaveSucceeded: (value: boolean) => void; -}) { - return ( - { - if (!nextOpen) { - setDraftStatus(user.status ?? ""); - setDraftOnlineStatus(user.online_status); - setErrorMessage(""); - setSaveSucceeded(false); - } - - onOpenChange(nextOpen); - }} - > - - - Update Status - -
- - { - setSaveSucceeded(false); - setErrorMessage(""); - setDraftStatus(e.target.value); - }} - /> - - -
- {errorMessage && ( -

{errorMessage}

- )} - - Cancel} /> - - -
-
- ); -} +/** + * Renders the conversation sidebar with account summary and conversation list. + * @returns Sidebar JSX. + */ export default function Sidebar() { const isMobile = useIsMobile(); const showMobileNavbar = useShowMobileNavbar(); - const { openMobile, setOpenMobile } = useSidebar(); - const [draftStatus, setDraftStatus] = useState(""); - const [draftOnlineStatus, setDraftOnlineStatus] = - useState("user_online"); - const [dialogOpen, setDialogOpen] = useState(false); - const [statusErrorMessage, setStatusErrorMessage] = useState(""); - const [statusSaveSucceeded, setStatusSaveSucceeded] = useState(false); - const { send } = useTTP(); - - const content = ( - <> + return ( + } userId={"own"} - component={(user) => ( - <> - - - - - } - /> - - - Profile - { - setDraftStatus(user.status ?? ""); - setDraftOnlineStatus(user.online_status); - setStatusErrorMessage(""); - setStatusSaveSucceeded(false); - setDialogOpen(true); - }} - > - Set Status - - - - - } - /> - { - if (!nextOpen) { - setDraftStatus(user.status ?? ""); - setDraftOnlineStatus(user.online_status); - setStatusErrorMessage(""); - setStatusSaveSucceeded(false); - } - - setDialogOpen(nextOpen); - }} - send={send} - draftStatus={draftStatus} - setDraftStatus={setDraftStatus} - draftOnlineStatus={draftOnlineStatus} - setDraftOnlineStatus={setDraftOnlineStatus} - errorMessage={statusErrorMessage} - setErrorMessage={setStatusErrorMessage} - saveSucceeded={statusSaveSucceeded} - setSaveSucceeded={setStatusSaveSucceeded} - /> - - )} + component={(user) => } />
@@ -287,34 +52,6 @@ export default function Sidebar() { )} - + ); - - if (isMobile) { - return ( - <> - {openMobile && ( -
setOpenMobile(false)} - /> - )} -
-
{content}
-
- - ); - } - - return {content}; } diff --git a/apps/web/src/features/conversation/list/body.tsx b/apps/web/src/features/conversation/list/body.tsx index d240655..7092b6f 100644 --- a/apps/web/src/features/conversation/list/body.tsx +++ b/apps/web/src/features/conversation/list/body.tsx @@ -76,16 +76,6 @@ export default function List() {
); })} -
diff --git a/apps/web/src/features/settings/components.tsx b/apps/web/src/features/settings/components.tsx index 7b4157b..ff1d7f1 100644 --- a/apps/web/src/features/settings/components.tsx +++ b/apps/web/src/features/settings/components.tsx @@ -36,7 +36,7 @@ export function Switch({ label, id, }: { - label: React.ReactNode; + label: string; id: keyof typeof settingsStorageDefaults & BooleanStorageKey; }) { const { save, load } = useStorage(); diff --git a/apps/web/src/features/settings/layout.tsx b/apps/web/src/features/settings/layout.tsx index 36d366a..fa27444 100644 --- a/apps/web/src/features/settings/layout.tsx +++ b/apps/web/src/features/settings/layout.tsx @@ -1,4 +1,4 @@ -import { Button, ClearStorageButton } from "@tensamin/ui"; +import { Button } from "@tensamin/ui"; import options from "@tensamin/shared/settings"; import { cn, useIsMobile } from "@tensamin/ui"; @@ -69,9 +69,6 @@ export function SettingsSidebar() { ))} ))} -
- -
); } diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 8175c9c..d243481 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -6,20 +6,6 @@ @source "./**/*.{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, body, #root { @@ -31,32 +17,3 @@ body, #root { 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; - } -} diff --git a/apps/web/src/routes/app/home.tsx b/apps/web/src/routes/app/home.tsx index 3e2c477..90f6a26 100644 --- a/apps/web/src/routes/app/home.tsx +++ b/apps/web/src/routes/app/home.tsx @@ -11,12 +11,12 @@ import { useIsMobile, } from "@tensamin/ui"; import z from "zod"; +import { toast } from "@tensamin/shared/log"; import { useTTP } from "@tensamin/ttp"; import { useState } from "react"; import { Loader2 } from "lucide-react"; import { isTauri } from "@tauri-apps/api/core"; import { useStorage } from "@tensamin/storage/context"; -import { useSession } from "@tensamin/storage/session"; // The page export default function Page() { @@ -43,16 +43,11 @@ export default function Page() { // Add Conversation Button Component function AddConversationButton() { const { send } = useTTP(); - const { contacts, insertContact } = useSession(); const [loading, setLoading] = useState(false); - const [open, setOpen] = useState(false); - const [error, setError] = useState(null); - async function submit(username: string | null) { + function submit(username: string | null) { if (loading) return; - setError(null); - // username check const schema = z .string() .min(1, "Username is too short") @@ -61,50 +56,26 @@ function AddConversationButton() { const result = schema.safeParse(username?.toLowerCase().trim()); if (!result.success) { - setError(result.error.issues[0].message); + toast("error", result.error.issues[0].message); return; } - // user existence check - const user = await send("get_user_data", { - username: result.data, - }) - .then((data) => { - if (data.data.user_id === 0) { - throw new Error(); - } - - return data; - }) - .catch(() => { - setError("User not found"); - return; - }); - if (!user) return; - - // alrady added check - if (contacts.some((contact) => contact.user_id === user.data.user_id)) { - setError("Conversation already exists"); - return; - } - - // add the conv const timeout = setTimeout(() => setLoading(true), 500); send("add_conversation", { chat_partner_name: result.data, }) .then(() => { - insertContact(user.data.user_id); - setOpen(false); + toast("success", "Conversation added"); }) .catch((error) => { if (String(error).includes("error_not_found")) { - setError("User not found"); + toast("error", "User not found"); return; } - setError(String(error)); + toast("error", "Failed to add conversation, check console for details"); + console.error("Failed to add conversation", error); }) .finally(() => { clearTimeout(timeout); @@ -113,15 +84,7 @@ function AddConversationButton() { } return ( - { - if (value) { - setError(null); - } - setOpen(value); - }} - > + Add Conversation} /> @@ -147,10 +110,7 @@ function AddConversationButton() { name="username" placeholder="Enter username..." /> -
- {error && ( -

{error}

- )} +
Cancel} /> - -
-

- GIFs are supported in decentralised mode or with Tensamin Premium. -
- Maximum file size is 16mb. -

-
- - - updateDraftUser((prev) => ({ - ...prev, - display: event.target.value, - })) - } - placeholder="Display Name" - value={draftUser.display || ""} - /> - - updateDraftUser((prev) => ({ - ...prev, - username: event.target.value, - })) - } - placeholder="Username" - value={draftUser.username || ""} - /> - - updateDraftUser((prev) => ({ ...prev, about: value })) - } - value={draftUser.about || ""} - /> - - {errorMessage && ( -

{errorMessage}

- )} - - - ) : ( -

Loading...

- ); + return
; } 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..5b4b4cd 100644 --- a/bun.lock +++ b/bun.lock @@ -40,7 +40,6 @@ }, "devDependencies": { "@tauri-apps/cli": "^2", - "@types/node": "^25.9.1", }, }, "apps/web": { @@ -56,7 +55,6 @@ "@tensamin/call": "workspace:*", "@tensamin/chat": "workspace:*", "@tensamin/crypto": "workspace:*", - "@tensamin/markdown": "workspace:*", "@tensamin/notifications": "workspace:*", "@tensamin/shared": "workspace:*", "@tensamin/storage": "workspace:*", @@ -171,7 +169,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:*", @@ -261,8 +258,8 @@ }, }, "overrides": { - "@tensamin/ttp-core": "https://git.methanium.net/tensamin/ttp/archive/0.0.19.tar.gz", - "@tensamin/ui": "https://git.methanium.net/tensamin/ui/archive/0.0.34.tar.gz", + "@tensamin/ttp-core": "https://git.methanium.net/tensamin/ttp/archive/0.0.17.tar.gz", + "@tensamin/ui": "https://git.methanium.net/tensamin/ui/archive/0.0.31.tar.gz", }, "packages": { "@antfu/ni": ["@antfu/ni@25.0.0", "", { "dependencies": { "ansis": "^4.0.0", "fzf": "^0.5.2", "package-manager-detector": "^1.3.0", "tinyexec": "^1.0.1" }, "bin": { "na": "bin/na.mjs", "ni": "bin/ni.mjs", "nr": "bin/nr.mjs", "nci": "bin/nci.mjs", "nlx": "bin/nlx.mjs", "nun": "bin/nun.mjs", "nup": "bin/nup.mjs" } }, "sha512-9q/yCljni37pkMr4sPrI3G4jqdIk074+iukc5aFJl7kmDCCsiJrbZ6zKxnES1Gwg+i9RcDZwvktl23puGslmvA=="], @@ -701,9 +698,9 @@ "@tensamin/ttp": ["@tensamin/ttp@workspace:packages/ttp"], - "@tensamin/ttp-core": ["@tensamin/ttp-core@https://git.methanium.net/tensamin/ttp/archive/0.0.19.tar.gz", { "dependencies": { "@eslint/js": "^10.0.1", "@typescript-eslint/parser": "^8.59.1", "@webtransport-bun/webtransport": "^0.3.0", "globals": "^17.5.0", "typescript": "^6.0.3", "typescript-eslint": "^8.59.1", "zod": "^4.4.1" } }, "sha512-La9VqXqJFtzzsRQotXVp+3Vr6u8kj4mQ4wTlSIMRDxKFBnbCvtZyB3V/f8HiIlf7FlZ0Xg0suUUpnamvtcvs9w=="], + "@tensamin/ttp-core": ["@tensamin/ttp-core@https://git.methanium.net/tensamin/ttp/archive/0.0.17.tar.gz", { "dependencies": { "@eslint/js": "^10.0.1", "@typescript-eslint/parser": "^8.59.1", "@webtransport-bun/webtransport": "^0.3.0", "globals": "^17.5.0", "typescript": "^6.0.3", "typescript-eslint": "^8.59.1", "zod": "^4.4.1" } }, "sha512-smyx+04hSnWM1oyWJfJrRWmxu7OInwyHeIlaD1h3tUrkrSxiKWHl1qCmxVO1bC+cDwyUXhJ5HUnNCbx1aWx7Dg=="], - "@tensamin/ui": ["@tensamin/ui@https://git.methanium.net/tensamin/ui/archive/0.0.34.tar.gz", { "dependencies": { "@base-ui/react": "^1.3.0", "@fontsource-variable/inter": "^5.2.6", "@tauri-apps/api": "^2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^4.1.0", "embla-carousel-react": "^8.6.0", "input-otp": "^1.4.2", "lucide-react": "^1.8.0", "next-themes": "^0.4.6", "react-day-picker": "^9.14.0", "react-resizable-panels": "^4.10.0", "recharts": "3.8.0", "shadcn": "^3.5.0", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tw-animate-css": "^1.3.0", "vaul": "^1.1.2" }, "peerDependencies": { "react": "^19.2.0", "react-dom": "^19.2.0" } }, "sha512-hp7rV0a0gfD/rNw9et+PqM1PPkgFC6/Z7eYfza6NIp/m+a8/r5Um+S/8tzBDCgZmQC9Y1sJsjesH7mXZz6Jmuw=="], + "@tensamin/ui": ["@tensamin/ui@https://git.methanium.net/tensamin/ui/archive/0.0.31.tar.gz", { "dependencies": { "@base-ui/react": "^1.3.0", "@fontsource-variable/inter": "^5.2.6", "@tauri-apps/api": "^2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^4.1.0", "embla-carousel-react": "^8.6.0", "input-otp": "^1.4.2", "lucide-react": "^1.8.0", "next-themes": "^0.4.6", "react-day-picker": "^9.14.0", "react-resizable-panels": "^4.10.0", "recharts": "3.8.0", "shadcn": "^3.5.0", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tw-animate-css": "^1.3.0", "vaul": "^1.1.2" }, "peerDependencies": { "react": "^19.2.0", "react-dom": "^19.2.0" } }, "sha512-I2FhsDtR5ElHwCasf6CfFCiyr5T2Cp9MQ2uAhcMnoNZ0tsK0mJhs+Rz9nUDmysydNyqOj8j/uC0CYXnnG1pCxQ=="], "@tensamin/user": ["@tensamin/user@workspace:packages/user"], @@ -1663,8 +1660,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 +1720,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/licenses/@tensamin_ttp-core@0.0.19/LICENSE b/licenses/@tensamin_ttp-core@0.0.15/LICENSE similarity index 100% rename from licenses/@tensamin_ttp-core@0.0.19/LICENSE rename to licenses/@tensamin_ttp-core@0.0.15/LICENSE diff --git a/licenses/THIRD_PARTY_NOTICES.md b/licenses/THIRD_PARTY_NOTICES.md index 2dcc4e3..51009a7 100644 --- a/licenses/THIRD_PARTY_NOTICES.md +++ b/licenses/THIRD_PARTY_NOTICES.md @@ -163,18 +163,18 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/@tauri-apps_plugin-opener@2.5.4` - Source package dir: `apps/tauri/node_modules/@tauri-apps/plugin-opener` -## @tensamin/ttp-core@0.0.19 +## @tensamin/ttp-core@0.0.15 - License: UNKNOWN - Included files: LICENSE -- Folder: `licenses/@tensamin_ttp-core@0.0.19` +- Folder: `licenses/@tensamin_ttp-core@0.0.15` - Source package dir: `packages/ttp/node_modules/@tensamin/ttp-core` -## @tensamin/ui@0.0.34 +## @tensamin/ui@0.0.30 - License: UNKNOWN - Included files: none found -- Folder: `licenses/@tensamin_ui@0.0.34` +- Folder: `licenses/@tensamin_ui@0.0.30` - Source package dir: `apps/tauri/node_modules/@tensamin/ui` ## @types/node@25.6.0 @@ -449,16 +449,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/tailwindcss@4.2.4` - Source package dir: `apps/web/node_modules/tailwindcss` -## tauri-plugin-app-events-api@0.2.0 - -- License: MIT -- Homepage: https://github.com/wtto00/tauri-plugin-app-events#readme -- Repository: git+https://github.com/wtto00/tauri-plugin-app-events.git -- Description: A plugin for tauri@v2 to listen some events on iOS and Android. -- Included files: LICENSE -- Folder: `licenses/tauri-plugin-app-events-api@0.2.0` -- Source package dir: `apps/web/node_modules/tauri-plugin-app-events-api` - ## tw-animate-css@1.4.0 - License: MIT diff --git a/licenses/sbom.cyclonedx.json b/licenses/sbom.cyclonedx.json index 4d1284c..6e10a91 100644 --- a/licenses/sbom.cyclonedx.json +++ b/licenses/sbom.cyclonedx.json @@ -3,7 +3,7 @@ "specVersion": "1.5", "version": 1, "metadata": { - "timestamp": "2026-05-21T10:15:15.541Z", + "timestamp": "2026-05-04T13:05:17.472Z", "tools": [ { "vendor": "OpenAI", @@ -580,15 +580,15 @@ }, { "type": "library", - "bomRef": "pkg:npm/%40tensamin/ttp-core@0.0.19", + "bomRef": "pkg:npm/%40tensamin/ttp-core@0.0.15", "name": "@tensamin/ttp-core", - "version": "0.0.19", - "purl": "pkg:npm/%40tensamin/ttp-core@0.0.19", + "version": "0.0.15", + "purl": "pkg:npm/%40tensamin/ttp-core@0.0.15", "externalReferences": [], "properties": [ { "name": "local:licenseFolder", - "value": "licenses/@tensamin_ttp-core@0.0.19" + "value": "licenses/@tensamin_ttp-core@0.0.15" }, { "name": "local:sourcePackageDir", @@ -598,15 +598,15 @@ }, { "type": "library", - "bomRef": "pkg:npm/%40tensamin/ui@0.0.34", + "bomRef": "pkg:npm/%40tensamin/ui@0.0.30", "name": "@tensamin/ui", - "version": "0.0.34", - "purl": "pkg:npm/%40tensamin/ui@0.0.34", + "version": "0.0.30", + "purl": "pkg:npm/%40tensamin/ui@0.0.30", "externalReferences": [], "properties": [ { "name": "local:licenseFolder", - "value": "licenses/@tensamin_ui@0.0.34" + "value": "licenses/@tensamin_ui@0.0.30" }, { "name": "local:sourcePackageDir", @@ -1562,41 +1562,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/tauri-plugin-app-events-api@0.2.0", - "name": "tauri-plugin-app-events-api", - "version": "0.2.0", - "purl": "pkg:npm/tauri-plugin-app-events-api@0.2.0", - "description": "A plugin for tauri@v2 to listen some events on iOS and Android.", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://github.com/wtto00/tauri-plugin-app-events#readme" - }, - { - "type": "vcs", - "url": "git+https://github.com/wtto00/tauri-plugin-app-events.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/tauri-plugin-app-events-api@0.2.0" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/tauri-plugin-app-events-api" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/tw-animate-css@1.4.0", diff --git a/licenses/tauri-plugin-app-events-api@0.2.0/LICENSE b/licenses/tauri-plugin-app-events-api@0.2.0/LICENSE deleted file mode 100644 index 637004f..0000000 --- a/licenses/tauri-plugin-app-events-api@0.2.0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 简静凡 - -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. diff --git a/licenses/third-party-credits.json b/licenses/third-party-credits.json index bf9eab8..a1d7968 100644 --- a/licenses/third-party-credits.json +++ b/licenses/third-party-credits.json @@ -1,6 +1,6 @@ { - "generatedAt": "2026-05-21T10:15:15.540Z", - "packageCount": 54, + "generatedAt": "2026-05-04T13:05:17.471Z", + "packageCount": 53, "packages": [ { "name": "@codemirror/commands", @@ -227,7 +227,7 @@ }, { "name": "@tensamin/ttp-core", - "version": "0.0.19", + "version": "0.0.15", "license": "UNKNOWN", "homepage": null, "repository": null, @@ -235,18 +235,18 @@ "files": [ "LICENSE" ], - "licenseFolder": "licenses/@tensamin_ttp-core@0.0.19", + "licenseFolder": "licenses/@tensamin_ttp-core@0.0.15", "sourcePackageDir": "packages/ttp/node_modules/@tensamin/ttp-core" }, { "name": "@tensamin/ui", - "version": "0.0.34", + "version": "0.0.30", "license": "UNKNOWN", "homepage": null, "repository": null, "description": null, "files": [], - "licenseFolder": "licenses/@tensamin_ui@0.0.34", + "licenseFolder": "licenses/@tensamin_ui@0.0.30", "sourcePackageDir": "apps/tauri/node_modules/@tensamin/ui" }, { @@ -614,19 +614,6 @@ "licenseFolder": "licenses/tailwindcss@4.2.4", "sourcePackageDir": "apps/web/node_modules/tailwindcss" }, - { - "name": "tauri-plugin-app-events-api", - "version": "0.2.0", - "license": "MIT", - "homepage": "https://github.com/wtto00/tauri-plugin-app-events#readme", - "repository": "git+https://github.com/wtto00/tauri-plugin-app-events.git", - "description": "A plugin for tauri@v2 to listen some events on iOS and Android.", - "files": [ - "LICENSE" - ], - "licenseFolder": "licenses/tauri-plugin-app-events-api@0.2.0", - "sourcePackageDir": "apps/web/node_modules/tauri-plugin-app-events-api" - }, { "name": "tw-animate-css", "version": "1.4.0", diff --git a/package.json b/package.json index d408353..40e19a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tensamin", - "version": "0.0.3", + "version": "0.0.1", "private": true, "workspaces": [ "packages/*", @@ -40,8 +40,8 @@ "jsonc-parser": "^3.3.1" }, "overrides": { - "@tensamin/ui": "https://git.methanium.net/tensamin/ui/archive/0.0.34.tar.gz", - "@tensamin/ttp-core": "https://git.methanium.net/tensamin/ttp/archive/0.0.19.tar.gz" + "@tensamin/ui": "https://git.methanium.net/tensamin/ui/archive/0.0.31.tar.gz", + "@tensamin/ttp-core": "https://git.methanium.net/tensamin/ttp/archive/0.0.17.tar.gz" }, "dependencies": { "@tensamin/ttp-core": "*", diff --git a/packages/call/src/components/buttons/screenshare.tsx b/packages/call/src/components/buttons/screenshare.tsx index 21ba118..4471539 100644 --- a/packages/call/src/components/buttons/screenshare.tsx +++ b/packages/call/src/components/buttons/screenshare.tsx @@ -18,12 +18,10 @@ export default function ScreenshareButton({ className, iconSize, tooltip, - defaultPortal, }: { className?: string; iconSize?: number; tooltip?: string; - defaultPortal?: boolean; }) { const isScreensharing = useCall((state) => state.screenShareEnabled); const screenRef = useCall((state) => state.screenRef); @@ -32,9 +30,8 @@ export default function ScreenshareButton({ const [menuOpen, setMenuOpen] = useState(false); useEffect(() => { - if (defaultPortal) return; setPortalContainer(screenRef?.current ?? undefined); - }, [screenRef, defaultPortal]); + }, [screenRef]); async function startWebShare() { try { @@ -113,9 +110,7 @@ export default function ScreenshareButton({ /> } /> - Click to open call page + + Click to open call page + ); } -export function TinyPingGraph() { - const room = getRoom(); +export function TinyPingGraph({ + portalContainer, +}: { + portalContainer?: HTMLElement; +}) { + const room = useCall((store) => store.room); const [mapData, setMapData] = useState>(() => new Map()); @@ -164,7 +176,7 @@ export function TinyPingGraph() { } /> - + {data.length > 0 ? `${data.at(-1)?.ping} ms` : "Measuring ping..."} diff --git a/packages/call/src/components/top.tsx b/packages/call/src/components/top.tsx index 610493a..62e8bfc 100644 --- a/packages/call/src/components/top.tsx +++ b/packages/call/src/components/top.tsx @@ -1,5 +1,5 @@ import { useUser, type User } from "@tensamin/user/context"; -import { useCall, getRoom } from "../store"; +import { useCall } from "../store"; import { useEffect, useState } from "react"; import { useStorage } from "@tensamin/storage/context"; import { @@ -14,7 +14,7 @@ import { export default function TopBar() { const { get } = useUser(); const { load } = useStorage(); - const room = getRoom(); + const room = useCall((state) => state.room); const screenRef = useCall((state) => state.screenRef); const [portalContainer, setPortalContainer] = useState(); diff --git a/packages/call/src/components/videoViewer.tsx b/packages/call/src/components/videoViewer.tsx index 1268b22..40cf6ac 100644 --- a/packages/call/src/components/videoViewer.tsx +++ b/packages/call/src/components/videoViewer.tsx @@ -1,6 +1,6 @@ import { VideoTrack, useParticipantTracks } from "@livekit/components-react"; import { TrackPublication } from "livekit-client"; -import { getRoom } from "../store"; +import { useCall } from "../store"; import { cn } from "@tensamin/ui"; import { Loader2 } from "lucide-react"; @@ -17,7 +17,7 @@ export default function VideoViewer({ publication: TrackPublication; participantId: string; }) { - const room = getRoom(); + const room = useCall((state) => state.room); const tracks = useParticipantTracks([publication.source], { participantIdentity: participantId, room, diff --git a/packages/call/src/speakingIndicator.ts b/packages/call/src/speakingIndicator.ts deleted file mode 100644 index 0c4f5a5..0000000 --- a/packages/call/src/speakingIndicator.ts +++ /dev/null @@ -1,252 +0,0 @@ -import { log } from "@tensamin/shared/log"; -import { useCall } from "./store"; - -const SPEAKING_THRESHOLD = 0.01; -const SPEAKING_HANGTIME_MS = 500; -const ANALYSIS_INTERVAL_MS = 30; -const FFT_SIZE = 256; - -type AnalyserEntry = { - source: MediaStreamAudioSourceNode; - analyser: AnalyserNode; - track: MediaStreamTrack; - originalTrack?: MediaStreamTrack; - lastSpeakingTime: number; - isSpeaking: boolean; -}; - -class SpeakingDetector { - private audioContext: AudioContext | null = null; - private entries = new Map(); - private intervalId: ReturnType | null = null; - private deaf = false; - private gateThresholdStart = -50; - private gateThresholdEnd = -40; - private localParticipantId: number | null = null; - private localMicGateClosed = false; - - private ensureAudioContext(): AudioContext { - if (!this.audioContext) { - this.audioContext = new AudioContext(); - } - if (this.audioContext.state === "suspended") { - void this.audioContext.resume(); - } - return this.audioContext; - } - - setLocalParticipantId(id: number) { - this.localParticipantId = id; - } - - setGateThresholds(start: number, end: number) { - this.gateThresholdStart = start; - this.gateThresholdEnd = end; - } - - addTrack( - participantId: number, - track: MediaStreamTrack, - originalTrack?: MediaStreamTrack, - ) { - if (track.kind !== "audio") return; - - this.removeParticipant(participantId); - - const ctx = this.ensureAudioContext(); - const stream = new MediaStream([track]); - const source = ctx.createMediaStreamSource(stream); - const analyser = ctx.createAnalyser(); - analyser.fftSize = FFT_SIZE; - source.connect(analyser); - - this.entries.set(participantId, { - source, - analyser, - track, - originalTrack, - lastSpeakingTime: 0, - isSpeaking: false, - }); - - if (!this.intervalId) { - this.startLoop(); - } - } - - removeParticipant(participantId: number) { - const entry = this.entries.get(participantId); - if (!entry) return; - - try { - entry.source.disconnect(); - } catch { - // ignore - } - this.entries.delete(participantId); - - useCall.setState((state) => { - if (!state.speakingParticipantIds.has(participantId)) return state; - const next = new Set(state.speakingParticipantIds); - next.delete(participantId); - return { speakingParticipantIds: next }; - }); - - if (participantId === this.localParticipantId && this.localMicGateClosed) { - this.muteLocalTrack(false); - } - } - - setDeaf(deaf: boolean) { - this.deaf = deaf; - if (deaf) { - for (const entry of this.entries.values()) { - entry.isSpeaking = false; - entry.lastSpeakingTime = 0; - } - useCall.setState({ speakingParticipantIds: new Set() }); - } - } - - private startLoop() { - if (this.intervalId) return; - this.intervalId = setInterval(() => this.analyse(), ANALYSIS_INTERVAL_MS); - } - - private stopLoop() { - if (this.intervalId) { - clearInterval(this.intervalId); - this.intervalId = null; - } - } - - private muteLocalTrack(muted: boolean) { - const entry = this.localParticipantId - ? this.entries.get(this.localParticipantId) - : undefined; - const target = entry?.originalTrack ?? entry?.track; - - if (target && target.enabled === muted) { - target.enabled = !muted; - } - - this.localMicGateClosed = muted; - useCall.setState({ micGated: muted }); - } - - private applyNoiseGate(rms: number) { - const db = 20 * Math.log10(Math.max(rms, 0.0001)); - - if (!this.localMicGateClosed && db < this.gateThresholdStart) { - log(3, "noise gate", "purple", "closed"); - this.muteLocalTrack(true); - } else if (this.localMicGateClosed && db > this.gateThresholdEnd) { - log(3, "noise gate", "purple", "opened"); - this.muteLocalTrack(false); - } - } - - private analyse() { - if (this.deaf || this.entries.size === 0) return; - - const now = Date.now(); - const changed = new Map(); - - for (const [participantId, entry] of this.entries) { - const { analyser, track } = entry; - - if (track.muted || track.readyState === "ended" || !track.enabled) { - if (entry.isSpeaking) { - entry.isSpeaking = false; - entry.lastSpeakingTime = 0; - changed.set(participantId, false); - } - continue; - } - - const bufferLength = analyser.frequencyBinCount; - const dataArray = new Uint8Array(bufferLength); - analyser.getByteTimeDomainData(dataArray); - - let sum = 0; - for (let i = 0; i < bufferLength; i++) { - const sample = (dataArray[i] - 128) / 128.0; - sum += sample * sample; - } - const rms = Math.sqrt(sum / bufferLength); - - let nextIsSpeaking = entry.isSpeaking; - if (rms > SPEAKING_THRESHOLD) { - entry.lastSpeakingTime = now; - nextIsSpeaking = true; - } else if (now - entry.lastSpeakingTime > SPEAKING_HANGTIME_MS) { - nextIsSpeaking = false; - } - - if (participantId === this.localParticipantId) { - this.applyNoiseGate(rms); - if (this.localMicGateClosed) { - nextIsSpeaking = false; - } - } - - if (nextIsSpeaking !== entry.isSpeaking) { - entry.isSpeaking = nextIsSpeaking; - changed.set(participantId, nextIsSpeaking); - } - } - - if (changed.size > 0) { - useCall.setState((state) => { - let hasDiff = false; - const next = new Set(state.speakingParticipantIds); - for (const [id, speaking] of changed) { - if (speaking) { - if (!next.has(id)) { - next.add(id); - hasDiff = true; - } - } else { - if (next.has(id)) { - next.delete(id); - hasDiff = true; - } - } - } - return hasDiff ? { speakingParticipantIds: next } : state; - }); - } - } - - dispose() { - this.stopLoop(); - for (const id of Array.from(this.entries.keys())) { - this.removeParticipant(id); - } - this.entries.clear(); - if (this.audioContext) { - void this.audioContext.close(); - this.audioContext = null; - } - } -} - -let detectorInstance: SpeakingDetector | null = null; - -export function getSpeakingDetector(): SpeakingDetector { - if (!detectorInstance) { - detectorInstance = new SpeakingDetector(); - } - return detectorInstance; -} - -export function disposeSpeakingDetector(): void { - if (detectorInstance) { - detectorInstance.dispose(); - detectorInstance = null; - } -} - -export function useIsSpeaking(participantId: number): boolean { - return useCall((state) => state.speakingParticipantIds.has(participantId)); -} diff --git a/packages/call/src/store.tsx b/packages/call/src/store.tsx index 5398e70..e605ece 100644 --- a/packages/call/src/store.tsx +++ b/packages/call/src/store.tsx @@ -11,7 +11,6 @@ import { DeepFilterNoiseFilterProcessor } from "deepfilternet3-noise-filter"; import { ExternalE2EEKeyProvider, LocalAudioTrack, - type LocalTrackPublication, type Participant, type RemoteParticipant, type RemoteTrackPublication, @@ -29,10 +28,6 @@ import { createScreenShareController, type ScreenShareSession, } from "./screenshare"; -import { - getSpeakingDetector, - disposeSpeakingDetector, -} from "./speakingIndicator"; // logging setLogExtension( @@ -91,7 +86,6 @@ type CallStore = { screenShareEnabled: boolean; screenShareSession: ScreenShareSession | null; focusedParticipantId: number | null; - focusedParticipantType: "user" | "stream" | null; usersInFocusedViewHidden: boolean; watchedStreamParticipantIds: number[]; pendingWatchedParticipantIds: number[]; @@ -101,46 +95,25 @@ type CallStore = { callIsPopout: boolean; layoutVersion: number; screenRef: React.RefObject | null; + room: Room; + keyProvider: ExternalE2EEKeyProvider; + e2eeWorker: Worker; runtime: Runtime | null; - speakingParticipantIds: Set; - micGated: boolean; }; -let _keyProvider: ExternalE2EEKeyProvider | null = null; -let _e2eeWorker: Worker | null = null; -let _room: Room | null = null; - -function getKeyProvider(): ExternalE2EEKeyProvider { - if (!_keyProvider) { - _keyProvider = new ExternalE2EEKeyProvider(); - } - return _keyProvider; -} - -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 keyProvider = new ExternalE2EEKeyProvider(); +const e2eeWorker = new Worker( + new URL("livekit-client/e2ee-worker", import.meta.url), +); +const room = new Room({ + dynacast: true, + adaptiveStream: true, + loggerName: "tensamin", + encryption: { + keyProvider, + worker: e2eeWorker, + }, +}); const remoteAudioElements = new Map(); const SCREEN_SHARE_PREVIEW_MAX_WIDTH = 320; @@ -179,7 +152,7 @@ function clearRemoteAudio() { } } -export function getParticipantId(identity: string | undefined): number | null { +function getParticipantId(identity: string | undefined): number | null { if (!identity) { return null; } @@ -189,7 +162,6 @@ export function getParticipantId(identity: string | undefined): number | null { } function getAllParticipants(): Participant[] { - const room = getRoom(); return [...room.remoteParticipants.values(), room.localParticipant]; } @@ -207,7 +179,7 @@ function getTrackPublicationBySource( } function getRemoteParticipant(participantId: number) { - return [...getRoom().remoteParticipants.values()].find( + return [...room.remoteParticipants.values()].find( (participant) => getParticipantId(participant.identity) === participantId, ); } @@ -227,15 +199,12 @@ function matchesRemoteTrackSelector( function syncRemoteParticipantTrackSubscriptions(participantId: number) { for (const publication of getRemoteTrackPublications(participantId)) { - publication.setSubscribed( - publication.kind === Track.Kind.Audio && - publication.source !== Track.Source.ScreenShareAudio, - ); + publication.setSubscribed(publication.kind === Track.Kind.Audio); } } function syncAllRemoteTrackSubscriptions() { - for (const participant of getRoom().remoteParticipants.values()) { + for (const participant of room.remoteParticipants.values()) { const participantId = getParticipantId(participant.identity); if (participantId != null) { @@ -276,7 +245,7 @@ function hasParticipant(participantId: number) { function getLocalScreenShareTrack(): MediaStreamTrack | null { const track = getTrackPublicationBySource( - getRoom().localParticipant, + room.localParticipant, Track.Source.ScreenShare, )?.track; @@ -295,15 +264,13 @@ async function updateLocalParticipantAttributes( screenSharePreviewLength: attributes.screenSharePreview?.length ?? 0, }); - await getRoom() - .localParticipant.setAttributes(attributes) - .catch((error) => { - log(1, "call", "red", "Failed to update local participant attributes", { - attributes: Object.keys(attributes), - error, - }); - throw error; + await room.localParticipant.setAttributes(attributes).catch((error) => { + log(1, "call", "red", "Failed to update local participant attributes", { + attributes: Object.keys(attributes), + error, }); + throw error; + }); log(2, "call", "purple", "Updated local participant attributes", { attributeKeys: Object.keys(attributes), @@ -490,8 +457,6 @@ function syncScreenShareParticipants() { watchedStreamParticipantIds, pendingWatchedParticipantIds, focusedParticipantId, - focusedParticipantType: - focusedParticipantId == null ? null : state.focusedParticipantType, view: state.view === "focused" && focusedParticipantId == null ? "grid" @@ -509,7 +474,7 @@ function requireRuntime(runtime: Runtime | null): Runtime { } export function getRoomMetadata() { - const roomMetadata = getRoom().metadata; + const roomMetadata = room.metadata; try { const data = JSON.parse(roomMetadata || '{"admins": []}'); return data as { admins: number[] }; @@ -520,8 +485,7 @@ export function getRoomMetadata() { // Sync local participant flags and screen-share derived state for the active call UI. export function syncParticipantState() { - const { screenShareSession } = useCall.getState(); - const room = getRoom(); + const { room, screenShareSession } = useCall.getState(); useCall.setState({ micEnabled: room.localParticipant.isMicrophoneEnabled, @@ -650,7 +614,6 @@ export function startWatchingStream(participantId: number) { const trackReady = getScreenShareTrackForParticipant(participantId) != null; setParticipantTrackSubscribed(participantId, Track.Source.ScreenShare); - setParticipantTrackSubscribed(participantId, Track.Source.ScreenShareAudio); useCall.setState((state) => ({ watchedStreamParticipantIds: state.watchedStreamParticipantIds.includes( @@ -664,7 +627,6 @@ export function startWatchingStream(participantId: number) { ? state.pendingWatchedParticipantIds : [...state.pendingWatchedParticipantIds, participantId], focusedParticipantId: participantId, - focusedParticipantType: "stream", })); } @@ -684,13 +646,9 @@ export function setParticipantTrackSubscribed( } // Focus a participant in the main call view even when they are not sharing a screen. -export function focusParticipant( - participantId: number, - type: "user" | "stream" = "user", -) { +export function focusParticipant(participantId: number) { useCall.setState({ focusedParticipantId: participantId, - focusedParticipantType: type, view: "focused", }); } @@ -698,11 +656,6 @@ export function focusParticipant( // Stop tracking a participant's shared screen and clean up related UI state. export function stopWatchingStream(participantId: number) { setParticipantTrackSubscribed(participantId, Track.Source.ScreenShare, false); - setParticipantTrackSubscribed( - participantId, - Track.Source.ScreenShareAudio, - false, - ); useCall.setState((state) => ({ watchedStreamParticipantIds: state.watchedStreamParticipantIds.filter( @@ -715,10 +668,6 @@ export function stopWatchingStream(participantId: number) { state.focusedParticipantId === participantId ? null : state.focusedParticipantId, - focusedParticipantType: - state.focusedParticipantId === participantId - ? null - : state.focusedParticipantType, view: state.view === "focused" && state.focusedParticipantId === participantId ? "grid" @@ -744,7 +693,7 @@ let screenShareController: ReturnType< function getScreenShareController() { if (!screenShareController) { screenShareController = createScreenShareController({ - room: getRoom(), + room, getState: () => ({ screenShareSession: useCall.getState().screenShareSession, }), @@ -756,7 +705,7 @@ function getScreenShareController() { ); }, getLocalParticipantId: () => - getParticipantId(getRoom().localParticipant.identity), + getParticipantId(room.localParticipant.identity), startWatching: startWatchingStream, stopWatching: stopWatchingStream, syncParticipantState, @@ -781,7 +730,7 @@ export async function connect(callId: string) { callSecret: useCall.getState().callSecret, }); - await getRoom() + await room .connect("wss://call.tensamin.net", token, { autoSubscribe: false, }) @@ -797,20 +746,17 @@ export async function connect(callId: string) { syncAllRemoteTrackSubscriptions(); - await getRoom() - .localParticipant.setMicrophoneEnabled(true) - .catch((error) => { - log(1, "call", "red", "Failed to enable microphone", error); - toast("error", "Failed to enable microphone."); - throw error; - }); + await room.localParticipant.setMicrophoneEnabled(true).catch((error) => { + log(1, "call", "red", "Failed to enable microphone", error); + toast("error", "Failed to enable microphone."); + throw error; + }); syncParticipantState(); } // Tear down the active call session and return the store to a closed state. export async function disconnect() { - disposeSpeakingDetector(); await clearScreenSharePreview(); try { @@ -836,20 +782,18 @@ export async function disconnect() { view: "preview", screenShareSession: null, focusedParticipantId: null, - focusedParticipantType: null, usersInFocusedViewHidden: false, watchedStreamParticipantIds: [], pendingWatchedParticipantIds: [], activeScreenShareParticipantIds: [], - micGated: false, }); - getRoom().remoteParticipants.forEach((participant) => { + room.remoteParticipants.forEach((participant) => { participant.setVolume(1); }); try { - await getRoom().disconnect(); + await room.disconnect(); } catch (error) { log(1, "call", "red", "Failed to disconnect from room", error); } finally { @@ -892,8 +836,8 @@ export async function joinCall( callSecret, ); - await getKeyProvider().setKey(decryptedSecret); - await getRoom().setE2EEEnabled(true); + await keyProvider.setKey(decryptedSecret); + await room.setE2EEEnabled(true); useCall.setState({ callSecret: decryptedSecret }); } catch (err) { log(1, "call", "red", "Failed getting call secret", err); @@ -903,8 +847,8 @@ export async function joinCall( } else { const random = crypto.randomUUID(); - await getKeyProvider().setKey(random); - await getRoom().setE2EEEnabled(true); + await keyProvider.setKey(random); + await room.setE2EEEnabled(true); useCall.setState({ callSecret: random }); } @@ -923,11 +867,11 @@ export async function joinCall( export async function toggleDeaf() { const nextDeaf = !useCall.getState().deaf; - getRoom().remoteParticipants.forEach((participant) => { + room.remoteParticipants.forEach((participant) => { participant.setVolume(nextDeaf ? 0 : 1); }); - if (nextDeaf && getRoom().localParticipant.isMicrophoneEnabled) { + if (nextDeaf && room.localParticipant.isMicrophoneEnabled) { await toggleMute(); } @@ -935,7 +879,6 @@ export async function toggleDeaf() { deafened: nextDeaf ? "true" : "false", }); - getSpeakingDetector().setDeaf(nextDeaf); useCall.setState({ deaf: nextDeaf }); } @@ -947,7 +890,7 @@ export async function toggleMute() { await toggleDeaf(); } - await getRoom().localParticipant.setMicrophoneEnabled(!micEnabled); + await room.localParticipant.setMicrophoneEnabled(!micEnabled); syncParticipantState(); } @@ -997,7 +940,6 @@ export function resetCallState() { deaf: false, screenShareSession: null, focusedParticipantId: null, - focusedParticipantType: null, usersInFocusedViewHidden: false, watchedStreamParticipantIds: [], pendingWatchedParticipantIds: [], @@ -1011,7 +953,7 @@ export function resetCallState() { async function ensureNoiseFilter( noiseFilter: DeepFilterNoiseFilterProcessor, ): Promise { - const microphoneTrack = getRoom().localParticipant.getTrackPublication( + const microphoneTrack = room.localParticipant.getTrackPublication( Track.Source.Microphone, )?.track; @@ -1025,16 +967,6 @@ async function ensureNoiseFilter( await microphoneTrack.setProcessor(noiseFilter).catch((err) => { log(1, "call", "red", "Failed to enable noise filter", err); }); - - const participantId = getParticipantId(getRoom().localParticipant.identity); - if (participantId != null) { - const processedTrack = microphoneTrack.mediaStreamTrack; - getSpeakingDetector().addTrack( - participantId, - processedTrack.clone(), - processedTrack, - ); - } } export const useCall = create(() => ({ @@ -1046,23 +978,24 @@ export const useCall = create(() => ({ livekitToken: null, currentCallData: null, deaf: false, - micEnabled: false, - screenShareEnabled: false, + micEnabled: room.localParticipant.isMicrophoneEnabled, + screenShareEnabled: room.localParticipant.isScreenShareEnabled, screenShareSession: null, focusedParticipantId: null, - focusedParticipantType: null, usersInFocusedViewHidden: false, watchedStreamParticipantIds: [], pendingWatchedParticipantIds: [], activeScreenShareParticipantIds: [], - isEncrypted: false, + isEncrypted: + room.localParticipant.isE2EEEnabled && room.localParticipant.isEncrypted, callIsFullscreen: false, callIsPopout: false, layoutVersion: 0, screenRef: null, + room, + keyProvider, + e2eeWorker, runtime: null, - speakingParticipantIds: new Set(), - micGated: false, })); // Register app-level call listeners and wire React dependencies into the store. @@ -1083,7 +1016,7 @@ export function useInitializeCall() { new DeepFilterNoiseFilterProcessor({ enabled: true, enableNoiseReduction: true, - noiseReductionLevel: 60, + noiseReductionLevel: 80, sampleRate: 48000, assetConfig: { cdnUrl: "/assets", @@ -1204,46 +1137,10 @@ export function useInitializeCall() { listenersRegistered.current = true; - const onConnected = async () => { + const onConnected = () => { useCall.setState({ state: "open" }); syncParticipantState(); - const detector = getSpeakingDetector(); - const localParticipantId = getParticipantId( - room.localParticipant.identity, - ); - if (localParticipantId != null) { - detector.setLocalParticipantId(localParticipantId); - } - - const [start, end] = await Promise.all([ - load("call_mute_range_start"), - load("call_mute_range_end"), - ]); - detector.setGateThresholds(start, end); - - // Scan existing audio tracks for speaking detection - for (const participant of getAllParticipants()) { - const participantId = getParticipantId(participant.identity); - if (participantId == null) continue; - - for (const publication of participant.trackPublications.values()) { - if ( - publication.kind === Track.Kind.Audio && - publication.source === Track.Source.Microphone && - publication.track - ) { - const mediaTrack = publication.track.mediaStreamTrack; - if (participant === room.localParticipant) { - const clonedTrack = mediaTrack.clone(); - detector.addTrack(participantId, clonedTrack, mediaTrack); - } else { - detector.addTrack(participantId, mediaTrack); - } - } - } - } - const invitedUserId = useCall.getState().invitedUserId; if (invitedUserId != null) { @@ -1280,7 +1177,6 @@ export function useInitializeCall() { if (participantId != null) { stopWatchingStream(participantId); - getSpeakingDetector().removeParticipant(participantId); } syncParticipantState(); @@ -1301,40 +1197,6 @@ export function useInitializeCall() { void ensureNoiseFilter(noiseFilter); }; - const onLocalTrackPublished = (publication: LocalTrackPublication) => { - if ( - publication.kind === Track.Kind.Audio && - publication.source === Track.Source.Microphone && - publication.track - ) { - const participantId = getParticipantId(room.localParticipant.identity); - if (participantId != null) { - const originalTrack = publication.track.mediaStreamTrack; - const clonedTrack = originalTrack.clone(); - getSpeakingDetector().addTrack( - participantId, - clonedTrack, - originalTrack, - ); - } - } - syncParticipantState(); - void ensureNoiseFilter(noiseFilter); - }; - - const onLocalTrackUnpublished = (publication: LocalTrackPublication) => { - if ( - publication.kind === Track.Kind.Audio && - publication.source === Track.Source.Microphone - ) { - const participantId = getParticipantId(room.localParticipant.identity); - if (participantId != null) { - getSpeakingDetector().removeParticipant(participantId); - } - } - syncParticipantState(); - }; - const onTrackPublished = ( publication: RemoteTrackPublication, participant: RemoteParticipant, @@ -1342,10 +1204,7 @@ export function useInitializeCall() { const participantId = getParticipantId(participant.identity); if (participantId != null) { - if ( - publication.kind === Track.Kind.Audio && - publication.source !== Track.Source.ScreenShareAudio - ) { + if (publication.kind === Track.Kind.Audio) { publication.setSubscribed(true); } else { publication.setSubscribed(false); @@ -1355,21 +1214,9 @@ export function useInitializeCall() { onParticipantStateChange(); }; - const onTrackSubscribed = ( - track: RemoteTrack, - publication: RemoteTrackPublication, - participant: RemoteParticipant, - ) => { + const onTrackSubscribed = (track: RemoteTrack) => { if (track.kind === "audio" && track.sid) { attachRemoteAudio(track.sid, track.attach()); - - const participantId = getParticipantId(participant.identity); - if ( - participantId != null && - publication.source === Track.Source.Microphone - ) { - getSpeakingDetector().addTrack(participantId, track.mediaStreamTrack); - } } syncParticipantState(); @@ -1377,23 +1224,16 @@ export function useInitializeCall() { const onTrackUnsubscribed = ( track: RemoteTrack, - publication: RemoteTrackPublication, + _publication: unknown, participant: Participant, ) => { - const participantId = getParticipantId(participant.identity); - if (track.kind === "audio" && track.sid) { track.detach(); detachRemoteAudio(track.sid); - - if ( - participantId != null && - publication.source === Track.Source.Microphone - ) { - getSpeakingDetector().removeParticipant(participantId); - } } + const participantId = getParticipantId(participant.identity); + if ( participantId != null && getTrackPublicationBySource(participant, Track.Source.ScreenShare) @@ -1405,7 +1245,6 @@ export function useInitializeCall() { syncParticipantState(); }; - const room = getRoom(); room.on(RoomEvent.Connected, onConnected); room.on(RoomEvent.Reconnected, onConnected); room.on(RoomEvent.Disconnected, onDisconnected); @@ -1417,8 +1256,8 @@ export function useInitializeCall() { room.on(RoomEvent.ParticipantDisconnected, onParticipantDisconnected); room.on(RoomEvent.TrackMuted, onParticipantStateChange); room.on(RoomEvent.TrackUnmuted, onParticipantStateChange); - room.on(RoomEvent.LocalTrackPublished, onLocalTrackPublished); - room.on(RoomEvent.LocalTrackUnpublished, onLocalTrackUnpublished); + room.on(RoomEvent.LocalTrackPublished, onParticipantStateChange); + room.on(RoomEvent.LocalTrackUnpublished, onParticipantStateChange); room.on(RoomEvent.MediaDevicesError, onMediaDeviceFailure); room.on(RoomEvent.EncryptionError, onEncryptionError); room.on(RoomEvent.ConnectionStateChanged, onParticipantStateChange); @@ -1438,17 +1277,17 @@ export function useInitializeCall() { room.off(RoomEvent.ParticipantDisconnected, onParticipantDisconnected); room.off(RoomEvent.TrackMuted, onParticipantStateChange); room.off(RoomEvent.TrackUnmuted, onParticipantStateChange); - room.off(RoomEvent.LocalTrackPublished, onLocalTrackPublished); - room.off(RoomEvent.LocalTrackUnpublished, onLocalTrackUnpublished); + room.off(RoomEvent.LocalTrackPublished, onParticipantStateChange); + room.off(RoomEvent.LocalTrackUnpublished, onParticipantStateChange); room.off(RoomEvent.MediaDevicesError, onMediaDeviceFailure); room.off(RoomEvent.EncryptionError, onEncryptionError); room.off(RoomEvent.ConnectionStateChanged, onParticipantStateChange); clearRemoteAudio(); listenersRegistered.current = false; room.disconnect(); - if (_e2eeWorker) _e2eeWorker.terminate(); + e2eeWorker.terminate(); }; - }, [noiseFilter, load]); + }, [noiseFilter]); // fetch call data for preview page useEffect(() => { diff --git a/packages/call/src/views/main/focused.tsx b/packages/call/src/views/main/focused.tsx index f8239c5..d52362b 100644 --- a/packages/call/src/views/main/focused.tsx +++ b/packages/call/src/views/main/focused.tsx @@ -1,13 +1,13 @@ import { RoomEvent } from "livekit-client"; import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; -import { useCall, getRoom } from "../../store"; +import { useCall } from "../../store"; import Base from "../../components/modals/base"; const SECONDARY_ROW_HEIGHT_PX = 180; const STACK_GAP_PX = 12; export default function View() { - const room = getRoom(); + const room = useCall((state) => state.room); const layoutVersion = useCall((state) => state.layoutVersion); const usersInFocusedViewHidden = useCall( @@ -16,9 +16,6 @@ export default function View() { const callIsFullscreen = useCall((state) => state.callIsFullscreen); const focusedParticipantId = useCall((state) => state.focusedParticipantId); - const focusedParticipantType = useCall( - (state) => state.focusedParticipantType, - ); const activeScreenShareParticipantIds = useCall( (state) => state.activeScreenShareParticipantIds, ); @@ -160,11 +157,6 @@ export default function View() { const focusedParticipant = getParticipantById(focusedParticipantId); const focusedParticipantHasActiveScreenShare = activeScreenShareParticipantIdSet.has(focusedParticipantId); - const focusedTileType: "user" | "stream" = - focusedParticipantType === "stream" && - focusedParticipantHasActiveScreenShare - ? "stream" - : "user"; const isImmersiveFocusedView = callIsFullscreen && usersInFocusedViewHidden; return ( @@ -187,7 +179,7 @@ export default function View() { diff --git a/packages/call/src/views/main/grid.tsx b/packages/call/src/views/main/grid.tsx index 956842d..833d7b5 100644 --- a/packages/call/src/views/main/grid.tsx +++ b/packages/call/src/views/main/grid.tsx @@ -1,6 +1,6 @@ import { RoomEvent } from "livekit-client"; import { useEffect, useMemo, useRef, useState } from "react"; -import { useCall, getRoom } from "../../store"; +import { useCall } from "../../store"; import Base from "../../components/modals/base"; const TILE_ASPECT_RATIO = 16 / 9; @@ -82,7 +82,7 @@ function calculateOptimalGridLayout( } export default function View() { - const room = getRoom(); + const room = useCall((state) => state.room); const layoutVersion = useCall((state) => state.layoutVersion); const activeScreenShareParticipantIds = useCall( (state) => state.activeScreenShareParticipantIds, diff --git a/packages/call/todo.md b/packages/call/todo.md index 4db4db0..952858f 100644 --- a/packages/call/todo.md +++ b/packages/call/todo.md @@ -1,3 +1,4 @@ +- Speaking indicator - Overlay for stream modals - User modals - Bg based on avatar @@ -10,4 +11,3 @@ - Disconnect - Desktop-App screenshares - Context menus -- Popout Window diff --git a/packages/chat/src/components/input.tsx b/packages/chat/src/components/input.tsx index cf74848..487c813 100644 --- a/packages/chat/src/components/input.tsx +++ b/packages/chat/src/components/input.tsx @@ -97,9 +97,6 @@ export default function InputComponent({ > - ( - <> - {grouped ? ( -

- {new Date(message.send_time).toLocaleString([], { - hour: "2-digit", - minute: "2-digit", - })} -

- ) : ( - - - - {user.display.slice(0, 2).toUpperCase()} - - - )} - {message.failed && message.message_state === "awaiting" && ( - - -

Failed to send message

-
- } /> -
- )} -
- {!grouped && ( -
-

{user.display}

-

- {new Date(message.send_time).toLocaleString([], { - hour: "2-digit", - minute: "2-digit", - })} -

-
- )} - -
- - )} - /> + {message.failed && message.message_state === "awaiting" && ( + + +

Failed to send message

+
+ } /> +
+ )} + } /> diff --git a/packages/chat/src/screen.tsx b/packages/chat/src/screen.tsx index 44e581b..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); @@ -102,6 +101,12 @@ export default function Screen() { const virtualRowCount = messages.length + (shouldShowConversationStart ? 1 : 0); + const messagesRef = React.useRef(messages); + + React.useEffect(() => { + messagesRef.current = messages; + }, [messages]); + const getItemKey = React.useCallback( (index: number) => { if (shouldShowConversationStart && index === 0) { @@ -109,9 +114,9 @@ export default function Screen() { } const messageIndex = shouldShowConversationStart ? index - 1 : index; - return messages[messageIndex]?.send_time ?? index; + return messagesRef.current[messageIndex]?.send_time ?? index; }, - [shouldShowConversationStart, messages], + [shouldShowConversationStart], ); const setMeasurementRef = React.useCallback( @@ -355,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(() => { @@ -459,26 +435,13 @@ export default function Screen() {
- {messagesQuery.isPending && ( -
-

- - Loading... -

-
- )} - {messagesQuery.isFetchingNextPage && ( -
- -
- )}
-
- Conversation start +
+ This is the start of your conversation with{" "}
@@ -517,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 (
- +
); })} @@ -551,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/input.tsx b/packages/markdown/src/input.tsx index 3222ddf..f44ced6 100644 --- a/packages/markdown/src/input.tsx +++ b/packages/markdown/src/input.tsx @@ -23,7 +23,6 @@ import { indentWithTab, } from "@codemirror/commands"; import { useEffect, useRef } from "react"; -import type { CSSProperties } from "react"; import { collectInlineRanges, ensureMarkdownStyles } from "./markdown"; @@ -34,36 +33,8 @@ export type InputProps = { setValue: (value: string) => void; onSubmit?: () => void; invertEnterBehavior?: boolean; - styled?: boolean; - fontSize?: CSSProperties["fontSize"]; - paddingX?: CSSProperties["padding"]; - paddingY?: CSSProperties["padding"]; - className?: string; }; -type InputStyle = CSSProperties & { - "--tm-md-content-padding"?: string; -}; - -function toCssLength(value: CSSProperties["padding"]): string | undefined { - if (value === undefined) { - return undefined; - } - - return typeof value === "number" ? `${value}px` : value; -} - -function toCssPadding( - vertical: CSSProperties["padding"], - horizontal: CSSProperties["padding"], - styled: boolean, -): string { - const defaultVertical = styled ? "0.25rem" : "0"; - const defaultHorizontal = styled ? "0.625rem" : "0"; - - return `${toCssLength(vertical) ?? defaultVertical} ${toCssLength(horizontal) ?? defaultHorizontal}`; -} - type TokenRange = { from: number; to: number; @@ -109,10 +80,6 @@ const markdownDecorations = ViewPlugin.fromClass( export default function Input(props: InputProps) { ensureMarkdownStyles(); - const shellClassName = props.styled - ? "min-h-8 w-full min-w-0 rounded-lg border border-input bg-transparent text-base transition-colors outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40" - : ""; - const elementRef = useRef(null); const viewRef = useRef(undefined); const ignoreSyncRef = useRef(false); @@ -176,22 +143,7 @@ export default function Input(props: InputProps) { }); }, [props.value]); - return ( -
- ); + return
; } /** @@ -252,7 +204,7 @@ function createEditorExtensions( }), EditorView.theme({ "&": { - fontSize: "inherit", + fontSize: "1rem", }, "&.cm-editor": { width: "100%", diff --git a/packages/markdown/src/markdown.tsx b/packages/markdown/src/markdown.tsx index 46ebb92..c3a17a6 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; } @@ -664,12 +665,12 @@ export const markdownStyles = ` .tm-md-table th { background: hsl(var(--muted)); font-weight: 600; } .tm-md-hr { margin: 0.55rem 0; } -.cm-editor.tm-md-editor { border-radius: inherit; background: transparent; caret-color: var(--foreground); } +.cm-editor.tm-md-editor { border-radius: 0.65rem; background: hsl(var(--card)); caret-color: var(--foreground); } .cm-editor.tm-md-editor.cm-focused { outline: none; box-shadow: none; } .cm-editor.tm-md-editor .cm-scroller { font-family: inherit; line-height: 1.55; max-height: 30vh; overflow-y: auto; overflow-x: hidden; } .cm-editor.tm-md-editor .cm-content { caret-color: var(--foreground); } -.cm-editor.tm-md-editor .cm-content { padding: var(--tm-md-content-padding, 0.25rem 0.625rem); min-height: 2rem; } -.cm-editor.tm-md-editor .cm-line { padding: 0; color: hsl(var(--foreground)); } +.cm-editor.tm-md-editor .cm-content { padding: 0.7rem 0.85rem; min-height: 2.75rem; } +.cm-editor.tm-md-editor .cm-line { padding: 0 1px; color: hsl(var(--foreground)); } .cm-editor.tm-md-editor .tm-md-hidden-token { color: transparent; opacity: 0; font-size: inherit; } .cm-editor.tm-md-editor .tm-md-code-line { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: hsl(var(--muted)); border-radius: 0.3rem; } `; 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..a059e9c 100644 --- a/packages/shared/src/data.ts +++ b/packages/shared/src/data.ts @@ -48,31 +48,6 @@ export type Communities = z.infer< export type Calls = z.infer; // TTP -const user = z.object({ - about: z.string().max(255).optional(), - avatar: z.string().optional(), - display: z.string().min(1).max(15), - iota_id: z.number(), - omikron_connections: z.array(z.number()), - omikron_id: z.number().optional(), - online_status: z.enum([ - "user_offline", - "user_online", - "user_dnd", - "user_idle", - "user_wc", - "user_borked", - "iota_offline", - "iota_online", - "iota_borked", - ]), - public_key: z.base64(), - status: z.string().max(15).optional(), - sub_end: z.number(), - sub_level: z.number(), - user_id: z.number(), - username: z.string().min(1).max(15), -}); export const ttp = { identification: { request: z.object({ @@ -115,14 +90,33 @@ export const ttp = { }, get_user_data: { request: z.object({ - user_id: z.number().optional(), - username: z.string().optional(), + user_id: z.number(), + }), + response: z.object({ + about: z.string().max(255).optional(), + avatar: z.string().optional(), + display: z.string().max(15), + iota_id: z.number(), + omikron_connections: z.array(z.number()), + omikron_id: z.number().optional(), + online_status: z.enum([ + "user_offline", + "user_online", + "user_dnd", + "user_idle", + "user_wc", + "user_borked", + "iota_offline", + "iota_online", + "iota_borked", + ]), + public_key: z.base64(), + status: z.string().max(15).optional(), + sub_end: z.number(), + sub_level: z.number(), + user_id: z.number(), + username: z.string().max(15), }), - response: user, - }, - change_user_data: { - request: user.partial(), - response: z.object({}), }, ping: { request: z.object({ @@ -167,17 +161,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, @@ -256,9 +244,6 @@ export interface Storage extends SettingsStorageDefaults { legal_docs: z.infer; cached_contacts: Contacts; cached_communities: Communities; - ttp_url: string; - call_mute_range_start: number; - call_mute_range_end: number; } export const storageDefaults: Storage = { @@ -291,32 +276,4 @@ export const storageDefaults: Storage = { }, cached_contacts: [], cached_communities: [], - ttp_url: "https://tensamin.net:959", - call_mute_range_start: -55, - call_mute_range_end: -45, }; - -// User Status -export function getStatusColor( - status: z.infer, -) { - switch (status) { - case "user_online": - return "#22c55e"; - case "iota_online": - return "#22c55e"; - case "user_dnd": - return "#ef4444"; - case "user_idle": - return "#f59e0b"; - case "user_wc": - return "#3b82f6"; - case "user_borked": - case "iota_borked": - return "#6b7280"; - case "user_offline": - case "iota_offline": - default: - return "#9ca3af"; - } -} 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/storage/src/session.tsx b/packages/storage/src/session.tsx index d992a03..03b3826 100644 --- a/packages/storage/src/session.tsx +++ b/packages/storage/src/session.tsx @@ -14,7 +14,6 @@ interface SessionContextType { communities: Communities; calls: Calls; moveUserIdToTop: (userId: number) => void; - insertContact: (userId: number) => void; } const SessionContext = createContext(undefined); @@ -70,31 +69,9 @@ export default function SessionProvider({ children }: { children: ReactNode }) { }); }; - const insertContact = (userId: number) => { - setContacts((prevContacts) => { - if (prevContacts.some((contact) => contact.user_id === userId)) { - return prevContacts; - } - - const newUser = { - user_id: userId, - last_message_at: new Date().getTime(), - messages: [], - } satisfies Contacts[0]; - - return [newUser, ...prevContacts]; - }); - }; - return ( {children} diff --git a/packages/ttp/src/context.tsx b/packages/ttp/src/context.tsx index d33313d..f1c30aa 100644 --- a/packages/ttp/src/context.tsx +++ b/packages/ttp/src/context.tsx @@ -24,6 +24,7 @@ import { RECONNECT_RESET, RECONNECT_TRIES, RETRY_INTERVAL, + TRANSPORT_URL, } from "./values"; import { type Calls, @@ -191,15 +192,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); - useEffect(() => { - load("ttp_url").then((url) => { - setTtpUrl(url); - }); - }, [load]); /** * Sends typed protocol messages through the active transport client. @@ -243,23 +235,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; @@ -291,10 +266,6 @@ export function Provider(props: { }, [connected, identified, send]); useEffect(() => { - if (!ttpUrl) { - return; - } - let attempts = 0; let reconnectTimer: ReturnType | null = null; let reconnectResetTimer: ReturnType | null = null; @@ -372,7 +343,7 @@ export function Provider(props: { const transportClient = !props.blockConnection ? createTransportClient(schemas, { - url: ttpUrl, + url: TRANSPORT_URL, onReadyStateChange: (state) => { currentReadyState = state; setReadyState(state); @@ -381,7 +352,6 @@ export function Provider(props: { clearReconnectTimer(); scheduleReconnectReset(); identificationStartedRef.current = false; - identificationCancelRef.current = false; setConnected(true); setIdentified(false); setError(""); @@ -422,12 +392,8 @@ export function Provider(props: { return; } - if (!ttpUrl) { - return; - } - try { - await transportClient?.connect(ttpUrl); + await transportClient?.connect(TRANSPORT_URL); } catch (connectError) { if (disposed) { return; @@ -494,7 +460,7 @@ export function Provider(props: { setIdentifying(false); identificationStartedRef.current = false; }; - }, [props.blockConnection, ttpUrl]); + }, [props.blockConnection]); useEffect(() => { if (!connected) { @@ -502,11 +468,6 @@ export function Provider(props: { return; } - if (identificationCancelRef.current) { - identificationStartedRef.current = false; - return; - } - if (identificationStartedRef.current) { return; } @@ -575,12 +536,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 +547,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 +559,6 @@ export function Provider(props: { return; } - if (identificationCancelRef.current) { - return; - } - if (isStopSendingError(identificationError)) { setError("Connection closed"); setErrorDescription( @@ -634,7 +589,7 @@ export function Provider(props: { : "Unable to complete secure identification because the transport request failed.", ); } finally { - if (!cancelled && !identificationCancelRef.current) { + if (!cancelled) { setIdentifying(false); } } @@ -648,19 +603,14 @@ export function Provider(props: { }, [connected, decrypt, getSharedSecret, load, send]); const progress = useMemo(() => { - if (!ttpUrl) return 10; if (readyState === READY_STATE.CONNECTING) return 30; if (!connected) return 45; if (identifying) return 75; if (!identified) return 90; return 100; - }, [connected, identified, identifying, readyState, ttpUrl]); + }, [connected, identified, identifying, readyState]); const loadingTitle = useMemo(() => { - if (!ttpUrl) { - return "Looking up configuration"; - } - if (readyState === READY_STATE.CONNECTING || !connected) { return "Connecting to Tensamin"; } @@ -670,13 +620,9 @@ export function Provider(props: { } return "Loading"; - }, [connected, identified, identifying, readyState, ttpUrl]); + }, [connected, identified, identifying, readyState]); const loadingDescription = useMemo(() => { - if (!ttpUrl) { - return "Loading connection details"; - } - if (readyState === READY_STATE.CONNECTING || !connected) { return "Establishing transport channel"; } @@ -686,13 +632,13 @@ export function Provider(props: { } return undefined; - }, [connected, identified, identifying, readyState, ttpUrl]); + }, [connected, identified, identifying, readyState]); if (error !== "" && errorDescription !== "") { return ; } - if (!connected || !identified || !ttpUrl) { + if (!connected || !identified) { return (