forked from Mirrors/elk
Compare commits
6 commits
main
...
userquin/f
Author | SHA1 | Date | |
---|---|---|---|
|
55e855181d | ||
|
3f3cb16979 | ||
|
0cfd6a1d33 | ||
|
40b472ce9d | ||
|
44d0e9c300 | ||
|
059502f3e2 |
307 changed files with 7721 additions and 12243 deletions
|
@ -11,6 +11,7 @@ dist
|
||||||
.netlify/
|
.netlify/
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
|
public/shiki
|
||||||
public/emojis
|
public/emojis
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
|
|
@ -8,7 +8,7 @@ NUXT_CLOUDFLARE_ACCOUNT_ID=
|
||||||
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
||||||
NUXT_CLOUDFLARE_API_TOKEN=
|
NUXT_CLOUDFLARE_API_TOKEN=
|
||||||
|
|
||||||
# 'cloudflare' | 'vercel' | 'fs'
|
# 'cloudflare' | 'fs'
|
||||||
NUXT_STORAGE_DRIVER=
|
NUXT_STORAGE_DRIVER=
|
||||||
NUXT_STORAGE_FS_BASE=
|
NUXT_STORAGE_FS_BASE=
|
||||||
|
|
||||||
|
|
15
.eslintignore
Normal file
15
.eslintignore
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
*.css
|
||||||
|
*.png
|
||||||
|
*.ico
|
||||||
|
*.toml
|
||||||
|
*.patch
|
||||||
|
*.txt
|
||||||
|
Dockerfile
|
||||||
|
public/
|
||||||
|
public-dev/
|
||||||
|
public-staging/
|
||||||
|
https-dev-config/localhost.crt
|
||||||
|
https-dev-config/localhost.key
|
||||||
|
Dockerfile
|
||||||
|
elk-translation-status.json
|
||||||
|
docs/translation-status.json
|
19
.eslintrc
Normal file
19
.eslintrc
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"extends": "@antfu",
|
||||||
|
"ignorePatterns": ["!pages/public"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["locales/**.json"],
|
||||||
|
"rules": {
|
||||||
|
"jsonc/sort-keys": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"vue/no-restricted-syntax":["error", {
|
||||||
|
"selector": "VElement[name='a']",
|
||||||
|
"message": "Use NuxtLink instead."
|
||||||
|
}],
|
||||||
|
"n/prefer-global/process": "off"
|
||||||
|
}
|
||||||
|
}
|
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +0,0 @@
|
||||||
* text=auto eol=lf
|
|
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -2,4 +2,4 @@
|
||||||
name: 🚀 New feature proposal
|
name: 🚀 New feature proposal
|
||||||
about: Propose a new feature
|
about: Propose a new feature
|
||||||
labels: 's: pending triage'
|
labels: 's: pending triage'
|
||||||
---
|
---
|
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -17,11 +17,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 18
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: 📦 Install dependencies
|
- name: 📦 Install dependencies
|
||||||
|
@ -31,8 +31,7 @@ jobs:
|
||||||
run: pnpm nuxi prepare
|
run: pnpm nuxi prepare
|
||||||
|
|
||||||
- name: 🧪 Test project
|
- name: 🧪 Test project
|
||||||
run: pnpm test:ci
|
run: pnpm test tests/unit
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
- name: 📝 Lint
|
- name: 📝 Lint
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|
14
.github/workflows/docker.yml
vendored
14
.github/workflows/docker.yml
vendored
|
@ -16,29 +16,29 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: metal
|
id: metal
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.metal.outputs.tags }}
|
tags: ${{ steps.metal.outputs.tags }}
|
||||||
labels: ${{ steps.metal.outputs.labels }}
|
labels: ${{ steps.metal.outputs.labels }}
|
||||||
|
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -12,12 +12,12 @@ jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set node
|
- name: Set node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
|
|
||||||
|
|
2
.github/workflows/semantic-pull-request.yml
vendored
2
.github/workflows/semantic-pull-request.yml
vendored
|
@ -19,6 +19,6 @@ jobs:
|
||||||
name: Semantic Pull Request
|
name: Semantic Pull Request
|
||||||
steps:
|
steps:
|
||||||
- name: Validate PR title
|
- name: Validate PR title
|
||||||
uses: amannn/action-semantic-pull-request@v5.4.0
|
uses: amannn/action-semantic-pull-request@v5.2.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,7 +2,6 @@ node_modules
|
||||||
*.log
|
*.log
|
||||||
dist
|
dist
|
||||||
.output
|
.output
|
||||||
.pnpm-store
|
|
||||||
.nuxt
|
.nuxt
|
||||||
.env
|
.env
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@ -12,6 +11,7 @@ dist
|
||||||
.eslintcache
|
.eslintcache
|
||||||
elk-translation-status.json
|
elk-translation-status.json
|
||||||
|
|
||||||
|
public/shiki
|
||||||
public/emojis
|
public/emojis
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
||||||
20
|
18
|
45
.vscode/settings.json
vendored
45
.vscode/settings.json
vendored
|
@ -5,6 +5,10 @@
|
||||||
"unmute",
|
"unmute",
|
||||||
"unstorage"
|
"unstorage"
|
||||||
],
|
],
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": false,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.css": "postcss"
|
"*.css": "postcss"
|
||||||
},
|
},
|
||||||
|
@ -19,44 +23,7 @@
|
||||||
"i18n-ally.preferredDelimiter": "_",
|
"i18n-ally.preferredDelimiter": "_",
|
||||||
"i18n-ally.sortKeys": true,
|
"i18n-ally.sortKeys": true,
|
||||||
"i18n-ally.sourceLanguage": "en",
|
"i18n-ally.sourceLanguage": "en",
|
||||||
|
|
||||||
// Enable the ESlint flat config support
|
|
||||||
"eslint.experimental.useFlatConfig": true,
|
|
||||||
|
|
||||||
// Disable the default formatter, use eslint instead
|
|
||||||
"prettier.enable": false,
|
"prettier.enable": false,
|
||||||
"editor.formatOnSave": false,
|
"volar.completion.preferredTagNameCase": "pascal",
|
||||||
|
"volar.completion.preferredAttrNameCase": "kebab"
|
||||||
// Auto fix
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.fixAll": "explicit",
|
|
||||||
"source.organizeImports": "never"
|
|
||||||
},
|
|
||||||
|
|
||||||
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
||||||
"eslint.rules.customizations": [
|
|
||||||
{ "rule": "style/*", "severity": "off" },
|
|
||||||
{ "rule": "*-indent", "severity": "off" },
|
|
||||||
{ "rule": "*-spacing", "severity": "off" },
|
|
||||||
{ "rule": "*-spaces", "severity": "off" },
|
|
||||||
{ "rule": "*-order", "severity": "off" },
|
|
||||||
{ "rule": "*-dangle", "severity": "off" },
|
|
||||||
{ "rule": "*-newline", "severity": "off" },
|
|
||||||
{ "rule": "*quotes", "severity": "off" },
|
|
||||||
{ "rule": "*semi", "severity": "off" }
|
|
||||||
],
|
|
||||||
|
|
||||||
// Enable eslint for all supported languages
|
|
||||||
"eslint.validate": [
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"typescript",
|
|
||||||
"typescriptreact",
|
|
||||||
"vue",
|
|
||||||
"html",
|
|
||||||
"markdown",
|
|
||||||
"json",
|
|
||||||
"jsonc",
|
|
||||||
"yaml"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
steps:
|
|
||||||
- name: build docker
|
|
||||||
image: docker:25-cli
|
|
||||||
secrets: [user, pass]
|
|
||||||
commands:
|
|
||||||
- apk add git
|
|
||||||
- REPO=$(echo "$CI_REPO" | tr '[:upper:]' '[:lower:]')
|
|
||||||
- REGISTRY="dev.cat-enby.club"
|
|
||||||
- MAJOR=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 1 | tr -d 'v')
|
|
||||||
- MINOR=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 2)
|
|
||||||
- PATCH=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 3 | cut -d '-' -f 1)
|
|
||||||
- docker buildx build -t $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR:-0}.$${PATCH-0} -t $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR} -t $${REGISTRY}/$$REPO:v$${MAJOR:-0} -t $${REGISTRY}/$$REPO:latest .
|
|
||||||
- docker login --username $USER --password $PASS $${REGISTRY}
|
|
||||||
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR:-0}.$${PATCH-0}
|
|
||||||
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR}
|
|
||||||
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}
|
|
||||||
- docker push $${REGISTRY}/$${REPO}:latest
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
when:
|
|
||||||
- repo: nikurasu:elk-test-ci
|
|
||||||
- event: tag
|
|
|
@ -8,7 +8,7 @@ For guidelines on contributing to the documentation, refer to the [docs README](
|
||||||
|
|
||||||
### Online
|
### Online
|
||||||
|
|
||||||
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
||||||
|
|
||||||
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ To develop and test the Elk package:
|
||||||
2. Ensure using the latest Node.js (16.x).
|
2. Ensure using the latest Node.js (16.x).
|
||||||
If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version.
|
If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version.
|
||||||
|
|
||||||
|
|
||||||
3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v7. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command)
|
3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v7. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command)
|
||||||
|
|
||||||
4. Check out a branch where you can work and commit your changes:
|
4. Check out a branch where you can work and commit your changes:
|
||||||
|
@ -83,7 +84,7 @@ Simple approach used by most websites of relying on direction set in HTML elemen
|
||||||
We've added some `UnoCSS` utilities styles to help you with that:
|
We've added some `UnoCSS` utilities styles to help you with that:
|
||||||
- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin.
|
- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin.
|
||||||
- Do not use `rtl-` classes, such as `rtl-left-0`.
|
- Do not use `rtl-` classes, such as `rtl-left-0`.
|
||||||
- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception to the rule above. For icons inside the timeline, it might not work as expected.
|
- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception from the rule above. For icons inside the timeline, it might not work as expected.
|
||||||
- For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`.
|
- For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`.
|
||||||
- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`.
|
- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`.
|
||||||
- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`.
|
- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`.
|
||||||
|
|
16
README.md
16
README.md
|
@ -39,8 +39,8 @@ The Elk team maintains a deployment at:
|
||||||
|
|
||||||
### Self-Host Docker Deployment
|
### Self-Host Docker Deployment
|
||||||
|
|
||||||
In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly if the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself.
|
In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly if the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself.
|
||||||
One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc.
|
One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc.
|
||||||
|
|
||||||
1. checkout source ```git clone https://github.com/elk-zone/elk.git```
|
1. checkout source ```git clone https://github.com/elk-zone/elk.git```
|
||||||
1. got into new source dir: ```cd elk```
|
1. got into new source dir: ```cd elk```
|
||||||
|
@ -49,8 +49,8 @@ One could put Elk behind popular reverse proxies with SSL Handling like Traefik,
|
||||||
1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage```
|
1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage```
|
||||||
1. start container: ```docker-compose up -d```
|
1. start container: ```docker-compose up -d```
|
||||||
|
|
||||||
> [!NOTE]
|
Note: The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container.
|
||||||
> The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container.
|
|
||||||
|
|
||||||
### Ecosystem
|
### Ecosystem
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ We're really excited that you're interested in contributing to Elk! Before submi
|
||||||
|
|
||||||
### Online
|
### Online
|
||||||
|
|
||||||
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
||||||
|
|
||||||
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
||||||
|
|
||||||
|
@ -151,14 +151,14 @@ You can consult the [PWA documentation](https://docs.elk.zone/pwa) to learn more
|
||||||
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
||||||
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
||||||
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
||||||
- [shiki](https://shiki.style/) - A beautiful yet powerful syntax highlighter
|
- [shiki](https://shiki.matsu.io/) - A beautiful Syntax Highlighter
|
||||||
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API
|
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API
|
||||||
|
|
||||||
## 👨💻 Contributors
|
## 👨💻 Contributors
|
||||||
|
|
||||||
<a href="https://github.com/elk-zone/elk/graphs/contributors">
|
<a href="https://github.com/elk-zone/elk/graphs/contributors">
|
||||||
<img src="https://contrib.rocks/image?repo=elk-zone/elk" />
|
<img src="https://contrib.rocks/image?repo=elk-zone/elk" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
||||||
|
|
6
app.vue
6
app.vue
|
@ -4,12 +4,10 @@ provideGlobalCommands()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
if (import.meta.server && !route.path.startsWith('/settings')) {
|
if (process.server && !route.path.startsWith('/settings')) {
|
||||||
const url = useRequestURL()
|
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
meta: [
|
meta: [
|
||||||
{ property: 'og:url', content: `${url.origin}${route.path}` },
|
{ property: 'og:url', content: `https://elk.zone${route.path}` },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ defineProps<{
|
||||||
square?: boolean
|
square?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const loaded = ref(false)
|
const loaded = $ref(false)
|
||||||
const error = ref(false)
|
const error = $ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -5,7 +5,7 @@ defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const { account, as = 'div' } = defineProps<{
|
const { account, as = 'div' } = $defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
as?: string
|
as?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
|
@ -10,36 +10,35 @@ const { account, command, context, ...props } = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const isSelf = useSelfAccount(() => account)
|
const isSelf = $(useSelfAccount(() => account))
|
||||||
const enable = computed(() => !isSelf.value && currentUser.value)
|
const enable = $computed(() => !isSelf && currentUser.value)
|
||||||
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
const relationship = $computed(() => props.relationship || useRelationship(account).value)
|
||||||
const isLoading = computed(() => relationship.value === undefined)
|
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
async function unblock() {
|
async function unblock() {
|
||||||
relationship.value!.blocking = false
|
relationship!.blocking = false
|
||||||
try {
|
try {
|
||||||
const newRel = await client.value.v1.accounts.$select(account.id).unblock()
|
const newRel = await client.v1.accounts.unblock(account.id)
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship.value!.blocking = true
|
relationship!.blocking = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unmute() {
|
async function unmute() {
|
||||||
relationship.value!.muting = false
|
relationship!.muting = false
|
||||||
try {
|
try {
|
||||||
const newRel = await client.value.v1.accounts.$select(account.id).unmute()
|
const newRel = await client.v1.accounts.unmute(account.id)
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship.value!.muting = true
|
relationship!.muting = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,25 +46,21 @@ useCommand({
|
||||||
scope: 'Actions',
|
scope: 'Actions',
|
||||||
order: -2,
|
order: -2,
|
||||||
visible: () => command && enable,
|
visible: () => command && enable,
|
||||||
name: () => `${relationship.value?.following ? t('account.unfollow') : t('account.follow')} ${getShortHandle(account)}`,
|
name: () => `${relationship?.following ? t('account.unfollow') : t('account.follow')} ${getShortHandle(account)}`,
|
||||||
icon: 'i-ri:star-line',
|
icon: 'i-ri:star-line',
|
||||||
onActivate: () => toggleFollowAccount(relationship.value!, account),
|
onActivate: () => toggleFollowAccount(relationship!, account),
|
||||||
})
|
})
|
||||||
|
|
||||||
const buttonStyle = computed(() => {
|
const buttonStyle = $computed(() => {
|
||||||
if (relationship.value?.blocking)
|
if (relationship?.blocking)
|
||||||
return 'text-inverted bg-red border-red'
|
return 'text-inverted bg-red border-red'
|
||||||
|
|
||||||
if (relationship.value?.muting)
|
if (relationship?.muting)
|
||||||
return 'text-base bg-card border-base'
|
return 'text-base bg-card border-base'
|
||||||
|
|
||||||
// If following, use a label style with a strong border for Mutuals
|
// If following, use a label style with a strong border for Mutuals
|
||||||
if (relationship.value ? relationship.value.following : context === 'following')
|
if (relationship ? relationship.following : context === 'following')
|
||||||
return `text-base ${relationship.value?.followedBy ? 'border-strong' : 'border-base'}`
|
return `text-base ${relationship?.followedBy ? 'border-strong' : 'border-base'}`
|
||||||
|
|
||||||
// If loading, use a plain style
|
|
||||||
if (isLoading.value)
|
|
||||||
return 'text-base border-base'
|
|
||||||
|
|
||||||
// If not following, use a button style
|
// If not following, use a button style
|
||||||
return 'text-inverted bg-primary border-primary'
|
return 'text-inverted bg-primary border-primary'
|
||||||
|
@ -82,33 +77,28 @@ const buttonStyle = computed(() => {
|
||||||
:hover="!relationship?.blocking && !relationship?.muting && relationship?.following ? 'border-red text-red' : 'bg-base border-primary text-primary'"
|
:hover="!relationship?.blocking && !relationship?.muting && relationship?.following ? 'border-red text-red' : 'bg-base border-primary text-primary'"
|
||||||
@click="relationship?.blocking ? unblock() : relationship?.muting ? unmute() : toggleFollowAccount(relationship!, account)"
|
@click="relationship?.blocking ? unblock() : relationship?.muting ? unmute() : toggleFollowAccount(relationship!, account)"
|
||||||
>
|
>
|
||||||
<template v-if="isLoading">
|
<template v-if="relationship?.blocking">
|
||||||
<span i-svg-spinners-180-ring-with-bg />
|
<span elk-group-hover="hidden">{{ $t('account.blocking') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unblock') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="relationship?.muting">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.muting') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unmute') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.following : context === 'following'">
|
||||||
|
<span elk-group-hover="hidden">{{ relationship?.followedBy ? $t('account.mutuals') : $t('account.following') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unfollow') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship?.requested">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follow_requested') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.withdraw_follow_request') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.followedBy : context === 'followedBy'">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follows_you') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ account.locked ? $t('account.request_follow') : $t('account.follow_back') }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="relationship?.blocking">
|
<span>{{ account.locked ? $t('account.request_follow') : $t('account.follow') }}</span>
|
||||||
<span elk-group-hover="hidden">{{ $t('account.blocking') }}</span>
|
|
||||||
<span hidden elk-group-hover="inline">{{ $t('account.unblock') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-if="relationship?.muting">
|
|
||||||
<span elk-group-hover="hidden">{{ $t('account.muting') }}</span>
|
|
||||||
<span hidden elk-group-hover="inline">{{ $t('account.unmute') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship ? relationship.following : context === 'following'">
|
|
||||||
<span elk-group-hover="hidden">{{ relationship?.followedBy ? $t('account.mutuals') : $t('account.following') }}</span>
|
|
||||||
<span hidden elk-group-hover="inline">{{ $t('account.unfollow') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship?.requested">
|
|
||||||
<span elk-group-hover="hidden">{{ $t('account.follow_requested') }}</span>
|
|
||||||
<span hidden elk-group-hover="inline">{{ $t('account.withdraw_follow_request') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship ? relationship.followedBy : context === 'followedBy'">
|
|
||||||
<span elk-group-hover="hidden">{{ $t('account.follows_you') }}</span>
|
|
||||||
<span hidden elk-group-hover="inline">{{ account.locked ? $t('account.request_follow') : $t('account.follow_back') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<span>{{ account.locked ? $t('account.request_follow') : $t('account.follow') }}</span>
|
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,32 +5,32 @@ const { account, ...props } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
relationship?: mastodon.v1.Relationship
|
relationship?: mastodon.v1.Relationship
|
||||||
}>()
|
}>()
|
||||||
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
const relationship = $computed(() => props.relationship || useRelationship(account).value)
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
async function authorizeFollowRequest() {
|
async function authorizeFollowRequest() {
|
||||||
relationship.value!.requestedBy = false
|
relationship!.requestedBy = false
|
||||||
relationship.value!.followedBy = true
|
relationship!.followedBy = true
|
||||||
try {
|
try {
|
||||||
const newRel = await client.value.v1.followRequests.$select(account.id).authorize()
|
const newRel = await client.v1.followRequests.authorize(account.id)
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
relationship.value!.requestedBy = true
|
relationship!.requestedBy = true
|
||||||
relationship.value!.followedBy = false
|
relationship!.followedBy = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function rejectFollowRequest() {
|
async function rejectFollowRequest() {
|
||||||
relationship.value!.requestedBy = false
|
relationship!.requestedBy = false
|
||||||
try {
|
try {
|
||||||
const newRel = await client.value.v1.followRequests.$select(account.id).reject()
|
const newRel = await client.v1.followRequests.reject(account.id)
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
relationship.value!.requestedBy = true
|
relationship!.requestedBy = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const serverName = computed(() => getServerName(account))
|
const serverName = $computed(() => getServerName(account))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -6,30 +6,29 @@ const { account } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const createdAt = useFormattedDateTime(() => account.createdAt, {
|
const createdAt = $(useFormattedDateTime(() => account.createdAt, {
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
})
|
}))
|
||||||
|
|
||||||
const relationship = useRelationship(account)
|
const relationship = $(useRelationship(account))
|
||||||
|
|
||||||
const namedFields = ref<mastodon.v1.AccountField[]>([])
|
const namedFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const isEditingPersonalNote = ref<boolean>(false)
|
const isEditingPersonalNote = ref<boolean>(false)
|
||||||
const hasHeader = computed(() => !account.header.endsWith('/original/missing.png'))
|
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
|
||||||
const isCopied = ref<boolean>(false)
|
|
||||||
|
|
||||||
function getFieldIconTitle(fieldName: string) {
|
function getFieldIconTitle(fieldName: string) {
|
||||||
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotificationIconTitle() {
|
function getNotificationIconTitle() {
|
||||||
return relationship.value?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
|
return relationship?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
function previewHeader() {
|
function previewHeader() {
|
||||||
|
@ -51,14 +50,14 @@ function previewAvatar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleNotifications() {
|
async function toggleNotifications() {
|
||||||
relationship.value!.notifying = !relationship.value?.notifying
|
relationship!.notifying = !relationship?.notifying
|
||||||
try {
|
try {
|
||||||
const newRel = await client.value.v1.accounts.$select(account.id).follow({ notify: relationship.value?.notifying })
|
const newRel = await client.v1.accounts.follow(account.id, { notify: relationship?.notifying })
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship.value!.notifying = !relationship.value?.notifying
|
relationship!.notifying = !relationship?.notifying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,54 +74,37 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
icons.push({
|
icons.push({
|
||||||
name: 'Joined',
|
name: 'Joined',
|
||||||
value: createdAt.value,
|
value: createdAt,
|
||||||
})
|
})
|
||||||
|
|
||||||
namedFields.value = named
|
namedFields.value = named
|
||||||
iconFields.value = icons
|
iconFields.value = icons
|
||||||
})
|
})
|
||||||
|
|
||||||
const personalNoteDraft = ref(relationship.value?.note ?? '')
|
const personalNoteDraft = ref(relationship?.note ?? '')
|
||||||
watch(relationship, (relationship, oldValue) => {
|
watch($$(relationship), (relationship, oldValue) => {
|
||||||
if (!oldValue && relationship)
|
if (!oldValue && relationship)
|
||||||
personalNoteDraft.value = relationship.note ?? ''
|
personalNoteDraft.value = relationship.note ?? ''
|
||||||
})
|
})
|
||||||
|
|
||||||
async function editNote(event: Event) {
|
async function editNote(event: Event) {
|
||||||
if (!event.target || !('value' in event.target) || !relationship.value)
|
if (!event.target || !('value' in event.target) || !relationship)
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNote = event.target?.value as string
|
const newNote = event.target?.value as string
|
||||||
|
|
||||||
if (relationship.value.note?.trim() === newNote.trim())
|
if (relationship.note?.trim() === newNote.trim())
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNoteApiResult = await client.value.v1.accounts.$select(account.id).note.create({ comment: newNote })
|
const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote })
|
||||||
relationship.value.note = newNoteApiResult.note
|
relationship.note = newNoteApiResult.note
|
||||||
personalNoteDraft.value = relationship.value.note ?? ''
|
personalNoteDraft.value = relationship.note ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSelf = useSelfAccount(() => account)
|
const isSelf = $(useSelfAccount(() => account))
|
||||||
const isNotifiedOnPost = computed(() => !!relationship.value?.notifying)
|
const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
|
||||||
|
|
||||||
const personalNoteMaxLength = 2000
|
const personalNoteMaxLength = 2000
|
||||||
|
|
||||||
async function copyAccountName() {
|
|
||||||
try {
|
|
||||||
const shortHandle = getShortHandle(account)
|
|
||||||
const serverName = getServerName(account)
|
|
||||||
const accountName = `${shortHandle}@${serverName}`
|
|
||||||
await navigator.clipboard.writeText(accountName)
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.error('Failed to copy account name:', err)
|
|
||||||
}
|
|
||||||
|
|
||||||
isCopied.value = true
|
|
||||||
setTimeout(() => {
|
|
||||||
isCopied.value = false
|
|
||||||
}, 2000)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -193,15 +175,7 @@ async function copyAccountName() {
|
||||||
<AccountLockIndicator v-if="account.locked" show-label />
|
<AccountLockIndicator v-if="account.locked" show-label />
|
||||||
<AccountBotIndicator v-if="account.bot" show-label />
|
<AccountBotIndicator v-if="account.bot" show-label />
|
||||||
</div>
|
</div>
|
||||||
|
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
||||||
<div flex items-center gap-1>
|
|
||||||
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
|
||||||
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" no-auto-focus flex>
|
|
||||||
<button text-secondary-light text-sm :class="isCopied ? 'i-ri:check-fill text-green' : 'i-ri:file-copy-line'" @click="copyAccountName">
|
|
||||||
<span sr-only>{{ $t('account.copy_account_name') }}</span>
|
|
||||||
</button>
|
|
||||||
</CommonTooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label
|
<label
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const relationship = useRelationship(account)
|
const relationship = $(useRelationship(account))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,69 +1,26 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
import { fetchAccountByHandle } from '~/composables/cache'
|
|
||||||
|
|
||||||
type WatcherType = [acc?: mastodon.v1.Account | null, h?: string, v?: boolean]
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
account?: mastodon.v1.Account | null
|
account?: mastodon.v1.Account
|
||||||
handle?: string
|
handle?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const accountHover = ref()
|
const account = computed(() => props.account || (props.handle ? useAccountByHandle(props.handle!) : undefined))
|
||||||
const hovered = useElementHover(accountHover)
|
|
||||||
const account = ref<mastodon.v1.Account | null | undefined>(props.account)
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [props.account, props.handle, hovered.value] satisfies WatcherType,
|
|
||||||
([newAccount, newHandle, newVisible], oldProps) => {
|
|
||||||
if (!newVisible || process.test)
|
|
||||||
return
|
|
||||||
|
|
||||||
if (newAccount) {
|
|
||||||
account.value = newAccount
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newHandle) {
|
|
||||||
const [_oldAccount, oldHandle, _oldVisible] = oldProps ?? [undefined, undefined, false]
|
|
||||||
if (!oldHandle || newHandle !== oldHandle || !account.value) {
|
|
||||||
// new handle can be wrong: using server instead of webDomain
|
|
||||||
fetchAccountByHandle(newHandle).then((acc) => {
|
|
||||||
if (newHandle === props.handle)
|
|
||||||
account.value = acc
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
account.value = undefined
|
|
||||||
},
|
|
||||||
{ immediate: true, flush: 'post' },
|
|
||||||
)
|
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span ref="accountHover">
|
<VMenu v-if="!disabled && account && !getPreferences(userSettings, 'hideAccountHoverCard')" placement="bottom-start" :delay="{ show: 500, hide: 100 }" v-bind="$attrs" :close-on-content-click="false">
|
||||||
<VMenu
|
<slot />
|
||||||
v-if="!disabled && account && !getPreferences(userSettings, 'hideAccountHoverCard')"
|
<template #popper>
|
||||||
placement="bottom-start"
|
<AccountHoverCard v-if="account" :account="account" />
|
||||||
:delay="{ show: 500, hide: 100 }"
|
</template>
|
||||||
v-bind="$attrs"
|
</VMenu>
|
||||||
:close-on-content-click="false"
|
<slot v-else />
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
<template #popper>
|
|
||||||
<AccountHoverCard v-if="account" :account="account" />
|
|
||||||
</template>
|
|
||||||
</VMenu>
|
|
||||||
<slot v-else />
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showLabel?: boolean
|
showLabel?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -17,7 +15,7 @@ const { t } = useI18n()
|
||||||
<div i-ri:lock-line />
|
<div i-ri:lock-line />
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
<div v-if="showLabel">
|
<div v-if="showLabel">
|
||||||
{{ t('account.lock') }}
|
Lock
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,12 +11,12 @@ const emit = defineEmits<{
|
||||||
(evt: 'removeNote'): void
|
(evt: 'removeNote'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const relationship = useRelationship(account)
|
let relationship = $(useRelationship(account))
|
||||||
|
|
||||||
const isSelf = useSelfAccount(() => account)
|
const isSelf = $(useSelfAccount(() => account))
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
const { share, isSupported: isShareSupported } = useShare()
|
const { share, isSupported: isShareSupported } = useShare()
|
||||||
|
|
||||||
|
@ -25,19 +25,15 @@ function shareAccount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleReblogs() {
|
async function toggleReblogs() {
|
||||||
if (!relationship.value!.showingReblogs) {
|
if (!relationship!.showingReblogs && await openConfirmDialog({
|
||||||
const dialogChoice = await openConfirmDialog({
|
title: t('confirm.show_reblogs.title', [account.acct]),
|
||||||
title: t('confirm.show_reblogs.title'),
|
confirm: t('confirm.show_reblogs.confirm'),
|
||||||
description: t('confirm.show_reblogs.description', [account.acct]),
|
cancel: t('confirm.show_reblogs.cancel'),
|
||||||
confirm: t('confirm.show_reblogs.confirm'),
|
}) !== 'confirm')
|
||||||
cancel: t('confirm.show_reblogs.cancel'),
|
return
|
||||||
})
|
|
||||||
if (dialogChoice.choice !== 'confirm')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const showingReblogs = !relationship.value?.showingReblogs
|
const showingReblogs = !relationship?.showingReblogs
|
||||||
relationship.value = await client.value.v1.accounts.$select(account.id).follow({ reblogs: showingReblogs })
|
relationship = await client.v1.accounts.follow(account.id, { reblogs: showingReblogs })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addUserNote() {
|
async function addUserNote() {
|
||||||
|
@ -45,11 +41,11 @@ async function addUserNote() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeUserNote() {
|
async function removeUserNote() {
|
||||||
if (!relationship.value!.note || relationship.value!.note.length === 0)
|
if (!relationship!.note || relationship!.note.length === 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNote = await client.value.v1.accounts.$select(account.id).note.create({ comment: '' })
|
const newNote = await client.v1.accounts.createNote(account.id, { comment: '' })
|
||||||
relationship.value!.note = newNote.note
|
relationship!.note = newNote.note
|
||||||
emit('removeNote')
|
emit('removeNote')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { Paginator, mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator, account, context } = defineProps<{
|
const { paginator, account, context } = defineProps<{
|
||||||
paginator: mastodon.Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams | undefined>
|
paginator: Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams>
|
||||||
context?: 'following' | 'followers'
|
context?: 'following' | 'followers'
|
||||||
account?: mastodon.v1.Account
|
account?: mastodon.v1.Account
|
||||||
relationshipContext?: 'followedBy' | 'following'
|
relationshipContext?: 'followedBy' | 'following'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const fallbackContext = computed(() => {
|
const fallbackContext = $computed(() => {
|
||||||
return ['following', 'followers'].includes(context!)
|
return ['following', 'followers'].includes(context!)
|
||||||
})
|
})
|
||||||
const showOriginSite = computed(() =>
|
const showOriginSite = $computed(() =>
|
||||||
account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value,
|
account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value,
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CommonRouteTabOption } from '~/types'
|
import type { CommonRouteTabOption } from '../common/CommonRouteTabs.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const server = computed(() => route.params.server as string)
|
const server = $(computedEager(() => route.params.server as string))
|
||||||
const account = computed(() => route.params.account as string)
|
const account = $(computedEager(() => route.params.account as string))
|
||||||
|
|
||||||
const tabs = computed<CommonRouteTabOption[]>(() => [
|
const tabs = $computed<CommonRouteTabOption[]>(() => [
|
||||||
{
|
{
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
params: { server: server.value, account: account.value },
|
params: { server, account },
|
||||||
},
|
},
|
||||||
display: t('tab.posts'),
|
display: t('tab.posts'),
|
||||||
icon: 'i-ri:file-list-2-line',
|
icon: 'i-ri:file-list-2-line',
|
||||||
|
@ -21,7 +21,7 @@ const tabs = computed<CommonRouteTabOption[]>(() => [
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
params: { server: server.value, account: account.value },
|
params: { server, account },
|
||||||
},
|
},
|
||||||
display: t('tab.posts_with_replies'),
|
display: t('tab.posts_with_replies'),
|
||||||
icon: 'i-ri:chat-1-line',
|
icon: 'i-ri:chat-1-line',
|
||||||
|
@ -30,7 +30,7 @@ const tabs = computed<CommonRouteTabOption[]>(() => [
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
params: { server: server.value, account: account.value },
|
params: { server, account },
|
||||||
},
|
},
|
||||||
display: t('tab.media'),
|
display: t('tab.media'),
|
||||||
icon: 'i-ri:camera-2-line',
|
icon: 'i-ri:camera-2-line',
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import type { mastodon } from 'masto'
|
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
const { tagName, disabled } = defineProps<{
|
|
||||||
tagName?: string
|
|
||||||
disabled?: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const tag = ref<mastodon.v1.Tag>()
|
|
||||||
const tagHover = ref()
|
|
||||||
const hovered = useElementHover(tagHover)
|
|
||||||
|
|
||||||
watch(hovered, (newHovered) => {
|
|
||||||
if (newHovered && tagName) {
|
|
||||||
fetchTag(tagName).then((t) => {
|
|
||||||
tag.value = t
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<span ref="tagHover">
|
|
||||||
<VMenu
|
|
||||||
v-if="!disabled && !getPreferences(userSettings, 'hideTagHoverCard')"
|
|
||||||
placement="bottom-start"
|
|
||||||
:delay="{ show: 500, hide: 100 }"
|
|
||||||
v-bind="$attrs"
|
|
||||||
:close-on-content-click="false"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
<template #popper>
|
|
||||||
<TagCardSkeleton v-if="!tag" />
|
|
||||||
<TagCard v-else :tag="tag" />
|
|
||||||
</template>
|
|
||||||
</VMenu>
|
|
||||||
<slot v-else />
|
|
||||||
</span>
|
|
||||||
</template>
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { LocaleObject } from '@nuxtjs/i18n'
|
|
||||||
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
||||||
|
import type { LocaleObject } from '#i18n'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { t, locale, locales } = useI18n()
|
const { t, locale, locales } = useI18n()
|
||||||
|
@ -11,16 +11,16 @@ const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||||
return acc
|
return acc
|
||||||
}, {} as Record<string, string>)
|
}, {} as Record<string, string>)
|
||||||
|
|
||||||
const ariaLive = ref<AriaLive>('polite')
|
let ariaLive = $ref<AriaLive>('polite')
|
||||||
const ariaMessage = ref<string>('')
|
let ariaMessage = $ref<string>('')
|
||||||
|
|
||||||
function onMessage(event: AriaAnnounceType, message?: string) {
|
function onMessage(event: AriaAnnounceType, message?: string) {
|
||||||
if (event === 'announce')
|
if (event === 'announce')
|
||||||
ariaMessage.value = message!
|
ariaMessage = message!
|
||||||
else if (event === 'mute')
|
else if (event === 'mute')
|
||||||
ariaLive.value = 'off'
|
ariaLive = 'off'
|
||||||
else
|
else
|
||||||
ariaLive.value = 'polite'
|
ariaLive = 'polite'
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(locale, (l, ol) => {
|
watch(locale, (l, ol) => {
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ResolvedCommand } from '~/composables/command'
|
import type { ResolvedCommand } from '~/composables/command'
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'activate'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
cmd,
|
cmd,
|
||||||
index,
|
index,
|
||||||
active = false,
|
active = false,
|
||||||
} = defineProps<{
|
} = $defineProps<{
|
||||||
cmd: ResolvedCommand
|
cmd: ResolvedCommand
|
||||||
index: number
|
index: number
|
||||||
active?: boolean
|
active?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(event: 'activate'): void
|
|
||||||
}>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -5,7 +5,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
|
|
||||||
const keys = computed(() => props.name.toLowerCase().split('+'))
|
const keys = $computed(() => props.name.toLowerCase().split('+'))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -10,21 +10,21 @@ const registry = useCommandRegistry()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const inputEl = ref<HTMLInputElement>()
|
const inputEl = $ref<HTMLInputElement>()
|
||||||
const resultEl = ref<HTMLDivElement>()
|
const resultEl = $ref<HTMLDivElement>()
|
||||||
|
|
||||||
const scopes = ref<CommandScope[]>([])
|
const scopes = $ref<CommandScope[]>([])
|
||||||
const input = commandPanelInput
|
let input = $(commandPanelInput)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
inputEl.value?.focus()
|
inputEl?.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
const commandMode = computed(() => input.value.startsWith('>'))
|
const commandMode = $computed(() => input.startsWith('>'))
|
||||||
|
|
||||||
const query = computed(() => commandMode.value ? '' : input.value.trim())
|
const query = $computed(() => commandMode ? '' : input.trim())
|
||||||
|
|
||||||
const { accounts, hashtags, loading } = useSearch(query)
|
const { accounts, hashtags, loading } = useSearch($$(query))
|
||||||
|
|
||||||
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
||||||
return {
|
return {
|
||||||
|
@ -35,8 +35,8 @@ function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchResult = computed<QueryResult>(() => {
|
const searchResult = $computed<QueryResult>(() => {
|
||||||
if (query.value.length === 0 || loading.value)
|
if (query.length === 0 || loading.value)
|
||||||
return { length: 0, items: [], grouped: {} as any }
|
return { length: 0, items: [], grouped: {} as any }
|
||||||
|
|
||||||
// TODO extract this scope
|
// TODO extract this scope
|
||||||
|
@ -61,22 +61,22 @@ const searchResult = computed<QueryResult>(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const result = computed<QueryResult>(() => commandMode.value
|
const result = $computed<QueryResult>(() => commandMode
|
||||||
? registry.query(scopes.value.map(s => s.id).join('.'), input.value.slice(1).trim())
|
? registry.query(scopes.map(s => s.id).join('.'), input.slice(1).trim())
|
||||||
: searchResult.value,
|
: searchResult,
|
||||||
)
|
)
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
const modifierKeyName = $computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
const active = ref(0)
|
let active = $ref(0)
|
||||||
watch(result, (n, o) => {
|
watch($$(result), (n, o) => {
|
||||||
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
||||||
active.value = 0
|
active = 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function findItemEl(index: number) {
|
function findItemEl(index: number) {
|
||||||
return resultEl.value?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
return resultEl?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
||||||
}
|
}
|
||||||
function onCommandActivate(item: QueryResultItem) {
|
function onCommandActivate(item: QueryResultItem) {
|
||||||
if (item.onActivate) {
|
if (item.onActivate) {
|
||||||
|
@ -84,14 +84,14 @@ function onCommandActivate(item: QueryResultItem) {
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
else if (item.onComplete) {
|
else if (item.onComplete) {
|
||||||
scopes.value.push(item.onComplete())
|
scopes.push(item.onComplete())
|
||||||
input.value = '> '
|
input = '> '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onCommandComplete(item: QueryResultItem) {
|
function onCommandComplete(item: QueryResultItem) {
|
||||||
if (item.onComplete) {
|
if (item.onComplete) {
|
||||||
scopes.value.push(item.onComplete())
|
scopes.push(item.onComplete())
|
||||||
input.value = '> '
|
input = '> '
|
||||||
}
|
}
|
||||||
else if (item.onActivate) {
|
else if (item.onActivate) {
|
||||||
item.onActivate()
|
item.onActivate()
|
||||||
|
@ -105,9 +105,9 @@ function intoView(index: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActive(index: number) {
|
function setActive(index: number) {
|
||||||
const len = result.value.length
|
const len = result.length
|
||||||
active.value = (index + len) % len
|
active = (index + len) % len
|
||||||
intoView(active.value)
|
intoView(active)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(e: KeyboardEvent) {
|
function onKeyDown(e: KeyboardEvent) {
|
||||||
|
@ -118,7 +118,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active.value - 1)
|
setActive(active - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active.value + 1)
|
setActive(active + 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Home': {
|
case 'Home': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
active.value = 0
|
active = 0
|
||||||
|
|
||||||
intoView(active.value)
|
intoView(active)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'End': {
|
case 'End': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(result.value.length - 1)
|
setActive(result.length - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Enter': {
|
case 'Enter': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.value.items[active.value]
|
const cmd = result.items[active]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandActivate(cmd)
|
onCommandActivate(cmd)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Tab': {
|
case 'Tab': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.value.items[active.value]
|
const cmd = result.items[active]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandComplete(cmd)
|
onCommandComplete(cmd)
|
||||||
|
|
||||||
|
@ -172,9 +172,9 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Backspace': {
|
case 'Backspace': {
|
||||||
if (input.value === '>' && scopes.value.length) {
|
if (input === '>' && scopes.length) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
scopes.value.pop()
|
scopes.pop()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ defineProps<{
|
||||||
hover?: boolean
|
hover?: boolean
|
||||||
iconChecked?: string
|
iconChecked?: string
|
||||||
iconUnchecked?: string
|
iconUnchecked?: string
|
||||||
checkedIconColor?: string
|
|
||||||
prependCheckbox?: boolean
|
|
||||||
}>()
|
}>()
|
||||||
const modelValue = defineModel<boolean | null>()
|
const modelValue = defineModel<boolean | null>()
|
||||||
</script>
|
</script>
|
||||||
|
@ -17,12 +15,9 @@ const modelValue = defineModel<boolean | null>()
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@click.prevent="modelValue = !modelValue"
|
@click.prevent="modelValue = !modelValue"
|
||||||
>
|
>
|
||||||
<span v-if="label && !prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
<span v-if="label" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
<span
|
<span
|
||||||
:class="[
|
:class="modelValue ? (iconChecked ?? 'i-ri:checkbox-line') : (iconUnchecked ?? 'i-ri:checkbox-blank-line')"
|
||||||
modelValue ? (iconChecked ?? 'i-ri:checkbox-line') : (iconUnchecked ?? 'i-ri:checkbox-blank-line'),
|
|
||||||
modelValue && checkedIconColor,
|
|
||||||
]"
|
|
||||||
text-lg
|
text-lg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
|
@ -31,7 +26,6 @@ const modelValue = defineModel<boolean | null>()
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
sr-only
|
sr-only
|
||||||
>
|
>
|
||||||
<span v-if="label && prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ const previewImage = ref('')
|
||||||
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
|
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
|
||||||
|
|
||||||
async function pickImage() {
|
async function pickImage() {
|
||||||
if (import.meta.server)
|
if (process.server)
|
||||||
return
|
return
|
||||||
const image = await fileOpen({
|
const image = await fileOpen({
|
||||||
description: 'Image',
|
description: 'Image',
|
||||||
|
|
|
@ -2,23 +2,23 @@
|
||||||
// @ts-expect-error missing types
|
// @ts-expect-error missing types
|
||||||
import { DynamicScroller } from 'vue-virtual-scroller'
|
import { DynamicScroller } from 'vue-virtual-scroller'
|
||||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||||
import type { mastodon } from 'masto'
|
import type { Paginator, WsEvents } from 'masto'
|
||||||
import type { UnwrapRef } from 'vue'
|
import type { UnwrapRef } from 'vue'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
paginator,
|
paginator,
|
||||||
stream,
|
stream,
|
||||||
eventType,
|
|
||||||
keyProp = 'id',
|
keyProp = 'id',
|
||||||
virtualScroller = false,
|
virtualScroller = false,
|
||||||
|
eventType = 'update',
|
||||||
preprocess,
|
preprocess,
|
||||||
endMessage = true,
|
endMessage = true,
|
||||||
} = defineProps<{
|
} = defineProps<{
|
||||||
paginator: mastodon.Paginator<T[], O>
|
paginator: Paginator<T[], O>
|
||||||
keyProp?: keyof T
|
keyProp?: keyof T
|
||||||
virtualScroller?: boolean
|
virtualScroller?: boolean
|
||||||
stream?: mastodon.streaming.Subscription
|
stream?: Promise<WsEvents>
|
||||||
eventType?: 'update' | 'notification'
|
eventType?: 'notification' | 'update'
|
||||||
preprocess?: (items: (U | T)[]) => U[]
|
preprocess?: (items: (U | T)[]) => U[]
|
||||||
endMessage?: boolean | string
|
endMessage?: boolean | string
|
||||||
}>()
|
}>()
|
||||||
|
@ -46,7 +46,7 @@ defineSlots<{
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, toRef(() => stream), eventType, preprocess)
|
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, $$(stream), eventType, preprocess)
|
||||||
|
|
||||||
nuxtApp.hook('elk-logo:click', () => {
|
nuxtApp.hook('elk-logo:click', () => {
|
||||||
update()
|
update()
|
||||||
|
@ -96,8 +96,8 @@ defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<slot
|
<slot
|
||||||
v-for="(item, index) of items"
|
v-for="item, index of items"
|
||||||
v-bind="{ key: (item as U)[keyProp as keyof U] }"
|
v-bind="{ key: item[keyProp as keyof U] }"
|
||||||
:item="item as U"
|
:item="item as U"
|
||||||
:older="items[index + 1] as U"
|
:older="items[index + 1] as U"
|
||||||
:newer="items[index - 1] as U"
|
:newer="items[index - 1] as U"
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CommonRouteTabMoreOption, CommonRouteTabOption } from '~/types'
|
import type { RouteLocationRaw } from 'vue-router'
|
||||||
|
|
||||||
const { options, command, replace, preventScrollTop = false, moreOptions } = defineProps<{
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
export interface CommonRouteTabOption {
|
||||||
|
to: RouteLocationRaw
|
||||||
|
display: string
|
||||||
|
disabled?: boolean
|
||||||
|
name?: string
|
||||||
|
icon?: string
|
||||||
|
hide?: boolean
|
||||||
|
match?: boolean
|
||||||
|
}
|
||||||
|
export interface CommonRouteTabMoreOption {
|
||||||
|
options: CommonRouteTabOption[]
|
||||||
|
icon?: string
|
||||||
|
tooltip?: string
|
||||||
|
match?: boolean
|
||||||
|
}
|
||||||
|
const { options, command, replace, preventScrollTop = false, moreOptions } = $defineProps<{
|
||||||
options: CommonRouteTabOption[]
|
options: CommonRouteTabOption[]
|
||||||
moreOptions?: CommonRouteTabMoreOption
|
moreOptions?: CommonRouteTabMoreOption
|
||||||
command?: boolean
|
command?: boolean
|
||||||
|
@ -9,7 +26,6 @@ const { options, command, replace, preventScrollTop = false, moreOptions } = def
|
||||||
preventScrollTop?: boolean
|
preventScrollTop?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useCommands(() => command
|
useCommands(() => command
|
||||||
|
@ -33,7 +49,7 @@ useCommands(() => command
|
||||||
:to="option.to"
|
:to="option.to"
|
||||||
:replace="replace"
|
:replace="replace"
|
||||||
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
||||||
tabindex="0"
|
tabindex="1"
|
||||||
hover:bg-active transition-100
|
hover:bg-active transition-100
|
||||||
exact-active-class="children:(text-secondary !border-primary !op100 !text-base)"
|
exact-active-class="children:(text-secondary !border-primary !op100 !text-base)"
|
||||||
@click="!preventScrollTop && $scrollToTop()"
|
@click="!preventScrollTop && $scrollToTop()"
|
||||||
|
@ -44,9 +60,9 @@ useCommands(() => command
|
||||||
<span ws-nowrap mxa sm:px2 sm:py3 py2 text-center text-secondary-light op50>{{ option.display }}</span>
|
<span ws-nowrap mxa sm:px2 sm:py3 py2 text-center text-secondary-light op50>{{ option.display }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="isHydrated && moreOptions?.options?.length">
|
<template v-if="moreOptions?.options?.length">
|
||||||
<CommonDropdown placement="bottom" flex cursor-pointer mx-1.25rem>
|
<CommonDropdown placement="bottom" flex cursor-pointer mx-1.25rem>
|
||||||
<CommonTooltip placement="top" no-auto-focus :content="moreOptions.tooltip || t('action.more')">
|
<CommonTooltip placement="top" :content="moreOptions.tooltip || t('action.more')">
|
||||||
<button
|
<button
|
||||||
cursor-pointer
|
cursor-pointer
|
||||||
flex
|
flex
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { as = 'div', active } = defineProps<{
|
const { as = 'div', active } = defineProps<{ as: any; active: boolean }>()
|
||||||
as: any
|
|
||||||
active: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const el = ref()
|
const el = ref()
|
||||||
|
|
||||||
watch(() => active, (active) => {
|
watch(() => active, (active) => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ const { options, command } = defineProps<{
|
||||||
|
|
||||||
const modelValue = defineModel<string>({ required: true })
|
const modelValue = defineModel<string>({ required: true })
|
||||||
|
|
||||||
const tabs = computed(() => {
|
const tabs = $computed(() => {
|
||||||
return options.map((option) => {
|
return options.map((option) => {
|
||||||
if (typeof option === 'string')
|
if (typeof option === 'string')
|
||||||
return { name: option, display: option }
|
return { name: option, display: option }
|
||||||
|
@ -19,12 +19,12 @@ const tabs = computed(() => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function toValidName(option: string) {
|
function toValidName(otpion: string) {
|
||||||
return option.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
|
return otpion.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
useCommands(() => command
|
useCommands(() => command
|
||||||
? tabs.value.map(tab => ({
|
? tabs.map(tab => ({
|
||||||
scope: 'Tabs',
|
scope: 'Tabs',
|
||||||
|
|
||||||
name: tab.display,
|
name: tab.display,
|
||||||
|
@ -49,7 +49,7 @@ useCommands(() => command
|
||||||
><label
|
><label
|
||||||
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
||||||
:for="`tab-${toValidName(option.name)}`"
|
:for="`tab-${toValidName(option.name)}`"
|
||||||
tabindex="0"
|
tabindex="1"
|
||||||
hover:bg-active transition-100
|
hover:bg-active transition-100
|
||||||
@keypress.enter="modelValue = option.name"
|
@keypress.enter="modelValue = option.name"
|
||||||
><span
|
><span
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Popper as VTooltipType } from 'floating-vue'
|
import type { Popper as VTooltipType } from 'floating-vue/dist'
|
||||||
|
|
||||||
export interface Props extends Partial<typeof VTooltipType> {
|
export interface Props extends Partial<typeof VTooltipType> {
|
||||||
content?: string
|
content?: string
|
||||||
|
@ -10,7 +10,6 @@ defineProps<Props>()
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VTooltip
|
<VTooltip
|
||||||
v-if="isHydrated"
|
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
auto-hide
|
auto-hide
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,15 +4,15 @@ import type { mastodon } from 'masto'
|
||||||
const {
|
const {
|
||||||
history,
|
history,
|
||||||
maxDay = 2,
|
maxDay = 2,
|
||||||
} = defineProps<{
|
} = $defineProps<{
|
||||||
history: mastodon.v1.TagHistory[]
|
history: mastodon.v1.TagHistory[]
|
||||||
maxDay?: number
|
maxDay?: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const ongoingHot = computed(() => history.slice(0, maxDay))
|
const ongoingHot = $computed(() => history.slice(0, maxDay))
|
||||||
|
|
||||||
const people = computed(() =>
|
const people = $computed(() =>
|
||||||
ongoingHot.value.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
ongoingHot.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,22 @@ const {
|
||||||
history,
|
history,
|
||||||
width = 60,
|
width = 60,
|
||||||
height = 40,
|
height = 40,
|
||||||
} = defineProps<{
|
} = $defineProps<{
|
||||||
history?: mastodon.v1.TagHistory[]
|
history?: mastodon.v1.TagHistory[]
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const historyNum = computed(() => {
|
const historyNum = $computed(() => {
|
||||||
if (!history)
|
if (!history)
|
||||||
return [1, 1, 1, 1, 1, 1, 1]
|
return [1, 1, 1, 1, 1, 1, 1]
|
||||||
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
const sparklineEl = ref<SVGSVGElement>()
|
const sparklineEl = $ref<SVGSVGElement>()
|
||||||
const sparklineFn = typeof sparkline !== 'function' ? (sparkline as any).default : sparkline
|
const sparklineFn = typeof sparkline !== 'function' ? (sparkline as any).default : sparkline
|
||||||
|
|
||||||
watch([historyNum, sparklineEl], ([historyNum, sparklineEl]) => {
|
watch([$$(historyNum), $$(sparklineEl)], ([historyNum, sparklineEl]) => {
|
||||||
if (!sparklineEl)
|
if (!sparklineEl)
|
||||||
return
|
return
|
||||||
sparklineFn(sparklineEl, historyNum)
|
sparklineFn(sparklineEl, historyNum)
|
||||||
|
|
|
@ -10,9 +10,9 @@ const props = defineProps<{
|
||||||
|
|
||||||
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
||||||
|
|
||||||
const useSR = computed(() => forSR(props.count))
|
const useSR = $computed(() => forSR(props.count))
|
||||||
const rawNumber = computed(() => formatNumber(props.count))
|
const rawNumber = $computed(() => formatNumber(props.count))
|
||||||
const humanReadableNumber = computed(() => formatHumanReadableNumber(props.count))
|
const humanReadableNumber = $computed(() => formatHumanReadableNumber(props.count))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -6,11 +6,11 @@ defineProps<{
|
||||||
autoBoundaryMaxSize?: boolean
|
autoBoundaryMaxSize?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const dropdown = ref<any>()
|
const dropdown = $ref<any>()
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
return dropdown.value.hide()
|
return dropdown.hide()
|
||||||
}
|
}
|
||||||
provide(InjectionKeyDropdownContext, {
|
provide(InjectionKeyDropdownContext, {
|
||||||
hide,
|
hide,
|
||||||
|
|
|
@ -4,7 +4,7 @@ const props = defineProps<{
|
||||||
lang?: string
|
lang?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const raw = computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
const raw = $computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
||||||
|
|
||||||
const langMap: Record<string, string> = {
|
const langMap: Record<string, string> = {
|
||||||
js: 'javascript',
|
js: 'javascript',
|
||||||
|
@ -13,7 +13,7 @@ const langMap: Record<string, string> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlighted = computed(() => {
|
const highlighted = computed(() => {
|
||||||
return props.lang ? highlightCode(raw.value, (langMap[props.lang] || props.lang) as any) : raw
|
return props.lang ? highlightCode(raw, (langMap[props.lang] || props.lang) as any) : raw
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { conversation } = defineProps<{
|
||||||
conversation: mastodon.v1.Conversation
|
conversation: mastodon.v1.Conversation
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const withAccounts = computed(() =>
|
const withAccounts = $computed(() =>
|
||||||
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { Paginator, mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator } = defineProps<{
|
const { paginator } = defineProps<{
|
||||||
paginator: mastodon.Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
|
paginator: Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
|
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
const { as, alt, dataEmojiId } = defineProps<{
|
|
||||||
as: string
|
|
||||||
alt?: string
|
|
||||||
dataEmojiId?: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const title = ref<string | undefined>()
|
|
||||||
|
|
||||||
if (alt) {
|
|
||||||
if (alt.startsWith(':')) {
|
|
||||||
title.value = alt.replace(/:/g, '')
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
import('node-emoji').then(({ find }) => {
|
|
||||||
title.value = find(alt)?.key.replace(/_/g, ' ')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it has a data-emoji-id, use that as the title instead
|
|
||||||
if (dataEmojiId)
|
|
||||||
title.value = dataEmojiId
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<component :is="as" v-bind="$attrs" :alt="alt" :data-emoji-id="dataEmojiId" :title="title">
|
|
||||||
<slot />
|
|
||||||
</component>
|
|
||||||
</template>
|
|
|
@ -2,14 +2,12 @@
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const vAutoFocus = (el: HTMLElement) => el.focus()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
||||||
<button v-auto-focus type="button" btn-action-icon absolute top--8 right-0 m1 aria-label="Close" @click="emit('close')">
|
<button btn-action-icon absolute top--8 right-0 m1 aria-label="Close" @click="emit('close')">
|
||||||
<span i-ri:close-line />
|
<div i-ri:close-line />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<img :alt="$t('app_logo')" :src="`/${''}logo.svg`" w-20 h-20 height="80" width="80" mxa class="rtl-flip">
|
<img :alt="$t('app_logo')" :src="`/${''}logo.svg`" w-20 h-20 height="80" width="80" mxa class="rtl-flip">
|
||||||
|
@ -30,12 +28,10 @@ const vAutoFocus = (el: HTMLElement) => el.focus()
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
{{ $t('help.desc_para6') }}
|
{{ $t('help.desc_para6') }}
|
||||||
</p>
|
</p>
|
||||||
<NuxtLink hover:text-primary href="https://github.com/sponsors/elk-zone" target="_blank">
|
{{ $t('help.desc_para3') }}
|
||||||
{{ $t('help.desc_para3') }}
|
<p flex="~ gap-2 wrap" mxa>
|
||||||
</NuxtLink>
|
|
||||||
<p flex="~ gap-2 wrap justify-center" mxa>
|
|
||||||
<template v-for="team of elkTeamMembers" :key="team.github">
|
<template v-for="team of elkTeamMembers" :key="team.github">
|
||||||
<NuxtLink :href="team.link" target="_blank" external rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
<NuxtLink :href="`https://github.com/sponsors/${team.github}`" target="_blank" external rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
||||||
<img :src="`/avatars/${team.github}-100x100.png`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
<img :src="`/avatars/${team.github}-100x100.png`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
@ -46,7 +42,7 @@ const vAutoFocus = (el: HTMLElement) => el.focus()
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button type="button" btn-solid mxa @click="emit('close')">
|
<button btn-solid mxa tabindex="2" @click="emit('close')">
|
||||||
{{ $t('action.enter_app') }}
|
{{ $t('action.enter_app') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,8 +16,8 @@ const isRemoved = ref(false)
|
||||||
async function edit() {
|
async function edit() {
|
||||||
try {
|
try {
|
||||||
isRemoved.value
|
isRemoved.value
|
||||||
? await client.v1.lists.$select(list).accounts.create({ accountIds: [account.id] })
|
? await client.v1.lists.addAccount(list, { accountIds: [account.id] })
|
||||||
: await client.v1.lists.$select(list).accounts.remove({ accountIds: [account.id] })
|
: await client.v1.lists.removeAccount(list, { accountIds: [account.id] })
|
||||||
isRemoved.value = !isRemoved.value
|
isRemoved.value = !isRemoved.value
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
|
@ -15,23 +15,23 @@ const { form, isDirty, submitter, reset } = useForm({
|
||||||
form: () => ({ ...list.value }),
|
form: () => ({ ...list.value }),
|
||||||
})
|
})
|
||||||
|
|
||||||
const isEditing = ref<boolean>(false)
|
let isEditing = $ref<boolean>(false)
|
||||||
const deleting = ref<boolean>(false)
|
let deleting = $ref<boolean>(false)
|
||||||
const actionError = ref<string | undefined>(undefined)
|
let actionError = $ref<string | undefined>(undefined)
|
||||||
|
|
||||||
const input = ref<HTMLInputElement>()
|
const input = ref<HTMLInputElement>()
|
||||||
const editBtn = ref<HTMLButtonElement>()
|
const editBtn = ref<HTMLButtonElement>()
|
||||||
const deleteBtn = ref<HTMLButtonElement>()
|
const deleteBtn = ref<HTMLButtonElement>()
|
||||||
|
|
||||||
async function prepareEdit() {
|
async function prepareEdit() {
|
||||||
isEditing.value = true
|
isEditing = true
|
||||||
actionError.value = undefined
|
actionError = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
}
|
}
|
||||||
async function cancelEdit() {
|
async function cancelEdit() {
|
||||||
isEditing.value = false
|
isEditing = false
|
||||||
actionError.value = undefined
|
actionError = undefined
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
@ -40,59 +40,58 @@ async function cancelEdit() {
|
||||||
|
|
||||||
const { submit, submitting } = submitter(async () => {
|
const { submit, submitting } = submitter(async () => {
|
||||||
try {
|
try {
|
||||||
list.value = await client.v1.lists.$select(form.id).update({
|
list.value = await client.v1.lists.update(form.id, {
|
||||||
title: form.title,
|
title: form.title,
|
||||||
})
|
})
|
||||||
cancelEdit()
|
cancelEdit()
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
actionError.value = (err as Error).message
|
actionError = (err as Error).message
|
||||||
await nextTick()
|
await nextTick()
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function removeList() {
|
async function removeList() {
|
||||||
if (deleting.value)
|
if (deleting)
|
||||||
return
|
return
|
||||||
|
|
||||||
const confirmDelete = await openConfirmDialog({
|
const confirmDelete = await openConfirmDialog({
|
||||||
title: t('confirm.delete_list.title'),
|
title: t('confirm.delete_list.title', [list.value.title]),
|
||||||
description: t('confirm.delete_list.description', [list.value.title]),
|
|
||||||
confirm: t('confirm.delete_list.confirm'),
|
confirm: t('confirm.delete_list.confirm'),
|
||||||
cancel: t('confirm.delete_list.cancel'),
|
cancel: t('confirm.delete_list.cancel'),
|
||||||
})
|
})
|
||||||
|
|
||||||
deleting.value = true
|
deleting = true
|
||||||
actionError.value = undefined
|
actionError = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|
||||||
if (confirmDelete.choice === 'confirm') {
|
if (confirmDelete === 'confirm') {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
try {
|
try {
|
||||||
await client.v1.lists.$select(list.value.id).remove()
|
await client.v1.lists.remove(list.value.id)
|
||||||
emit('listRemoved', list.value.id)
|
emit('listRemoved', list.value.id)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
actionError.value = (err as Error).message
|
actionError = (err as Error).message
|
||||||
await nextTick()
|
await nextTick()
|
||||||
deleteBtn.value?.focus()
|
deleteBtn.value?.focus()
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
deleting.value = false
|
deleting = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deleting.value = false
|
deleting = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearError() {
|
async function clearError() {
|
||||||
actionError.value = undefined
|
actionError = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
if (isEditing.value)
|
if (isEditing)
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
else
|
else
|
||||||
deleteBtn.value?.focus()
|
deleteBtn.value?.focus()
|
||||||
|
|
|
@ -3,9 +3,9 @@ const { userId } = defineProps<{
|
||||||
userId: string
|
userId: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
const paginator = client.value.v1.lists.list()
|
const paginator = client.v1.lists.list()
|
||||||
const listsWithUser = ref((await client.value.v1.accounts.$select(userId).lists.list()).map(list => list.id))
|
const listsWithUser = ref((await client.v1.accounts.listLists(userId)).map(list => list.id))
|
||||||
|
|
||||||
function indexOfUserInList(listId: string) {
|
function indexOfUserInList(listId: string) {
|
||||||
return listsWithUser.value.indexOf(listId)
|
return listsWithUser.value.indexOf(listId)
|
||||||
|
@ -15,11 +15,11 @@ async function edit(listId: string) {
|
||||||
try {
|
try {
|
||||||
const index = indexOfUserInList(listId)
|
const index = indexOfUserInList(listId)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
await client.value.v1.lists.$select(listId).accounts.create({ accountIds: [userId] })
|
await client.v1.lists.addAccount(listId, { accountIds: [userId] })
|
||||||
listsWithUser.value.push(listId)
|
listsWithUser.value.push(listId)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await client.value.v1.lists.$select(listId).accounts.remove({ accountIds: [userId] })
|
await client.v1.lists.removeAccount(listId, { accountIds: [userId] })
|
||||||
listsWithUser.value = listsWithUser.value.filter(id => id !== listId)
|
listsWithUser.value = listsWithUser.value.filter(id => id !== listId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ interface ShortcutItemGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
const modifierKeyName = $computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
const shortcutItemGroups: ShortcutItemGroup[] = [
|
||||||
{
|
{
|
||||||
name: t('magic_keys.groups.navigation.title'),
|
name: t('magic_keys.groups.navigation.title'),
|
||||||
items: [
|
items: [
|
||||||
|
@ -40,10 +40,6 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
// description: t('magic_keys.groups.navigation.previous_status'),
|
// description: t('magic_keys.groups.navigation.previous_status'),
|
||||||
// shortcut: { keys: ['k'], isSequence: false },
|
// shortcut: { keys: ['k'], isSequence: false },
|
||||||
// },
|
// },
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_search'),
|
|
||||||
shortcut: { keys: ['/'], isSequence: false },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_home'),
|
description: t('magic_keys.groups.navigation.go_to_home'),
|
||||||
shortcut: { keys: ['g', 'h'], isSequence: true },
|
shortcut: { keys: ['g', 'h'], isSequence: true },
|
||||||
|
@ -52,42 +48,6 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
||||||
shortcut: { keys: ['g', 'n'], isSequence: true },
|
shortcut: { keys: ['g', 'n'], isSequence: true },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
|
||||||
shortcut: { keys: ['g', 'c'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
|
||||||
shortcut: { keys: ['g', 'f'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
|
||||||
shortcut: { keys: ['g', 'b'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_explore'),
|
|
||||||
shortcut: { keys: ['g', 'e'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_local'),
|
|
||||||
shortcut: { keys: ['g', 'l'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_federated'),
|
|
||||||
shortcut: { keys: ['g', 't'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_lists'),
|
|
||||||
shortcut: { keys: ['g', 'i'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_settings'),
|
|
||||||
shortcut: { keys: ['g', 's'], isSequence: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.navigation.go_to_profile'),
|
|
||||||
shortcut: { keys: ['g', 'p'], isSequence: true },
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -95,20 +55,16 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.search'),
|
description: t('magic_keys.groups.actions.search'),
|
||||||
shortcut: { keys: [modifierKeyName.value, 'k'], isSequence: false },
|
shortcut: { keys: [modifierKeyName, 'k'], isSequence: false },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.command_mode'),
|
description: t('magic_keys.groups.actions.command_mode'),
|
||||||
shortcut: { keys: [modifierKeyName.value, '/'], isSequence: false },
|
shortcut: { keys: [modifierKeyName, '/'], isSequence: false },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.compose'),
|
description: t('magic_keys.groups.actions.compose'),
|
||||||
shortcut: { keys: ['c'], isSequence: false },
|
shortcut: { keys: ['c'], isSequence: false },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: t('magic_keys.groups.actions.show_new_items'),
|
|
||||||
shortcut: { keys: ['.'], isSequence: false },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.favourite'),
|
description: t('magic_keys.groups.actions.favourite'),
|
||||||
shortcut: { keys: ['f'], isSequence: false },
|
shortcut: { keys: ['f'], isSequence: false },
|
||||||
|
@ -123,7 +79,7 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
name: t('magic_keys.groups.media.title'),
|
name: t('magic_keys.groups.media.title'),
|
||||||
items: [],
|
items: [],
|
||||||
},
|
},
|
||||||
])
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -10,7 +10,6 @@ defineProps<{
|
||||||
|
|
||||||
const container = ref()
|
const container = ref()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const userSettings = useUserSettings()
|
|
||||||
const { height: windowHeight } = useWindowSize()
|
const { height: windowHeight } = useWindowSize()
|
||||||
const { height: containerHeight } = useElementBounding(container)
|
const { height: containerHeight } = useElementBounding(container)
|
||||||
const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
||||||
|
@ -27,13 +26,10 @@ const containerClass = computed(() => {
|
||||||
<template>
|
<template>
|
||||||
<div ref="container" :class="containerClass">
|
<div ref="container" :class="containerClass">
|
||||||
<div
|
<div
|
||||||
sticky top-0 z10
|
sticky top-0 z10 backdrop-blur
|
||||||
pt="[env(safe-area-inset-top,0)]"
|
pt="[env(safe-area-inset-top,0)]"
|
||||||
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
||||||
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
||||||
:class="{
|
|
||||||
'backdrop-blur': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<div flex justify-between px5 py2 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
<div flex justify-between px5 py2 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
||||||
<div flex gap-3 items-center :overflow-hidden="!noOverflowHidden ? '' : false" py2 w-full>
|
<div flex gap-3 items-center :overflow-hidden="!noOverflowHidden ? '' : false" py2 w-full>
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
const model = defineModel<number>()
|
|
||||||
const isValid = defineModel<boolean>('isValid')
|
|
||||||
|
|
||||||
const days = ref<number | ''>(0)
|
|
||||||
const hours = ref<number | ''>(1)
|
|
||||||
const minutes = ref<number | ''>(0)
|
|
||||||
|
|
||||||
watchEffect(() => {
|
|
||||||
if (days.value === '' || hours.value === '' || minutes.value === '') {
|
|
||||||
isValid.value = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const duration
|
|
||||||
= days.value * 24 * 60 * 60
|
|
||||||
+ hours.value * 60 * 60
|
|
||||||
+ minutes.value * 60
|
|
||||||
|
|
||||||
if (duration <= 0) {
|
|
||||||
isValid.value = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
isValid.value = true
|
|
||||||
model.value = duration
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div flex flex-grow-0 gap-2>
|
|
||||||
<label flex items-center gap-2>
|
|
||||||
<input v-model="days" type="number" min="0" max="1999" input-base :class="!isValid ? 'input-error' : null">
|
|
||||||
{{ $t('confirm.mute_account.days', days === '' ? 0 : days) }}
|
|
||||||
</label>
|
|
||||||
<label flex items-center gap-2>
|
|
||||||
<input v-model="hours" type="number" min="0" max="24" input-base :class="!isValid ? 'input-error' : null">
|
|
||||||
{{ $t('confirm.mute_account.hours', hours === '' ? 0 : hours) }}
|
|
||||||
</label>
|
|
||||||
<label flex items-center gap-2>
|
|
||||||
<input v-model="minutes" type="number" min="0" max="59" step="5" input-base :class="!isValid ? 'input-error' : null">
|
|
||||||
{{ $t('confirm.mute_account.minute', minutes === '' ? 0 : minutes) }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -1,55 +1,26 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ConfirmDialogChoice, ConfirmDialogOptions } from '~/types'
|
import type { ConfirmDialogChoice, ConfirmDialogLabel } from '~/types'
|
||||||
import DurationPicker from '~/components/modal/DurationPicker.vue'
|
|
||||||
|
|
||||||
const props = defineProps<ConfirmDialogOptions>()
|
defineProps<ConfirmDialogLabel>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(evt: 'choice', choice: ConfirmDialogChoice): void
|
(evt: 'choice', choice: ConfirmDialogChoice): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const hasDuration = ref(false)
|
|
||||||
const isValidDuration = ref(true)
|
|
||||||
const duration = ref(60 * 60) // default to 1 hour
|
|
||||||
const shouldMuteNotifications = ref(true)
|
|
||||||
const isMute = computed(() => props.extraOptionType === 'mute')
|
|
||||||
|
|
||||||
function handleChoice(choice: ConfirmDialogChoice['choice']) {
|
|
||||||
const dialogChoice = {
|
|
||||||
choice,
|
|
||||||
...isMute.value && {
|
|
||||||
extraOptions: {
|
|
||||||
mute: {
|
|
||||||
duration: hasDuration.value ? duration.value : 0,
|
|
||||||
notifications: shouldMuteNotifications.value,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('choice', dialogChoice)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex="~ col" gap-6>
|
<div flex="~ col" gap-6>
|
||||||
<div font-bold text-lg>
|
<div font-bold text-lg text-center>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="description">
|
<div v-if="description">
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isMute" flex-col flex gap-4>
|
|
||||||
<CommonCheckbox v-model="hasDuration" :label="$t('confirm.mute_account.specify_duration')" prepend-checkbox checked-icon-color="text-primary" />
|
|
||||||
<DurationPicker v-if="hasDuration" v-model="duration" v-model:is-valid="isValidDuration" />
|
|
||||||
<CommonCheckbox v-model="shouldMuteNotifications" :label="$t('confirm.mute_account.notifications')" prepend-checkbox checked-icon-color="text-primary" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div flex justify-end gap-2>
|
<div flex justify-end gap-2>
|
||||||
<button btn-text @click="handleChoice('cancel')">
|
<button btn-text @click="emit('choice', 'cancel')">
|
||||||
{{ cancel || $t('confirm.common.cancel') }}
|
{{ cancel || $t('confirm.common.cancel') }}
|
||||||
</button>
|
</button>
|
||||||
<button btn-solid :disabled="!isValidDuration" @click="handleChoice('confirm')">
|
<button btn-solid @click="emit('choice', 'confirm')">
|
||||||
{{ confirm || $t('confirm.common.confirm') }}
|
{{ confirm || $t('confirm.common.confirm') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,7 +56,6 @@ const visible = defineModel<boolean>({ required: true })
|
||||||
|
|
||||||
const deactivated = useDeactivated()
|
const deactivated = useDeactivated()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const userSettings = useUserSettings()
|
|
||||||
|
|
||||||
/** scrollable HTML element */
|
/** scrollable HTML element */
|
||||||
const elDialogMain = ref<HTMLDivElement>()
|
const elDialogMain = ref<HTMLDivElement>()
|
||||||
|
@ -157,13 +156,7 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
<!-- corresponding to issue: #106, so please don't remove it. -->
|
<!-- corresponding to issue: #106, so please don't remove it. -->
|
||||||
|
|
||||||
<!-- Mask layer: blur -->
|
<!-- Mask layer: blur -->
|
||||||
<div
|
<div class="dialog-mask" absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter backdrop-blur-sm touch-none />
|
||||||
class="dialog-mask"
|
|
||||||
:class="{
|
|
||||||
'backdrop-blur-sm': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
|
||||||
}"
|
|
||||||
absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter touch-none
|
|
||||||
/>
|
|
||||||
<!-- Mask layer: dimming -->
|
<!-- Mask layer: dimming -->
|
||||||
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
||||||
<!-- Dialog container -->
|
<!-- Dialog container -->
|
||||||
|
|
|
@ -37,7 +37,7 @@ onUnmounted(() => locked.value = false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div relative h-full w-full flex pt-12 @click="onClick">
|
<div relative h-full w-full flex pt-12 w-100vh @click="onClick">
|
||||||
<button
|
<button
|
||||||
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.previous')"
|
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.previous')"
|
||||||
hover:bg="black/40" dark:bg="white/30" dark-hover:bg="white/20" absolute top="1/2" right-1 z5
|
hover:bg="black/40" dark:bg="white/30" dark-hover:bg="white/20" absolute top="1/2" right-1 z5
|
||||||
|
|
|
@ -15,14 +15,14 @@ const emit = defineEmits<{
|
||||||
const modelValue = defineModel<number>({ required: true })
|
const modelValue = defineModel<number>({ required: true })
|
||||||
|
|
||||||
const slideGap = 20
|
const slideGap = 20
|
||||||
const doubleTapThreshold = 250
|
const doubleTapTreshold = 250
|
||||||
|
|
||||||
const view = ref()
|
const view = ref()
|
||||||
const slider = ref()
|
const slider = ref()
|
||||||
const slide = ref()
|
const slide = ref()
|
||||||
const image = ref()
|
const image = ref()
|
||||||
|
|
||||||
const reduceMotion = import.meta.server ? ref(false) : useReducedMotion()
|
const reduceMotion = process.server ? ref(false) : useReducedMotion()
|
||||||
const isInitialScrollDone = useTimeout(350)
|
const isInitialScrollDone = useTimeout(350)
|
||||||
const canAnimate = computed(() => isInitialScrollDone.value && !reduceMotion.value)
|
const canAnimate = computed(() => isInitialScrollDone.value && !reduceMotion.value)
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@ const isPinching = ref(false)
|
||||||
const maxZoomOut = ref(1)
|
const maxZoomOut = ref(1)
|
||||||
const isZoomedIn = computed(() => scale.value > 1)
|
const isZoomedIn = computed(() => scale.value > 1)
|
||||||
|
|
||||||
const enableAutoplay = usePreferences('enableAutoplay')
|
|
||||||
|
|
||||||
function goToFocusedSlide() {
|
function goToFocusedSlide() {
|
||||||
scale.value = 1
|
scale.value = 1
|
||||||
x.value = slide.value[modelValue.value].offsetLeft * scale.value
|
x.value = slide.value[modelValue.value].offsetLeft * scale.value
|
||||||
|
@ -149,7 +147,7 @@ function handleLastDrag(tap: boolean, swipe: Vector2, movement: Vector2, positio
|
||||||
let lastTapAt = 0
|
let lastTapAt = 0
|
||||||
function handleTap([positionX, positionY]: Vector2) {
|
function handleTap([positionX, positionY]: Vector2) {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
const isDoubleTap = now - lastTapAt < doubleTapThreshold
|
const isDoubleTap = now - lastTapAt < doubleTapTreshold
|
||||||
lastTapAt = now
|
lastTapAt = now
|
||||||
|
|
||||||
if (!isDoubleTap)
|
if (!isDoubleTap)
|
||||||
|
@ -220,7 +218,7 @@ function handleZoomDrag([deltaX, deltaY]: Vector2) {
|
||||||
function handleSlideDrag([movementX, movementY]: Vector2) {
|
function handleSlideDrag([movementX, movementY]: Vector2) {
|
||||||
goToFocusedSlide()
|
goToFocusedSlide()
|
||||||
|
|
||||||
if (Math.abs(movementY) > Math.abs(movementX)) // vertical movement is more than horizontal
|
if (Math.abs(movementY) > Math.abs(movementX)) // vertical movement is more then horizontal
|
||||||
y.value -= movementY / scale.value
|
y.value -= movementY / scale.value
|
||||||
else
|
else
|
||||||
x.value -= movementX / scale.value
|
x.value -= movementX / scale.value
|
||||||
|
@ -266,12 +264,8 @@ const imageStyle = computed(() => ({
|
||||||
items-center
|
items-center
|
||||||
justify-center
|
justify-center
|
||||||
>
|
>
|
||||||
<component
|
<img
|
||||||
:is="item.type === 'gifv' ? 'video' : 'img'"
|
|
||||||
ref="image"
|
ref="image"
|
||||||
:autoplay="enableAutoplay"
|
|
||||||
controls
|
|
||||||
loop
|
|
||||||
select-none
|
select-none
|
||||||
max-w-full
|
max-w-full
|
||||||
max-h-full
|
max-h-full
|
||||||
|
@ -279,7 +273,7 @@ const imageStyle = computed(() => ({
|
||||||
:draggable="false"
|
:draggable="false"
|
||||||
:src="item.url || item.previewUrl"
|
:src="item.url || item.previewUrl"
|
||||||
:alt="item.description || ''"
|
:alt="item.description || ''"
|
||||||
/>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// only one icon can be lit up at the same time
|
// only one icon can be lit up at the same time
|
||||||
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
|
|
||||||
|
|
||||||
const moreMenuVisible = ref(false)
|
const moreMenuVisible = ref(false)
|
||||||
|
|
||||||
const { notifications } = useNotifications()
|
const { notifications } = useNotifications()
|
||||||
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
|
|
||||||
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -23,7 +19,7 @@ const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLO
|
||||||
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div i-ri:search-line />
|
<div i-ri:search-line />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
<NuxtLink to="/notifications" :aria-label="$t('nav.notifications')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div flex relative>
|
<div flex relative>
|
||||||
<div class="i-ri:notification-4-line" text-xl />
|
<div class="i-ri:notification-4-line" text-xl />
|
||||||
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
|
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
|
||||||
|
@ -36,8 +32,8 @@ const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLO
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<NuxtLink :to="`/${currentServer}/explore/${lastAccessedExploreRoute}`" :aria-label="$t('nav.explore')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
<NuxtLink :to="`/${currentServer}/explore`" :aria-label="$t('nav.explore')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div i-ri:compass-3-line />
|
<div i-ri:hashtag />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div i-ri:group-2-line />
|
<div i-ri:group-2-line />
|
||||||
|
|
|
@ -13,10 +13,7 @@ function toggleVisible() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonEl = ref<HTMLDivElement>()
|
const buttonEl = ref<HTMLDivElement>()
|
||||||
/**
|
/** Close the drop-down menu if the mouse click is not on the drop-down menu button when the drop-down menu is opened */
|
||||||
* Close the drop-down menu if the mouse click is not on the drop-down menu button when the drop-down menu is opened
|
|
||||||
* @param mouse
|
|
||||||
*/
|
|
||||||
function clickEvent(mouse: MouseEvent) {
|
function clickEvent(mouse: MouseEvent) {
|
||||||
if (mouse.target && !buttonEl.value?.children[0].contains(mouse.target as any)) {
|
if (mouse.target && !buttonEl.value?.children[0].contains(mouse.target as any)) {
|
||||||
if (modelValue.value) {
|
if (modelValue.value) {
|
||||||
|
@ -144,12 +141,11 @@ const { dragging, dragDistance } = invoke(() => {
|
||||||
:class="{
|
:class="{
|
||||||
'duration-0': dragging,
|
'duration-0': dragging,
|
||||||
'duration-250': !dragging,
|
'duration-250': !dragging,
|
||||||
'backdrop-blur-md': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
|
||||||
}"
|
}"
|
||||||
transition="transform ease-in"
|
transition="transform ease-in"
|
||||||
flex-1 min-w-48 py-6 mb="-1px"
|
flex-1 min-w-48 py-6 mb="-1px"
|
||||||
of-y-auto scrollbar-hide overscroll-none max-h="[calc(100vh-200px)]"
|
of-y-auto scrollbar-hide overscroll-none max-h="[calc(100vh-200px)]"
|
||||||
rounded-t-lg bg="white/85 dark:neutral-900/85" backdrop-filter
|
rounded-t-lg bg="white/85 dark:neutral-900/85" backdrop-filter backdrop-blur-md
|
||||||
border-t-1 border-base
|
border-t-1 border-base
|
||||||
>
|
>
|
||||||
<!-- Nav -->
|
<!-- Nav -->
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
|
|
||||||
|
|
||||||
const { command } = defineProps<{
|
const { command } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { notifications } = useNotifications()
|
const { notifications } = useNotifications()
|
||||||
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
|
|
||||||
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -16,7 +12,7 @@ const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLO
|
||||||
|
|
||||||
<div class="spacer" shrink xl:hidden />
|
<div class="spacer" shrink xl:hidden />
|
||||||
<NavSideItem :text="$t('nav.home')" to="/home" icon="i-ri:home-5-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.home')" to="/home" icon="i-ri:home-5-line" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.notifications')" :to="`/notifications/${lastAccessedNotificationRoute}`" icon="i-ri:notification-4-line" user-only :command="command">
|
<NavSideItem :text="$t('nav.notifications')" to="/notifications" icon="i-ri:notification-4-line" user-only :command="command">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<div flex relative>
|
<div flex relative>
|
||||||
<div class="i-ri:notification-4-line" text-xl />
|
<div class="i-ri:notification-4-line" text-xl />
|
||||||
|
@ -34,11 +30,10 @@ const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLO
|
||||||
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
||||||
|
|
||||||
<div class="spacer" shrink hidden sm:block />
|
<div class="spacer" shrink hidden sm:block />
|
||||||
<NavSideItem :text="$t('nav.explore')" :to="isHydrated ? `/${currentServer}/explore/${lastAccessedExploreRoute}` : `/explore/${lastAccessedExploreRoute}`" icon="i-ri:compass-3-line" :command="command" />
|
<NavSideItem :text="$t('nav.explore')" :to="isHydrated ? `/${currentServer}/explore` : '/explore'" icon="i-ri:hashtag" :command="command" />
|
||||||
<NavSideItem :text="$t('nav.local')" :to="isHydrated ? `/${currentServer}/public/local` : '/public/local'" icon="i-ri:group-2-line " :command="command" />
|
<NavSideItem :text="$t('nav.local')" :to="isHydrated ? `/${currentServer}/public/local` : '/public/local'" icon="i-ri:group-2-line " :command="command" />
|
||||||
<NavSideItem :text="$t('nav.federated')" :to="isHydrated ? `/${currentServer}/public` : '/public'" icon="i-ri:earth-line" :command="command" />
|
<NavSideItem :text="$t('nav.federated')" :to="isHydrated ? `/${currentServer}/public` : '/public'" icon="i-ri:earth-line" :command="command" />
|
||||||
<NavSideItem :text="$t('nav.lists')" :to="isHydrated ? `/${currentServer}/lists` : '/lists'" icon="i-ri:list-check" user-only :command="command" />
|
<NavSideItem :text="$t('nav.lists')" :to="isHydrated ? `/${currentServer}/lists` : '/lists'" icon="i-ri:list-check" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.hashtags')" to="/hashtags" icon="i-ri:hashtag" user-only :command="command" />
|
|
||||||
|
|
||||||
<div class="spacer" shrink hidden sm:block />
|
<div class="spacer" shrink hidden sm:block />
|
||||||
<NavSideItem :text="$t('nav.settings')" to="/settings" icon="i-ri:settings-3-line" :command="command" />
|
<NavSideItem :text="$t('nav.settings')" to="/settings" icon="i-ri:settings-3-line" :command="command" />
|
||||||
|
|
|
@ -28,13 +28,13 @@ useCommand({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const activeClass = ref('text-primary')
|
let activeClass = $ref('text-primary')
|
||||||
onHydrated(async () => {
|
onHydrated(async () => {
|
||||||
// TODO: force NuxtLink to reevaluate, we now we are in this route though, so we should force it to active
|
// TODO: force NuxtLink to reevaluate, we now we are in this route though, so we should force it to active
|
||||||
// we don't have currentServer defined until later
|
// we don't have currentServer defined until later
|
||||||
activeClass.value = ''
|
activeClass = ''
|
||||||
await nextTick()
|
await nextTick()
|
||||||
activeClass.value = 'text-primary'
|
activeClass = 'text-primary'
|
||||||
})
|
})
|
||||||
|
|
||||||
// Optimize rendering for the common case of being logged in, only show visual feedback for disabled user-only items
|
// Optimize rendering for the common case of being logged in, only show visual feedback for disabled user-only items
|
||||||
|
@ -57,21 +57,11 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre
|
||||||
<div
|
<div
|
||||||
class="item"
|
class="item"
|
||||||
flex items-center gap4
|
flex items-center gap4
|
||||||
|
w-fit rounded-3
|
||||||
|
px2 mx3 sm:mxa
|
||||||
xl="ml0 mr5 px5 w-auto"
|
xl="ml0 mr5 px5 w-auto"
|
||||||
:class="isSmallScreen
|
transition-100
|
||||||
? `
|
elk-group-hover="bg-active" group-focus-visible:ring="2 current"
|
||||||
w-full
|
|
||||||
px5 sm:mxa
|
|
||||||
transition-colors duration-200 transform
|
|
||||||
hover-bg-gray-100 hover-dark:(bg-gray-700 text-white)
|
|
||||||
` : `
|
|
||||||
w-fit rounded-3
|
|
||||||
px2 mx3 sm:mxa
|
|
||||||
transition-100
|
|
||||||
elk-group-hover-bg-active
|
|
||||||
group-focus-visible:ring-2
|
|
||||||
group-focus-visible:ring-current
|
|
||||||
`"
|
|
||||||
>
|
>
|
||||||
<slot name="icon">
|
<slot name="icon">
|
||||||
<div :class="icon" text-xl />
|
<div :class="icon" text-xl />
|
||||||
|
|
|
@ -34,13 +34,7 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
<strong>{{ currentServer }}</strong>
|
<strong>{{ currentServer }}</strong>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button v-else btn-solid text-sm px-2 py-1 text-center xl:hidden @click="openSigninDialog()">
|
||||||
v-else
|
|
||||||
flex="~ row"
|
|
||||||
gap-x-1 items-center justify-center btn-solid text-sm px-2 py-1 xl:hidden
|
|
||||||
@click="openSigninDialog()"
|
|
||||||
>
|
|
||||||
<span aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
|
||||||
{{ $t('action.sign_in') }}
|
{{ $t('action.sign_in') }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,13 +4,6 @@ import type { mastodon } from 'masto'
|
||||||
const { notification } = defineProps<{
|
const { notification } = defineProps<{
|
||||||
notification: mastodon.v1.Notification
|
notification: mastodon.v1.Notification
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
// well-known emoji reactions types Elk does not support yet
|
|
||||||
const unsupportedEmojiReactionTypes = ['pleroma:emoji_reaction', 'reaction']
|
|
||||||
if (unsupportedEmojiReactionTypes.includes(notification.type))
|
|
||||||
console.warn(`[DEV] ${t('notification.missing_type')} '${notification.type}' (notification.id: ${notification.id})`)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -22,6 +15,7 @@ if (unsupportedEmojiReactionTypes.includes(notification.type))
|
||||||
ps-3 pe-4 inset-is-0
|
ps-3 pe-4 inset-is-0
|
||||||
rounded-ie-be-3
|
rounded-ie-be-3
|
||||||
py-3 bg-base top-0
|
py-3 bg-base top-0
|
||||||
|
:lang="notification.status?.language ?? undefined"
|
||||||
>
|
>
|
||||||
<div i-ri-user-3-line text-xl me-3 color-blue />
|
<div i-ri-user-3-line text-xl me-3 color-blue />
|
||||||
<AccountDisplayName :account="notification.account" text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all />
|
<AccountDisplayName :account="notification.account" text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all />
|
||||||
|
@ -32,6 +26,7 @@ if (unsupportedEmojiReactionTypes.includes(notification.type))
|
||||||
<AccountBigCard
|
<AccountBigCard
|
||||||
ms10
|
ms10
|
||||||
:account="notification.account"
|
:account="notification.account"
|
||||||
|
:lang="notification.status?.language ?? undefined"
|
||||||
/>
|
/>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
@ -95,8 +90,7 @@ if (unsupportedEmojiReactionTypes.includes(notification.type))
|
||||||
<template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'">
|
<template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'">
|
||||||
<StatusCard :status="notification.status!" />
|
<StatusCard :status="notification.status!" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="!unsupportedEmojiReactionTypes.includes(notification.type)">
|
<template v-else>
|
||||||
<!-- prevent showing errors for dev for known emoji reaction types -->
|
|
||||||
<!-- type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes -->
|
<!-- type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes -->
|
||||||
<div text-red font-bold>
|
<div text-red font-bold>
|
||||||
[DEV] {{ $t('notification.missing_type') }} '{{ notification.type }}'
|
[DEV] {{ $t('notification.missing_type') }} '{{ notification.type }}'
|
||||||
|
|
|
@ -5,10 +5,10 @@ const { items } = defineProps<{
|
||||||
items: GroupedNotifications
|
items: GroupedNotifications
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const count = computed(() => items.items.length)
|
const count = $computed(() => items.items.length)
|
||||||
const isExpanded = ref(false)
|
const isExpanded = ref(false)
|
||||||
const lang = computed(() => {
|
const lang = $computed(() => {
|
||||||
return (count.value > 1 || count.value === 0) ? undefined : items.items[0].status?.language
|
return (count > 1 || count === 0) ? undefined : items.items[0].status?.language
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ const { group } = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
const reblogs = computed(() => group.likes.filter(i => i.reblog))
|
const reblogs = $computed(() => group.likes.filter(i => i.reblog))
|
||||||
const likes = computed(() => group.likes.filter(i => i.favourite && !i.reblog))
|
const likes = $computed(() => group.likes.filter(i => i.favourite && !i.reblog))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// @ts-expect-error missing types
|
// @ts-expect-error missing types
|
||||||
import { DynamicScrollerItem } from 'vue-virtual-scroller'
|
import { DynamicScrollerItem } from 'vue-virtual-scroller'
|
||||||
import type { mastodon } from 'masto'
|
import type { Paginator, WsEvents, mastodon } from 'masto'
|
||||||
import type { GroupedAccountLike, NotificationSlot } from '~/types'
|
import type { GroupedAccountLike, NotificationSlot } from '~/types'
|
||||||
|
|
||||||
const { paginator, stream } = defineProps<{
|
const { paginator, stream } = defineProps<{
|
||||||
paginator: mastodon.Paginator<mastodon.v1.Notification[], mastodon.rest.v1.ListNotificationsParams>
|
paginator: Paginator<mastodon.v1.Notification[], mastodon.v1.ListNotificationsParams>
|
||||||
stream?: mastodon.streaming.Subscription
|
stream?: Promise<WsEvents>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const virtualScroller = false // TODO: fix flickering issue with virtual scroll
|
const virtualScroller = false // TODO: fix flickering issue with virtual scroll
|
||||||
|
@ -25,7 +25,7 @@ function includeNotificationsForStatusCard({ type, status }: mastodon.v1.Notific
|
||||||
|
|
||||||
// Group by type (and status when applicable)
|
// Group by type (and status when applicable)
|
||||||
function groupId(item: mastodon.v1.Notification): string {
|
function groupId(item: mastodon.v1.Notification): string {
|
||||||
// If the update is related to a status, group notifications from the same account (boost + favorite the same status)
|
// If the update is related to an status, group notifications from the same account (boost + favorite the same status)
|
||||||
const id = item.status
|
const id = item.status
|
||||||
? {
|
? {
|
||||||
status: item.status?.id,
|
status: item.status?.id,
|
||||||
|
@ -171,11 +171,11 @@ const { formatNumber } = useHumanReadableNumber()
|
||||||
:paginator="paginator"
|
:paginator="paginator"
|
||||||
:preprocess="preprocess"
|
:preprocess="preprocess"
|
||||||
:stream="stream"
|
:stream="stream"
|
||||||
eventType="notification"
|
|
||||||
:virtualScroller="virtualScroller"
|
:virtualScroller="virtualScroller"
|
||||||
|
eventType="notification"
|
||||||
>
|
>
|
||||||
<template #updater="{ number, update }">
|
<template #updater="{ number, update }">
|
||||||
<button id="elk_show_new_items" py-4 border="b base" flex="~ col" p-3 w-full text-primary font-bold @click="() => { update(); clearNotifications() }">
|
<button py-4 border="b base" flex="~ col" p-3 w-full text-primary font-bold @click="() => { update(); clearNotifications() }">
|
||||||
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -17,12 +17,12 @@ const { t } = useI18n()
|
||||||
|
|
||||||
const pwaEnabled = useAppConfig().pwaEnabled
|
const pwaEnabled = useAppConfig().pwaEnabled
|
||||||
|
|
||||||
const busy = ref<boolean>(false)
|
let busy = $ref<boolean>(false)
|
||||||
const animateSave = ref<boolean>(false)
|
let animateSave = $ref<boolean>(false)
|
||||||
const animateSubscription = ref<boolean>(false)
|
let animateSubscription = $ref<boolean>(false)
|
||||||
const animateRemoveSubscription = ref<boolean>(false)
|
let animateRemoveSubscription = $ref<boolean>(false)
|
||||||
const subscribeError = ref<string>('')
|
let subscribeError = $ref<string>('')
|
||||||
const showSubscribeError = ref<boolean>(false)
|
let showSubscribeError = $ref<boolean>(false)
|
||||||
|
|
||||||
function hideNotification() {
|
function hideNotification() {
|
||||||
const key = currentUser.value?.account?.acct
|
const key = currentUser.value?.account?.acct
|
||||||
|
@ -30,22 +30,22 @@ function hideNotification() {
|
||||||
hiddenNotification.value[key] = true
|
hiddenNotification.value[key] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const showWarning = computed(() => {
|
const showWarning = $computed(() => {
|
||||||
if (!pwaEnabled)
|
if (!pwaEnabled)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return isSupported
|
return isSupported
|
||||||
&& (!isSubscribed.value || !notificationPermission.value || notificationPermission.value === 'prompt')
|
&& (!isSubscribed.value || !notificationPermission.value || notificationPermission.value === 'prompt')
|
||||||
&& !(hiddenNotification.value[currentUser.value?.account?.acct ?? ''])
|
&& !(hiddenNotification.value[currentUser.value?.account?.acct ?? ''] === true)
|
||||||
})
|
})
|
||||||
|
|
||||||
async function saveSettings() {
|
async function saveSettings() {
|
||||||
if (busy.value)
|
if (busy)
|
||||||
return
|
return
|
||||||
|
|
||||||
busy.value = true
|
busy = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
animateSave.value = true
|
animateSave = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await updateSubscription()
|
await updateSubscription()
|
||||||
|
@ -55,48 +55,48 @@ async function saveSettings() {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
busy.value = false
|
busy = false
|
||||||
animateSave.value = false
|
animateSave = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function doSubscribe() {
|
async function doSubscribe() {
|
||||||
if (busy.value)
|
if (busy)
|
||||||
return
|
return
|
||||||
|
|
||||||
busy.value = true
|
busy = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
animateSubscription.value = true
|
animateSubscription = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await subscribe()
|
const result = await subscribe()
|
||||||
if (result !== 'subscribed') {
|
if (result !== 'subscribed') {
|
||||||
subscribeError.value = t(`settings.notifications.push_notifications.subscription_error.${result === 'notification-denied' ? 'permission_denied' : 'request_error'}`)
|
subscribeError = t(`settings.notifications.push_notifications.subscription_error.${result === 'notification-denied' ? 'permission_denied' : 'request_error'}`)
|
||||||
showSubscribeError.value = true
|
showSubscribeError = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof PushSubscriptionError) {
|
if (err instanceof PushSubscriptionError) {
|
||||||
subscribeError.value = t(`settings.notifications.push_notifications.subscription_error.${err.code}`)
|
subscribeError = t(`settings.notifications.push_notifications.subscription_error.${err.code}`)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
subscribeError.value = t('settings.notifications.push_notifications.subscription_error.request_error')
|
subscribeError = t('settings.notifications.push_notifications.subscription_error.request_error')
|
||||||
}
|
}
|
||||||
showSubscribeError.value = true
|
showSubscribeError = true
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
busy.value = false
|
busy = false
|
||||||
animateSubscription.value = false
|
animateSubscription = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function removeSubscription() {
|
async function removeSubscription() {
|
||||||
if (busy.value)
|
if (busy)
|
||||||
return
|
return
|
||||||
|
|
||||||
busy.value = true
|
busy = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
animateRemoveSubscription.value = true
|
animateRemoveSubscription = true
|
||||||
try {
|
try {
|
||||||
await unsubscribe()
|
await unsubscribe()
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,11 @@ async function removeSubscription() {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
busy.value = false
|
busy = false
|
||||||
animateRemoveSubscription.value = false
|
animateRemoveSubscription = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onActivated(() => (busy.value = false))
|
onActivated(() => (busy = false))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -20,10 +20,9 @@ const maxDescriptionLength = 1500
|
||||||
|
|
||||||
const isEditDialogOpen = ref(false)
|
const isEditDialogOpen = ref(false)
|
||||||
const description = ref(props.attachment.description ?? '')
|
const description = ref(props.attachment.description ?? '')
|
||||||
|
|
||||||
function toggleApply() {
|
function toggleApply() {
|
||||||
isEditDialogOpen.value = false
|
isEditDialogOpen.value = false
|
||||||
emit('setDescription', description.value)
|
emit('setDescription', unref(description))
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ const { editor } = defineProps<{
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonTooltip placement="top" :content="$t('tooltip.open_editor_tools')">
|
<CommonTooltip placement="top" :content="$t('tooltip.open_editor_tools')">
|
||||||
<VDropdown v-if="editor" placement="bottom">
|
<VDropdown v-if="editor" placement="top">
|
||||||
<button
|
<button
|
||||||
btn-action-icon
|
btn-action-icon
|
||||||
:aria-label="$t('tooltip.open_editor_tools')"
|
:aria-label="$t('tooltip.open_editor_tools')"
|
||||||
|
|
|
@ -9,16 +9,16 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
|
|
||||||
const el = ref<HTMLElement>()
|
const el = $ref<HTMLElement>()
|
||||||
const picker = ref<Picker>()
|
let picker = $ref<Picker>()
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
async function openEmojiPicker() {
|
async function openEmojiPicker() {
|
||||||
await updateCustomEmojis()
|
await updateCustomEmojis()
|
||||||
|
|
||||||
if (picker.value) {
|
if (picker) {
|
||||||
picker.value.update({
|
picker.update({
|
||||||
theme: colorMode,
|
theme: colorMode.value,
|
||||||
custom: customEmojisData.value,
|
custom: customEmojisData.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ async function openEmojiPicker() {
|
||||||
importEmojiLang(locale.value.split('-')[0]),
|
importEmojiLang(locale.value.split('-')[0]),
|
||||||
])
|
])
|
||||||
|
|
||||||
picker.value = new Picker({
|
picker = new Picker({
|
||||||
data: () => dataPromise,
|
data: () => dataPromise,
|
||||||
onEmojiSelect({ native, src, alt, name }: any) {
|
onEmojiSelect({ native, src, alt, name }: any) {
|
||||||
native
|
native
|
||||||
|
@ -37,19 +37,19 @@ async function openEmojiPicker() {
|
||||||
: emit('selectCustom', { src, alt, 'data-emoji-id': name })
|
: emit('selectCustom', { src, alt, 'data-emoji-id': name })
|
||||||
},
|
},
|
||||||
set: 'twitter',
|
set: 'twitter',
|
||||||
theme: colorMode,
|
theme: colorMode.value,
|
||||||
custom: customEmojisData.value,
|
custom: customEmojisData.value,
|
||||||
i18n,
|
i18n,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await nextTick()
|
await nextTick()
|
||||||
// TODO: custom picker
|
// TODO: custom picker
|
||||||
el.value?.appendChild(picker.value as any as HTMLElement)
|
el?.appendChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideEmojiPicker() {
|
function hideEmojiPicker() {
|
||||||
if (picker.value)
|
if (picker)
|
||||||
el.value?.removeChild(picker.value as any as HTMLElement)
|
el?.removeChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,16 @@ const modelValue = defineModel<string>({ required: true })
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
const languageKeyword = ref('')
|
const languageKeyword = $ref('')
|
||||||
|
|
||||||
const fuse = new Fuse(languagesNameList, {
|
const fuse = new Fuse(languagesNameList, {
|
||||||
keys: ['code', 'nativeName', 'name'],
|
keys: ['code', 'nativeName', 'name'],
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const languages = computed(() =>
|
const languages = $computed(() =>
|
||||||
languageKeyword.value.trim()
|
languageKeyword.trim()
|
||||||
? fuse.search(languageKeyword.value).map(r => r.item)
|
? fuse.search(languageKeyword).map(r => r.item)
|
||||||
: [...languagesNameList].filter(entry => !userSettings.value.disabledTranslationLanguages.includes(entry.code))
|
: [...languagesNameList].filter(entry => !userSettings.value.disabledTranslationLanguages.includes(entry.code))
|
||||||
.sort(({ code: a }, { code: b }) => {
|
.sort(({ code: a }, { code: b }) => {
|
||||||
// Put English on the top
|
// Put English on the top
|
||||||
|
|
|
@ -7,7 +7,7 @@ const modelValue = defineModel<string>({
|
||||||
required: true,
|
required: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentVisibility = computed(() =>
|
const currentVisibility = $computed(() =>
|
||||||
statusVisibilities.find(v => v.value === modelValue.value) || statusVisibilities[0],
|
statusVisibilities.find(v => v.value === modelValue.value) || statusVisibilities[0],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,98 +27,89 @@ const emit = defineEmits<{
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const draftState = useDraft(draftKey, initial)
|
const draftState = useDraft(draftKey, initial)
|
||||||
const { draft } = draftState
|
const { draft } = $(draftState)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isExceedingAttachmentLimit,
|
isExceedingAttachmentLimit, isUploading, failedAttachments, isOverDropZone,
|
||||||
isUploading,
|
uploadAttachments, pickAttachments, setDescription, removeAttachment,
|
||||||
failedAttachments,
|
|
||||||
isOverDropZone,
|
|
||||||
uploadAttachments,
|
|
||||||
pickAttachments,
|
|
||||||
setDescription,
|
|
||||||
removeAttachment,
|
|
||||||
dropZoneRef,
|
dropZoneRef,
|
||||||
} = useUploadMediaAttachment(draft)
|
} = $(useUploadMediaAttachment($$(draft)))
|
||||||
|
|
||||||
const { shouldExpanded, isExpanded, isSending, isPublishDisabled, publishDraft, failedMessages, preferredLanguage, publishSpoilerText } = usePublish(
|
let { shouldExpanded, isExpanded, isSending, isPublishDisabled, publishDraft, failedMessages, preferredLanguage, publishSpoilerText } = $(usePublish(
|
||||||
{
|
{
|
||||||
draftState,
|
draftState,
|
||||||
...{ expanded: toRef(() => expanded), isUploading, initialDraft: toRef(() => initial) },
|
...$$({ expanded, isUploading, initialDraft: initial }),
|
||||||
},
|
},
|
||||||
)
|
))
|
||||||
|
|
||||||
const { editor } = useTiptap({
|
const { editor } = useTiptap({
|
||||||
content: computed({
|
content: computed({
|
||||||
get: () => draft.value.params.status,
|
get: () => draft.params.status,
|
||||||
set: (newVal) => {
|
set: (newVal) => {
|
||||||
draft.value.params.status = newVal
|
draft.params.status = newVal
|
||||||
draft.value.lastUpdated = Date.now()
|
draft.lastUpdated = Date.now()
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
placeholder: computed(() => placeholder ?? draft.value.params.inReplyToId ? t('placeholder.replying') : t('placeholder.default_1')),
|
placeholder: computed(() => placeholder ?? draft.params.inReplyToId ? t('placeholder.replying') : t('placeholder.default_1')),
|
||||||
autofocus: shouldExpanded.value,
|
autofocus: shouldExpanded,
|
||||||
onSubmit: publish,
|
onSubmit: publish,
|
||||||
onFocus() {
|
onFocus() {
|
||||||
if (!isExpanded && draft.value.initialText) {
|
if (!isExpanded && draft.initialText) {
|
||||||
editor.value?.chain().insertContent(`${draft.value.initialText} `).focus('end').run()
|
editor.value?.chain().insertContent(`${draft.initialText} `).focus('end').run()
|
||||||
draft.value.initialText = ''
|
draft.initialText = ''
|
||||||
}
|
}
|
||||||
isExpanded.value = true
|
isExpanded = true
|
||||||
},
|
},
|
||||||
onPaste: handlePaste,
|
onPaste: handlePaste,
|
||||||
})
|
})
|
||||||
|
|
||||||
function trimPollOptions() {
|
function trimPollOptions() {
|
||||||
const indexLastNonEmpty = draft.value.params.poll!.options.findLastIndex(option => option.trim().length > 0)
|
const indexLastNonEmpty = draft.params.poll!.options.findLastIndex(option => option.trim().length > 0)
|
||||||
const trimmedOptions = draft.value.params.poll!.options.slice(0, indexLastNonEmpty + 1)
|
const trimmedOptions = draft.params.poll!.options.slice(0, indexLastNonEmpty + 1)
|
||||||
|
|
||||||
if (currentInstance.value?.configuration
|
if (currentInstance.value?.configuration
|
||||||
&& trimmedOptions.length >= currentInstance.value?.configuration?.polls.maxOptions)
|
&& trimmedOptions.length >= currentInstance.value?.configuration?.polls.maxOptions)
|
||||||
draft.value.params.poll!.options = trimmedOptions
|
draft.params.poll!.options = trimmedOptions
|
||||||
else
|
else
|
||||||
draft.value.params.poll!.options = [...trimmedOptions, '']
|
draft.params.poll!.options = [...trimmedOptions, '']
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPollOptionDraft(event: Event, index: number) {
|
function editPollOptionDraft(event: Event, index: number) {
|
||||||
draft.value.params.poll!.options = Object.assign(draft.value.params.poll!.options.slice(), { [index]: (event.target as HTMLInputElement).value })
|
draft.params.poll!.options[index] = (event.target as HTMLInputElement).value
|
||||||
|
|
||||||
trimPollOptions()
|
trimPollOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletePollOption(index: number) {
|
function deletePollOption(index: number) {
|
||||||
const newPollOptions = draft.value.params.poll!.options.slice()
|
draft.params.poll!.options.splice(index, 1)
|
||||||
newPollOptions.splice(index, 1)
|
|
||||||
draft.value.params.poll!.options = newPollOptions
|
|
||||||
trimPollOptions()
|
trimPollOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
const expiresInOptions = computed(() => [
|
const expiresInOptions = computed(() => [
|
||||||
{
|
{
|
||||||
seconds: 1 * 60 * 60,
|
seconds: 1 * 60 * 60,
|
||||||
label: t('time_ago_options.hour_future', 1),
|
label: isHydrated.value ? t('time_ago_options.hour_future', 1) : '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
seconds: 2 * 60 * 60,
|
seconds: 2 * 60 * 60,
|
||||||
label: t('time_ago_options.hour_future', 2),
|
label: isHydrated.value ? t('time_ago_options.hour_future', 2) : '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
seconds: 1 * 24 * 60 * 60,
|
seconds: 1 * 24 * 60 * 60,
|
||||||
label: t('time_ago_options.day_future', 1),
|
label: isHydrated.value ? t('time_ago_options.day_future', 1) : '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
seconds: 2 * 24 * 60 * 60,
|
seconds: 2 * 24 * 60 * 60,
|
||||||
label: t('time_ago_options.day_future', 2),
|
label: isHydrated.value ? t('time_ago_options.day_future', 2) : '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
seconds: 7 * 24 * 60 * 60,
|
seconds: 7 * 24 * 60 * 60,
|
||||||
label: t('time_ago_options.day_future', 7),
|
label: isHydrated.value ? t('time_ago_options.day_future', 7) : '',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const expiresInDefaultOptionIndex = 2
|
const expiresInDefaultOptionIndex = 2
|
||||||
|
|
||||||
const characterCount = computed(() => {
|
const characterCount = $computed(() => {
|
||||||
const text = htmlToText(editor.value?.getHTML() || '')
|
const text = htmlToText(editor.value?.getHTML() || '')
|
||||||
|
|
||||||
let length = stringLength(text)
|
let length = stringLength(text)
|
||||||
|
@ -139,26 +130,24 @@ const characterCount = computed(() => {
|
||||||
for (const [fullMatch, before, _handle, username] of text.matchAll(countableMentionRegex))
|
for (const [fullMatch, before, _handle, username] of text.matchAll(countableMentionRegex))
|
||||||
length -= fullMatch.length - (before + username).length - 1 // - 1 for the @
|
length -= fullMatch.length - (before + username).length - 1 // - 1 for the @
|
||||||
|
|
||||||
if (draft.value.mentions) {
|
if (draft.mentions) {
|
||||||
// + 1 is needed as mentions always need a space separator at the end
|
// + 1 is needed as mentions always need a space seperator at the end
|
||||||
length += draft.value.mentions.map((mention) => {
|
length += draft.mentions.map((mention) => {
|
||||||
const [handle] = mention.split('@')
|
const [handle] = mention.split('@')
|
||||||
return `@${handle}`
|
return `@${handle}`
|
||||||
}).join(' ').length + 1
|
}).join(' ').length + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
length += stringLength(publishSpoilerText.value)
|
length += stringLength(publishSpoilerText)
|
||||||
|
|
||||||
return length
|
return length
|
||||||
})
|
})
|
||||||
|
|
||||||
const isExceedingCharacterLimit = computed(() => {
|
const isExceedingCharacterLimit = $computed(() => {
|
||||||
return characterCount.value > characterLimit.value
|
return characterCount > characterLimit.value
|
||||||
})
|
})
|
||||||
|
|
||||||
const postLanguageDisplay = computed(() => languagesNameList.find(i => i.code === (draft.value.params.language || preferredLanguage))?.nativeName)
|
const postLanguageDisplay = $computed(() => languagesNameList.find(i => i.code === (draft.params.language || preferredLanguage))?.nativeName)
|
||||||
|
|
||||||
const isDM = computed(() => draft.value.params.visibility === 'direct')
|
|
||||||
|
|
||||||
async function handlePaste(evt: ClipboardEvent) {
|
async function handlePaste(evt: ClipboardEvent) {
|
||||||
const files = evt.clipboardData?.files
|
const files = evt.clipboardData?.files
|
||||||
|
@ -177,7 +166,7 @@ function insertCustomEmoji(image: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleSensitive() {
|
async function toggleSensitive() {
|
||||||
draft.value.params.sensitive = !draft.value.params.sensitive
|
draft.params.sensitive = !draft.params.sensitive
|
||||||
}
|
}
|
||||||
|
|
||||||
async function publish() {
|
async function publish() {
|
||||||
|
@ -279,16 +268,12 @@ onDeactivated(() => {
|
||||||
</ol>
|
</ol>
|
||||||
</CommonErrorMessage>
|
</CommonErrorMessage>
|
||||||
|
|
||||||
<div relative flex-1 flex flex-col min-h-30>
|
<div relative flex-1 flex flex-col>
|
||||||
<EditorContent
|
<EditorContent
|
||||||
:editor="editor"
|
:editor="editor"
|
||||||
flex max-w-full
|
flex max-w-full
|
||||||
:class="{
|
:class="shouldExpanded ? 'min-h-30 md:max-h-[calc(100vh-200px)] sm:max-h-[calc(100vh-400px)] max-h-35 of-y-auto overscroll-contain' : ''"
|
||||||
'md:max-h-[calc(100vh-200px)] sm:max-h-[calc(100vh-400px)] max-h-35 of-y-auto overscroll-contain': shouldExpanded,
|
|
||||||
'py2 px3.5 bg-dm rounded-4 me--1 ms--1 mt--1': isDM,
|
|
||||||
}"
|
|
||||||
@keydown="stopQuestionMarkPropagation"
|
@keydown="stopQuestionMarkPropagation"
|
||||||
@keydown.esc.prevent="editor?.commands.blur()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ const route = useRoute()
|
||||||
const { formatNumber } = useHumanReadableNumber()
|
const { formatNumber } = useHumanReadableNumber()
|
||||||
const timeAgoOptions = useTimeAgoOptions()
|
const timeAgoOptions = useTimeAgoOptions()
|
||||||
|
|
||||||
const draftKey = ref('home')
|
let draftKey = $ref('home')
|
||||||
|
|
||||||
const draftKeys = computed(() => Object.keys(currentUserDrafts.value))
|
const draftKeys = $computed(() => Object.keys(currentUserDrafts.value))
|
||||||
const nonEmptyDrafts = computed(() => draftKeys.value
|
const nonEmptyDrafts = $computed(() => draftKeys
|
||||||
.filter(i => i !== draftKey.value && !isEmptyDraft(currentUserDrafts.value[i]))
|
.filter(i => i !== draftKey && !isEmptyDraft(currentUserDrafts.value[i]))
|
||||||
.map(i => [i, currentUserDrafts.value[i]] as const),
|
.map(i => [i, currentUserDrafts.value[i]] as const),
|
||||||
)
|
)
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
draftKey.value = route.query.draft?.toString() || 'home'
|
draftKey = route.query.draft?.toString() || 'home'
|
||||||
})
|
})
|
||||||
|
|
||||||
onDeactivated(() => {
|
onDeactivated(() => {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<button
|
<button
|
||||||
v-if="useNuxtApp().$pwa?.needRefresh"
|
v-if="$pwa?.needRefresh"
|
||||||
bg="primary-fade" relative rounded
|
bg="primary-fade" relative rounded
|
||||||
flex="~ gap-1 center" px3 py1 text-primary
|
flex="~ gap-1 center" px3 py1 text-primary
|
||||||
@click="useNuxtApp().$pwa?.updateServiceWorker()"
|
@click="$pwa.updateServiceWorker()"
|
||||||
>
|
>
|
||||||
<div i-ri-download-cloud-2-line />
|
<div i-ri-download-cloud-2-line />
|
||||||
<h2 flex="~ gap-2" items-center>
|
<h2 flex="~ gap-2" items-center>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="useNuxtApp().$pwa?.showInstallPrompt && !useNuxtApp().$pwa?.needRefresh"
|
v-if="$pwa?.showInstallPrompt && !$pwa?.needRefresh"
|
||||||
m-2 p5 bg="primary-fade" relative
|
m-2 p5 bg="primary-fade" relative
|
||||||
rounded-lg of-hidden
|
rounded-lg of-hidden
|
||||||
flex="~ col gap-3"
|
flex="~ col gap-3"
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
{{ $t('pwa.install_title') }}
|
{{ $t('pwa.install_title') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div flex="~ gap-1">
|
<div flex="~ gap-1">
|
||||||
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="useNuxtApp().$pwa?.install()">
|
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="$pwa.install()">
|
||||||
{{ $t('pwa.install') }}
|
{{ $t('pwa.install') }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="useNuxtApp().$pwa?.cancelInstall()">
|
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="$pwa.cancelInstall()">
|
||||||
{{ $t('pwa.dismiss') }}
|
{{ $t('pwa.dismiss') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="useNuxtApp().$pwa?.needRefresh"
|
v-if="$pwa?.needRefresh"
|
||||||
m-2 p5 bg="primary-fade" relative
|
m-2 p5 bg="primary-fade" relative
|
||||||
rounded-lg of-hidden
|
rounded-lg of-hidden
|
||||||
flex="~ col gap-3"
|
flex="~ col gap-3"
|
||||||
|
@ -9,10 +9,10 @@
|
||||||
{{ $t('pwa.title') }}
|
{{ $t('pwa.title') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div flex="~ gap-1">
|
<div flex="~ gap-1">
|
||||||
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="useNuxtApp().$pwa?.updateServiceWorker()">
|
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="$pwa.updateServiceWorker()">
|
||||||
{{ $t('pwa.update') }}
|
{{ $t('pwa.update') }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="useNuxtApp().$pwa?.close()">
|
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="$pwa.close()">
|
||||||
{{ $t('pwa.dismiss') }}
|
{{ $t('pwa.dismiss') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -34,11 +34,11 @@ function categoryChosen() {
|
||||||
async function loadStatuses() {
|
async function loadStatuses() {
|
||||||
if (status) {
|
if (status) {
|
||||||
// Load the 5 statuses before and after the reported status
|
// Load the 5 statuses before and after the reported status
|
||||||
const prevStatuses = await client.value.v1.accounts.$select(account.id).statuses.list({
|
const prevStatuses = await client.value.v1.accounts.listStatuses(account.id, {
|
||||||
maxId: status.id,
|
maxId: status.id,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
})
|
})
|
||||||
const nextStatuses = await client.value.v1.accounts.$select(account.id).statuses.list({
|
const nextStatuses = await client.value.v1.accounts.listStatuses(account.id, {
|
||||||
minId: status.id,
|
minId: status.id,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
})
|
})
|
||||||
|
@ -48,7 +48,7 @@ async function loadStatuses() {
|
||||||
else {
|
else {
|
||||||
// Reporting an account directly
|
// Reporting an account directly
|
||||||
// Load the 10 most recent statuses
|
// Load the 10 most recent statuses
|
||||||
const mostRecentStatuses = await client.value.v1.accounts.$select(account.id).statuses.list({
|
const mostRecentStatuses = await client.value.v1.accounts.listStatuses(account.id, {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
})
|
})
|
||||||
availableStatuses.value = mostRecentStatuses
|
availableStatuses.value = mostRecentStatuses
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { hashtag } = defineProps<{
|
||||||
hashtag: mastodon.v1.Tag
|
hashtag: mastodon.v1.Tag
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const totalTrend = computed(() =>
|
const totalTrend = $computed(() =>
|
||||||
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -77,12 +77,11 @@ function activate() {
|
||||||
ps-3
|
ps-3
|
||||||
pe-1
|
pe-1
|
||||||
ml-1
|
ml-1
|
||||||
:placeholder="t('nav.search')"
|
:placeholder="isHydrated ? t('nav.search') : ''"
|
||||||
pb="1px"
|
pb="1px"
|
||||||
placeholder-text-secondary
|
placeholder-text-secondary
|
||||||
@keydown.down.prevent="shift(1)"
|
@keydown.down.prevent="shift(1)"
|
||||||
@keydown.up.prevent="shift(-1)"
|
@keydown.up.prevent="shift(-1)"
|
||||||
@keydown.esc.prevent="input?.blur()"
|
|
||||||
@keypress.enter="activate"
|
@keypress.enter="activate"
|
||||||
>
|
>
|
||||||
<button v-if="query.length" btn-action-icon text-secondary @click="query = ''; input?.focus()">
|
<button v-if="query.length" btn-action-icon text-secondary @click="query = ''; input?.focus()">
|
||||||
|
|
|
@ -10,22 +10,20 @@ const props = defineProps<{
|
||||||
external?: true
|
external?: true
|
||||||
large?: true
|
large?: true
|
||||||
match?: boolean
|
match?: boolean
|
||||||
target?: string
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external))
|
|
||||||
|
|
||||||
useCommand({
|
useCommand({
|
||||||
scope: 'Settings',
|
scope: 'Settings',
|
||||||
|
|
||||||
name: () => props.text
|
name: () => props.text
|
||||||
?? (props.to
|
?? (props.to
|
||||||
? typeof props.to === 'string'
|
? typeof props.to === 'string'
|
||||||
? props.to
|
? props.to
|
||||||
: props.to.name
|
: props.to.name
|
||||||
: ''
|
: ''
|
||||||
),
|
),
|
||||||
description: () => props.description,
|
description: () => props.description,
|
||||||
icon: () => props.icon || '',
|
icon: () => props.icon || '',
|
||||||
visible: () => props.command && props.to,
|
visible: () => props.command && props.to,
|
||||||
|
@ -41,15 +39,14 @@ useCommand({
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:to="to"
|
:to="to"
|
||||||
:external="external"
|
:external="external"
|
||||||
:target="target"
|
|
||||||
exact-active-class="text-primary"
|
exact-active-class="text-primary"
|
||||||
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
|
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
|
||||||
block w-full group focus:outline-none
|
block w-full group focus:outline-none
|
||||||
:tabindex="disabled ? -1 : null"
|
:tabindex="disabled ? -1 : null"
|
||||||
@click="scrollOnClick ? $scrollToTop() : undefined"
|
@click="to ? $scrollToTop() : undefined"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
w-full flex px5 py3 md:gap2 gap4 items-center
|
w-full flex w-fit px5 py3 md:gap2 gap4 items-center
|
||||||
transition-250 group-hover:bg-active
|
transition-250 group-hover:bg-active
|
||||||
group-focus-visible:ring="2 current"
|
group-focus-visible:ring="2 current"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ComputedRef } from 'vue'
|
import type { ComputedRef } from 'vue'
|
||||||
import type { LocaleObject } from '@nuxtjs/i18n'
|
import type { LocaleObject } from '#i18n'
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const form = defineModel<{
|
const form = defineModel<{
|
||||||
fieldsAttributes: NonNullable<mastodon.rest.v1.UpdateCredentialsParams['fieldsAttributes']>
|
fieldsAttributes: NonNullable<mastodon.v1.UpdateCredentialsParams['fieldsAttributes']>
|
||||||
}>({ required: true })
|
}>({ required: true })
|
||||||
const dropdown = ref<any>()
|
const dropdown = $ref<any>()
|
||||||
|
|
||||||
const fieldIcons = computed(() =>
|
const fieldIcons = computed(() =>
|
||||||
Array.from({ length: maxAccountFieldCount.value }, (_, i) =>
|
Array.from({ length: maxAccountFieldCount.value }, (_, i) =>
|
||||||
getAccountFieldIcon(form.value.fieldsAttributes[i].name)),
|
getAccountFieldIcon(form.value.fieldsAttributes[i].name),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
const fieldCount = computed(() => {
|
const fieldCount = $computed(() => {
|
||||||
// find last non-empty field
|
// find last non-empty field
|
||||||
const idx = [...form.value.fieldsAttributes].reverse().findIndex(f => f.name || f.value)
|
const idx = [...form.value.fieldsAttributes].reverse().findIndex(f => f.name || f.value)
|
||||||
if (idx === -1)
|
if (idx === -1)
|
||||||
|
@ -24,7 +25,7 @@ const fieldCount = computed(() => {
|
||||||
|
|
||||||
function chooseIcon(i: number, text: string) {
|
function chooseIcon(i: number, text: string) {
|
||||||
form.value.fieldsAttributes[i].name = text
|
form.value.fieldsAttributes[i].name = text
|
||||||
dropdown.value[i]?.hide()
|
dropdown[i]?.hide()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
import type { ThemeColors } from '~/composables/settings'
|
import type { ThemeColors } from '~/composables/settings'
|
||||||
|
|
||||||
const themes = await import('~/constants/themes.json').then(r => r.default) as [string, ThemeColors][]
|
const themes = await import('~/constants/themes.json').then(r => r.default) as [string, ThemeColors][]
|
||||||
const settings = useUserSettings()
|
const settings = $(useUserSettings())
|
||||||
|
|
||||||
const currentTheme = computed(() => settings.value.themeColors?.['--theme-color-name'] || themes[0][1]['--theme-color-name'])
|
const currentTheme = $computed(() => settings.themeColors?.['--theme-color-name'] || themes[0][0])
|
||||||
|
|
||||||
function updateTheme(theme: ThemeColors) {
|
function updateTheme(theme: ThemeColors) {
|
||||||
settings.value.themeColors = theme
|
settings.themeColors = theme
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ function updateTheme(theme: ThemeColors) {
|
||||||
'background': key,
|
'background': key,
|
||||||
'--local-ring-color': key,
|
'--local-ring-color': key,
|
||||||
}"
|
}"
|
||||||
:class="currentTheme === theme['--theme-color-name'] ? 'ring-2' : 'scale-90'"
|
:class="currentTheme === key ? 'ring-2' : 'scale-90'"
|
||||||
:title="theme['--theme-color-name']"
|
:title="key"
|
||||||
w-8 h-8 rounded-full transition-all
|
w-8 h-8 rounded-full transition-all
|
||||||
ring="$local-ring-color offset-3 offset-$c-bg-base"
|
ring="$local-ring-color offset-3 offset-$c-bg-base"
|
||||||
@click="updateTheme(theme)"
|
@click="updateTheme(theme)"
|
||||||
|
|
|
@ -16,7 +16,7 @@ const { disabled = false } = defineProps<{
|
||||||
:class="disabled ? 'opacity-50 cursor-not-allowed' : ''"
|
:class="disabled ? 'opacity-50 cursor-not-allowed' : ''"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
w-full flex px5 py3 md:gap2 gap4 items-center
|
w-full flex w-fit px5 py3 md:gap2 gap4 items-center
|
||||||
transition-250
|
transition-250
|
||||||
:class="disabled ? '' : 'group-hover:bg-active'"
|
:class="disabled ? '' : 'group-hover:bg-active'"
|
||||||
group-focus-visible:ring="2 current"
|
group-focus-visible:ring="2 current"
|
||||||
|
|
|
@ -9,7 +9,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const focusEditor = inject<typeof noop>('focus-editor', noop)
|
const focusEditor = inject<typeof noop>('focus-editor', noop)
|
||||||
|
|
||||||
const { details, command } = props // TODO
|
const { details, command } = $(props)
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
@ -21,7 +21,7 @@ const {
|
||||||
toggleBookmark,
|
toggleBookmark,
|
||||||
toggleFavourite,
|
toggleFavourite,
|
||||||
toggleReblog,
|
toggleReblog,
|
||||||
} = useStatusActions(props)
|
} = $(useStatusActions(props))
|
||||||
|
|
||||||
function reply() {
|
function reply() {
|
||||||
if (!checkLogin())
|
if (!checkLogin())
|
||||||
|
@ -29,7 +29,7 @@ function reply() {
|
||||||
if (details)
|
if (details)
|
||||||
focusEditor()
|
focusEditor()
|
||||||
else
|
else
|
||||||
navigateToStatus({ status: status.value, focusReply: true })
|
navigateToStatus({ status, focusReply: true })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ function reply() {
|
||||||
|
|
||||||
<div flex-1>
|
<div flex-1>
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
:content="$t(status.reblogged ? 'action.boosted' : 'action.boost')"
|
:content="$t('action.boost')"
|
||||||
:text="!getPreferences(userSettings, 'hideBoostCount') && status.reblogsCount ? status.reblogsCount : ''"
|
:text="!getPreferences(userSettings, 'hideBoostCount') && status.reblogsCount ? status.reblogsCount : ''"
|
||||||
color="text-green" hover="text-green" elk-group-hover="bg-green/10"
|
color="text-green" hover="text-green" elk-group-hover="bg-green/10"
|
||||||
icon="i-ri:repeat-line"
|
icon="i-ri:repeat-line"
|
||||||
|
@ -77,7 +77,7 @@ function reply() {
|
||||||
|
|
||||||
<div flex-1>
|
<div flex-1>
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
:content="$t(status.favourited ? 'action.favourited' : 'action.favourite')"
|
:content="$t('action.favourite')"
|
||||||
:text="!getPreferences(userSettings, 'hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
|
:text="!getPreferences(userSettings, 'hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
|
||||||
:color="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
:color="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
||||||
:hover="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
:hover="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
||||||
|
@ -100,7 +100,7 @@ function reply() {
|
||||||
|
|
||||||
<div flex-none>
|
<div flex-none>
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
:content="$t(status.bookmarked ? 'action.bookmarked' : 'action.bookmark')"
|
:content="$t('action.bookmark')"
|
||||||
:color="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
:color="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
||||||
:hover="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
:hover="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
||||||
:elk-group-hover="useStarFavoriteIcon ? 'bg-rose/10' : 'bg-yellow/10' "
|
:elk-group-hover="useStarFavoriteIcon ? 'bg-rose/10' : 'bg-yellow/10' "
|
||||||
|
|
|
@ -14,6 +14,8 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const focusEditor = inject<typeof noop>('focus-editor', noop)
|
const focusEditor = inject<typeof noop>('focus-editor', noop)
|
||||||
|
|
||||||
|
const { details, command } = $(props)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
status,
|
status,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -22,7 +24,7 @@ const {
|
||||||
togglePin,
|
togglePin,
|
||||||
toggleReblog,
|
toggleReblog,
|
||||||
toggleMute,
|
toggleMute,
|
||||||
} = useStatusActions(props)
|
} = $(useStatusActions(props))
|
||||||
|
|
||||||
const clipboard = useClipboard()
|
const clipboard = useClipboard()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -31,9 +33,9 @@ const { t } = useI18n()
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
const isAuthor = computed(() => status.value.account.id === currentUser.value?.account.id)
|
const isAuthor = $computed(() => status.account.id === currentUser.value?.account.id)
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
function getPermalinkUrl(status: mastodon.v1.Status) {
|
function getPermalinkUrl(status: mastodon.v1.Status) {
|
||||||
const url = getStatusPermalinkRoute(status)
|
const url = getStatusPermalinkRoute(status)
|
||||||
|
@ -62,17 +64,15 @@ async function shareLink(status: mastodon.v1.Status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteStatus() {
|
async function deleteStatus() {
|
||||||
const confirmDelete = await openConfirmDialog({
|
if (await openConfirmDialog({
|
||||||
title: t('confirm.delete_posts.title'),
|
title: t('confirm.delete_posts.title'),
|
||||||
description: t('confirm.delete_posts.description'),
|
|
||||||
confirm: t('confirm.delete_posts.confirm'),
|
confirm: t('confirm.delete_posts.confirm'),
|
||||||
cancel: t('confirm.delete_posts.cancel'),
|
cancel: t('confirm.delete_posts.cancel'),
|
||||||
})
|
}) !== 'confirm')
|
||||||
if (confirmDelete.choice !== 'confirm')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
removeCachedStatus(status.value.id)
|
removeCachedStatus(status.id)
|
||||||
await client.value.v1.statuses.$select(status.value.id).remove()
|
await client.v1.statuses.remove(status.id)
|
||||||
|
|
||||||
if (route.name === 'status')
|
if (route.name === 'status')
|
||||||
router.back()
|
router.back()
|
||||||
|
@ -81,25 +81,23 @@ async function deleteStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteAndRedraft() {
|
async function deleteAndRedraft() {
|
||||||
const confirmDelete = await openConfirmDialog({
|
if (await openConfirmDialog({
|
||||||
title: t('confirm.delete_posts.title'),
|
title: t('confirm.delete_posts.title'),
|
||||||
description: t('confirm.delete_posts.description'),
|
|
||||||
confirm: t('confirm.delete_posts.confirm'),
|
confirm: t('confirm.delete_posts.confirm'),
|
||||||
cancel: t('confirm.delete_posts.cancel'),
|
cancel: t('confirm.delete_posts.cancel'),
|
||||||
})
|
}) !== 'confirm')
|
||||||
if (confirmDelete.choice !== 'confirm')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if (import.meta.dev) {
|
if (process.dev) {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
const result = confirm('[DEV] Are you sure you want to delete and re-draft this post?')
|
const result = confirm('[DEV] Are you sure you want to delete and re-draft this post?')
|
||||||
if (!result)
|
if (!result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCachedStatus(status.value.id)
|
removeCachedStatus(status.id)
|
||||||
await client.value.v1.statuses.$select(status.value.id).remove()
|
await client.v1.statuses.remove(status.id)
|
||||||
await openPublishDialog('dialog', await getDraftFromStatus(status.value), true)
|
await openPublishDialog('dialog', await getDraftFromStatus(status), true)
|
||||||
|
|
||||||
// Go to the new status, if the page is the old status
|
// Go to the new status, if the page is the old status
|
||||||
if (lastPublishDialogStatus.value && route.name === 'status')
|
if (lastPublishDialogStatus.value && route.name === 'status')
|
||||||
|
@ -109,25 +107,25 @@ async function deleteAndRedraft() {
|
||||||
function reply() {
|
function reply() {
|
||||||
if (!checkLogin())
|
if (!checkLogin())
|
||||||
return
|
return
|
||||||
if (props.details) {
|
if (details) {
|
||||||
focusEditor()
|
focusEditor()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const { key, draft } = getReplyDraft(status.value)
|
const { key, draft } = getReplyDraft(status)
|
||||||
openPublishDialog(key, draft())
|
openPublishDialog(key, draft())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editStatus() {
|
async function editStatus() {
|
||||||
await openPublishDialog(`edit-${status.value.id}`, {
|
await openPublishDialog(`edit-${status.id}`, {
|
||||||
...await getDraftFromStatus(status.value),
|
...await getDraftFromStatus(status),
|
||||||
editingStatus: status.value,
|
editingStatus: status,
|
||||||
}, true)
|
}, true)
|
||||||
emit('afterEdit')
|
emit('afterEdit')
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFavoritedAndBoostedBy() {
|
function showFavoritedAndBoostedBy() {
|
||||||
openFavoridedBoostedByDialog(status.value.id)
|
openFavoridedBoostedByDialog(status.id)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -144,7 +142,7 @@ function showFavoritedAndBoostedBy() {
|
||||||
|
|
||||||
<template #popper>
|
<template #popper>
|
||||||
<div flex="~ col">
|
<div flex="~ col">
|
||||||
<template v-if="getPreferences(userSettings, 'zenMode') && !details">
|
<template v-if="getPreferences(userSettings, 'zenMode')">
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
:text="$t('action.reply')"
|
:text="$t('action.reply')"
|
||||||
icon="i-ri:chat-1-line"
|
icon="i-ri:chat-1-line"
|
||||||
|
|
|
@ -14,8 +14,8 @@ const {
|
||||||
isPreview?: boolean
|
isPreview?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const src = computed(() => attachment.previewUrl || attachment.url || attachment.remoteUrl!)
|
const src = $computed(() => attachment.previewUrl || attachment.url || attachment.remoteUrl!)
|
||||||
const srcset = computed(() => [
|
const srcset = $computed(() => [
|
||||||
[attachment.url, attachment.meta?.original?.width],
|
[attachment.url, attachment.meta?.original?.width],
|
||||||
[attachment.remoteUrl, attachment.meta?.original?.width],
|
[attachment.remoteUrl, attachment.meta?.original?.width],
|
||||||
[attachment.previewUrl, attachment.meta?.small?.width],
|
[attachment.previewUrl, attachment.meta?.small?.width],
|
||||||
|
@ -53,12 +53,12 @@ const typeExtsMap = {
|
||||||
gifv: ['gifv', 'gif'],
|
gifv: ['gifv', 'gif'],
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = computed(() => {
|
const type = $computed(() => {
|
||||||
if (attachment.type && attachment.type !== 'unknown')
|
if (attachment.type && attachment.type !== 'unknown')
|
||||||
return attachment.type
|
return attachment.type
|
||||||
// some server returns unknown type, we need to guess it based on file extension
|
// some server returns unknown type, we need to guess it based on file extension
|
||||||
for (const [type, exts] of Object.entries(typeExtsMap)) {
|
for (const [type, exts] of Object.entries(typeExtsMap)) {
|
||||||
if (exts.some(ext => src.value?.toLowerCase().endsWith(`.${ext}`)))
|
if (exts.some(ext => src?.toLowerCase().endsWith(`.${ext}`)))
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
|
@ -66,9 +66,7 @@ const type = computed(() => {
|
||||||
|
|
||||||
const video = ref<HTMLVideoElement | undefined>()
|
const video = ref<HTMLVideoElement | undefined>()
|
||||||
const prefersReducedMotion = usePreferredReducedMotion()
|
const prefersReducedMotion = usePreferredReducedMotion()
|
||||||
const isAudio = computed(() => attachment.type === 'audio')
|
const isAudio = $computed(() => attachment.type === 'audio')
|
||||||
const isVideo = computed(() => attachment.type === 'video')
|
|
||||||
const isGif = computed(() => attachment.type === 'gifv')
|
|
||||||
|
|
||||||
const enableAutoplay = usePreferences('enableAutoplay')
|
const enableAutoplay = usePreferences('enableAutoplay')
|
||||||
|
|
||||||
|
@ -101,21 +99,21 @@ function loadAttachment() {
|
||||||
shouldLoadAttachment.value = true
|
shouldLoadAttachment.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const blurHashSrc = computed(() => {
|
const blurHashSrc = $computed(() => {
|
||||||
if (!attachment.blurhash)
|
if (!attachment.blurhash)
|
||||||
return ''
|
return ''
|
||||||
const pixels = decode(attachment.blurhash, 32, 32)
|
const pixels = decode(attachment.blurhash, 32, 32)
|
||||||
return getDataUrlFromArr(pixels, 32, 32)
|
return getDataUrlFromArr(pixels, 32, 32)
|
||||||
})
|
})
|
||||||
|
|
||||||
const videoThumbnail = ref(shouldLoadAttachment.value
|
let videoThumbnail = shouldLoadAttachment.value
|
||||||
? attachment.previewUrl
|
? attachment.previewUrl
|
||||||
: blurHashSrc.value)
|
: blurHashSrc
|
||||||
|
|
||||||
watch(shouldLoadAttachment, () => {
|
watch(shouldLoadAttachment, () => {
|
||||||
videoThumbnail.value = shouldLoadAttachment.value
|
videoThumbnail = shouldLoadAttachment
|
||||||
? attachment.previewUrl
|
? attachment.previewUrl
|
||||||
: blurHashSrc.value
|
: blurHashSrc
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -165,7 +163,7 @@ watch(shouldLoadAttachment, () => {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
relative
|
relative
|
||||||
@click="!shouldLoadAttachment ? loadAttachment() : openMediaPreview(attachments ? attachments : [attachment], attachments?.indexOf(attachment) || 0)"
|
@click="!shouldLoadAttachment ? loadAttachment() : null"
|
||||||
>
|
>
|
||||||
<video
|
<video
|
||||||
ref="video"
|
ref="video"
|
||||||
|
@ -248,14 +246,8 @@ watch(shouldLoadAttachment, () => {
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div v-if="attachment.description && !getPreferences(userSettings, 'hideAltIndicatorOnPosts')" :class="isAudio ? '' : 'absolute left-2 bottom-2'">
|
||||||
:class="isAudio ? [] : [
|
<VDropdown :distance="6" placement="bottom-start">
|
||||||
'absolute left-2',
|
|
||||||
isVideo ? 'top-2' : 'bottom-2',
|
|
||||||
]"
|
|
||||||
flex gap-col-2
|
|
||||||
>
|
|
||||||
<VDropdown v-if="attachment.description && !getPreferences(userSettings, 'hideAltIndicatorOnPosts')" :distance="6" placement="bottom-start">
|
|
||||||
<button
|
<button
|
||||||
font-bold text-sm
|
font-bold text-sm
|
||||||
:class="isAudio
|
:class="isAudio
|
||||||
|
@ -283,14 +275,6 @@ watch(shouldLoadAttachment, () => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VDropdown>
|
</VDropdown>
|
||||||
<div v-if="isGif && !getPreferences(userSettings, 'hideGifIndicatorOnPosts')">
|
|
||||||
<button
|
|
||||||
aria-hidden font-bold text-sm
|
|
||||||
rounded-1 bg-black:65 text-white px1.2 py0.2 pointer-events-none
|
|
||||||
>
|
|
||||||
{{ $t('status.gif') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -14,10 +14,10 @@ const {
|
||||||
const { translation } = useTranslation(status, getLanguageCode())
|
const { translation } = useTranslation(status, getLanguageCode())
|
||||||
|
|
||||||
const emojisObject = useEmojisFallback(() => status.emojis)
|
const emojisObject = useEmojisFallback(() => status.emojis)
|
||||||
const vnode = computed(() => {
|
const vnode = $computed(() => {
|
||||||
if (!status.content)
|
if (!status.content)
|
||||||
return null
|
return null
|
||||||
return contentToVNode(status.content, {
|
const vnode = contentToVNode(status.content, {
|
||||||
emojis: emojisObject.value,
|
emojis: emojisObject.value,
|
||||||
mentions: 'mentions' in status ? status.mentions : undefined,
|
mentions: 'mentions' in status ? status.mentions : undefined,
|
||||||
markdown: true,
|
markdown: true,
|
||||||
|
@ -25,6 +25,7 @@ const vnode = computed(() => {
|
||||||
status: 'id' in status ? status : undefined,
|
status: 'id' in status ? status : undefined,
|
||||||
inReplyToStatus: newer,
|
inReplyToStatus: newer,
|
||||||
})
|
})
|
||||||
|
return vnode
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,45 +26,45 @@ const props = withDefaults(
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
const status = computed(() => {
|
const status = $computed(() => {
|
||||||
if (props.status.reblog && (!props.status.content || props.status.content === props.status.reblog.content))
|
if (props.status.reblog && (!props.status.content || props.status.content === props.status.reblog.content))
|
||||||
return props.status.reblog
|
return props.status.reblog
|
||||||
return props.status
|
return props.status
|
||||||
})
|
})
|
||||||
|
|
||||||
// Use original status, avoid connecting a reblog
|
// Use original status, avoid connecting a reblog
|
||||||
const directReply = computed(() => props.hasNewer || (!!status.value.inReplyToId && (status.value.inReplyToId === props.newer?.id || status.value.inReplyToId === props.newer?.reblog?.id)))
|
const directReply = $computed(() => props.hasNewer || (!!status.inReplyToId && (status.inReplyToId === props.newer?.id || status.inReplyToId === props.newer?.reblog?.id)))
|
||||||
// Use reblogged status, connect it to further replies
|
// Use reblogged status, connect it to further replies
|
||||||
const connectReply = computed(() => props.hasOlder || status.value.id === props.older?.inReplyToId || status.value.id === props.older?.reblog?.inReplyToId)
|
const connectReply = $computed(() => props.hasOlder || status.id === props.older?.inReplyToId || status.id === props.older?.reblog?.inReplyToId)
|
||||||
// Open a detailed status, the replies directly to it
|
// Open a detailed status, the replies directly to it
|
||||||
const replyToMain = computed(() => props.main && props.main.id === status.value.inReplyToId)
|
const replyToMain = $computed(() => props.main && props.main.id === status.inReplyToId)
|
||||||
|
|
||||||
const rebloggedBy = computed(() => props.status.reblog ? props.status.account : null)
|
const rebloggedBy = $computed(() => props.status.reblog ? props.status.account : null)
|
||||||
|
|
||||||
const statusRoute = computed(() => getStatusRoute(status.value))
|
const statusRoute = $computed(() => getStatusRoute(status))
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
function go(evt: MouseEvent | KeyboardEvent) {
|
function go(evt: MouseEvent | KeyboardEvent) {
|
||||||
if (evt.metaKey || evt.ctrlKey) {
|
if (evt.metaKey || evt.ctrlKey) {
|
||||||
window.open(statusRoute.value.href)
|
window.open(statusRoute.href)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cacheStatus(status.value)
|
cacheStatus(status)
|
||||||
router.push(statusRoute.value)
|
router.push(statusRoute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const createdAt = useFormattedDateTime(status.value.createdAt)
|
const createdAt = useFormattedDateTime(status.createdAt)
|
||||||
const timeAgoOptions = useTimeAgoOptions(true)
|
const timeAgoOptions = useTimeAgoOptions(true)
|
||||||
const timeago = useTimeAgo(() => status.value.createdAt, timeAgoOptions)
|
const timeago = useTimeAgo(() => status.createdAt, timeAgoOptions)
|
||||||
|
|
||||||
const isSelfReply = computed(() => status.value.inReplyToAccountId === status.value.account.id)
|
const isSelfReply = $computed(() => status.inReplyToAccountId === status.account.id)
|
||||||
const collapseRebloggedBy = computed(() => rebloggedBy.value?.id === status.value.account.id)
|
const collapseRebloggedBy = $computed(() => rebloggedBy?.id === status.account.id)
|
||||||
const isDM = computed(() => status.value.visibility === 'direct')
|
const isDM = $computed(() => status.visibility === 'direct')
|
||||||
|
|
||||||
const showUpperBorder = computed(() => props.newer && !directReply.value)
|
const showUpperBorder = $computed(() => props.newer && !directReply)
|
||||||
const showReplyTo = computed(() => !replyToMain.value && !directReply.value)
|
const showReplyTo = $computed(() => !replyToMain && !directReply)
|
||||||
|
|
||||||
const forceShow = ref(false)
|
const forceShow = ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,35 +9,33 @@ const { status, context } = defineProps<{
|
||||||
inNotification?: boolean
|
inNotification?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const isDM = computed(() => status.visibility === 'direct')
|
const isDM = $computed(() => status.visibility === 'direct')
|
||||||
const isDetails = computed(() => context === 'details')
|
const isDetails = $computed(() => context === 'details')
|
||||||
|
|
||||||
// Content Filter logic
|
// Content Filter logic
|
||||||
const filterResult = computed(() => status.filtered?.length ? status.filtered[0] : null)
|
const filterResult = $computed(() => status.filtered?.length ? status.filtered[0] : null)
|
||||||
const filter = computed(() => filterResult.value?.filter)
|
const filter = $computed(() => filterResult?.filter)
|
||||||
|
|
||||||
const filterPhrase = computed(() => filter.value?.title)
|
const filterPhrase = $computed(() => filter?.title)
|
||||||
const isFiltered = computed(() => status.account.id !== currentUser.value?.account.id && filterPhrase && context && context !== 'details' && !!filter.value?.context.includes(context))
|
const isFiltered = $computed(() => status.account.id !== currentUser.value?.account.id && filterPhrase && context && context !== 'details' && !!filter?.context.includes(context))
|
||||||
|
|
||||||
// check spoiler text or media attachment
|
// check spoiler text or media attachment
|
||||||
// needed to handle accounts that mark all their posts as sensitive
|
// needed to handle accounts that mark all their posts as sensitive
|
||||||
const spoilerTextPresent = computed(() => !!status.spoilerText && status.spoilerText.trim().length > 0)
|
const spoilerTextPresent = $computed(() => !!status.spoilerText && status.spoilerText.trim().length > 0)
|
||||||
const hasSpoilerOrSensitiveMedia = computed(() => spoilerTextPresent.value || (status.sensitive && !!status.mediaAttachments.length))
|
const hasSpoilerOrSensitiveMedia = $computed(() => spoilerTextPresent || (status.sensitive && !!status.mediaAttachments.length))
|
||||||
const isSensitiveNonSpoiler = computed(() => status.sensitive && !status.spoilerText && !!status.mediaAttachments.length)
|
const isSensitiveNonSpoiler = computed(() => status.sensitive && !status.spoilerText && !!status.mediaAttachments.length)
|
||||||
const hideAllMedia = computed(
|
const hideAllMedia = computed(
|
||||||
() => {
|
() => {
|
||||||
return currentUser.value ? (getHideMediaByDefault(currentUser.value.account) && (!!status.mediaAttachments.length || !!status.card?.html)) : false
|
return currentUser.value ? (getHideMediaByDefault(currentUser.value.account) && !!status.mediaAttachments.length) : false
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
const embeddedMediaPreference = usePreferences('experimentalEmbeddedMedia')
|
|
||||||
const allowEmbeddedMedia = computed(() => status.card?.html && embeddedMediaPreference.value)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
space-y-3
|
space-y-3
|
||||||
:class="{
|
:class="{
|
||||||
'py2 px3.5 bg-dm rounded-4 me--1': isDM,
|
'pt2 pb0.5 px3.5 bg-dm rounded-4 me--1': isDM,
|
||||||
'ms--3.5 mt--1 ms--1': isDM && context !== 'details',
|
'ms--3.5 mt--1 ms--1': isDM && context !== 'details',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
@ -58,16 +56,16 @@ const allowEmbeddedMedia = computed(() => status.card?.html && embeddedMediaPref
|
||||||
:is-preview="isPreview"
|
:is-preview="isPreview"
|
||||||
/>
|
/>
|
||||||
<StatusPreviewCard
|
<StatusPreviewCard
|
||||||
v-if="status.card && !allowEmbeddedMedia"
|
v-if="status.card"
|
||||||
:card="status.card"
|
:card="status.card"
|
||||||
:small-picture-only="status.mediaAttachments?.length > 0"
|
:small-picture-only="status.mediaAttachments?.length > 0"
|
||||||
/>
|
/>
|
||||||
<StatusEmbeddedMedia v-if="allowEmbeddedMedia" :status="status" />
|
|
||||||
<StatusCard
|
<StatusCard
|
||||||
v-if="status.reblog"
|
v-if="status.reblog"
|
||||||
:status="status.reblog" border="~ rounded"
|
:status="status.reblog" border="~ rounded"
|
||||||
:actions="false"
|
:actions="false"
|
||||||
/>
|
/>
|
||||||
|
<div v-if="isDM" />
|
||||||
</StatusSpoiler>
|
</StatusSpoiler>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -14,24 +14,24 @@ defineEmits<{
|
||||||
(event: 'refetchStatus'): void
|
(event: 'refetchStatus'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const status = computed(() => {
|
const status = $computed(() => {
|
||||||
if (props.status.reblog && props.status.reblog)
|
if (props.status.reblog && props.status.reblog)
|
||||||
return props.status.reblog
|
return props.status.reblog
|
||||||
return props.status
|
return props.status
|
||||||
})
|
})
|
||||||
|
|
||||||
const createdAt = useFormattedDateTime(status.value.createdAt)
|
const createdAt = useFormattedDateTime(status.createdAt)
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHydratedHead({
|
useHydratedHead({
|
||||||
title: () => `${getDisplayName(status.value.account)} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.value.content) || ''}"`,
|
title: () => `${getDisplayName(status.account)} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.content) || ''}"`,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :id="`status-${status.id}`" flex flex-col gap-2 pt2 pb1 ps-3 pe-4 relative :lang="status.language ?? undefined" aria-roledescription="status-details">
|
<div :id="`status-${status.id}`" flex flex-col gap-2 pt2 pb1 ps-3 pe-4 relative :lang="status.language ?? undefined" aria-roledescription="status-details">
|
||||||
<StatusActionsMore :status="status" :details="true" absolute inset-ie-2 top-2 @after-edit="$emit('refetchStatus')" />
|
<StatusActionsMore :status="status" absolute inset-ie-2 top-2 @after-edit="$emit('refetchStatus')" />
|
||||||
<NuxtLink :to="getAccountRoute(status.account)" rounded-full hover:bg-active transition-100 pe5 me-a>
|
<NuxtLink :to="getAccountRoute(status.account)" rounded-full hover:bg-active transition-100 pe5 me-a>
|
||||||
<AccountHoverWrapper :account="status.account">
|
<AccountHoverWrapper :account="status.account">
|
||||||
<AccountInfo :account="status.account" />
|
<AccountInfo :account="status.account" />
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import type { mastodon } from 'masto'
|
|
||||||
|
|
||||||
const { status } = defineProps<{
|
|
||||||
status: mastodon.v1.Status
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const vnode = computed(() => {
|
|
||||||
if (!status.card?.html)
|
|
||||||
return null
|
|
||||||
const node = sanitizeEmbeddedIframe(status.card?.html)?.children[0]
|
|
||||||
return node ? nodeToVNode(node) : null
|
|
||||||
})
|
|
||||||
const overlayToggle = ref(true)
|
|
||||||
const card = ref(status.card)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="card">
|
|
||||||
<div
|
|
||||||
v-if="overlayToggle"
|
|
||||||
h-80
|
|
||||||
cursor-pointer
|
|
||||||
relative
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
p-3
|
|
||||||
absolute
|
|
||||||
w-full
|
|
||||||
h-full
|
|
||||||
z-100
|
|
||||||
rounded-lg
|
|
||||||
style="background: linear-gradient(black, rgba(0,0,0,0.5), transparent, transparent, rgba(0,0,0,0.20))"
|
|
||||||
>
|
|
||||||
<NuxtLink flex flex-col gap-1 hover:underline text-xs text-light font-light target="_blank" :href="card?.url">
|
|
||||||
<div flex gap-0.5>
|
|
||||||
<p flex-row line-clamp-1>
|
|
||||||
{{ card?.providerName }}<span v-if="card?.authorName"> • {{ card?.authorName }}</span>
|
|
||||||
</p>
|
|
||||||
<span
|
|
||||||
flex-row
|
|
||||||
w-4 h-4
|
|
||||||
pointer-events-none
|
|
||||||
i-ri:arrow-right-up-line
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<p font-bold line-clamp-1 text-size-base>
|
|
||||||
{{ card?.title }}
|
|
||||||
</p>
|
|
||||||
<p line-clamp-1>
|
|
||||||
{{ $t('status.embedded_warning') }}
|
|
||||||
</p>
|
|
||||||
</NuxtLink>
|
|
||||||
<div
|
|
||||||
flex
|
|
||||||
h-50
|
|
||||||
mt-1
|
|
||||||
justify-center
|
|
||||||
flex-items-center
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
absolute
|
|
||||||
bg-primary
|
|
||||||
opacity-85
|
|
||||||
rounded-full
|
|
||||||
hover:bg-primary-active
|
|
||||||
hover:opacity-95
|
|
||||||
transition-all
|
|
||||||
box-shadow-outline
|
|
||||||
@click.stop.prevent="() => overlayToggle = !overlayToggle"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
text-light
|
|
||||||
flex flex-col
|
|
||||||
gap-3
|
|
||||||
w-27 h-27
|
|
||||||
pointer-events-none
|
|
||||||
i-ri:play-circle-line
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<CommonBlurhash
|
|
||||||
v-if="card?.image"
|
|
||||||
:blurhash="card.blurhash"
|
|
||||||
:src="card.image"
|
|
||||||
w-full
|
|
||||||
h-full
|
|
||||||
object-cover
|
|
||||||
rounded-lg
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<!-- this inserts the iframe -->
|
|
||||||
<component :is="vnode" v-if="vnode" rounded-lg h-80 />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
iframe {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -3,13 +3,13 @@ import { favouritedBoostedByStatusId } from '~/composables/dialog'
|
||||||
|
|
||||||
const type = ref<'favourited-by' | 'boosted-by'>('favourited-by')
|
const type = ref<'favourited-by' | 'boosted-by'>('favourited-by')
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
return client.value.v1.statuses.$select(favouritedBoostedByStatusId.value!)[type.value === 'favourited-by' ? 'favouritedBy' : 'rebloggedBy'].list()
|
return client.v1.statuses[type.value === 'favourited-by' ? 'listFavouritedBy' : 'listRebloggedBy'](favouritedBoostedByStatusId.value!)
|
||||||
}
|
}
|
||||||
|
|
||||||
const paginator = computed(() => load())
|
const paginator = $computed(() => load())
|
||||||
|
|
||||||
function showFavouritedBy() {
|
function showFavouritedBy() {
|
||||||
type.value = 'favourited-by'
|
type.value = 'favourited-by'
|
||||||
|
@ -42,7 +42,7 @@ const tabs = [
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
||||||
tabindex="0"
|
tabindex="1"
|
||||||
hover:bg-active transition-100
|
hover:bg-active transition-100
|
||||||
@click="option.onClick"
|
@click="option.onClick"
|
||||||
>
|
>
|
||||||
|
|
|
@ -8,24 +8,23 @@ const props = defineProps<{
|
||||||
|
|
||||||
const el = ref<HTMLElement>()
|
const el = ref<HTMLElement>()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const statusRoute = computed(() => getStatusRoute(props.status))
|
const statusRoute = $computed(() => getStatusRoute(props.status))
|
||||||
|
|
||||||
function onclick(evt: MouseEvent | KeyboardEvent) {
|
function onclick(evt: MouseEvent | KeyboardEvent) {
|
||||||
const path = evt.composedPath() as HTMLElement[]
|
const path = evt.composedPath() as HTMLElement[]
|
||||||
const el = path.find(el => ['A', 'BUTTON', 'IMG', 'VIDEO'].includes(el.tagName?.toUpperCase()))
|
const el = path.find(el => ['A', 'BUTTON', 'IMG', 'VIDEO'].includes(el.tagName?.toUpperCase()))
|
||||||
const text = window.getSelection()?.toString()
|
const text = window.getSelection()?.toString()
|
||||||
const isCustomEmoji = el?.parentElement?.classList.contains('custom-emoji')
|
if (!el && !text)
|
||||||
if ((!el && !text) || isCustomEmoji)
|
|
||||||
go(evt)
|
go(evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
function go(evt: MouseEvent | KeyboardEvent) {
|
function go(evt: MouseEvent | KeyboardEvent) {
|
||||||
if (evt.metaKey || evt.ctrlKey) {
|
if (evt.metaKey || evt.ctrlKey) {
|
||||||
window.open(statusRoute.value.href)
|
window.open(statusRoute.href)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cacheStatus(props.status)
|
cacheStatus(props.status)
|
||||||
router.push(statusRoute.value)
|
router.push(statusRoute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -15,7 +15,7 @@ const expiredTimeAgo = useTimeAgo(poll.expiresAt!, timeAgoOptions)
|
||||||
const expiredTimeFormatted = useFormattedDateTime(poll.expiresAt!)
|
const expiredTimeFormatted = useFormattedDateTime(poll.expiresAt!)
|
||||||
const { formatPercentage } = useHumanReadableNumber()
|
const { formatPercentage } = useHumanReadableNumber()
|
||||||
|
|
||||||
const { client } = useMasto()
|
const { client } = $(useMasto())
|
||||||
|
|
||||||
async function vote(e: Event) {
|
async function vote(e: Event) {
|
||||||
const formData = new FormData(e.target as HTMLFormElement)
|
const formData = new FormData(e.target as HTMLFormElement)
|
||||||
|
@ -36,10 +36,10 @@ async function vote(e: Event) {
|
||||||
|
|
||||||
cacheStatus({ ...status, poll }, undefined, true)
|
cacheStatus({ ...status, poll }, undefined, true)
|
||||||
|
|
||||||
await client.value.v1.polls.$select(poll.id).votes.create({ choices })
|
await client.v1.polls.vote(poll.id, { choices })
|
||||||
}
|
}
|
||||||
|
|
||||||
const votersCount = computed(() => poll.votersCount ?? poll.votesCount ?? 0)
|
const votersCount = $computed(() => poll.votersCount ?? poll.votesCount ?? 0)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -11,7 +11,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const providerName = props.card.providerName
|
const providerName = props.card.providerName
|
||||||
|
|
||||||
const gitHubCards = usePreferences('experimentalGitHubCards')
|
const gitHubCards = $(usePreferences('experimentalGitHubCards'))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue