Merge branch 'dev' into dev
This commit is contained in:
476 files changed
+4238
-2922
No files matched your search
@@ -1,44 +0,0 @@
|
||||
name: Build pull request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: ['opened', 'synchronize']
|
||||
|
||||
jobs:
|
||||
build-pull-request:
|
||||
name: Build pull request
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build app
|
||||
env:
|
||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||
run: npm run build
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: preview
|
||||
path: dist
|
||||
retention-days: 1
|
||||
- name: Save pr number
|
||||
run: echo ${PR_NUMBER} > ./pr.txt
|
||||
- name: Upload pr number
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: pr
|
||||
path: ./pr.txt
|
||||
retention-days: 1
|
||||
@@ -1,57 +0,0 @@
|
||||
name: Deploy PR to Netlify
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['Build pull request']
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
deploy-pull-request:
|
||||
name: Deploy pull request
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
pull-requests: write
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Download pr number
|
||||
uses: dawidd6/action-download-artifact@fe9d59ce33ce92db8a6ac90b2c8be6b6d90417c8
|
||||
with:
|
||||
workflow: ${{ github.event.workflow.id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: pr
|
||||
- name: Output pr number
|
||||
id: pr
|
||||
run: echo "id=$(<pr.txt)" >> $GITHUB_OUTPUT
|
||||
- name: Download artifact
|
||||
uses: dawidd6/action-download-artifact@fe9d59ce33ce92db8a6ac90b2c8be6b6d90417c8
|
||||
with:
|
||||
workflow: ${{ github.event.workflow.id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: preview
|
||||
path: dist
|
||||
- name: Deploy to Netlify
|
||||
id: netlify
|
||||
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||
with:
|
||||
publish-dir: dist
|
||||
deploy-message: 'Deploy PR ${{ steps.pr.outputs.id }}'
|
||||
alias: ${{ steps.pr.outputs.id }}
|
||||
# These don't work because we're in workflow_run
|
||||
enable-pull-request-comment: false
|
||||
enable-commit-comment: false
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_PR_CINNY }}
|
||||
timeout-minutes: 1
|
||||
- name: Comment preview on PR
|
||||
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b #v3.0.1
|
||||
env:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
pr-number: ${{ steps.pr.outputs.id }}
|
||||
comment-tag: ${{ steps.pr.outputs.id }}
|
||||
message: |
|
||||
Preview: ${{ steps.netlify.outputs.deploy-url }}
|
||||
⚠️ Exercise caution. Use test accounts. ⚠️
|
||||
@@ -1,24 +0,0 @@
|
||||
name: 'Docker check'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- '.github/workflows/docker-pr.yml'
|
||||
- '.github/workflows/prod-deploy.yml'
|
||||
|
||||
jobs:
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
@@ -0,0 +1,76 @@
|
||||
name: Build and publish Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
tags:
|
||||
- '+([0-9]).+([0-9]).+([0-9])'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
attestations: write
|
||||
artifact-metadata: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
# dev branch: short commit SHA + latest
|
||||
type=sha,prefix=,format=short,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||
|
||||
# git tags: semver breakdown
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Generate artifact attestation
|
||||
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
|
||||
with:
|
||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
subject-digest: ${{ steps.push.outputs.digest }}
|
||||
push-to-registry: true
|
||||
@@ -1,44 +0,0 @@
|
||||
name: Deploy to Netlify (dev)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
deploy-to-netlify:
|
||||
name: Deploy to Netlify
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
deployments: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build app
|
||||
env:
|
||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||
run: npm run build
|
||||
- name: Deploy to Netlify
|
||||
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||
with:
|
||||
publish-dir: dist
|
||||
deploy-message: 'Dev deploy ${{ github.sha }}'
|
||||
enable-commit-comment: false
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
production-deploy: true
|
||||
github-deployment-environment: nightly
|
||||
github-deployment-description: 'Nightly deployment on each commit to dev branch'
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_DEV }}
|
||||
timeout-minutes: 1
|
||||
@@ -1,110 +0,0 @@
|
||||
name: Production deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
deploy-and-tarball:
|
||||
name: Netlify deploy and tarball
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
package-manager-cache: false
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build app
|
||||
env:
|
||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||
run: npm run build
|
||||
- name: Deploy to Netlify
|
||||
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||
with:
|
||||
publish-dir: dist
|
||||
deploy-message: 'Prod deploy ${{ github.ref_name }}'
|
||||
enable-commit-comment: false
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
production-deploy: true
|
||||
github-deployment-environment: stable
|
||||
github-deployment-description: 'Stable deployment on each release'
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_APP }}
|
||||
timeout-minutes: 1
|
||||
- name: Get version from tag
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Create tar.gz
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.vars.outputs.tag }}
|
||||
run: tar -czvf "cinny-${RELEASE_TAG}.tar.gz" dist
|
||||
- name: Sign tar.gz
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.vars.outputs.tag }}
|
||||
run: |
|
||||
echo '${{ secrets.GNUPG_KEY }}' | gpg --batch --import
|
||||
# Sadly a few lines in the private key match a few lines in the public key,
|
||||
# As a result just --export --armor gives us a few lines replaced with ***
|
||||
# making it useless for importing the signing key. Instead, we dump it as
|
||||
# non-armored and hex-encode it so that its printable.
|
||||
echo "PGP Signing key, in raw PGP format in hex. Import with cat ... | xxd -r -p - | gpg --import"
|
||||
gpg --export | xxd -p
|
||||
echo '${{ secrets.GNUPG_PASSPHRASE }}' | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign "cinny-${RELEASE_TAG}.tar.gz"
|
||||
- name: Upload tagged release
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
with:
|
||||
files: |
|
||||
cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
||||
cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc
|
||||
|
||||
publish-image:
|
||||
name: Push Docker image to Docker Hub, ghcr
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to the Container registry
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||
with:
|
||||
images: |
|
||||
${{ secrets.DOCKER_USERNAME }}/cinny
|
||||
ghcr.io/${{ github.repository }}
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -0,0 +1,86 @@
|
||||
name: Quality checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format check
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Check formatting
|
||||
run: npm run fmt:check
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
||||
|
||||
typecheck:
|
||||
name: Typecheck
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run TypeScript typecheck
|
||||
run: npm run typecheck -- --pretty false
|
||||
|
||||
knip:
|
||||
name: Knip
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci --ignore-scripts
|
||||
- name: Run Knip
|
||||
run: npm run knip
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
|
||||
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "webpro.vscode-knip"]
|
||||
}
|
||||
@@ -1,5 +1,24 @@
|
||||
# Sable Client Changelog
|
||||
|
||||
## 1.2.4 - in dev
|
||||
|
||||
- Add validation to timezones before rendering.
|
||||
- Fix invalid matrix.to event link generation ([cinnyapp#2717](https://github.com/cinnyapp/cinny/pull/2717)) - [tulir](https://github.com/tulir)
|
||||
- Fix Call Rooms' chat button ([#58](https://github.com/7w1/sable/pull/58)) - [Rosy-iso](https://github.com/Rosy-iso)
|
||||
- Strip quotes for mxc urls converted to http for tuwunel ([#56](https://github.com/7w1/sable/pull/56)) - [Rosy-iso](https://github.com/Rosy-iso)
|
||||
- Add sable space and announcements room to featured communities.
|
||||
|
||||
## 1.2.3 - 3/2/2026
|
||||
|
||||
- Actually fix quotes around colors for tuwunel homeservers ([#46](https://github.com/7w1/sable/issues/46))
|
||||
- Option to have your own message bubbles in bubble layout right aligned ([#38](https://github.com/7w1/sable/issues/38))
|
||||
- Allow responding to and rendering replies with files ([#54](https://github.com/7w1/sable/pull/54)) - [nushea](https://github.com/nushea)
|
||||
- Added Gruvbox theme ([#51](https://github.com/7w1/sable/pull/51)) - [dollth.ing](https://github.com/dollth-ing)
|
||||
|
||||
## 1.2.2 v2
|
||||
|
||||
- hotfix for stupid firefox cors crash
|
||||
|
||||
## 1.2.2 - 3/1/2026
|
||||
|
||||
- Fixed/updated unknown extended profile keys rendering.
|
||||
|
||||
@@ -37,6 +37,13 @@ It is not always possible to phrase every change in such a manner, but it is des
|
||||
|
||||
Also, we use [ESLint](https://eslint.org/) for clean and stylistically consistent code syntax, so make sure your pull request follow it.
|
||||
|
||||
**Pull requests are not merged unless all quality checks are passing.** At minimum, `format`, `lint`, `typecheck`, and `knip` must all be green before a pull request can be merged. Run these locally before opening or updating a pull request:
|
||||
|
||||
- `npm run fmt:check`
|
||||
- `npm run lint`
|
||||
- `npm run typecheck`
|
||||
- `npm run knip`
|
||||
|
||||
**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#sable:sable.moe).**
|
||||
|
||||
## Helpful links
|
||||
|
||||
@@ -12,7 +12,41 @@ The web app is available at [app.sable.moe](https://app.sable.moe/) and gets upd
|
||||
You can also download our desktop app for windows and linux from [releases](https://github.com/7w1/sable/releases/latest).
|
||||
|
||||
## Self-hosting
|
||||
To host Sable on your own, download this repo and built with nginx.
|
||||
You can either run the prebuilt container image or build Sable yourself.
|
||||
|
||||
### Docker
|
||||
|
||||
Prebuilt images are published to `ghcr.io/7w1/sable`.
|
||||
|
||||
- `latest` tracks the current `dev` branch image.
|
||||
- `X.Y.Z` tags are versioned releases.
|
||||
- `X.Y` tags float within a release line.
|
||||
- Pushes to `dev` also publish a short commit SHA tag.
|
||||
|
||||
Run the latest image with:
|
||||
|
||||
```sh
|
||||
docker run --rm -p 8080:80 ghcr.io/7w1/sable:latest
|
||||
```
|
||||
|
||||
Then open `http://localhost:8080`.
|
||||
|
||||
If you want to override the bundled [`config.json`](config.json), mount your own
|
||||
file at `/app/config.json`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
sable:
|
||||
image: ghcr.io/7w1/sable:latest
|
||||
ports:
|
||||
- '8080:80'
|
||||
volumes:
|
||||
- ./config.json:/app/config.json:ro
|
||||
```
|
||||
|
||||
### Build it yourself
|
||||
|
||||
To build and serve Sable yourself with nginx, clone this repo and build it:
|
||||
|
||||
```sh
|
||||
npm ci # Installs all dependencies
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"elementCallUrl": null,
|
||||
|
||||
"disableAccountSwitcher": false,
|
||||
"matrixToBaseUrl": "https://matrix.to",
|
||||
|
||||
"pushNotificationDetails": {
|
||||
"pushNotifyUrl": "https://cinny.cc/_matrix/push/v1/notify",
|
||||
@@ -15,6 +16,7 @@
|
||||
"featuredCommunities": {
|
||||
"openAsDefault": false,
|
||||
"spaces": [
|
||||
"#sable:sable.moe",
|
||||
"#community:matrix.org",
|
||||
"#space:unredacted.org",
|
||||
"#science-space:matrix.org",
|
||||
@@ -22,6 +24,7 @@
|
||||
"#mathematics-on:matrix.org"
|
||||
],
|
||||
"rooms": [
|
||||
"#announcements:sable.moe",
|
||||
"#freesoftware:matrix.org",
|
||||
"#pcapdroid:matrix.org",
|
||||
"#gentoo:matrix.org",
|
||||
|
||||
+111
-62
@@ -1,65 +1,97 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import js from '@eslint/js';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import css from '@eslint/css';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import react from 'eslint-plugin-react';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import { configs, helpers, plugins } from 'eslint-config-airbnb-extended';
|
||||
import { rules as prettierConfigRules } from 'eslint-config-prettier';
|
||||
import prettierPlugin from 'eslint-plugin-prettier';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import globals from 'globals';
|
||||
|
||||
const sourceFiles = ['**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}'];
|
||||
const tsSourceFiles = ['**/*.{ts,tsx,mts,cts}'];
|
||||
const jsSourceFiles = ['**/*.{js,jsx,mjs,cjs}'];
|
||||
const scopedRecommendedTsConfigs = tseslint.configs.recommended.map((config) =>
|
||||
config.files ? config : { ...config, files: sourceFiles }
|
||||
);
|
||||
const scopedRecommendedTypeCheckedTsConfigs = tseslint.configs.recommendedTypeChecked.map(
|
||||
(config) => (config.files ? config : { ...config, files: sourceFiles })
|
||||
);
|
||||
const gitignorePath = path.resolve('.', '.gitignore');
|
||||
const { jsFiles, tsFiles } = helpers.extensions;
|
||||
|
||||
export default defineConfig(
|
||||
const jsConfig = defineConfig([
|
||||
// ESLint recommended config
|
||||
{
|
||||
files: ['**/*.css'],
|
||||
plugins: { css },
|
||||
language: 'css/css',
|
||||
rules: css.configs.recommended.rules,
|
||||
name: 'js/config',
|
||||
...js.configs.recommended,
|
||||
},
|
||||
// Stylistic plugin
|
||||
plugins.stylistic,
|
||||
// Import X plugin
|
||||
plugins.importX,
|
||||
// Airbnb base recommended config
|
||||
...configs.base.recommended,
|
||||
]);
|
||||
|
||||
const reactConfig = defineConfig([
|
||||
// React plugin
|
||||
plugins.react,
|
||||
// React hooks plugin
|
||||
plugins.reactHooks,
|
||||
// React JSX A11y plugin
|
||||
plugins.reactA11y,
|
||||
// Airbnb React recommended config
|
||||
...configs.react.recommended,
|
||||
// React 17+ automatic JSX runtime
|
||||
reactPlugin.configs.flat['jsx-runtime'],
|
||||
]);
|
||||
|
||||
const typescriptConfig = defineConfig([
|
||||
// TypeScript ESLint plugin
|
||||
plugins.typescriptEslint,
|
||||
// Airbnb base TypeScript config
|
||||
...configs.base.typescript,
|
||||
// Airbnb React TypeScript config
|
||||
...configs.react.typescript,
|
||||
]);
|
||||
|
||||
const prettierConfig = defineConfig([
|
||||
// Prettier plugin
|
||||
{
|
||||
files: sourceFiles,
|
||||
name: 'prettier/plugin/config',
|
||||
plugins: {
|
||||
prettier: prettierPlugin,
|
||||
},
|
||||
},
|
||||
// Prettier config
|
||||
{
|
||||
name: 'prettier/config',
|
||||
rules: {
|
||||
...prettierConfigRules,
|
||||
'prettier/prettier': 'error',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const projectOverrides = defineConfig([
|
||||
{
|
||||
name: 'project/rule-overrides',
|
||||
files: [...jsFiles, ...tsFiles],
|
||||
languageOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
globals: {
|
||||
JSX: 'readonly',
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
},
|
||||
{ ...js.configs.recommended, files: sourceFiles },
|
||||
...scopedRecommendedTsConfigs,
|
||||
...scopedRecommendedTypeCheckedTsConfigs,
|
||||
{ ...importPlugin.flatConfigs.recommended, files: sourceFiles },
|
||||
{ ...importPlugin.flatConfigs.typescript, files: tsSourceFiles },
|
||||
{ ...react.configs.flat.recommended, files: sourceFiles },
|
||||
{ ...react.configs.flat['jsx-runtime'], files: sourceFiles },
|
||||
{ ...reactHooks.configs.flat.recommended, files: sourceFiles },
|
||||
{ ...tseslint.configs.disableTypeChecked, files: jsSourceFiles },
|
||||
{ ...eslintConfigPrettier, files: sourceFiles },
|
||||
{
|
||||
files: sourceFiles,
|
||||
rules: {
|
||||
'linebreak-style': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-underscore-dangle': 'off',
|
||||
'no-shadow': 'off',
|
||||
'import-x/prefer-default-export': 'off',
|
||||
'import-x/extensions': 'off',
|
||||
'import-x/no-unresolved': 'off',
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: false,
|
||||
peerDependencies: true,
|
||||
bundledDependencies: true,
|
||||
},
|
||||
],
|
||||
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
||||
'react/jsx-filename-extension': [
|
||||
'error',
|
||||
@@ -67,28 +99,45 @@ export default defineConfig(
|
||||
extensions: ['.tsx', '.jsx'],
|
||||
},
|
||||
],
|
||||
// obsolete in a React 19
|
||||
'react/prop-types': 'off',
|
||||
'react/require-default-props': 'off',
|
||||
'react/jsx-props-no-spreading': 'off',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
varsIgnorePattern: '^React$',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: tsSourceFiles,
|
||||
name: 'project/typescript-rule-overrides',
|
||||
files: tsFiles,
|
||||
rules: {
|
||||
// disabled for now to get eslint to pass
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'off',
|
||||
'@typescript-eslint/array-type': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
args: 'after-used',
|
||||
enableAutofixRemoval: {
|
||||
imports: true,
|
||||
},
|
||||
ignoreRestSiblings: true,
|
||||
vars: 'all',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'no-undef': 'off',
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
||||
export default defineConfig([
|
||||
includeIgnoreFile(gitignorePath),
|
||||
...jsConfig,
|
||||
...reactConfig,
|
||||
...typescriptConfig,
|
||||
...prettierConfig,
|
||||
...projectOverrides,
|
||||
]);
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"entry": ["src/sw.ts", "scripts/normalize-imports.js"],
|
||||
"ignoreExportsUsedInFile": {
|
||||
"interface": true,
|
||||
"type": true
|
||||
},
|
||||
"ignoreDependencies": ["buffer", "@element-hq/element-call-embedded"],
|
||||
"rules": {
|
||||
"exports": "off",
|
||||
"types": "off",
|
||||
"enumMembers": "off"
|
||||
},
|
||||
"tags": ["-lintignore"]
|
||||
}
|
||||
Generated
+1619
-206
File diff suppressed because it is too large.
Load diff
+18
-20
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"name": "sable",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"description": "Yet another matrix client fork",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
"engines": {
|
||||
@@ -10,14 +9,15 @@
|
||||
"npm": "11.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "npm run check:eslint && npm run check:prettier",
|
||||
"check:eslint": "eslint src/*",
|
||||
"check:prettier": "prettier --check .",
|
||||
"fix:prettier": "prettier --write .",
|
||||
"typecheck": "tsc"
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"fmt": "prettier --write .",
|
||||
"fmt:check": "prettier --check .",
|
||||
"typecheck": "tsc",
|
||||
"knip": "knip"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "7w1",
|
||||
@@ -41,11 +41,11 @@
|
||||
"browser-encrypt-attachment": "^0.3.0",
|
||||
"chroma-js": "^3.2.0",
|
||||
"classnames": "^2.5.1",
|
||||
"dateformat": "^5.0.3",
|
||||
"dayjs": "^1.11.19",
|
||||
"domhandler": "^5.0.3",
|
||||
"emojibase": "^15.3.1",
|
||||
"emojibase-data": "^15.3.2",
|
||||
"eslint-plugin-react": "7.37.5",
|
||||
"file-saver": "^2.0.5",
|
||||
"focus-trap-react": "^10.3.1",
|
||||
"folds": "^2.6.1",
|
||||
@@ -85,9 +85,8 @@
|
||||
"devDependencies": {
|
||||
"@element-hq/element-call-embedded": "0.16.3",
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
"@eslint/css": "^0.14.1",
|
||||
"@eslint/eslintrc": "^3.3.4",
|
||||
"@eslint/js": "^9.39.3",
|
||||
"@eslint/compat": "2.0.2",
|
||||
"@eslint/js": "9.39.3",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/plugin-wasm": "^6.2.2",
|
||||
"@types/chroma-js": "^3.1.2",
|
||||
@@ -102,15 +101,14 @@
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"buffer": "^6.0.3",
|
||||
"eslint": "^9.39.3",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"prettier": "^3.8.1",
|
||||
"eslint": "9.39.3",
|
||||
"eslint-config-airbnb-extended": "3.0.1",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-plugin-prettier": "5.5.5",
|
||||
"globals": "17.3.0",
|
||||
"knip": "5.85.0",
|
||||
"prettier": "3.8.1",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.56.1",
|
||||
"vite": "^7.3.1",
|
||||
"vite-plugin-pwa": "^1.2.0",
|
||||
"vite-plugin-static-copy": "^3.2.0",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
@@ -37,23 +38,18 @@ function toPosix(inputPath) {
|
||||
function parseArgs(argv) {
|
||||
let write = false;
|
||||
const roots = [];
|
||||
let index = 0;
|
||||
|
||||
for (let i = 0; i < argv.length; i += 1) {
|
||||
const arg = argv[i];
|
||||
while (index < argv.length) {
|
||||
const arg = argv[index];
|
||||
if (arg === '--write') {
|
||||
write = true;
|
||||
continue;
|
||||
}
|
||||
if (arg === '--root' && argv[i + 1]) {
|
||||
roots.push(argv[i + 1]);
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
if (arg.startsWith('--root=')) {
|
||||
} else if (arg === '--root' && argv[index + 1]) {
|
||||
roots.push(argv[index + 1]);
|
||||
index += 1;
|
||||
} else if (arg.startsWith('--root=')) {
|
||||
roots.push(arg.slice('--root='.length));
|
||||
continue;
|
||||
}
|
||||
if (arg === '--help' || arg === '-h') {
|
||||
} else if (arg === '--help' || arg === '-h') {
|
||||
console.log(
|
||||
[
|
||||
'Usage: node scripts/normalize-imports.mjs [--write] [--root <dir>]',
|
||||
@@ -65,6 +61,8 @@ function parseArgs(argv) {
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -149,7 +147,7 @@ function getRewrittenSpecifier(filePath, specifier, aliases, projectRoot) {
|
||||
return `$types/matrix-sdk${suffix}`;
|
||||
}
|
||||
|
||||
if (!bare.startsWith('.') || !/^(\.\.\/){2,}/.test(bare)) {
|
||||
if (!/^\.\.(?:\/|$)/.test(bare)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -232,13 +230,11 @@ function rewriteFileImports(filePath, sourceCode, aliases, projectRoot) {
|
||||
new Map(replacements.map((r) => [`${r.start}:${r.end}`, r])).values()
|
||||
).sort((a, b) => b.start - a.start);
|
||||
|
||||
let updatedCode = sourceCode;
|
||||
for (const replacement of uniqueReplacements) {
|
||||
updatedCode =
|
||||
updatedCode.slice(0, replacement.start) +
|
||||
replacement.value +
|
||||
updatedCode.slice(replacement.end);
|
||||
}
|
||||
const updatedCode = uniqueReplacements.reduce(
|
||||
(code, replacement) =>
|
||||
code.slice(0, replacement.start) + replacement.value + code.slice(replacement.end),
|
||||
sourceCode
|
||||
);
|
||||
|
||||
return {
|
||||
changed: updatedCode !== sourceCode,
|
||||
@@ -276,48 +272,51 @@ async function main() {
|
||||
)
|
||||
).flat();
|
||||
|
||||
let filesChanged = 0;
|
||||
let importRewrites = 0;
|
||||
const displayRows = [];
|
||||
const fileResults = await Promise.all(
|
||||
sourceFiles.map(async (filePath) => {
|
||||
const sourceCode = await fs.readFile(filePath, 'utf8');
|
||||
const { changed, updatedCode, replacements, edits } = rewriteFileImports(
|
||||
filePath,
|
||||
sourceCode,
|
||||
aliases,
|
||||
projectRoot
|
||||
);
|
||||
|
||||
for (const filePath of sourceFiles) {
|
||||
const sourceCode = await fs.readFile(filePath, 'utf8');
|
||||
const { changed, updatedCode, replacements, edits } = rewriteFileImports(
|
||||
filePath,
|
||||
sourceCode,
|
||||
aliases,
|
||||
projectRoot
|
||||
);
|
||||
if (!changed) return null;
|
||||
|
||||
if (!changed) continue;
|
||||
if (write) {
|
||||
await fs.writeFile(filePath, updatedCode, 'utf8');
|
||||
}
|
||||
|
||||
filesChanged += 1;
|
||||
importRewrites += replacements;
|
||||
const relativeFilePath = toPosix(path.relative(projectRoot, filePath));
|
||||
return {
|
||||
file: toPosix(path.relative(projectRoot, filePath)),
|
||||
replacements,
|
||||
edits,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
for (const edit of edits) {
|
||||
displayRows.push({
|
||||
file: relativeFilePath,
|
||||
from: edit.from,
|
||||
to: edit.to,
|
||||
});
|
||||
}
|
||||
|
||||
if (write) {
|
||||
await fs.writeFile(filePath, updatedCode, 'utf8');
|
||||
}
|
||||
}
|
||||
const changedFiles = fileResults.filter((result) => result !== null);
|
||||
const filesChanged = changedFiles.length;
|
||||
const importRewrites = changedFiles.reduce((total, result) => total + result.replacements, 0);
|
||||
const displayRows = changedFiles.flatMap((result) =>
|
||||
result.edits.map((edit) => ({
|
||||
file: result.file,
|
||||
from: edit.from,
|
||||
to: edit.to,
|
||||
}))
|
||||
);
|
||||
|
||||
displayRows.sort((a, b) =>
|
||||
a.file === b.file ? a.from.localeCompare(b.from) : a.file.localeCompare(b.file)
|
||||
);
|
||||
for (const row of displayRows) {
|
||||
displayRows.forEach((row) => {
|
||||
const fileLabel = styleText(row.file, ANSI.dim, useColor);
|
||||
const fromLabel = styleText(`"${row.from}"`, ANSI.red, useColor);
|
||||
const arrowLabel = styleText(' -> ', ANSI.dim, useColor);
|
||||
const toLabel = styleText(`"${row.to}"`, ANSI.green, useColor);
|
||||
console.log(`${fileLabel}: ${fromLabel}${arrowLabel}${toLabel}`);
|
||||
}
|
||||
});
|
||||
|
||||
const mode = write ? 'Applied' : 'Dry run';
|
||||
console.log(`${mode}: ${importRewrites} imports across ${filesChanged} files.`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { FormEventHandler, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { FormEventHandler, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Text,
|
||||
@@ -15,14 +15,14 @@ import {
|
||||
config,
|
||||
} from 'folds';
|
||||
import { MatrixError } from '$types/matrix-sdk';
|
||||
import { Cursor } from '../plugins/text-area';
|
||||
import { syntaxErrorPosition } from '../utils/dom';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { Cursor } from '$plugins/text-area';
|
||||
import { syntaxErrorPosition } from '$utils/dom';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
import { useTextAreaCodeEditor } from '$hooks/useTextAreaCodeEditor';
|
||||
import { Page, PageHeader } from './page';
|
||||
import { useAlive } from '../hooks/useAlive';
|
||||
import { SequenceCard } from './sequence-card';
|
||||
import { TextViewerContent } from './text-viewer';
|
||||
import { useTextAreaCodeEditor } from '../hooks/useTextAreaCodeEditor';
|
||||
|
||||
const EDITOR_INTENT_SPACE_COUNT = 2;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { AuthDict, AuthType, IAuthData, UIAFlow } from '$types/matrix-sdk';
|
||||
import { getUIAFlowForStages } from '../utils/matrix-uia';
|
||||
import { useSupportedUIAFlows, useUIACompleted, useUIAFlow } from '../hooks/useUIAFlows';
|
||||
import { getUIAFlowForStages } from '$utils/matrix-uia';
|
||||
import { useSupportedUIAFlows, useUIACompleted, useUIAFlow } from '$hooks/useUIAFlows';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { UIAFlowOverlay } from './UIAFlowOverlay';
|
||||
import { PasswordStage, SSOStage } from './uia-stages';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
|
||||
export const SUPPORTED_IN_APP_UIA_STAGES = [AuthType.Password, AuthType.Sso];
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { ReactNode, useCallback, useEffect, useMemo } from 'react';
|
||||
import { MatrixError, createClient } from '$types/matrix-sdk';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { useAutoDiscoveryInfo } from '../hooks/useAutoDiscoveryInfo';
|
||||
import { promiseFulfilledResult, promiseRejectedResult } from '../utils/common';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useAutoDiscoveryInfo } from '$hooks/useAutoDiscoveryInfo';
|
||||
import { promiseFulfilledResult, promiseRejectedResult } from '$utils/common';
|
||||
import {
|
||||
AuthFlows,
|
||||
RegisterFlowStatus,
|
||||
RegisterFlowsResponse,
|
||||
parseRegisterErrResp,
|
||||
} from '../hooks/useAuthFlows';
|
||||
} from '$hooks/useAuthFlows';
|
||||
|
||||
type AuthFlowsLoaderProps = {
|
||||
fallback?: () => ReactNode;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
getHomePath,
|
||||
getInboxPath,
|
||||
getSpacePath,
|
||||
} from '../pages/pathUtils';
|
||||
} from '$pages/pathUtils';
|
||||
import {
|
||||
DIRECT_PATH,
|
||||
EXPLORE_PATH,
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
HOME_ROOM_PATH,
|
||||
DIRECT_ROOM_PATH,
|
||||
SPACE_ROOM_PATH,
|
||||
} from '../pages/paths';
|
||||
import { lastVisitedRoomIdAtom } from '../state/room/lastRoom';
|
||||
} from '$pages/paths';
|
||||
import { lastVisitedRoomIdAtom } from '$state/room/lastRoom';
|
||||
|
||||
type BackRouteHandlerProps = {
|
||||
children: (onBack: () => void) => ReactNode;
|
||||
@@ -107,7 +107,7 @@ export function BackRouteHandler({ children }: BackRouteHandlerProps) {
|
||||
) {
|
||||
navigate(getInboxPath());
|
||||
}
|
||||
}, [navigate, location]);
|
||||
}, [navigate, location, setLastRoomId]);
|
||||
|
||||
return children(goBack);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { MouseEventHandler, useCallback, useState } from 'react';
|
||||
import { MouseEventHandler, useCallback, useState } from 'react';
|
||||
import { useAtom } from 'jotai';
|
||||
import { CryptoApi, KeyBackupInfo } from '$types/matrix-sdk';
|
||||
import {
|
||||
@@ -19,17 +19,17 @@ import {
|
||||
Text,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { BackupProgressStatus, backupRestoreProgressAtom } from '../state/backupRestore';
|
||||
import { InfoCard } from './info-card';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { BackupProgressStatus, backupRestoreProgressAtom } from '$state/backupRestore';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import {
|
||||
useKeyBackupInfo,
|
||||
useKeyBackupStatus,
|
||||
useKeyBackupSync,
|
||||
useKeyBackupTrust,
|
||||
} from '../hooks/useKeyBackup';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { useRestoreBackupOnVerification } from '../hooks/useRestoreBackupOnVerification';
|
||||
} from '$hooks/useKeyBackup';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useRestoreBackupOnVerification } from '$hooks/useRestoreBackupOnVerification';
|
||||
import { InfoCard } from './info-card';
|
||||
|
||||
type BackupStatusProps = {
|
||||
enabled: boolean;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { TooltipProvider, Tooltip, Box, Text, Badge, toRem } from 'folds';
|
||||
|
||||
export function BetaNoticeBadge() {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { ReactNode, useCallback, useEffect } from 'react';
|
||||
import { Capabilities } from '$types/matrix-sdk';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
|
||||
type CapabilitiesLoaderProps = {
|
||||
children: (capabilities: Capabilities | undefined) => ReactNode;
|
||||
};
|
||||
export function CapabilitiesLoader({ children }: CapabilitiesLoaderProps) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const [state, load] = useAsyncCallback(useCallback(() => mx.getCapabilities(), [mx]));
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
}, [load]);
|
||||
|
||||
return children(state.status === AsyncStatus.Success ? state.data : undefined);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ReactNode, useCallback, useEffect, useState } from 'react';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { ClientConfig } from '../hooks/useClientConfig';
|
||||
import { trimTrailingSlash } from '../utils/common';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { ClientConfig } from '$hooks/useClientConfig';
|
||||
import { trimTrailingSlash } from '$utils/common';
|
||||
|
||||
const getClientConfig = async (): Promise<ClientConfig> => {
|
||||
const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ReactNode, RefObject, useCallback, useRef, useState } from 'react';
|
||||
import { useDebounce } from '../hooks/useDebounce';
|
||||
import { useDebounce } from '$hooks/useDebounce';
|
||||
|
||||
type ConfirmPasswordMatchProps = {
|
||||
initialValue: boolean;
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
VerificationPhase,
|
||||
VerificationRequest,
|
||||
Verifier,
|
||||
VerificationMethod,
|
||||
} from '$types/matrix-sdk';
|
||||
import React, { CSSProperties, useCallback, useEffect, useState } from 'react';
|
||||
import { VerificationMethod } from '$types/matrix-sdk';
|
||||
import { CSSProperties, useCallback, useEffect, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -27,9 +27,9 @@ import {
|
||||
useVerificationRequestReceived,
|
||||
useVerifierCancel,
|
||||
useVerifierShowSas,
|
||||
} from '../hooks/useVerificationRequest';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { ContainerColor } from '../styles/ContainerColor.css';
|
||||
} from '$hooks/useVerificationRequest';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { ContainerColor } from '$styles/ContainerColor.css';
|
||||
|
||||
const DialogHeaderStyles: CSSProperties = {
|
||||
padding: `0 ${config.space.S200} 0 ${config.space.S400}`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { FormEventHandler, forwardRef, useCallback, useState } from 'react';
|
||||
import { FormEventHandler, forwardRef, useCallback, useState } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
Header,
|
||||
@@ -16,14 +16,14 @@ import {
|
||||
import FileSaver from 'file-saver';
|
||||
import to from 'await-to-js';
|
||||
import { AuthDict, IAuthData, MatrixError, UIAuthCallback } from '$types/matrix-sdk';
|
||||
import { PasswordInput } from './password-input';
|
||||
import { ContainerColor } from '../styles/ContainerColor.css';
|
||||
import { copyToClipboard } from '../utils/dom';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { clearSecretStorageKeys } from '$client/secretStorageKeys';
|
||||
import { ContainerColor } from '$styles/ContainerColor.css';
|
||||
import { copyToClipboard } from '$utils/dom';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
import { PasswordInput } from './password-input';
|
||||
import { ActionUIA, ActionUIAFlowsLoader } from './ActionUIA';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { useAlive } from '../hooks/useAlive';
|
||||
import { UseStateProvider } from './UseStateProvider';
|
||||
|
||||
type UIACallback<T> = (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CryptoApi } from '$types/matrix-sdk';
|
||||
import {
|
||||
useDeviceVerificationStatus,
|
||||
VerificationStatus,
|
||||
} from '../hooks/useDeviceVerificationStatus';
|
||||
} from '$hooks/useDeviceVerificationStatus';
|
||||
|
||||
type DeviceVerificationStatusProps = {
|
||||
crypto?: CryptoApi;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Box, Button, config, Menu, PopOut, RectCords, Text } from 'folds';
|
||||
import React, { MouseEventHandler, ReactNode, useState } from 'react';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { MouseEventHandler, ReactNode, useState } from 'react';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type HexColorPickerPopOutProps = {
|
||||
children: (onOpen: MouseEventHandler<HTMLElement>, opened: boolean) => ReactNode;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { MouseEventHandler, useCallback, useMemo, useState } from 'react';
|
||||
import { MouseEventHandler, useCallback, useMemo, useState } from 'react';
|
||||
import {
|
||||
config,
|
||||
Box,
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
} from 'folds';
|
||||
import { JoinRule } from '$types/matrix-sdk';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { getRoomIconSrc } from '../utils/room';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { getRoomIconSrc } from '$utils/room';
|
||||
|
||||
export type ExtraJoinRules = 'knock_restricted';
|
||||
export type ExtendedJoinRules = JoinRule | ExtraJoinRules;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React, { forwardRef, useCallback } from 'react';
|
||||
import { forwardRef, useCallback } from 'react';
|
||||
import { Dialog, Header, config, Box, Text, Button, Spinner, color } from 'folds';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { logoutClient } from '$client/initMatrix';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { useCrossSigningActive } from '../hooks/useCrossSigning';
|
||||
import { InfoCard } from './info-card';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useCrossSigningActive } from '$hooks/useCrossSigning';
|
||||
import {
|
||||
useDeviceVerificationStatus,
|
||||
VerificationStatus,
|
||||
} from '../hooks/useDeviceVerificationStatus';
|
||||
} from '$hooks/useDeviceVerificationStatus';
|
||||
import { InfoCard } from './info-card';
|
||||
|
||||
type LogoutDialogProps = {
|
||||
handleClose: () => void;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { MouseEventHandler, ReactNode, useCallback, useState } from 'react';
|
||||
import { MouseEventHandler, ReactNode, useCallback, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Text,
|
||||
@@ -13,13 +13,13 @@ import {
|
||||
color,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { SettingTile } from './setting-tile';
|
||||
import { SecretStorageKeyContent } from '$types/matrix/accountData';
|
||||
import { SecretStorageRecoveryKey, SecretStorageRecoveryPassphrase } from './SecretStorage';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { storePrivateKey } from '$client/secretStorageKeys';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { SettingTile } from './setting-tile';
|
||||
import { SecretStorageRecoveryKey, SecretStorageRecoveryPassphrase } from './SecretStorage';
|
||||
|
||||
export enum ManualVerificationMethod {
|
||||
RecoveryPassphrase = 'passphrase',
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { ReactNode, useCallback, useEffect } from 'react';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { MediaConfig } from '../hooks/useMediaConfig';
|
||||
|
||||
type MediaConfigLoaderProps = {
|
||||
children: (mediaConfig: MediaConfig | undefined) => ReactNode;
|
||||
};
|
||||
export function MediaConfigLoader({ children }: MediaConfigLoaderProps) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const [state, load] = useAsyncCallback(useCallback(() => mx.getMediaConfig(), [mx]));
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
}, [load]);
|
||||
|
||||
return children(state.status === AsyncStatus.Success ? state.data : undefined);
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import React from 'react';
|
||||
import { config, Menu, MenuItem, Text } from 'folds';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { useMemberSortMenu } from '../hooks/useMemberSort';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useMemberSortMenu } from '$hooks/useMemberSort';
|
||||
|
||||
type MemberSortMenuProps = {
|
||||
requestClose: () => void;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import React from 'react';
|
||||
import { config, Menu, MenuItem, Text } from 'folds';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { useMembershipFilterMenu } from '../hooks/useMemberFilter';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useMembershipFilterMenu } from '$hooks/useMemberFilter';
|
||||
|
||||
type MembershipFilterMenuProps = {
|
||||
requestClose: () => void;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Modal, Overlay, OverlayBackdrop, OverlayCenter } from 'folds';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type Modal500Props = {
|
||||
requestClose: () => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
||||
import React, { FormEventHandler, MouseEventHandler, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { FormEventHandler, MouseEventHandler, useEffect, useRef, useState } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
Box,
|
||||
@@ -22,11 +22,11 @@ import {
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import FileSaver from 'file-saver';
|
||||
import * as css from './PdfViewer.css';
|
||||
import { AsyncStatus } from '$hooks/useAsyncCallback';
|
||||
import { useImageGestures } from '$hooks/useImageGestures';
|
||||
import { createPage, usePdfDocumentLoader, usePdfJSLoader } from '$plugins/pdfjs-dist';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import * as css from './PdfViewer.css';
|
||||
|
||||
export type PdfViewerProps = {
|
||||
name: string;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useMemo, useCallback } from 'react';
|
||||
import { memo, useMemo, useCallback } from 'react';
|
||||
import { MsgType } from '$types/matrix-sdk';
|
||||
import { testMatrixTo } from '$plugins/matrix-to';
|
||||
import { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import { Opts } from 'linkifyjs';
|
||||
import { config } from 'folds';
|
||||
@@ -29,7 +30,6 @@ import { Image, MediaControl, Video } from './media';
|
||||
import { ImageViewer } from './image-viewer';
|
||||
import { PdfViewer } from './Pdf-viewer';
|
||||
import { TextViewer } from './text-viewer';
|
||||
import { testMatrixTo } from '../plugins/matrix-to';
|
||||
|
||||
type RenderMessageContentProps = {
|
||||
displayName: string;
|
||||
@@ -267,4 +267,4 @@ function RenderMessageContentInternal({
|
||||
return <UnsupportedContent />;
|
||||
}
|
||||
|
||||
export const RenderMessageContent = React.memo(RenderMessageContentInternal);
|
||||
export const RenderMessageContent = memo(RenderMessageContentInternal);
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Box, config, Icon, Menu, MenuItem, PopOut, RectCords, Text } from 'folds';
|
||||
import React, { MouseEventHandler, ReactNode, useMemo, useState } from 'react';
|
||||
import { MouseEventHandler, ReactNode, useMemo, useState } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import {
|
||||
getRoomNotificationModeIcon,
|
||||
RoomNotificationMode,
|
||||
useSetRoomNotificationPreference,
|
||||
} from '../hooks/useRoomsNotificationPreferences';
|
||||
import { AsyncStatus } from '../hooks/useAsyncCallback';
|
||||
} from '$hooks/useRoomsNotificationPreferences';
|
||||
import { AsyncStatus } from '$hooks/useAsyncCallback';
|
||||
|
||||
const useRoomNotificationModes = (): RoomNotificationMode[] =>
|
||||
useMemo(
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { ReactNode, useCallback, useState } from 'react';
|
||||
import { MatrixClient, Room } from '$types/matrix-sdk';
|
||||
import { MatrixClient, Room, IHierarchyRoom } from '$types/matrix-sdk';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { IHierarchyRoom } from '$types/matrix-sdk';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { LocalRoomSummary, useLocalRoomSummary } from '../hooks/useLocalRoomSummary';
|
||||
import { AsyncState, AsyncStatus } from '../hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { LocalRoomSummary, useLocalRoomSummary } from '$hooks/useLocalRoomSummary';
|
||||
import { AsyncState, AsyncStatus } from '$hooks/useAsyncCallback';
|
||||
|
||||
export type IRoomSummary = Awaited<ReturnType<MatrixClient['getRoomSummary']>>;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ReactElement } from 'react';
|
||||
import { Unread } from '$types/matrix/room';
|
||||
import { useRoomUnread, useRoomsUnread } from '../state/hooks/unread';
|
||||
import { roomToUnreadAtom } from '../state/room/roomToUnread';
|
||||
import { useRoomUnread, useRoomsUnread } from '$state/hooks/unread';
|
||||
import { roomToUnreadAtom } from '$state/room/roomToUnread';
|
||||
|
||||
type RoomUnreadProviderProps = {
|
||||
roomId: string;
|
||||
children: (unread?: Unread) => ReactElement<any>;
|
||||
children: (unread?: Unread) => ReactElement;
|
||||
};
|
||||
export function RoomUnreadProvider({ roomId, children }: RoomUnreadProviderProps) {
|
||||
const unread = useRoomUnread(roomId, roomToUnreadAtom);
|
||||
@@ -15,7 +15,7 @@ export function RoomUnreadProvider({ roomId, children }: RoomUnreadProviderProps
|
||||
|
||||
type RoomsUnreadProviderProps = {
|
||||
rooms: string[];
|
||||
children: (unread?: Unread) => ReactElement<any>;
|
||||
children: (unread?: Unread) => ReactElement;
|
||||
};
|
||||
export function RoomsUnreadProvider({ rooms, children }: RoomsUnreadProviderProps) {
|
||||
const unread = useRoomsUnread(rooms, roomToUnreadAtom);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { FormEventHandler, useCallback } from 'react';
|
||||
import { FormEventHandler, useCallback } from 'react';
|
||||
import { Box, Text, Button, Spinner, color } from 'folds';
|
||||
import { decodeRecoveryKey, deriveRecoveryKeyFromPassphrase } from '$types/matrix-sdk';
|
||||
import { PasswordInput } from './password-input';
|
||||
import { SecretStorageKeyContent, SecretStoragePassphraseContent } from '$types/matrix/accountData';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { useAlive } from '../hooks/useAlive';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
import { PasswordInput } from './password-input';
|
||||
|
||||
type SecretStorageRecoveryPassphraseProps = {
|
||||
processing?: boolean;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { ReactNode, useCallback, useMemo } from 'react';
|
||||
import { Capabilities, validateAuthMetadata, ValidatedAuthMetadata } from '$types/matrix-sdk';
|
||||
import { AsyncStatus, useAsyncCallbackValue } from '../hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { MediaConfig } from '../hooks/useMediaConfig';
|
||||
import { promiseFulfilledResult } from '../utils/common';
|
||||
import { AsyncStatus, useAsyncCallbackValue } from '$hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { MediaConfig } from '$hooks/useMediaConfig';
|
||||
import { promiseFulfilledResult } from '$utils/common';
|
||||
import { createLogger } from '$utils/debug';
|
||||
|
||||
export type ServerConfigs = {
|
||||
capabilities?: Capabilities;
|
||||
@@ -14,6 +15,9 @@ export type ServerConfigs = {
|
||||
type ServerConfigsLoaderProps = {
|
||||
children: (configs: ServerConfigs) => ReactNode;
|
||||
};
|
||||
|
||||
const log = createLogger('ServerConfigsLoader');
|
||||
|
||||
export function ServerConfigsLoader({ children }: ServerConfigsLoaderProps) {
|
||||
const mx = useMatrixClient();
|
||||
const fallbackConfigs = useMemo(() => ({}), []);
|
||||
@@ -34,7 +38,7 @@ export function ServerConfigsLoader({ children }: ServerConfigsLoaderProps) {
|
||||
try {
|
||||
validatedAuthMetadata = validateAuthMetadata(authMetadata);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
log.error('Failed to validate auth metadata:', e);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { RoomToParents } from '$types/matrix/room';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { allRoomsAtom } from '../state/room-list/roomList';
|
||||
import { useChildDirectScopeFactory, useSpaceChildren } from '../state/hooks/roomList';
|
||||
|
||||
type SpaceChildDirectsProviderProps = {
|
||||
spaceId: string;
|
||||
mDirects: Set<string>;
|
||||
roomToParents: RoomToParents;
|
||||
children: (rooms: string[]) => ReactNode;
|
||||
};
|
||||
export function SpaceChildDirectsProvider({
|
||||
spaceId,
|
||||
roomToParents,
|
||||
mDirects,
|
||||
children,
|
||||
}: SpaceChildDirectsProviderProps) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const childDirects = useSpaceChildren(
|
||||
allRoomsAtom,
|
||||
spaceId,
|
||||
useChildDirectScopeFactory(mx, mDirects, roomToParents)
|
||||
);
|
||||
|
||||
return children(childDirects);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { RoomToParents } from '$types/matrix/room';
|
||||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { allRoomsAtom } from '../state/room-list/roomList';
|
||||
import { useChildRoomScopeFactory, useSpaceChildren } from '../state/hooks/roomList';
|
||||
|
||||
type SpaceChildRoomsProviderProps = {
|
||||
spaceId: string;
|
||||
mDirects: Set<string>;
|
||||
roomToParents: RoomToParents;
|
||||
children: (rooms: string[]) => ReactNode;
|
||||
};
|
||||
export function SpaceChildRoomsProvider({
|
||||
spaceId,
|
||||
roomToParents,
|
||||
mDirects,
|
||||
children,
|
||||
}: SpaceChildRoomsProviderProps) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const childRooms = useSpaceChildren(
|
||||
allRoomsAtom,
|
||||
spaceId,
|
||||
useChildRoomScopeFactory(mx, mDirects, roomToParents)
|
||||
);
|
||||
|
||||
return children(childRooms);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ReactNode, useCallback, useEffect, useState } from 'react';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { SpecVersions, specVersions } from '../cs-api';
|
||||
|
||||
type SpecVersionsLoaderProps = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { UIAFlow } from '$types/matrix-sdk';
|
||||
import { useSupportedUIAFlows } from '../hooks/useUIAFlows';
|
||||
import { useSupportedUIAFlows } from '$hooks/useUIAFlows';
|
||||
|
||||
export function SupportedUIAFlowsLoader({
|
||||
flows,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { motion, useMotionValue, useSpring } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { settingsAtom, RightSwipeAction } from '../state/settings';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
import { settingsAtom, RightSwipeAction } from '$state/settings';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
|
||||
interface SwipeableChatWrapperProps {
|
||||
children: ReactNode;
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import { useMotionValue, useSpring, useTransform, motion } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { ReactNode, useMemo, useState } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { config, Icon, Icons } from 'folds';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
import { RightSwipeAction, settingsAtom } from '../state/settings';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { RightSwipeAction, settingsAtom } from '$state/settings';
|
||||
|
||||
function ActiveSwipeWrapper({
|
||||
children,
|
||||
onReply,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
onReply: () => void;
|
||||
}) {
|
||||
function ActiveSwipeWrapper({ children, onReply }: { children: ReactNode; onReply: () => void }) {
|
||||
const x = useMotionValue(0);
|
||||
const springX = useSpring(x, { stiffness: 300, damping: 35 });
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
@@ -75,7 +69,7 @@ export function SwipeableMessageWrapper({
|
||||
children,
|
||||
onReply,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
children: ReactNode;
|
||||
onReply: () => void;
|
||||
}) {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
@@ -89,7 +83,7 @@ export function SwipeableMessageWrapper({
|
||||
);
|
||||
|
||||
if (!isSwipeToReplyEnabled) {
|
||||
return <>{children}</>;
|
||||
return children;
|
||||
}
|
||||
|
||||
return <ActiveSwipeWrapper onReply={onReply}>{children}</ActiveSwipeWrapper>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { motion, useMotionValue, useSpring } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { settingsAtom } from '../state/settings';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
|
||||
interface SwipeableOverlayWrapperProps {
|
||||
children: ReactNode;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import {
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Dispatch, ReactElement, SetStateAction, useState } from 'react';
|
||||
|
||||
type UseStateProviderProps<T> = {
|
||||
initial: T | (() => T);
|
||||
children: (value: T, setter: Dispatch<SetStateAction<T>>) => ReactElement<any>;
|
||||
children: (value: T, setter: Dispatch<SetStateAction<T>>) => ReactElement;
|
||||
};
|
||||
export function UseStateProvider<T>({ initial, children }: UseStateProviderProps<T>) {
|
||||
return children(...useState(initial));
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import React from 'react';
|
||||
import { Menu, PopOut, toRem } from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { useCloseUserRoomProfile, useUserRoomProfileState } from '../state/hooks/userRoomProfile';
|
||||
import { useCloseUserRoomProfile, useUserRoomProfileState } from '$state/hooks/userRoomProfile';
|
||||
import { UserRoomProfileState } from '$state/userRoomProfile';
|
||||
import { useAllJoinedRoomsSet, useGetRoom } from '$hooks/useGetRoom';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { SpaceProvider } from '$hooks/useSpace';
|
||||
import { RoomProvider } from '$hooks/useRoom';
|
||||
import { UserRoomProfile } from './user-profile';
|
||||
import { UserRoomProfileState } from '../state/userRoomProfile';
|
||||
import { useAllJoinedRoomsSet, useGetRoom } from '../hooks/useGetRoom';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { SpaceProvider } from '../hooks/useSpace';
|
||||
import { RoomProvider } from '../hooks/useRoom';
|
||||
|
||||
function UserRoomProfileContextMenu({ state }: { state: UserRoomProfileState }) {
|
||||
const { roomId, spaceId, userId, cords, position, initialProfile } = state;
|
||||
|
||||
@@ -17,20 +17,20 @@ import {
|
||||
} from 'folds';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import React, {
|
||||
import {
|
||||
ChangeEventHandler,
|
||||
KeyboardEventHandler,
|
||||
MouseEventHandler,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$appUtils/matrix';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$utils/matrix';
|
||||
import { useDirectUsers } from '$hooks/useDirectUsers';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useAsyncSearch, UseAsyncSearchOptions } from '$hooks/useAsyncSearch';
|
||||
import { highlightText, makeHighlightRegex } from '$plugins/react-custom-html-parser';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
|
||||
export const useAdditionalCreators = (defaultCreators?: string[]) => {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text, Icon, Icons, config, IconSrc } from 'folds';
|
||||
import { SequenceCard } from '../sequence-card';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { CreateRoomAccess } from './types';
|
||||
|
||||
type CreateRoomAccessSelectorProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {
|
||||
import {
|
||||
FormEventHandler,
|
||||
KeyboardEventHandler,
|
||||
useCallback,
|
||||
@@ -9,9 +9,9 @@ import React, {
|
||||
import { MatrixError } from '$types/matrix-sdk';
|
||||
import { Box, color, Icon, Icons, Input, Spinner, Text, toRem } from 'folds';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { getMxIdServer } from '$appUtils/matrix';
|
||||
import { getMxIdServer } from '$utils/matrix';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { replaceSpaceWithDash } from '$appUtils/common';
|
||||
import { replaceSpaceWithDash } from '$utils/common';
|
||||
import { AsyncState, AsyncStatus, useAsync } from '$hooks/useAsyncCallback';
|
||||
import { useDebounce } from '$hooks/useDebounce';
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text, Icon, Icons, config, IconSrc } from 'folds';
|
||||
import { SequenceCard } from '../sequence-card';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { CreateRoomType } from './types';
|
||||
|
||||
type CreateRoomTypeSelectorProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { MouseEventHandler, useState } from 'react';
|
||||
import { MouseEventHandler, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { SequenceCard } from '../sequence-card';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
|
||||
export function RoomVersionSelector({
|
||||
versions,
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
MatrixClient,
|
||||
RestrictedAllowType,
|
||||
Room,
|
||||
RoomJoinRulesEventContent,
|
||||
} from '$types/matrix-sdk';
|
||||
import { RoomJoinRulesEventContent } from '$types/matrix-sdk';
|
||||
import { RoomType, StateEvent } from '$types/matrix/room';
|
||||
import { getViaServers } from '$plugins/via-servers';
|
||||
import { getMxIdServer } from '$appUtils/matrix';
|
||||
import { getMxIdServer } from '$utils/matrix';
|
||||
import { CreateRoomAccess } from './types';
|
||||
|
||||
export const createRoomCreationContent = (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { as, ContainerColor as TContainerColor } from 'folds';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { ContainerColor } from '$styles/ContainerColor.css';
|
||||
import * as css from './CutoutCard.css';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
Box,
|
||||
@@ -16,7 +15,7 @@ import {
|
||||
color,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type DirectInvitePromptProps = {
|
||||
onCancel: () => void;
|
||||
@@ -82,9 +81,16 @@ export function DirectInvitePrompt({
|
||||
}
|
||||
aria-disabled={converting}
|
||||
>
|
||||
<Text size="B400">{converting ? 'Converting...' : 'Convert to Group Chat and Invite'}</Text>
|
||||
<Text size="B400">
|
||||
{converting ? 'Converting...' : 'Convert to Group Chat and Invite'}
|
||||
</Text>
|
||||
</Button>
|
||||
<Button variant="Warning" fill="Soft" onClick={onInviteDirect} disabled={converting}>
|
||||
<Button
|
||||
variant="Warning"
|
||||
fill="Soft"
|
||||
onClick={onInviteDirect}
|
||||
disabled={converting}
|
||||
>
|
||||
<Text size="B400">Invite to Direct Message anyway</Text>
|
||||
</Button>
|
||||
<Button variant="Secondary" fill="Soft" onClick={onCancel} disabled={converting}>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
import React, { useState } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
config,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Line,
|
||||
Modal,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
} from 'folds';
|
||||
|
||||
import { CustomEditor, useEditor } from './Editor';
|
||||
import { Toolbar } from './Toolbar';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
|
||||
export function EditorPreview() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const editor = useEditor();
|
||||
const [toolbar, setToolbar] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<IconButton variant="SurfaceVariant" onClick={() => setOpen(!open)}>
|
||||
<Icon src={Icons.BlockQuote} />
|
||||
</IconButton>
|
||||
<Overlay open={open} backdrop={<OverlayBackdrop />}>
|
||||
<OverlayCenter>
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
onDeactivate: () => setOpen(false),
|
||||
clickOutsideDeactivates: true,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Modal size="500">
|
||||
<div style={{ padding: config.space.S400 }}>
|
||||
<CustomEditor
|
||||
editor={editor}
|
||||
placeholder="Send a message..."
|
||||
before={
|
||||
<IconButton variant="SurfaceVariant" size="300" radii="300">
|
||||
<Icon src={Icons.PlusCircle} />
|
||||
</IconButton>
|
||||
}
|
||||
after={
|
||||
<>
|
||||
<IconButton
|
||||
variant="SurfaceVariant"
|
||||
size="300"
|
||||
radii="300"
|
||||
onClick={() => setToolbar(!toolbar)}
|
||||
aria-pressed={toolbar}
|
||||
>
|
||||
<Icon src={toolbar ? Icons.AlphabetUnderline : Icons.Alphabet} />
|
||||
</IconButton>
|
||||
<IconButton variant="SurfaceVariant" size="300" radii="300">
|
||||
<Icon src={Icons.Smile} />
|
||||
</IconButton>
|
||||
<IconButton variant="SurfaceVariant" size="300" radii="300">
|
||||
<Icon src={Icons.Send} />
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
bottom={
|
||||
toolbar && (
|
||||
<div>
|
||||
<Line variant="SurfaceVariant" size="300" />
|
||||
<Toolbar />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
</FocusTrap>
|
||||
</OverlayCenter>
|
||||
</Overlay>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import React, {
|
||||
import {
|
||||
ClipboardEventHandler,
|
||||
KeyboardEventHandler,
|
||||
ReactNode,
|
||||
@@ -19,12 +19,12 @@ import {
|
||||
ReactEditor,
|
||||
} from 'slate-react';
|
||||
import { withHistory } from 'slate-history';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { BlockType } from './types';
|
||||
import { RenderElement, RenderLeaf } from './Elements';
|
||||
import { CustomElement } from './slate';
|
||||
import * as css from './Editor.css';
|
||||
import { toggleKeyboardShortcut } from './keyboard';
|
||||
import { mobileOrTablet } from '$appUtils/user-agent';
|
||||
|
||||
const initialValue: CustomElement[] = [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Scroll, Text } from 'folds';
|
||||
import React from 'react';
|
||||
import {
|
||||
RenderElementProps,
|
||||
RenderLeafProps,
|
||||
@@ -10,13 +9,13 @@ import {
|
||||
import { useAtomValue } from 'jotai';
|
||||
|
||||
import * as css from '$styles/CustomHtml.css';
|
||||
import { CommandElement, EmoticonElement, LinkElement, MentionElement } from './slate';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { getBeginCommand } from './utils';
|
||||
import { BlockType } from './types';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { BlockType } from './types';
|
||||
import { getBeginCommand } from './utils';
|
||||
import { CommandElement, EmoticonElement, LinkElement, MentionElement } from './slate';
|
||||
|
||||
// Put this at the start and end of an inline component to work around this Chromium bug:
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
||||
|
||||
@@ -17,8 +17,17 @@ import {
|
||||
TooltipProvider,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import React, { MouseEventHandler, ReactNode, useState } from 'react';
|
||||
import { MouseEventHandler, ReactNode, useState } from 'react';
|
||||
import { ReactEditor, useSlate } from 'slate-react';
|
||||
import { isMacOS } from '$utils/user-agent';
|
||||
import { KeySymbol } from '$utils/key-symbol';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { floatingToolbar } from '$styles/overrides/Composer.css';
|
||||
import { HeadingLevel } from './slate';
|
||||
import { BlockType, MarkType } from './types';
|
||||
import * as css from './Editor.css';
|
||||
import {
|
||||
headingLevel,
|
||||
isAnyMarkActive,
|
||||
@@ -28,15 +37,6 @@ import {
|
||||
toggleBlock,
|
||||
toggleMark,
|
||||
} from './utils';
|
||||
import * as css from './Editor.css';
|
||||
import { BlockType, MarkType } from './types';
|
||||
import { HeadingLevel } from './slate';
|
||||
import { isMacOS } from '$appUtils/user-agent';
|
||||
import { KeySymbol } from '$appUtils/key-symbol';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { floatingToolbar } from '$styles/overrides/Composer.css';
|
||||
|
||||
function BtnTooltip({ text, shortCode }: { text: string; shortCode?: string }) {
|
||||
return (
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { Header, Menu, Scroll, config } from 'folds';
|
||||
|
||||
import * as css from './AutocompleteMenu.css';
|
||||
import { preventScrollWithArrowKey, stopPropagation } from '$appUtils/keyboard';
|
||||
import { preventScrollWithArrowKey, stopPropagation } from '$utils/keyboard';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
import * as css from './AutocompleteMenu.css';
|
||||
|
||||
type AutocompleteMenuProps = {
|
||||
requestClose: () => void;
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import React, { KeyboardEvent as ReactKeyboardEvent, useEffect, useMemo } from 'react';
|
||||
import { KeyboardEvent as ReactKeyboardEvent, useEffect, useMemo } from 'react';
|
||||
import { Editor } from 'slate';
|
||||
import { Box, MenuItem, Text, toRem } from 'folds';
|
||||
import { Room } from '$types/matrix-sdk';
|
||||
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { UseAsyncSearchOptions, useAsyncSearch } from '$hooks/useAsyncSearch';
|
||||
import { onTabPress } from '$appUtils/keyboard';
|
||||
import { createEmoticonElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { onTabPress } from '$utils/keyboard';
|
||||
import { useRecentEmoji } from '$hooks/useRecentEmoji';
|
||||
import { useRelevantImagePacks } from '$hooks/useImagePacks';
|
||||
import { IEmoji, emojis } from '$plugins/emoji';
|
||||
import { useKeyDown } from '$hooks/useKeyDown';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { ImageUsage, PackImageReader } from '$plugins/custom-emoji';
|
||||
import { getEmoticonSearchStr } from '$plugins/utils';
|
||||
import { createEmoticonElement, moveCursor, replaceWithElement } from '$components/editor/utils';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
|
||||
type EmoticonCompleteHandler = (key: string, shortcode: string) => void;
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import React, { KeyboardEvent as ReactKeyboardEvent, useCallback, useEffect } from 'react';
|
||||
import { KeyboardEvent as ReactKeyboardEvent, useCallback, useEffect } from 'react';
|
||||
import { Editor } from 'slate';
|
||||
import { Avatar, Icon, Icons, MenuItem, Text } from 'folds';
|
||||
import { JoinRule, MatrixClient } from '$types/matrix-sdk';
|
||||
import { useAtomValue } from 'jotai';
|
||||
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { getDirectRoomAvatarUrl } from '$appUtils/room';
|
||||
import { getDirectRoomAvatarUrl } from '$utils/room';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { getMxIdServer, isRoomAlias } from '$appUtils/matrix';
|
||||
import { getMxIdServer, isRoomAlias } from '$utils/matrix';
|
||||
import { UseAsyncSearchOptions, useAsyncSearch } from '$hooks/useAsyncSearch';
|
||||
import { onTabPress } from '$appUtils/keyboard';
|
||||
import { onTabPress } from '$utils/keyboard';
|
||||
import { useKeyDown } from '$hooks/useKeyDown';
|
||||
import { mDirectAtom } from '$state/mDirectList';
|
||||
import { allRoomsAtom } from '$state/room-list/roomList';
|
||||
import { factoryRoomIdByActivity } from '$appUtils/sort';
|
||||
import { factoryRoomIdByActivity } from '$utils/sort';
|
||||
import { RoomAvatar, RoomIcon } from '$components/room-avatar';
|
||||
import { getViaServers } from '$plugins/via-servers';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '$components/editor/utils';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
|
||||
type MentionAutoCompleteHandler = (roomAliasOrId: string, name: string) => void;
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import React, { useEffect, KeyboardEvent as ReactKeyboardEvent } from 'react';
|
||||
import { useEffect, KeyboardEvent as ReactKeyboardEvent } from 'react';
|
||||
import { Editor } from 'slate';
|
||||
import { Avatar, Icon, Icons, MenuItem, Text } from 'folds';
|
||||
import { MatrixClient, Room, RoomMember } from '$types/matrix-sdk';
|
||||
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { useRoomMembers } from '$hooks/useRoomMembers';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { SearchItemStrGetter, UseAsyncSearchOptions, useAsyncSearch } from '$hooks/useAsyncSearch';
|
||||
import { onTabPress } from '$appUtils/keyboard';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { onTabPress } from '$utils/keyboard';
|
||||
import { useKeyDown } from '$hooks/useKeyDown';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$appUtils/matrix';
|
||||
import { getMemberDisplayName, getMemberSearchStr } from '$appUtils/room';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$utils/matrix';
|
||||
import { getMemberDisplayName, getMemberSearchStr } from '$utils/room';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { Membership } from '$types/matrix/room';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '$components/editor/utils';
|
||||
import { AutocompleteMenu } from './AutocompleteMenu';
|
||||
import { AutocompleteQuery } from './autocompleteQuery';
|
||||
|
||||
type MentionAutoCompleteHandler = (userId: string, name: string) => void;
|
||||
|
||||
@@ -91,7 +91,7 @@ export function UserMentionAutocomplete({
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const nicknames = useAtomValue(nicknamesAtom);
|
||||
const roomId: string = room.roomId!;
|
||||
const roomId: string = room.roomId;
|
||||
const roomAliasOrId = room.getCanonicalAlias() || roomId;
|
||||
const members = useRoomMembers(mx, roomId);
|
||||
|
||||
@@ -116,6 +116,14 @@ export function UserMentionAutocomplete({
|
||||
requestClose();
|
||||
};
|
||||
|
||||
function getName(member: RoomMember) {
|
||||
return (
|
||||
getMemberDisplayName(room, member.userId, nicknames) ??
|
||||
getMxIdLocalPart(member.userId) ??
|
||||
member.userId
|
||||
);
|
||||
}
|
||||
|
||||
useKeyDown(window, (evt: KeyboardEvent) => {
|
||||
onTabPress(evt, () => {
|
||||
if (query.text === 'room') {
|
||||
@@ -132,11 +140,6 @@ export function UserMentionAutocomplete({
|
||||
});
|
||||
});
|
||||
|
||||
const getName = (member: RoomMember) =>
|
||||
getMemberDisplayName(room, member.userId, nicknames) ??
|
||||
getMxIdLocalPart(member.userId) ??
|
||||
member.userId;
|
||||
|
||||
return (
|
||||
<AutocompleteMenu headerContent={<Text size="L400">Mentions</Text>} requestClose={requestClose}>
|
||||
{query.text === 'room' && (
|
||||
|
||||
@@ -2,7 +2,14 @@ import { Descendant, Text } from 'slate';
|
||||
import parse from 'html-dom-parser';
|
||||
import { ChildNode, Element, isText, isTag } from 'domhandler';
|
||||
|
||||
import { sanitizeCustomHtml } from '$appUtils/sanitize';
|
||||
import { sanitizeCustomHtml } from '$utils/sanitize';
|
||||
import {
|
||||
parseMatrixToRoom,
|
||||
parseMatrixToRoomEvent,
|
||||
parseMatrixToUser,
|
||||
testMatrixTo,
|
||||
} from '$plugins/matrix-to';
|
||||
import { escapeMarkdownInlineSequences, escapeMarkdownBlockSequences } from '$plugins/markdown';
|
||||
import { BlockType, MarkType } from './types';
|
||||
import {
|
||||
BlockQuoteElement,
|
||||
@@ -20,13 +27,6 @@ import {
|
||||
UnorderedListElement,
|
||||
} from './slate';
|
||||
import { createEmoticonElement, createMentionElement } from './utils';
|
||||
import {
|
||||
parseMatrixToRoom,
|
||||
parseMatrixToRoomEvent,
|
||||
parseMatrixToUser,
|
||||
testMatrixTo,
|
||||
} from '$plugins/matrix-to';
|
||||
import { escapeMarkdownInlineSequences, escapeMarkdownBlockSequences } from '$plugins/markdown';
|
||||
|
||||
type ProcessTextCallback = (text: string) => string;
|
||||
|
||||
@@ -83,12 +83,7 @@ const getInlineMarkElement = (
|
||||
children.push({ text: mdSequence });
|
||||
return children;
|
||||
}
|
||||
children.forEach((child) => {
|
||||
if (Text.isText(child)) {
|
||||
child[markType] = true;
|
||||
}
|
||||
});
|
||||
return children;
|
||||
return children.map((child) => (Text.isText(child) ? { ...child, [markType]: true } : child));
|
||||
};
|
||||
|
||||
const getInlineNonMarkElement = (node: Element): MentionElement | EmoticonElement | undefined => {
|
||||
|
||||
@@ -28,7 +28,7 @@ const isHeading3 = isKeyHotkey('mod+3');
|
||||
/**
|
||||
* @return boolean true if shortcut is toggled.
|
||||
*/
|
||||
export const toggleKeyboardShortcut = (editor: Editor, event: KeyboardEvent<Element>): boolean => {
|
||||
export const toggleKeyboardShortcut = (editor: Editor, event: KeyboardEvent): boolean => {
|
||||
if (isKeyHotkey('backspace', event) && editor.selection && Range.isCollapsed(editor.selection)) {
|
||||
const startPoint = Range.start(editor.selection);
|
||||
if (startPoint.offset !== 0) return false;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { Descendant, Editor, Text } from 'slate';
|
||||
import { MatrixClient } from '$types/matrix-sdk';
|
||||
import { sanitizeText } from '$appUtils/sanitize';
|
||||
import { BlockType } from './types';
|
||||
import { CustomElement } from './slate';
|
||||
import { sanitizeText } from '$utils/sanitize';
|
||||
import {
|
||||
parseBlockMD,
|
||||
parseInlineMD,
|
||||
unescapeMarkdownBlockSequences,
|
||||
unescapeMarkdownInlineSequences,
|
||||
} from '$plugins/markdown';
|
||||
import { findAndReplace } from '$appUtils/findAndReplace';
|
||||
import { sanitizeForRegex } from '$appUtils/regex';
|
||||
import { getCanonicalAliasOrRoomId, isUserId } from '$appUtils/matrix';
|
||||
import { findAndReplace } from '$utils/findAndReplace';
|
||||
import { sanitizeForRegex } from '$utils/regex';
|
||||
import { isUserId } from '$utils/matrix';
|
||||
import { CustomElement } from './slate';
|
||||
import { BlockType } from './types';
|
||||
|
||||
export type OutputOptions = {
|
||||
allowTextFormatting?: boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {
|
||||
import {
|
||||
ChangeEventHandler,
|
||||
FocusEventHandler,
|
||||
MouseEventHandler,
|
||||
@@ -16,14 +16,12 @@ import { Room } from '$types/matrix-sdk';
|
||||
import { atom, PrimitiveAtom, useAtom, useSetAtom } from 'jotai';
|
||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||
import { IEmoji, emojiGroups, emojis } from '$plugins/emoji';
|
||||
import { useEmojiGroupLabels } from './useEmojiGroupLabels';
|
||||
import { useEmojiGroupIcons } from './useEmojiGroupIcons';
|
||||
import { preventScrollWithArrowKey, stopPropagation } from '$appUtils/keyboard';
|
||||
import { preventScrollWithArrowKey, stopPropagation } from '$utils/keyboard';
|
||||
import { useRelevantImagePacks } from '$hooks/useImagePacks';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useRecentEmoji } from '$hooks/useRecentEmoji';
|
||||
import { isUserId, mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { editableActiveElement, targetFromEvent } from '$appUtils/dom';
|
||||
import { isUserId, mxcUrlToHttp } from '$utils/matrix';
|
||||
import { editableActiveElement, targetFromEvent } from '$utils/dom';
|
||||
import { useAsyncSearch, UseAsyncSearchOptions } from '$hooks/useAsyncSearch';
|
||||
import { useDebounce } from '$hooks/useDebounce';
|
||||
import { useThrottle } from '$hooks/useThrottle';
|
||||
@@ -31,6 +29,9 @@ import { addRecentEmoji } from '$plugins/recent-emoji';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { ImagePack, ImageUsage, PackImageReader } from '$plugins/custom-emoji';
|
||||
import { getEmoticonSearchStr } from '$plugins/utils';
|
||||
import { VirtualTile } from '$components/virtualizer';
|
||||
import { useEmojiGroupIcons } from './useEmojiGroupIcons';
|
||||
import { useEmojiGroupLabels } from './useEmojiGroupLabels';
|
||||
import {
|
||||
SearchInput,
|
||||
EmojiBoardTabs,
|
||||
@@ -51,7 +52,6 @@ import {
|
||||
EmojiBoardLayout,
|
||||
} from './components';
|
||||
import { EmojiBoardTab, EmojiType } from './types';
|
||||
import { VirtualTile } from '../virtualizer';
|
||||
|
||||
const RECENT_GROUP_ID = 'recent_group';
|
||||
const SEARCH_GROUP_ID = 'search_group';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { as, Box, Text } from 'folds';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import * as css from './styles.css';
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { Box } from 'folds';
|
||||
import { MatrixClient } from '$types/matrix-sdk';
|
||||
import { EmojiItemInfo, EmojiType } from '../types';
|
||||
import * as css from './styles.css';
|
||||
import { PackImageReader } from '$plugins/custom-emoji';
|
||||
import { IEmoji } from '$plugins/emoji';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { EmojiItemInfo, EmojiType } from '$components/emoji-board/types';
|
||||
import * as css from './styles.css';
|
||||
|
||||
export const getEmojiItemInfo = (element: Element): EmojiItemInfo | undefined => {
|
||||
const label = element.getAttribute('title');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { as, Box, Line } from 'folds';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import * as css from './styles.css';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Box, toRem, config, Icons, Icon, Text } from 'folds';
|
||||
|
||||
export function NoStickerPacks() {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Box, Text } from 'folds';
|
||||
import React from 'react';
|
||||
import { Atom, atom, useAtomValue } from 'jotai';
|
||||
import * as css from './styles.css';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import * as css from './styles.css';
|
||||
|
||||
export type PreviewData = {
|
||||
key: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { ChangeEventHandler, useRef } from 'react';
|
||||
import { ChangeEventHandler, useRef } from 'react';
|
||||
import { Input, Chip, Icon, Icons, Text } from 'folds';
|
||||
import { mobileOrTablet } from '$appUtils/user-agent';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
|
||||
type SearchInputProps = {
|
||||
query?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Scroll,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { CSSProperties } from 'react';
|
||||
import { CSSProperties } from 'react';
|
||||
import { Badge, Box, Text } from 'folds';
|
||||
import { EmojiBoardTab } from '../types';
|
||||
import { EmojiBoardTab } from '$components/emoji-board/types';
|
||||
|
||||
const styles: CSSProperties = {
|
||||
cursor: 'pointer',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
Avatar,
|
||||
@@ -15,17 +14,17 @@ import {
|
||||
} from 'folds';
|
||||
import { Room } from '$types/matrix-sdk';
|
||||
import { useRoomEventReaders } from '$hooks/useRoomEventReaders';
|
||||
import { getMemberDisplayName } from '$appUtils/room';
|
||||
import { getMxIdLocalPart } from '$appUtils/matrix';
|
||||
import * as css from './EventReaders.css';
|
||||
import { getMemberDisplayName } from '$utils/room';
|
||||
import { getMxIdLocalPart } from '$utils/matrix';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { UserAvatar } from '../user-avatar';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { useOpenUserRoomProfile } from '$state/hooks/userRoomProfile';
|
||||
import { useSpaceOptionally } from '$hooks/useSpace';
|
||||
import { getMouseEventCords } from '$appUtils/dom';
|
||||
import { getMouseEventCords } from '$utils/dom';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import * as css from './EventReaders.css';
|
||||
|
||||
export type EventReadersProps = {
|
||||
room: Room;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
|
||||
import * as css from './ImageEditor.css';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { as, Box, Text, config, Button, Menu, Spinner } from 'folds';
|
||||
import {
|
||||
ImagePack,
|
||||
@@ -10,20 +10,20 @@ import {
|
||||
PackMetaReader,
|
||||
} from '$plugins/custom-emoji';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { SequenceCard } from '../sequence-card';
|
||||
import { useFilePicker } from '$hooks/useFilePicker';
|
||||
import { UploadSuccess } from '$state/upload';
|
||||
import { getImageInfo, TUploadContent } from '$utils/matrix';
|
||||
import { getImageFileUrl, loadImageElement, renameFile } from '$utils/dom';
|
||||
import { replaceSpaceWithDash, suffixRename } from '$utils/common';
|
||||
import { getFileNameWithoutExt } from '$utils/mimeTypes';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { CompactUploadCardRenderer } from '$components/upload-card';
|
||||
import { ImageTile, ImageTileEdit, ImageTileUpload } from './ImageTile';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { UsageSwitcher } from './UsageSwitcher';
|
||||
import { ImagePackProfile, ImagePackProfileEdit } from './PackMeta';
|
||||
import * as css from './style.css';
|
||||
import { useFilePicker } from '$hooks/useFilePicker';
|
||||
import { CompactUploadCardRenderer } from '../upload-card';
|
||||
import { UploadSuccess } from '$state/upload';
|
||||
import { getImageInfo, TUploadContent } from '$appUtils/matrix';
|
||||
import { getImageFileUrl, loadImageElement, renameFile } from '$appUtils/dom';
|
||||
import { replaceSpaceWithDash, suffixRename } from '$appUtils/common';
|
||||
import { getFileNameWithoutExt } from '$appUtils/mimeTypes';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
|
||||
export type ImagePackContentProps = {
|
||||
imagePack: ImagePack;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Box, IconButton, Text, Icon, Icons, Scroll, Chip } from 'folds';
|
||||
import { PackAddress } from '$plugins/custom-emoji';
|
||||
import { Page, PageHeader, PageContent } from '../page';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { Page, PageHeader, PageContent } from '$components/page';
|
||||
import { RoomImagePack } from './RoomImagePack';
|
||||
import { UserImagePack } from './UserImagePack';
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React, { FormEventHandler, ReactNode, useMemo, useState } from 'react';
|
||||
import { FormEventHandler, ReactNode, useMemo, useState } from 'react';
|
||||
import { Badge, Box, Button, Chip, Icon, Icons, Input, Text } from 'folds';
|
||||
import { UsageSwitcher, useUsageStr } from './UsageSwitcher';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import * as css from './style.css';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { ImageUsage, imageUsageEqual, PackImageReader } from '$plugins/custom-emoji';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { SettingTile } from '../setting-tile';
|
||||
import { useObjectURL } from '$hooks/useObjectURL';
|
||||
import { createUploadAtom, TUploadAtom } from '$state/upload';
|
||||
import { replaceSpaceWithDash } from '$appUtils/common';
|
||||
import { replaceSpaceWithDash } from '$utils/common';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import * as css from './style.css';
|
||||
import { UsageSwitcher, useUsageStr } from './UsageSwitcher';
|
||||
|
||||
type ImageTileProps = {
|
||||
defaultShortcode: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { FormEventHandler, useCallback, useMemo, useState } from 'react';
|
||||
import { FormEventHandler, useCallback, useMemo, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Text,
|
||||
@@ -13,18 +13,18 @@ import {
|
||||
Chip,
|
||||
} from 'folds';
|
||||
import Linkify from 'linkify-react';
|
||||
import { mxcUrlToHttp } from '$appUtils/matrix';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { nameInitials } from '$appUtils/common';
|
||||
import { nameInitials } from '$utils/common';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
import { LINKIFY_OPTS } from '$plugins/react-custom-html-parser';
|
||||
import { ContainerColor } from '$styles/ContainerColor.css';
|
||||
import { useFilePicker } from '$hooks/useFilePicker';
|
||||
import { useObjectURL } from '$hooks/useObjectURL';
|
||||
import { createUploadAtom, UploadSuccess } from '$state/upload';
|
||||
import { CompactUploadCardRenderer } from '../upload-card';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { PackMetaReader } from '$plugins/custom-emoji';
|
||||
import { CompactUploadCardRenderer } from '$components/upload-card';
|
||||
|
||||
type ImagePackAvatarProps = {
|
||||
url?: string;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { Room } from '$types/matrix-sdk';
|
||||
import { usePowerLevels } from '$hooks/usePowerLevels';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { ImagePackContent } from './ImagePackContent';
|
||||
import { ImagePack, PackContent } from '$plugins/custom-emoji';
|
||||
import { StateEvent } from '$types/matrix/room';
|
||||
import { useRoomImagePack } from '$hooks/useImagePacks';
|
||||
import { randomStr } from '$appUtils/common';
|
||||
import { randomStr } from '$utils/common';
|
||||
import { useRoomPermissions } from '$hooks/useRoomPermissions';
|
||||
import { useRoomCreators } from '$hooks/useRoomCreators';
|
||||
import { ImagePackContent } from './ImagePackContent';
|
||||
|
||||
type RoomImagePackProps = {
|
||||
room: Room;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React, { MouseEventHandler, useMemo, useState } from 'react';
|
||||
import { MouseEventHandler, useMemo, useState } from 'react';
|
||||
import { Box, Button, config, Icon, Icons, Menu, MenuItem, PopOut, RectCords, Text } from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { ImageUsage } from '$plugins/custom-emoji';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
export const useUsageStr = (): ((usage: ImageUsage[]) => string) => {
|
||||
const getUsageStr = (usage: ImageUsage[]): string => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { ImagePackContent } from './ImagePackContent';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { ImagePack, PackContent } from '$plugins/custom-emoji';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AccountDataEvent } from '$types/matrix/accountData';
|
||||
import { useUserImagePack } from '$hooks/useImagePacks';
|
||||
import { ImagePackContent } from './ImagePackContent';
|
||||
|
||||
export function UserImagePack() {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
||||
import React, { useEffect } from 'react';
|
||||
import { WheelEvent } from 'react';
|
||||
import FileSaver from 'file-saver';
|
||||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
|
||||
import * as css from './ImageViewer.css';
|
||||
import { useImageGestures } from '$hooks/useImageGestures';
|
||||
import { downloadMedia } from '$appUtils/matrix';
|
||||
import { downloadMedia } from '$utils/matrix';
|
||||
import * as css from './ImageViewer.css';
|
||||
|
||||
export type ImageViewerProps = {
|
||||
alt: string;
|
||||
@@ -25,7 +24,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
FileSaver.saveAs(fileContent, alt);
|
||||
};
|
||||
|
||||
const handleWheel = (e: React.WheelEvent) => {
|
||||
const handleWheel = (e: WheelEvent) => {
|
||||
if (e.deltaY < 0) zoomIn();
|
||||
else zoomOut();
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Box, ContainerColor, Text } from 'folds';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
import { ContainerColor as ContainerClr } from '$styles/ContainerColor.css';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {
|
||||
import {
|
||||
ChangeEventHandler,
|
||||
FormEventHandler,
|
||||
KeyboardEventHandler,
|
||||
@@ -32,9 +32,9 @@ import {
|
||||
import { Room } from '$types/matrix-sdk';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useDirectUsers } from '$hooks/useDirectUsers';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$appUtils/matrix';
|
||||
import { getMxIdLocalPart, getMxIdServer, isUserId } from '$utils/matrix';
|
||||
import { Membership } from '$types/matrix/room';
|
||||
import { useAsyncSearch, UseAsyncSearchOptions } from '$hooks/useAsyncSearch';
|
||||
import { highlightText, makeHighlightRegex } from '$plugins/react-custom-html-parser';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { FormEventHandler, useState } from 'react';
|
||||
import { FormEventHandler, useState } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
Dialog,
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
Input,
|
||||
color,
|
||||
} from 'folds';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { isRoomAlias, isRoomId } from '$appUtils/matrix';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { isRoomAlias, isRoomId } from '$utils/matrix';
|
||||
import { parseMatrixToRoom, parseMatrixToRoomEvent, testMatrixTo } from '$plugins/matrix-to';
|
||||
|
||||
type JoinAddressProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
Dialog,
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { MatrixError } from '$types/matrix-sdk';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type LeaveRoomPromptProps = {
|
||||
roomId: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import {
|
||||
Dialog,
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { MatrixError } from '$types/matrix-sdk';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { stopPropagation } from '$appUtils/keyboard';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type LeaveSpacePromptProps = {
|
||||
roomId: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ImgHTMLAttributes, forwardRef } from 'react';
|
||||
import { ImgHTMLAttributes, forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import * as css from './media.css';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { Box, as } from 'folds';
|
||||
|
||||
export type MediaControlProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { VideoHTMLAttributes, forwardRef } from 'react';
|
||||
import { VideoHTMLAttributes, forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import * as css from './media.css';
|
||||
|
||||
|
||||
Loaded 100 of 476 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user