diff --git a/.husky/pre-commit b/.husky/pre-commit index 6e2a29a9..bad1522c 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npm run test:unit \ No newline at end of file +npm run format && npm run test:unit \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..96c4abab --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +ios +src/js/lib \ No newline at end of file diff --git a/capacitor.config.ts b/capacitor.config.ts index c30f12c4..a25a7e1e 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -2,19 +2,19 @@ import { CapacitorConfig } from "@capacitor/cli"; const localIp = process.env.LOCAL_IP; - const config ={ +const config = { appId: "social.impro", appName: "Impro", webDir: "build", ios: { - backgroundColor: '#1a1a1a' + backgroundColor: "#1a1a1a", }, plugins: { StatusBar: { overlaysWebView: false, style: "DARK", backgroundColor: "#1a1a1a", - } + }, }, }; @@ -23,7 +23,7 @@ if (process.env.NODE_ENV === "development") { // https://capacitorjs.com/docs/guides/live-reload url: `http://${localIp}:8080`, cleartext: true, - } + }; } -export default config; \ No newline at end of file +export default config; diff --git a/eleventy.config.js b/eleventy.config.js index cfd88de2..9874ba13 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -35,7 +35,7 @@ export default async function (eleventyConfig) { return await linkHtml(content, { baseUrl, exclude: ["/lib/hls.js"] }); } return content; - } + }, ); return { diff --git a/modulepreload.js b/modulepreload.js index a3dba419..78102d3b 100644 --- a/modulepreload.js +++ b/modulepreload.js @@ -34,7 +34,7 @@ class ImportCollector { } if (!resolvedImport) { console.warn( - `WARNING: could not resolve import specifier: ${specifier} from parent: ${parent} - skipping` + `WARNING: could not resolve import specifier: ${specifier} from parent: ${parent} - skipping`, ); return; } @@ -46,7 +46,9 @@ class ImportCollector { contents = await fs.promises.readFile(resolvedImport, "utf8"); } catch (e) { console.warn( - "WARNING: could not read file: " + resolvedImport.href + " - skipping" + "WARNING: could not read file: " + + resolvedImport.href + + " - skipping", ); } if (contents) { @@ -65,7 +67,7 @@ class ImportCollector { const parent = new URL("./index.js", this.baseUrl); await Promise.all(this.imports.map((entry) => this.visit(entry, parent))); return [...this.dependencies].map((dep) => - dep.replace(this.baseUrl.href, "/") + dep.replace(this.baseUrl.href, "/"), ); } } @@ -113,7 +115,7 @@ async function parseHtml(contents) { export async function getDependencies( contents, baseUrl, - { noFetch, exclude = [] } = {} + { noFetch, exclude = [] } = {}, ) { if (!baseUrl) { throw new Error("baseUrl is required"); @@ -136,7 +138,7 @@ export async function getDependencies( export function injectPreloads( contents, dependencies, - { includeComments = true } = {} + { includeComments = true } = {}, ) { let preloads = ""; if (includeComments) { @@ -154,7 +156,7 @@ export function injectPreloads( return contents.replace("", `\n${preloads}`); } else { console.warn( - "WARNING: could not find or in HTML - skipping." + "WARNING: could not find or in HTML - skipping.", ); return contents; } @@ -162,7 +164,7 @@ export function injectPreloads( export async function linkHtml( htmlContentsOrUrl, - { baseUrl: providedBaseUrl, noFetch, exclude, includeComments } = {} + { baseUrl: providedBaseUrl, noFetch, exclude, includeComments } = {}, ) { let html = htmlContentsOrUrl; let baseUrl = providedBaseUrl; diff --git a/package-lock.json b/package-lock.json index d0e56e8f..83495c26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "impro", - "version": "0.3.10", + "version": "0.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "impro", - "version": "0.3.10", + "version": "0.4.1", "license": "MIT", "dependencies": { "@capacitor/app": "^7.0.0", @@ -30,6 +30,7 @@ "jest-environment-jsdom": "^30.1.2", "jsdom": "^27.0.0", "native-run": "^2.0.1", + "prettier": "^3.8.1", "typescript": "^5.9.2" } }, @@ -815,9 +816,9 @@ } }, "node_modules/@capacitor/cli": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@capacitor/cli/-/cli-7.4.4.tgz", - "integrity": "sha512-J7ciBE7GlJ70sr2s8oz1+H4ZdNk4MGG41fsakUlDHWva5UWgFIZYMiEdDvGbYazAYTaxN3lVZpH9zil9FfZj+Q==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@capacitor/cli/-/cli-7.4.5.tgz", + "integrity": "sha512-ApKxpzcWTqmyTD+WxBvL7UJt+x0xr9Vqa+S4Iqbl/R2kC0tf1ay22wE9pOrdWXbTqFbNhBuUuRvTvZ6Edp7QzQ==", "dev": true, "license": "MIT", "dependencies": { @@ -829,7 +830,7 @@ "env-paths": "^2.2.0", "fs-extra": "^11.2.0", "kleur": "^4.1.5", - "native-run": "^2.0.1", + "native-run": "^2.0.3", "open": "^8.4.0", "plist": "^3.1.0", "prompts": "^2.4.2", @@ -4181,9 +4182,9 @@ } }, "node_modules/fs-extra": { - "version": "11.3.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", - "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", + "version": "11.3.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", + "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", "dev": true, "license": "MIT", "dependencies": { @@ -6190,9 +6191,9 @@ } }, "node_modules/native-run": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/native-run/-/native-run-2.0.1.tgz", - "integrity": "sha512-XfG1FBZLM50J10xH9361whJRC9SHZ0Bub4iNRhhI61C8Jv0e1ud19muex6sNKB51ibQNUJNuYn25MuYET/rE6w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/native-run/-/native-run-2.0.3.tgz", + "integrity": "sha512-U1PllBuzW5d1gfan+88L+Hky2eZx+9gv3Pf6rNBxKbORxi7boHzqiA6QFGSnqMem4j0A9tZ08NMIs5+0m/VS1Q==", "dev": true, "license": "MIT", "dependencies": { @@ -6763,6 +6764,22 @@ "node": ">=12" } }, + "node_modules/prettier": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", + "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "30.2.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", @@ -6961,13 +6978,13 @@ } }, "node_modules/rimraf": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.0.tgz", - "integrity": "sha512-DxdlA1bdNzkZK7JiNWH+BAx1x4tEJWoTofIopFo6qWUU94jYrFZ0ubY05TqH3nWPJ1nKa1JWVFDINZ3fnrle/A==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", + "integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "glob": "^11.0.3", + "glob": "^13.0.0", "package-json-from-dist": "^1.0.1" }, "bin": { @@ -6981,38 +6998,16 @@ } }, "node_modules/rimraf/node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", "minimatch": "^10.1.1", "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/jackspeak": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", - "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, "engines": { "node": "20 || >=22" }, @@ -7021,11 +7016,11 @@ } }, "node_modules/rimraf/node_modules/lru-cache": { - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.2.tgz", - "integrity": "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg==", + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } @@ -7047,9 +7042,9 @@ } }, "node_modules/rimraf/node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -7542,6 +7537,7 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 7c3e4f4f..1f44f6c9 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "ios": "npm run build && cap sync && NODE_ENV=development cap run ios", "bundle:capacitor": "esbuild ./clientLibs/capacitor.js --bundle --format=esm --outfile=src/js/lib/capacitor.js", "bundle:lit-html": "esbuild ./clientLibs/litHtml.js --bundle --format=esm --outfile=src/js/lib/lit-html.js", + "format": "prettier --no-config --write .", "test": "npm run test:unit", "test:unit": "node tests/runTests.js", "prepare": "husky" @@ -26,6 +27,7 @@ "jest-environment-jsdom": "^30.1.2", "jsdom": "^27.0.0", "native-run": "^2.0.1", + "prettier": "^3.8.1", "typescript": "^5.9.2" }, "dependencies": { diff --git a/src/callback.html b/src/callback.html index ef321e12..5c20912b 100644 --- a/src/callback.html +++ b/src/callback.html @@ -1,4 +1,4 @@ - + {% include "head.html" %} @@ -40,7 +40,7 @@ const params = new URLSearchParams(); params.set( "error_message", - "OAuth callback failed. Please try again." + "OAuth callback failed. Please try again.", ); window.location.href = "/login?" + params.toString(); return; diff --git a/src/css/style.css b/src/css/style.css index b2b12058..0e003f09 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -158,7 +158,8 @@ html { /* base styles */ background: var(--background-color); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-color); font-size: var(--font-size); scrollbar-gutter: stable; @@ -862,7 +863,9 @@ body.scroll-locked header { z-index: var(--sidebar-overlay-z-index); opacity: 0; visibility: hidden; - transition: opacity 0.3s ease, visibility 0.3s ease; + transition: + opacity 0.3s ease, + visibility 0.3s ease; } .sidebar-overlay.open { @@ -2655,8 +2658,8 @@ lightbox-image-group.post-images.num-images-4 .post-image { /* Two images */ .notification-preview-images:has( - .notification-preview-image:nth-child(2):last-child - ) { + .notification-preview-image:nth-child(2):last-child +) { grid-template-columns: 1fr 1fr; } @@ -3282,7 +3285,9 @@ chat-input { justify-content: center; cursor: pointer; border-radius: var(--circular-button-border-radius); - transition: background-color 0.15s, transform 0.1s; + transition: + background-color 0.15s, + transform 0.1s; -webkit-tap-highlight-color: transparent; user-select: none; padding: 0; @@ -4183,7 +4188,9 @@ emoji-picker { z-index: var(--floating-compose-button-z-index); align-items: center; justify-content: center; - transition: transform 0.2s, box-shadow 0.2s; + transition: + transform 0.2s, + box-shadow 0.2s; } .floating-compose-button:hover { @@ -4653,8 +4660,9 @@ post-context-menu .text-button-text { border-radius: var(--text-input-border-radius); background-color: light-dark(var(--white), var(--mid-gray)); color: var(--text-color); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, - Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, + Cantarell, "Open Sans", "Helvetica Neue", sans-serif; font-size: 15px; resize: none; outline: none; @@ -4739,7 +4747,9 @@ post-context-menu .text-button-text { 0 0 10px 0 rgba(0, 0, 0, 0.1), 0 0 10px 0 rgba(0, 0, 0, 0.3) ); - transition: top 0.3s linear, opacity 0.3s linear; + transition: + top 0.3s linear, + opacity 0.3s linear; z-index: var(--toast-z-index); } @@ -4759,7 +4769,9 @@ post-context-menu .text-button-text { padding-right: 20px; top: auto; bottom: -100px; - transition: bottom 0.3s linear, opacity 0.3s linear; + transition: + bottom 0.3s linear, + opacity 0.3s linear; } .toast.active { diff --git a/src/index.html b/src/index.html index 36bbc74b..444e12a2 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,4 @@ - + {% include "head.html" %} @@ -164,24 +164,24 @@ router.addRoute("/profile/:handleOrDid/feed/:rkey", () => feedDetailView); router.addRoute( "/profile/:handleOrDid/post/:rkey/likes", - () => postLikesView + () => postLikesView, ); router.addRoute( "/profile/:handleOrDid/post/:rkey/quotes", - () => postQuotesView + () => postQuotesView, ); router.addRoute( "/profile/:handleOrDid/post/:rkey/reposts", - () => postRepostsView + () => postRepostsView, ); router.addRoute("/profile/:handleOrDid/post/:rkey", () => postThreadView); router.addRoute( "/profile/:handleOrDid/followers", - () => profileFollowersView + () => profileFollowersView, ); router.addRoute( "/profile/:handleOrDid/following", - () => profileFollowingView + () => profileFollowingView, ); router.addRoute("/profile/:handleOrDid", () => profileView); router.addRoute("/settings", () => settingsView); diff --git a/src/js/api.js b/src/js/api.js index 03b112aa..4ff35b31 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -77,7 +77,7 @@ export class Api { } res = await this.session.fetch( `${this.session.serviceEndpoint}/xrpc/${path}${queryString}`, - fetchOptions + fetchOptions, ); } catch (error) { // Handle token refresh error @@ -318,7 +318,7 @@ export class Api { const batches = batch(repostUris, 5); for (const batch of batches) { const results = await Promise.allSettled( - batch.map((repostUri) => this.getRepost(repostUri)) + batch.map((repostUri) => this.getRepost(repostUri)), ); // Only keep successful responses. This is similar to getPosts() const successfulResponses = results @@ -352,7 +352,7 @@ export class Api { async searchPosts( query, - { limit = 25, sort = "top", cursor = "", labelers = [] } = {} + { limit = 25, sort = "top", cursor = "", labelers = [] } = {}, ) { const queryParams = { q: query, limit, sort }; if (cursor) { @@ -387,7 +387,7 @@ export class Api { filter = "posts_and_author_threads", includePins = false, labelers = [], - } = {} + } = {}, ) { const res = await this.request(`app.bsky.feed.getAuthorFeed`, { query: { actor: did, limit, cursor, filter, includePins }, diff --git a/src/js/atproto.js b/src/js/atproto.js index 50f00add..5d7b4d65 100644 --- a/src/js/atproto.js +++ b/src/js/atproto.js @@ -4,7 +4,7 @@ export function getServiceEndpointFromDidDoc(didDoc) { const service = didDoc.service.find((s) => s.id === PDS_SERVICE_ID); if (!service) { throw new Error( - `No PDS service found in DID doc ${JSON.stringify(didDoc)}` + `No PDS service found in DID doc ${JSON.stringify(didDoc)}`, ); } return service.serviceEndpoint; @@ -16,7 +16,7 @@ export async function resolveHandle(handle) { }); const res = await fetch( "https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?" + - params.toString() + params.toString(), ); const data = await res.json(); return data.did; diff --git a/src/js/auth.js b/src/js/auth.js index b80a8388..bf82844b 100644 --- a/src/js/auth.js +++ b/src/js/auth.js @@ -42,7 +42,7 @@ function parseJwt(token) { atob(base64) .split("") .map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)) - .join("") + .join(""), ); return JSON.parse(jsonPayload); @@ -93,7 +93,7 @@ export class BasicAuthSession { headers: { Authorization: `Bearer ${this.refreshJwt}`, }, - } + }, ); if (refreshRes.ok) { const data = await refreshRes.json(); @@ -143,7 +143,7 @@ export class BasicAuth { "Content-Type": "application/json", }, body: JSON.stringify({ identifier: handle, password }), - } + }, ); if (!res.ok) { throw new Error("Login failed"); diff --git a/src/js/components/animated-sidebar.js b/src/js/components/animated-sidebar.js index f19d42a8..2b6bc3a2 100644 --- a/src/js/components/animated-sidebar.js +++ b/src/js/components/animated-sidebar.js @@ -28,7 +28,7 @@ class AnimatedSidebar extends Component { `, - this + this, ); const sidebarContent = this.querySelector(".sidebar-content"); sidebarContent.appendChild(this._children); diff --git a/src/js/components/chat-input.js b/src/js/components/chat-input.js index a42c9acc..17240487 100644 --- a/src/js/components/chat-input.js +++ b/src/js/components/chat-input.js @@ -67,7 +67,7 @@ class ChatInput extends Component { this.dispatchEvent( new CustomEvent("send", { detail: { message }, - }) + }), ); // Clear input after sending textarea.value = ""; diff --git a/src/js/components/context-menu-item.js b/src/js/components/context-menu-item.js index f5e504cf..af1a0bd1 100644 --- a/src/js/components/context-menu-item.js +++ b/src/js/components/context-menu-item.js @@ -32,7 +32,7 @@ class ContextMenuItem extends Component { html`
`, - this + this, ); const button = this.querySelector("button"); button.appendChild(this._children); diff --git a/src/js/components/context-menu.js b/src/js/components/context-menu.js index 8a8030f2..9f42bfa3 100644 --- a/src/js/components/context-menu.js +++ b/src/js/components/context-menu.js @@ -49,7 +49,7 @@ class ContextMenu extends Component { > `, - this + this, ); const dialog = this.querySelector(".context-menu"); diff --git a/src/js/components/gif-player.js b/src/js/components/gif-player.js index 07ba1d15..8e477863 100644 --- a/src/js/components/gif-player.js +++ b/src/js/components/gif-player.js @@ -12,7 +12,7 @@ const gifPlayerObserver = new IntersectionObserver( }, { rootMargin: "200px", - } + }, ); class GifPlayer extends Component { @@ -48,7 +48,7 @@ class GifPlayer extends Component { style="flex: 1 1 0%;" aria-label="${this.alt}" >`, - this + this, ); } diff --git a/src/js/components/hidden-replies-section.js b/src/js/components/hidden-replies-section.js index 934091f2..e5235388 100644 --- a/src/js/components/hidden-replies-section.js +++ b/src/js/components/hidden-replies-section.js @@ -46,7 +46,7 @@ class HiddenRepliesSection extends Component {
`, - this + this, ); const toggleContent = this.querySelector(".toggle-content"); diff --git a/src/js/components/image-alt-text-dialog.js b/src/js/components/image-alt-text-dialog.js index de8949f2..fd47f854 100644 --- a/src/js/components/image-alt-text-dialog.js +++ b/src/js/components/image-alt-text-dialog.js @@ -30,7 +30,7 @@ class ImageAltTextDialog extends Component { const maxChars = 2000; const charCountPercentage = Math.min( Math.round((currentCharCount / maxChars) * 100), - 100 + 100, ); const isAboveCharLimit = currentCharCount > maxChars; @@ -101,7 +101,7 @@ class ImageAltTextDialog extends Component { `, - this + this, ); } @@ -134,7 +134,7 @@ class ImageAltTextDialog extends Component { detail: { altText: this.value, }, - }) + }), ); this.close(); } diff --git a/src/js/components/infinite-scroll-container.js b/src/js/components/infinite-scroll-container.js index 72b0aac2..02861782 100644 --- a/src/js/components/infinite-scroll-container.js +++ b/src/js/components/infinite-scroll-container.js @@ -94,7 +94,7 @@ class InfiniteScrollContainer extends Component { } }, }, - }) + }), ); } }, options); diff --git a/src/js/components/lightbox-image-group.js b/src/js/components/lightbox-image-group.js index 2b1431f9..3776f635 100644 --- a/src/js/components/lightbox-image-group.js +++ b/src/js/components/lightbox-image-group.js @@ -84,7 +84,7 @@ class LightboxImageGroup extends Component { : ""} `, - lightboxContainer + lightboxContainer, ); document.body.style.overflow = "hidden"; // Prevent background scrolling diff --git a/src/js/components/like-button.js b/src/js/components/like-button.js index 632826e5..4e737a73 100644 --- a/src/js/components/like-button.js +++ b/src/js/components/like-button.js @@ -96,7 +96,7 @@ class LikeButton extends Component { }, this._isCountIncreasing ? COUNT_INCREASING_ANIMATION_DURATION - : COUNT_DECREASING_ANIMATION_DURATION + : COUNT_DECREASING_ANIMATION_DURATION, ); } @@ -115,7 +115,7 @@ class LikeButton extends Component { new CustomEvent("click-like", { bubbles: true, composed: true, - }) + }), ); setTimeout(() => { this._recentlyClicked = false; @@ -153,7 +153,7 @@ class LikeButton extends Component { : null} `, - this + this, ); } } diff --git a/src/js/components/moderation-warning.js b/src/js/components/moderation-warning.js index 8393a56c..85b9fc37 100644 --- a/src/js/components/moderation-warning.js +++ b/src/js/components/moderation-warning.js @@ -38,7 +38,7 @@ class ModerationWarning extends Component {
`, - this + this, ); const toggleContent = this.querySelector(".toggle-content"); diff --git a/src/js/components/muted-reply-toggle.js b/src/js/components/muted-reply-toggle.js index 1ca09a7a..b13a4ab2 100644 --- a/src/js/components/muted-reply-toggle.js +++ b/src/js/components/muted-reply-toggle.js @@ -48,7 +48,7 @@ class MutedReplyToggle extends Component {
`, - this + this, ); const toggleContent = this.querySelector(".toggle-content"); diff --git a/src/js/components/post-composer.js b/src/js/components/post-composer.js index a1c6ddd0..cebf3fc0 100644 --- a/src/js/components/post-composer.js +++ b/src/js/components/post-composer.js @@ -144,7 +144,7 @@ function imagePreviewTemplate({ images, onRemove, onEditAltText }) { ${img.alt ? "βœ“ ALT" : "+ ALT"} - ` + `, )} `; @@ -174,7 +174,7 @@ class PostComposer extends Component { const currentCharCount = this._postText.length; const charCountPercentage = Math.min( Math.round((currentCharCount / 300) * 100), - 100 + 100, ); const isAboveCharLimit = currentCharCount > 300; render( @@ -301,7 +301,7 @@ class PostComposer extends Component { `, - this + this, ); } @@ -450,7 +450,7 @@ class PostComposer extends Component { ) { const linkFacetUrls = this._unresolvedFacets .filter( - (facet) => facet.features[0].$type === "app.bsky.richtext.facet#link" + (facet) => facet.features[0].$type === "app.bsky.richtext.facet#link", ) .map((facet) => facet.features[0].uri); for (const rejectedLinkEmbed of this._rejectedLinkEmbeds) { @@ -560,7 +560,7 @@ class PostComposer extends Component { successCallback, errorCallback, }, - }) + }), ); } diff --git a/src/js/components/rich-text-input.js b/src/js/components/rich-text-input.js index 17c4ba25..d95e45d2 100644 --- a/src/js/components/rich-text-input.js +++ b/src/js/components/rich-text-input.js @@ -245,7 +245,7 @@ function mentionSuggestionsTemplate({
@${actor.handle}
- ` + `, )} `; @@ -316,7 +316,7 @@ export class RichTextInput extends Component { : ""} `, - this + this, ); // Position the typeahead below the @ symbol @@ -392,7 +392,7 @@ export class RichTextInput extends Component { limit: "8", }); const response = await fetch( - `https://public.api.bsky.app/xrpc/app.bsky.actor.searchActorsTypeahead?${queryParams.toString()}` + `https://public.api.bsky.app/xrpc/app.bsky.actor.searchActorsTypeahead?${queryParams.toString()}`, ); if (response.ok) { const data = await response.json(); @@ -413,7 +413,7 @@ export class RichTextInput extends Component { this.currentMentionStart = pendingMention.start; this.currentMentionEnd = pendingMention.end; const suggestions = await this.fetchMentionSuggestions( - pendingMention.query + pendingMention.query, ); this.mentionSuggestions = suggestions; } else { @@ -472,7 +472,7 @@ export class RichTextInput extends Component { text: this.text, facets: this.facets, }, - }) + }), ); } @@ -583,7 +583,7 @@ export class RichTextInput extends Component { this.dispatchEvent( new CustomEvent("input", { detail: { text: this.text, facets: this.facets }, - }) + }), ); } @@ -608,7 +608,7 @@ export class RichTextInput extends Component { this.dispatchEvent( new CustomEvent("input", { detail: { text: this.text, facets: this.facets }, - }) + }), ); } @@ -637,7 +637,7 @@ export class RichTextInput extends Component { } else { this.selectedSuggestionIndex = Math.min( this.selectedSuggestionIndex + 1, - this.mentionSuggestions.length - 1 + this.mentionSuggestions.length - 1, ); } this.render(); @@ -648,7 +648,7 @@ export class RichTextInput extends Component { } else { this.selectedSuggestionIndex = Math.max( this.selectedSuggestionIndex - 1, - 0 + 0, ); } this.render(); @@ -702,7 +702,7 @@ export class RichTextInput extends Component { text: this.text, facets: this.facets, }, - }) + }), ); } } diff --git a/src/js/components/streaming-video.js b/src/js/components/streaming-video.js index 9bde73d4..0179f0f3 100644 --- a/src/js/components/streaming-video.js +++ b/src/js/components/streaming-video.js @@ -12,7 +12,7 @@ const streamingVideoObserver = new IntersectionObserver( }, { rootMargin: "200px", - } + }, ); class StreamingVideo extends Component { @@ -45,7 +45,7 @@ class StreamingVideo extends Component { height=${this.height} width=${this.width} >`, - this + this, ); const video = this.querySelector("video"); if (this.muted) { diff --git a/src/js/constellation.js b/src/js/constellation.js index ea2cb3bf..dea72da2 100644 --- a/src/js/constellation.js +++ b/src/js/constellation.js @@ -23,14 +23,14 @@ export async function getLinks({ } const response = await fetch( `https://constellation.microcosm.blue/xrpc/blue.microcosm.links.getBacklinks?${buildQueryString( - query + query, )}`, { headers: { Accept: "application/json", }, signal: controller.signal, - } + }, ); const data = await response.json(); links.push(...data.records); diff --git a/src/js/dataHelpers.js b/src/js/dataHelpers.js index 9f652e04..61255cd9 100644 --- a/src/js/dataHelpers.js +++ b/src/js/dataHelpers.js @@ -7,7 +7,7 @@ export function avatarThumbnailUrl(avatarUrl) { } return avatarUrl.replace( "/img/avatar/plain/", - "/img/avatar_thumbnail/plain/" + "/img/avatar_thumbnail/plain/", ); } diff --git a/src/js/dataLayer/dataLayer.js b/src/js/dataLayer/dataLayer.js index b93ab795..30454c34 100644 --- a/src/js/dataLayer/dataLayer.js +++ b/src/js/dataLayer/dataLayer.js @@ -16,19 +16,19 @@ export class DataLayer { this.requests = new Requests( this.api, this.dataStore, - this.preferencesProvider + this.preferencesProvider, ); this.mutations = new Mutations( this.api, this.dataStore, this.patchStore, - this.preferencesProvider + this.preferencesProvider, ); this.selectors = new Selectors( this.dataStore, this.patchStore, this.preferencesProvider, - this.isAuthenticated + this.isAuthenticated, ); this.declarative = new Declarative(this.selectors, this.requests); this.subscribers = []; diff --git a/src/js/dataLayer/mutations.js b/src/js/dataLayer/mutations.js index bdce9ede..f6ca5fac 100644 --- a/src/js/dataLayer/mutations.js +++ b/src/js/dataLayer/mutations.js @@ -485,7 +485,7 @@ export class Mutations { const convoList = this.dataStore.getConvoList(); if (convoList) { const updatedList = convoList.map((c) => - c.id === convo.id ? updatedConvo : c + c.id === convo.id ? updatedConvo : c, ); this.dataStore.setConvoList(updatedList); } @@ -527,7 +527,7 @@ export class Mutations { const message = await this.api.addMessageReaction( convoId, messageId, - emoji + emoji, ); this.dataStore.setMessage(messageId, message); // Update the last reaction in the convo @@ -560,7 +560,7 @@ export class Mutations { const message = await this.api.removeMessageReaction( convoId, messageId, - emoji + emoji, ); this.dataStore.setMessage(messageId, message); // Update the last reaction in the convo diff --git a/src/js/dataLayer/patchStore.js b/src/js/dataLayer/patchStore.js index ca24cb09..8f2495c8 100644 --- a/src/js/dataLayer/patchStore.js +++ b/src/js/dataLayer/patchStore.js @@ -38,7 +38,7 @@ export class PatchStore { const postPatches = this._getPostPatches(postURI); this.postPatches.set( postURI, - postPatches.filter(({ id }) => id !== patchId) + postPatches.filter(({ id }) => id !== patchId), ); } @@ -143,7 +143,7 @@ export class PatchStore { const profilePatches = this._getProfilePatches(profileURI); this.profilePatches.set( profileURI, - profilePatches.filter(({ id }) => id !== patchId) + profilePatches.filter(({ id }) => id !== patchId), ); } @@ -231,7 +231,7 @@ export class PatchStore { const messagePatches = this._getMessagePatches(messageId); this.messagePatches.set( messageId, - messagePatches.filter(({ id }) => id !== patchId) + messagePatches.filter(({ id }) => id !== patchId), ); } @@ -257,7 +257,8 @@ export class PatchStore { ...message, reactions: message.reactions.filter( (reaction) => - reaction.sender.did !== currentUserDid && reaction.value !== value + reaction.sender.did !== currentUserDid && + reaction.value !== value, ), }; default: @@ -281,7 +282,7 @@ export class PatchStore { removePreferencePatch(patchId) { const preferencePatches = this._getPreferencePatches(); this.preferencePatches = preferencePatches.filter( - ({ id }) => id !== patchId + ({ id }) => id !== patchId, ); } @@ -291,7 +292,7 @@ export class PatchStore { for (const patch of preferencePatches) { patchedPreferences = this.applyPreferencePatch( patchedPreferences, - patch.body + patch.body, ); } return patchedPreferences; diff --git a/src/js/dataLayer/requests.js b/src/js/dataLayer/requests.js index d00b4de3..3528cb7d 100644 --- a/src/js/dataLayer/requests.js +++ b/src/js/dataLayer/requests.js @@ -19,7 +19,7 @@ async function getReplyUrisForPostFromBacklinks(post) { timeout: 2000, }); return backlinks.map(({ did, collection, rkey }) => - buildUri({ repo: did, collection, rkey }) + buildUri({ repo: did, collection, rkey }), ); } @@ -77,7 +77,7 @@ export class Requests { this.enableStatus(this.loadPost, "loadPost"); this.enableStatus( this.loadNextFeedPage, - (feedURI) => "loadNextFeedPage-" + feedURI + (feedURI) => "loadNextFeedPage-" + feedURI, ); this.enableStatus(this.loadProfile, "loadProfile"); this.enableStatus(this.loadNextAuthorFeedPage, "loadNextAuthorFeedPage"); @@ -181,7 +181,7 @@ export class Requests { throw error; } const missingReplyUris = allReplyUris.filter( - (uri) => !loadedReplies.some((reply) => reply.post?.uri === uri) + (uri) => !loadedReplies.some((reply) => reply.post?.uri === uri), ); if (missingReplyUris.length > 0) { // Load up to 100 blocked replies. @@ -192,7 +192,7 @@ export class Requests { labelers, }); const repliesToAdd = missingReplies.filter( - (post) => !isBlockingUser(post) + (post) => !isBlockingUser(post), ); this.dataStore.setPosts(repliesToAdd); loadedReplies.push( @@ -202,7 +202,7 @@ export class Requests { post: post, replies: [], // don't bother loading replies, if people want to see them they can click the post detail }; - }) + }), ); } return loadedReplies; @@ -247,7 +247,7 @@ export class Requests { this.dataStore.setPosts(fetchedBlockedPosts); // If any blocked posts are not found, create an unavailable post for them const notFoundPostUris = blockedPostUris.filter( - (uri) => !fetchedBlockedPosts.some((post) => post.uri === uri) + (uri) => !fetchedBlockedPosts.some((post) => post.uri === uri), ); if (notFoundPostUris.length > 0) { for (const uri of notFoundPostUris) { @@ -299,7 +299,7 @@ export class Requests { async loadNextAuthorFeedPage( did, feedType, - { reload = false, limit = 31 } = {} + { reload = false, limit = 31 } = {}, ) { const feedURI = `${did}-${feedType}`; const existingFeed = this.dataStore.getAuthorFeed(feedURI); @@ -365,7 +365,7 @@ export class Requests { const res = await this.api.getNotifications({ cursor, limit }); // Get associated posts const { postUris, repostUris } = getPostAndRepostUrisFromNotifications( - res.notifications + res.notifications, ); if (postUris.length > 0) { const fetchedPosts = await this.api.getPosts(postUris); diff --git a/src/js/dataLayer/selectors.js b/src/js/dataLayer/selectors.js index 8027c63f..2da4d483 100644 --- a/src/js/dataLayer/selectors.js +++ b/src/js/dataLayer/selectors.js @@ -51,7 +51,10 @@ export class Selectors { return false; } const quotedPost = getQuotedPost(feedItem.post); - if (quotedPost?.author && doHideAuthorOnUnauthenticated(quotedPost.author)) { + if ( + quotedPost?.author && + doHideAuthorOnUnauthenticated(quotedPost.author) + ) { return false; } return true; @@ -331,7 +334,7 @@ export class Selectors { (convo) => new Date(getLastInteractionTimestamp(convo)), { direction: "desc", - } + }, ); return sortedConvos; } @@ -371,7 +374,7 @@ export class Selectors { return null; } const hydratedMessages = messages.messages.map((message) => - this.getMessage(message.id) + this.getMessage(message.id), ); return { messages: hydratedMessages, @@ -390,7 +393,7 @@ export class Selectors { } // Hydrate the posts const hydratedPosts = quotes.posts.map((post) => - this.getPost(post.uri, { required: true }) + this.getPost(post.uri, { required: true }), ); return { posts: hydratedPosts, @@ -441,7 +444,7 @@ export class Selectors { } for (const pinnedFeedGenerator of pinnedFeedGenerators) { hydratedPinnedFeedGenerators.push( - this.getFeedGenerator(pinnedFeedGenerator.uri) + this.getFeedGenerator(pinnedFeedGenerator.uri), ); } return hydratedPinnedFeedGenerators; diff --git a/src/js/errorLogs.js b/src/js/errorLogs.js index 02a3bb19..58d00453 100644 --- a/src/js/errorLogs.js +++ b/src/js/errorLogs.js @@ -38,7 +38,7 @@ export function enableErrorLogs() { const errorDiv = document.createElement("div"); errorDiv.style.padding = "15px"; errorDiv.innerHTML = `${args.join( - " " + " ", )} `; errorLog.appendChild(errorDiv); consoleError(...args); diff --git a/src/js/facetHelpers.js b/src/js/facetHelpers.js index fabf9f53..0677497e 100644 --- a/src/js/facetHelpers.js +++ b/src/js/facetHelpers.js @@ -4,7 +4,7 @@ import tlds from "/js/lib/tlds.js"; const urlCharacterRegex = /[a-zA-Z0-9.\-:/_-~?#\[\]@!$&'()*+,;%=]/; const urlRegex = new RegExp( `${urlCharacterRegex.source}${urlCharacterRegex.source}+\\.${urlCharacterRegex.source}${urlCharacterRegex.source}+`, - "gm" + "gm", ); function ensureExternal(href) { @@ -134,7 +134,7 @@ export async function resolveFacets(facets, identityResolver) { } const resolvedMentions = await resolveMentions( unresolvedMentions, - identityResolver + identityResolver, ); return [...resolvedFacets, ...resolvedMentions]; } @@ -143,11 +143,13 @@ export async function getFacetsFromText(text, identityResolver) { const unresolvedFacets = getUnresolvedFacetsFromText(text); const resolvedFacets = await resolveFacets( unresolvedFacets, - identityResolver + identityResolver, ); return resolvedFacets; } export function getTagsFromFacets(facets) { - return facets.filter((facet) => facet.features[0].$type === "app.bsky.richtext.facet#tag") -} \ No newline at end of file + return facets.filter( + (facet) => facet.features[0].$type === "app.bsky.richtext.facet#tag", + ); +} diff --git a/src/js/feedFilters.js b/src/js/feedFilters.js index 3af7b4bd..33e50da4 100644 --- a/src/js/feedFilters.js +++ b/src/js/feedFilters.js @@ -34,7 +34,7 @@ function filterByFollowing(feed, currentUser) { continue; } const { parentAuthor, grandparentAuthor, rootAuthor } = getReplyAuthors( - feedItem.reply + feedItem.reply, ); if (!isSelfOrFollowing(author, userDid)) { @@ -97,7 +97,7 @@ function filterReplies(feed) { function filterQuotePosts(feed) { const filteredFeedItems = feed.feed.filter( - (item) => !getQuotedPost(item.post) + (item) => !getQuotedPost(item.post), ); return { feed: filteredFeedItems, @@ -138,7 +138,7 @@ function filterBlockedQuotes(feed) { function filterMutedQuotes(feed) { const filteredFeedItems = feed.feed.filter( - (item) => !getMutedQuote(item.post) + (item) => !getMutedQuote(item.post), ); return { feed: filteredFeedItems, diff --git a/src/js/identityPrecaching.js b/src/js/identityPrecaching.js index 0cad31ff..e6f4f467 100644 --- a/src/js/identityPrecaching.js +++ b/src/js/identityPrecaching.js @@ -18,7 +18,7 @@ export function setUpIdentityPrecaching(dataLayer, identityResolver) { if (quotedPost.author) { identityResolver.setDidForHandle( quotedPost.author.handle, - quotedPost.author.did + quotedPost.author.did, ); } // we can go deeper... @@ -28,7 +28,7 @@ export function setUpIdentityPrecaching(dataLayer, identityResolver) { if (nestedQuotedPost.author) { identityResolver.setDidForHandle( nestedQuotedPost.author.handle, - nestedQuotedPost.author.did + nestedQuotedPost.author.did, ); } } @@ -45,13 +45,13 @@ export function setUpIdentityPrecaching(dataLayer, identityResolver) { if (feedGenerator.creator) { identityResolver.setDidForHandle( feedGenerator.creator.handle, - feedGenerator.creator.did + feedGenerator.creator.did, ); } } catch (error) { console.error( "error when setting DID from feed generator", - feedGenerator + feedGenerator, ); console.error(error); } diff --git a/src/js/modals.js b/src/js/modals.js index 67b52804..39407a00 100644 --- a/src/js/modals.js +++ b/src/js/modals.js @@ -23,7 +23,7 @@ export async function showSignInModal() { `, - signInModal + signInModal, ); // Dismiss on backdrop click @@ -54,7 +54,7 @@ export function showInfoModal({ title, message, confirmButtonText = "OK" }) { `, - dialog + dialog, ); const okButton = dialog.querySelector(".primary-button"); @@ -89,7 +89,7 @@ export async function confirm( title = null, confirmButtonStyle = "primary", confirmButtonText = "Confirm", - } = {} + } = {}, ) { return new Promise((resolve) => { const dialog = document.createElement("dialog"); @@ -110,7 +110,7 @@ export async function confirm( `, - dialog + dialog, ); const cancelButton = dialog.querySelector(".cancel-button"); diff --git a/src/js/navigation.js b/src/js/navigation.js index c163eaf5..3c797964 100644 --- a/src/js/navigation.js +++ b/src/js/navigation.js @@ -51,7 +51,7 @@ export function linkToProfileFollowing(handleOrProfile) { export function linkToFeed(feedGenerator) { return `/profile/${feedGenerator.creator.handle}/feed/${getRKey( - feedGenerator + feedGenerator, )}`; } diff --git a/src/js/notificationService.js b/src/js/notificationService.js index 21294327..6edcdab3 100644 --- a/src/js/notificationService.js +++ b/src/js/notificationService.js @@ -14,7 +14,7 @@ export class NotificationService extends EventEmitter { const snoozedUntil = new Date(Date.now() + timeoutMinutes * 60 * 1000); localStorage.setItem( "notifications-snoozed-until", - snoozedUntil.toISOString() + snoozedUntil.toISOString(), ); } diff --git a/src/js/oauth.js b/src/js/oauth.js index 6c28e1e3..a0afae24 100644 --- a/src/js/oauth.js +++ b/src/js/oauth.js @@ -36,7 +36,7 @@ async function signJWT(header, payload, privateKey) { const signatureBuffer = await window.crypto.subtle.sign( { name: "ECDSA", hash: "SHA-256" }, privateKey, - encodeUtf8(signatureInput) + encodeUtf8(signatureInput), ); const signatureB64 = base64UrlEncode(signatureBuffer); @@ -61,7 +61,7 @@ async function fetchResourceServerMetadata(pdsUrl) { async function fetchAuthServerMetadata(authServerUrl) { const metadataUrl = new URL( "/.well-known/oauth-authorization-server", - authServerUrl + authServerUrl, ); const response = await fetch(metadataUrl); if (!response.ok) { @@ -80,14 +80,14 @@ async function loadOrGenerateDPoPKeypair() { pubkey, { name: "ECDSA", namedCurve: "P-256" }, true, - ["verify"] + ["verify"], ), privateKey: await window.crypto.subtle.importKey( "jwk", privkey, { name: "ECDSA", namedCurve: "P-256" }, true, - ["sign"] + ["sign"], ), }; } @@ -97,22 +97,22 @@ async function loadOrGenerateDPoPKeypair() { namedCurve: "P-256", }, true, - ["sign", "verify"] + ["sign", "verify"], ); const publicKeyJwk = await window.crypto.subtle.exportKey( "jwk", - keyPair.publicKey + keyPair.publicKey, ); const privateKeyJwk = await window.crypto.subtle.exportKey( "jwk", - keyPair.privateKey + keyPair.privateKey, ); localStorage.setItem( "dpop_keypair", JSON.stringify({ pubkey: publicKeyJwk, privkey: privateKeyJwk, - }) + }), ); return keyPair; } @@ -168,7 +168,7 @@ class DPoPRequests { async createProof(method, url, dpopNonce = null, accessToken = null) { const publicJwk = await window.crypto.subtle.exportKey( "jwk", - this.dpopKeypair.publicKey + this.dpopKeypair.publicKey, ); const header = { typ: "dpop+jwt", @@ -230,7 +230,7 @@ class Session { async refreshToken({ retryCount = 0 } = {}) { const authServer = new AuthServer( this.sessionData.authServerMetadata, - this.dpopRequests + this.dpopRequests, ); const params = { @@ -390,7 +390,7 @@ export class OauthClient { { scope = "atproto transition:generic transition:chat.bsky", state = {}, - } = {} + } = {}, ) { const did = await resolveHandle(handle); if (!did) { @@ -423,7 +423,7 @@ export class OauthClient { }; localStorage.setItem( `oauth_in_flight_${requestId}`, - JSON.stringify(inFlightData) + JSON.stringify(inFlightData), ); const authServer = new AuthServer(authServerMetadata, this.dpopRequests); @@ -458,7 +458,7 @@ export class OauthClient { const { requestId } = JSON.parse(decodeURIComponent(stateStr)); const inFlightDataStr = localStorage.getItem( - `oauth_in_flight_${requestId}` + `oauth_in_flight_${requestId}`, ); if (!inFlightDataStr) { throw new Error("No in-flight data found for requestId"); @@ -474,13 +474,13 @@ export class OauthClient { const authServer = new AuthServer( inFlightData.authServerMetadata, - this.dpopRequests + this.dpopRequests, ); const tokenResponse = await authServer.exchangeCodeForToken( this.clientId, code, inFlightData.codeVerifier, - inFlightData.redirectUri + inFlightData.redirectUri, ); if (tokenResponse.sub !== inFlightData.did) { diff --git a/src/js/postComposerService.js b/src/js/postComposerService.js index 2c745dd0..967655e8 100644 --- a/src/js/postComposerService.js +++ b/src/js/postComposerService.js @@ -88,7 +88,7 @@ export class PostComposerService { try { const facets = await resolveFacets( unresolvedFacets, - this.identityResolver + this.identityResolver, ); const res = await this.dataLayer.mutations.createPost({ postText, @@ -105,7 +105,7 @@ export class PostComposerService { href="${linkToPostFromUri(res.uri)}" >View - ` + `, ); return res; } catch (error) { diff --git a/src/js/postInteractionHandler.js b/src/js/postInteractionHandler.js index abe10691..1a447f2b 100644 --- a/src/js/postInteractionHandler.js +++ b/src/js/postInteractionHandler.js @@ -114,7 +114,7 @@ export class PostInteractionHandler { title: "Delete this post?", confirmButtonStyle: "danger", confirmButtonText: "Delete", - } + }, )) ) { return; diff --git a/src/js/postSeenObserver.js b/src/js/postSeenObserver.js index e6b5b874..7c29f8fb 100644 --- a/src/js/postSeenObserver.js +++ b/src/js/postSeenObserver.js @@ -21,7 +21,7 @@ class InteractionsDispatch { sendInteraction(interaction) { if ( this.sentInteractions.some((sentInteraction) => - shallowEqual(sentInteraction, interaction) + shallowEqual(sentInteraction, interaction), ) ) { console.warn("interaction already sent", interaction); @@ -43,7 +43,7 @@ class InteractionsDispatch { } catch (error) { console.warn( "Failed to send interactions to feed proxy url", - this.feedProxyUrl + this.feedProxyUrl, ); } this.queue = []; @@ -124,7 +124,7 @@ export class PostSeenObserver { "scroll", throttle(() => { this.handleScroll(); - }, 100) + }, 100), ); } @@ -164,7 +164,7 @@ export class PostSeenObserver { register(el, postUri, feedContext) { // don't double-register this.observedElements = this.observedElements.filter( - (item) => item.postUri !== postUri + (item) => item.postUri !== postUri, ); this.observedElements.push({ postUri, el, feedContext }); // check intersections immediately - this is similar to how the intersection observer works diff --git a/src/js/preferences.js b/src/js/preferences.js index bfcb92bb..be7daf53 100644 --- a/src/js/preferences.js +++ b/src/js/preferences.js @@ -69,7 +69,7 @@ function textMatchesMutedWord(text, mutedWord, languages) { // Also try matching with all punctuation removed (e.g., "don't" -> "dont") const wordNoPunctuation = wordTrimmed.replace( INTERNAL_PUNCTUATION_REGEX, - "" + "", ); if (wordNoPunctuation === normalizedMutedWord) { return true; @@ -81,14 +81,14 @@ function textMatchesMutedWord(text, mutedWord, languages) { function getLabelerForLabel(label, labelers) { const matchingLabeler = labelers.find( - (labeler) => labeler.creator.did === label.src + (labeler) => labeler.creator.did === label.src, ); return matchingLabeler ?? null; } function getDefinitionForLabel(label, labeler) { return labeler.policies.labelValueDefinitions.find( - (definition) => definition.identifier === label.val + (definition) => definition.identifier === label.val, ); } @@ -98,7 +98,7 @@ function getDisplayNameForLabel(label, labeler) { return null; } const enLocale = matchingDefinition.locales.find( - (locale) => locale.lang === "en" + (locale) => locale.lang === "en", ); return enLocale?.name || ""; } @@ -117,7 +117,7 @@ export class Preferences { throw new Error("Saved feeds preference not found"); } const matchingItem = savedFeedsPreference.items.find( - (item) => item.value === feedUri + (item) => item.value === feedUri, ); if (matchingItem) { matchingItem.pinned = false; @@ -132,7 +132,7 @@ export class Preferences { throw new Error("Saved feeds preference not found"); } const matchingItem = savedFeedsPreference.items.find( - (item) => item.value === feedUri + (item) => item.value === feedUri, ); if (matchingItem) { matchingItem.pinned = true; @@ -190,30 +190,29 @@ export class Preferences { } isPostHidden(postUri) { - const hiddenPostsPreference = Preferences.getHiddenPostsPreference(this.obj); + const hiddenPostsPreference = Preferences.getHiddenPostsPreference( + this.obj, + ); if (!hiddenPostsPreference) { return false; } return hiddenPostsPreference.items.includes(postUri); } - hasMutedWord({ - text, - facets, - embed, - languages, - author - }) { + hasMutedWord({ text, facets, embed, languages, author }) { const mutedWordsPreference = Preferences.getMutedWordsPreference(this.obj); if (!mutedWordsPreference) { return false; } const now = new Date().toISOString(); const activeItems = mutedWordsPreference.items.filter((item) => - item.expiresAt ? item.expiresAt > now : true + item.expiresAt ? item.expiresAt > now : true, ); for (const item of activeItems) { - if (item.actorTarget === "exclude-following" && author?.viewer?.following) { + if ( + item.actorTarget === "exclude-following" && + author?.viewer?.following + ) { continue; } if (item.targets.includes("content")) { @@ -270,7 +269,7 @@ export class Preferences { const followingFeedPreference = this.obj.find( (preference) => preference.$type === "app.bsky.actor.defs#feedViewPref" && - preference.feed === "home" + preference.feed === "home", ); return followingFeedPreference ?? null; } @@ -286,35 +285,35 @@ export class Preferences { // but there's a note in the code to "move to the server" so let's just do that here. return Preferences.getPreferenceByType( obj, - "app.bsky.actor.defs#improHiddenPostsPref" + "app.bsky.actor.defs#improHiddenPostsPref", ); } static getMutedWordsPreference(obj) { return Preferences.getPreferenceByType( obj, - "app.bsky.actor.defs#mutedWordsPref" + "app.bsky.actor.defs#mutedWordsPref", ); } static getSavedFeedsPreference(obj) { return Preferences.getPreferenceByType( obj, - "app.bsky.actor.defs#savedFeedsPrefV2" + "app.bsky.actor.defs#savedFeedsPrefV2", ); } static getLabelerPreference(obj) { return Preferences.getPreferenceByType( obj, - "app.bsky.actor.defs#labelersPref" + "app.bsky.actor.defs#labelersPref", ); } static getImproThemePreference(obj) { return Preferences.getPreferenceByType( obj, - "app.bsky.actor.defs#improThemePref" + "app.bsky.actor.defs#improThemePref", ); } @@ -341,7 +340,7 @@ export class Preferences { ], }, ], - [] + [], ); } } diff --git a/src/js/router.js b/src/js/router.js index 9cc421ab..70c94f56 100644 --- a/src/js/router.js +++ b/src/js/router.js @@ -99,7 +99,7 @@ export class Router extends EventEmitter { this.currentPage.style.opacity = 1; }, }, - }) + }), ); this.emit("page-shown", this.currentPage); return; diff --git a/src/js/templates/avatar.template.js b/src/js/templates/avatar.template.js index a9e0af5f..99295199 100644 --- a/src/js/templates/avatar.template.js +++ b/src/js/templates/avatar.template.js @@ -20,7 +20,7 @@ function avatarWrapperTemplate({ author, clickAction, children }) { }); }} >${children}` + >`, ); } else if (clickAction === "lightbox") { return html` ${image.alt ? html`
ALT
` : ""} - ` + `, )}
`; } @@ -247,7 +247,7 @@ function listTemplate({ list }) { return html``; if (i < feed.feed.length - 1) { diff --git a/src/js/templates/profileListItem.template.js b/src/js/templates/profileListItem.template.js index c1d0ebe5..8db65264 100644 --- a/src/js/templates/profileListItem.template.js +++ b/src/js/templates/profileListItem.template.js @@ -10,10 +10,7 @@ export function profileListItemTemplate({ actor }) { > ${avatarTemplate({ author: actor })}
- + ${displayName}
@${actor.handle}
diff --git a/src/js/templates/richText.template.js b/src/js/templates/richText.template.js index 6c57bcc9..4128069b 100644 --- a/src/js/templates/richText.template.js +++ b/src/js/templates/richText.template.js @@ -37,7 +37,10 @@ function textPartTemplate({ text }) { } function facetOverlaps(facet1, facet2) { - return facet1.index.byteStart <= facet2.index.byteEnd && facet1.index.byteEnd >= facet2.index.byteStart; + return ( + facet1.index.byteStart <= facet2.index.byteEnd && + facet1.index.byteEnd >= facet2.index.byteStart + ); } function richTextLineTemplate({ text, facets, byteOffset }) { @@ -48,9 +51,9 @@ function richTextLineTemplate({ text, facets, byteOffset }) { let currentIndex = 0; const sortedFacets = sortBy(facets, (facet) => facet.index.byteStart); // Filter overlapping facets - const distinctFacets = [] + const distinctFacets = []; for (const facet of sortedFacets) { - if (!distinctFacets.some(f => facetOverlaps(f, facet))) { + if (!distinctFacets.some((f) => facetOverlaps(f, facet))) { distinctFacets.push(facet); } } @@ -58,13 +61,13 @@ function richTextLineTemplate({ text, facets, byteOffset }) { const textPart = sliceByByte( text, currentIndex, - facet.index.byteStart - byteOffset + facet.index.byteStart - byteOffset, ); parts.push(textPartTemplate({ text: textPart })); const wrappedText = sliceByByte( text, facet.index.byteStart - byteOffset, - facet.index.byteEnd - byteOffset + facet.index.byteEnd - byteOffset, ); parts.push(facetTemplate({ facet, wrappedText })); currentIndex = facet.index.byteEnd - byteOffset; @@ -83,10 +86,10 @@ export function richTextTemplate({ text, facets = [] }) { const facetsForLine = facets.filter( (facet) => facet.index.byteStart >= byteOffset && - facet.index.byteEnd <= byteOffset + lineByteLength + facet.index.byteEnd <= byteOffset + lineByteLength, ); divs.push( - richTextLineTemplate({ text: line, facets: facetsForLine, byteOffset }) + richTextLineTemplate({ text: line, facets: facetsForLine, byteOffset }), ); byteOffset += lineByteLength + 1; // +1 for the newline character } diff --git a/src/js/templates/sidebar.template.js b/src/js/templates/sidebar.template.js index 77555136..c56cc916 100644 --- a/src/js/templates/sidebar.template.js +++ b/src/js/templates/sidebar.template.js @@ -73,7 +73,7 @@ function sidebarNavTemplate({ menuItems, activeNavItem, onClickActiveItem }) { ${item.label} - ` + `, )} `; diff --git a/src/js/theme.js b/src/js/theme.js index 65fa1cab..58d56d99 100644 --- a/src/js/theme.js +++ b/src/js/theme.js @@ -48,7 +48,7 @@ class Theme { apply() { document.documentElement.style.setProperty( `--highlight-color`, - this.highlightColor + this.highlightColor, ); document.documentElement.style.setProperty(`--like-color`, this.likeColor); // Apply color scheme @@ -57,7 +57,7 @@ class Theme { } else { document.documentElement.style.setProperty( "color-scheme", - this.colorScheme + this.colorScheme, ); } // Background color for iOS diff --git a/src/js/toasts.js b/src/js/toasts.js index 09cde2a9..bad8c98c 100644 --- a/src/js/toasts.js +++ b/src/js/toasts.js @@ -5,7 +5,7 @@ import { wait, raf } from "/js/utils.js"; export async function showToast( message, - { error = false, timeout = 3000 } = {} + { error = false, timeout = 3000 } = {}, ) { const toast = document.createElement("div"); toast.setAttribute("popover", "manual"); @@ -20,7 +20,7 @@ export async function showToast( > ${message} `, - toast + toast, ); document.body.appendChild(toast); await raf(); diff --git a/src/js/utils.js b/src/js/utils.js index f5a36bb6..26852520 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -166,7 +166,7 @@ export function deepClone(value) { return value.map((item) => deepClone(item)); } else if (value !== null && typeof value === "object") { return Object.fromEntries( - Object.entries(value).map(([key, value]) => [key, deepClone(value)]) + Object.entries(value).map(([key, value]) => [key, deepClone(value)]), ); } return value; diff --git a/src/js/views/bookmarks.view.js b/src/js/views/bookmarks.view.js index 2ad96458..4ba68057 100644 --- a/src/js/views/bookmarks.view.js +++ b/src/js/views/bookmarks.view.js @@ -24,7 +24,7 @@ class BookmarksView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); async function scrollAndReloadBookmarks() { @@ -68,7 +68,7 @@ class BookmarksView extends View { `, })}
`, - root + root, ); } diff --git a/src/js/views/chat.view.js b/src/js/views/chat.view.js index d5567a33..7c492de4 100644 --- a/src/js/views/chat.view.js +++ b/src/js/views/chat.view.js @@ -52,7 +52,7 @@ class ChatView extends View { function convoItemTemplate({ convo, currentUser }) { const lastInteraction = getLastInteraction(convo); const otherUser = convo.members.find( - (member) => member.did !== currentUser?.did + (member) => member.did !== currentUser?.did, ); const timeAgo = lastInteraction ? displayRelativeTime(getInteractionTimestamp(lastInteraction)) @@ -107,14 +107,14 @@ class ChatView extends View {
- ` + `, )} `; } function chatRequestsTemplate({ chatRequests }) { const hasUnreadRequests = chatRequests.some( - (convo) => convo.unreadCount > 0 + (convo) => convo.unreadCount > 0, ); return html`
convo.status === "request" + (convo) => convo.status === "request", ); const acceptedConvos = convos.filter( - (convo) => convo.status === "accepted" + (convo) => convo.status === "accepted", ); return html`
@@ -225,7 +225,7 @@ class ChatView extends View { `, })}
`, - root + root, ); } diff --git a/src/js/views/chatDetail.view.js b/src/js/views/chatDetail.view.js index 176b6f8b..d1e043b4 100644 --- a/src/js/views/chatDetail.view.js +++ b/src/js/views/chatDetail.view.js @@ -142,7 +142,7 @@ class ChatDetailView extends View { const res = await this.api.getChatLogs({ cursor: this._cursor }); this._cursor = res.cursor; const logsForConvo = res.logs.filter( - (log) => log.convoId === this.convoId + (log) => log.convoId === this.convoId, ); for (const log of logsForConvo) { if (log.$type === "chat.bsky.convo.defs#logCreateMessage") { @@ -151,7 +151,7 @@ class ChatDetailView extends View { continue; } const convoMessages = this.dataLayer.selectors.getConvoMessages( - this.convoId + this.convoId, ); if (!convoMessages) { console.warn("No messages data found for convoId", this.convoId); @@ -182,7 +182,7 @@ class ChatDetailView extends View { convoId, messageId, emoji, - currentUserDid + currentUserDid, ); closeReactionPalette(); renderPage(); @@ -199,7 +199,7 @@ class ChatDetailView extends View { const promise = dataLayer.mutations.removeMessageReaction( convoId, messageId, - emoji + emoji, ); // optimistic update renderPage(); @@ -215,7 +215,7 @@ class ChatDetailView extends View { const promise = dataLayer.mutations.addMessageReaction( convoId, messageId, - emoji + emoji, ); // optimistic update renderPage(); @@ -398,7 +398,7 @@ class ChatDetailView extends View { > ${emoji} - ` + `, )}
`} ` : !isCurrentUser && !showAvatar - ? html`
` - : ""} + ? html`
` + : ""}
${richTextTemplate({ @@ -512,7 +512,7 @@ class ChatDetailView extends View { otherMember, onLongPress: (msg, e) => handleLongPress(msg, e), isSelected: state.selectedMessageId === message.id, - }) + }), )}
{ renderPage(); diff --git a/src/js/views/chatRequests.view.js b/src/js/views/chatRequests.view.js index 7c988e1b..76183c92 100644 --- a/src/js/views/chatRequests.view.js +++ b/src/js/views/chatRequests.view.js @@ -47,7 +47,7 @@ class ChatRequestsView extends View { function requestItemTemplate({ convo }) { const lastMessage = convo.lastMessage; const members = convo.members.filter( - (member) => member.did !== dataLayer.selectors.getCurrentUser()?.did + (member) => member.did !== dataLayer.selectors.getCurrentUser()?.did, ); const otherMember = members[0]; const timeAgo = lastMessage @@ -136,7 +136,7 @@ class ChatRequestsView extends View { >
- ` + `, )} `; } @@ -214,7 +214,7 @@ class ChatRequestsView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/feedDetail.view.js b/src/js/views/feedDetail.view.js index 421076c2..c72e2e3a 100644 --- a/src/js/views/feedDetail.view.js +++ b/src/js/views/feedDetail.view.js @@ -40,7 +40,7 @@ class FeedDetailView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); async function handleClickPinFeed(doPin) { @@ -75,7 +75,7 @@ class FeedDetailView extends View { const showLessInteractions = dataLayer.selectors.getShowLessInteractions() ?? []; const hiddenPostUris = showLessInteractions.map( - (interaction) => interaction.item + (interaction) => interaction.item, ); const numNotifications = notificationService?.getNumNotifications() ?? null; @@ -132,7 +132,7 @@ class FeedDetailView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/feeds.view.js b/src/js/views/feeds.view.js index 095ec92a..906074ae 100644 --- a/src/js/views/feeds.view.js +++ b/src/js/views/feeds.view.js @@ -83,14 +83,14 @@ class FeedsView extends View { : ""} - ` + `, ) : html`
`} `, })} `, - root + root, ); } diff --git a/src/js/views/hashtag.view.js b/src/js/views/hashtag.view.js index cf33aa82..6f1da984 100644 --- a/src/js/views/hashtag.view.js +++ b/src/js/views/hashtag.view.js @@ -37,7 +37,7 @@ class HashtagView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); const feedScrollState = new Map(); @@ -68,7 +68,7 @@ class HashtagView extends View { // Load feed if not cached const feed = dataLayer.selectors.getHashtagFeed( hashtag, - state.currentSort + state.currentSort, ); if (!feed) { await loadCurrentFeed(); @@ -106,14 +106,14 @@ class HashtagView extends View { @click=${() => handleTabClick(sort.value)} > ${sort.label} - ` + `, )} ${sortOptions.map((sort) => { const feed = dataLayer.selectors.getHashtagFeed( hashtag, - sort.value + sort.value, ); return html`
`, })}
`, - root + root, ); } diff --git a/src/js/views/home.view.js b/src/js/views/home.view.js index 61da8f6b..d0ac3880 100644 --- a/src/js/views/home.view.js +++ b/src/js/views/home.view.js @@ -33,7 +33,7 @@ class HomeView extends View { localStorage.setItem(`${namespace}-${prop}`, JSON.stringify(value)); return true; }, - } + }, ); } @@ -68,14 +68,14 @@ class HomeView extends View { const interactableFeedGenerators = pinnedFeedGenerators.filter( (pinnedFeedGenerator) => pinnedFeedGenerator.acceptsInteractions || - pinnedFeedGenerator.uri === DISCOVER_FEED_URI + pinnedFeedGenerator.uri === DISCOVER_FEED_URI, ); for (const pinnedFeedGenerator of interactableFeedGenerators) { const proxyUrl = getProxyUrl(pinnedFeedGenerator); if (proxyUrl) { postSeenObservers.set( pinnedFeedGenerator.uri, - new PostSeenObserver(api, proxyUrl) + new PostSeenObserver(api, proxyUrl), ); } } @@ -91,7 +91,7 @@ class HomeView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); function isVisible(element) { @@ -105,7 +105,7 @@ class HomeView extends View { dataLayer.mutations.sendShowLessInteraction( post.uri, feedContext, - getProxyUrl(feedGenerator) + getProxyUrl(feedGenerator), ); // Render optimistic update renderPage(); @@ -152,7 +152,7 @@ class HomeView extends View { } // Trigger post seen checks for the new feed const postSeenObserver = postSeenObservers.get( - persistedState.currentFeedUri + persistedState.currentFeedUri, ); if (postSeenObserver) { postSeenObserver.checkAllIntersections(); @@ -173,7 +173,7 @@ class HomeView extends View { const showLessInteractions = dataLayer.selectors.getShowLessInteractions() ?? []; const hiddenPostUris = showLessInteractions.map( - (interaction) => interaction.item + (interaction) => interaction.item, ); const numNotifications = notificationService?.getNumNotifications() ?? null; @@ -216,7 +216,7 @@ class HomeView extends View { @click=${() => handleTabClick(feedGenerator)} > ${feedGenerator.displayName} - ` + `, )} @@ -226,7 +226,7 @@ class HomeView extends View { ${feedGenerators.map((feedGenerator) => { const feed = dataLayer.selectors.getFeed(feedGenerator.uri); const feedRequestStatus = dataLayer.requests.getStatus( - "loadNextFeedPage-" + feedGenerator.uri + "loadNextFeedPage-" + feedGenerator.uri, ); return html`
`, })}
`, - root + root, ); const feedItems = document.querySelectorAll(".feed-item"); feedItems.forEach((feedItem) => { @@ -307,7 +307,7 @@ class HomeView extends View { // If the current feed is not in the pinned feed generators, reset to default feed if ( !pinnedFeedGenerators.some( - (feed) => feed.uri === persistedState.currentFeedUri + (feed) => feed.uri === persistedState.currentFeedUri, ) ) { resetToDefaultFeed(); diff --git a/src/js/views/login.view.js b/src/js/views/login.view.js index 1120f669..12904a9d 100644 --- a/src/js/views/login.view.js +++ b/src/js/views/login.view.js @@ -104,7 +104,7 @@ class LoginView extends View { `, - root + root, ); } diff --git a/src/js/views/notFound.view.js b/src/js/views/notFound.view.js index 6aa02b47..149696b5 100644 --- a/src/js/views/notFound.view.js +++ b/src/js/views/notFound.view.js @@ -19,7 +19,7 @@ class NotFoundView extends View { > `, - root + root, ); } diff --git a/src/js/views/notifications.view.js b/src/js/views/notifications.view.js index 67d2d0e3..e82e9148 100644 --- a/src/js/views/notifications.view.js +++ b/src/js/views/notifications.view.js @@ -69,7 +69,7 @@ class NotificationsView extends View { alt="${image.alt || ""}" class="notification-preview-image" /> - ` + `, )} ` @@ -83,7 +83,7 @@ class NotificationsView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); async function handleMenuClick() { @@ -107,7 +107,7 @@ class NotificationsView extends View { const subject = notification.reasonSubject; const existingGroup = notificationGroups.find( - (group) => group.type === type && group.subject === subject + (group) => group.type === type && group.subject === subject, ); if (existingGroup && GROUPED_NOTIFICATION_TYPES.includes(type)) { @@ -131,10 +131,10 @@ class NotificationsView extends View { // Only group notifications per page const batchedNotifications = batch( notifications, - NOTIFICATIONS_PAGE_SIZE + NOTIFICATIONS_PAGE_SIZE, ); return batchedNotifications.flatMap((batch) => - groupNotificationsForBatch(batch) + groupNotificationsForBatch(batch), ); } @@ -149,7 +149,7 @@ class NotificationsView extends View {
${avatarTemplate({ author: notif.author })}
- ` + `, )} ${notifications.length > maxAvatars ? html`
@@ -399,7 +399,7 @@ class NotificationsView extends View { }} > ${groupedNotifications.map((notificationGroup) => - notificationGroupTemplate({ notificationGroup, currentUser }) + notificationGroupTemplate({ notificationGroup, currentUser }), )} ${!hasMore ? html`
No more notifications
` @@ -422,7 +422,7 @@ class NotificationsView extends View { const showLessInteractions = dataLayer.selectors.getShowLessInteractions() ?? []; const hiddenPostUris = showLessInteractions.map( - (interaction) => interaction.item + (interaction) => interaction.item, ); // Filter out notifications for hidden posts if (notifications && hiddenPostUris.length > 0) { @@ -497,7 +497,7 @@ class NotificationsView extends View { `, })}
`, - root + root, ); } diff --git a/src/js/views/postLikes.view.js b/src/js/views/postLikes.view.js index 6ccff1e0..f45137ad 100644 --- a/src/js/views/postLikes.view.js +++ b/src/js/views/postLikes.view.js @@ -49,7 +49,7 @@ class PostLikesView extends View { ${hasMore ? Array.from({ length: 5 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), ) : ""} `; @@ -58,7 +58,7 @@ class PostLikesView extends View { function likesSkeletonTemplate() { return html`
${Array.from({ length: 10 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), )}
`; } @@ -120,7 +120,7 @@ class PostLikesView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/postQuotes.view.js b/src/js/views/postQuotes.view.js index c7a6e334..38109a1d 100644 --- a/src/js/views/postQuotes.view.js +++ b/src/js/views/postQuotes.view.js @@ -36,7 +36,7 @@ class PostQuotesView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); function quotesListTemplate({ quotes, hasMore, currentUser }) { @@ -57,7 +57,7 @@ class PostQuotesView extends View { post: quote, isUserPost: currentUser?.did === quote.author?.did, postInteractionHandler, - }) + }), )} ${hasMore @@ -130,7 +130,7 @@ class PostQuotesView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/postReposts.view.js b/src/js/views/postReposts.view.js index cbe6af1a..f91e177a 100644 --- a/src/js/views/postReposts.view.js +++ b/src/js/views/postReposts.view.js @@ -50,7 +50,7 @@ class PostRepostsView extends View { ${hasMore ? Array.from({ length: 5 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), ) : ""} `; @@ -59,7 +59,7 @@ class PostRepostsView extends View { function repostsSkeletonTemplate() { return html`
${Array.from({ length: 10 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), )}
`; } @@ -120,7 +120,7 @@ class PostRepostsView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/postThread.view.js b/src/js/views/postThread.view.js index f6eb7ddc..1cc00eeb 100644 --- a/src/js/views/postThread.view.js +++ b/src/js/views/postThread.view.js @@ -47,7 +47,7 @@ class PostThreadView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); function postThreadErrorTemplate({ error }) { @@ -94,7 +94,7 @@ class PostThreadView extends View { let mostLikedReply = sortBy( shownReplies, (reply) => getLikesWithoutUser(reply.post), - { direction: "desc" } + { direction: "desc" }, )[0]; chain.push(mostLikedReply); currentPost = mostLikedReply; @@ -123,11 +123,11 @@ class PostThreadView extends View { (chain) => getLikesWithoutUser(chain[0].post), { direction: "desc", - } + }, ); // If there's a recent reply from the user, put it at the top const recentReplyFromUser = sortedReplyChains.find( - (chain) => chain[0].post.viewer?.priorityReply + (chain) => chain[0].post.viewer?.priorityReply, ); if (recentReplyFromUser) { return [ @@ -192,7 +192,7 @@ class PostThreadView extends View { function postThreadRepliesTemplate({ replies, currentUser }) { const hiddenReplies = replies.filter( - (reply) => reply.post && isMutedPost(reply.post) + (reply) => reply.post && isMutedPost(reply.post), ); const replyChains = buildReplyChains(replies, currentUser); return html` @@ -205,7 +205,7 @@ class PostThreadView extends View { replyChain, currentUser, lazyLoadImages: i > 20, - }) + }), )} ${hiddenReplies.length > 0 @@ -217,7 +217,7 @@ class PostThreadView extends View { postInteractionHandler, overrideMutedWords: true, lazyLoadImages: true, - }) + }), )} ` @@ -231,7 +231,7 @@ class PostThreadView extends View { return html`
${Array.from({ length: Math.min(numReplies, 10) }).map(() => - postSkeletonTemplate() + postSkeletonTemplate(), )}
`; @@ -251,7 +251,7 @@ class PostThreadView extends View { postInteractionHandler, replyContext: i === 0 ? "root" : "parent", hideMutedAccount: true, - }) + }), )} ${largePostTemplate({ post: postThread.post, @@ -274,7 +274,7 @@ class PostThreadView extends View { await handleClickReply( postThread.post, root, - currentUser + currentUser, ); }} > @@ -371,7 +371,7 @@ class PostThreadView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/profile.view.js b/src/js/views/profile.view.js index a6ce8af0..7296d65b 100644 --- a/src/js/views/profile.view.js +++ b/src/js/views/profile.view.js @@ -69,7 +69,7 @@ class ProfileView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); const feedScrollState = new Map(); @@ -140,7 +140,7 @@ class ProfileView extends View { } const isBlocked = !!profile.viewer?.blocking; const profileChatStatus = dataLayer.selectors.getProfileChatStatus( - profile.did + profile.did, ); const isCurrentUser = currentUser?.did === profile.did; const authorFeedsToShow = isCurrentUser @@ -164,7 +164,7 @@ class ProfileView extends View { } else { const convo = await dataLayer.declarative.ensureConvoForProfile( - profile.did + profile.did, ); window.router.go(`/messages/${convo.id}`); } @@ -201,14 +201,14 @@ class ProfileView extends View { @click=${() => handleTabClick(feedInfo)} > ${feedInfo.name} - ` + `, )} ${authorFeedsToShow.map((feedInfo) => { const authorFeed = dataLayer.selectors.getAuthorFeed( profileDid, - feedInfo.feedType + feedInfo.feedType, ); return html`
`, - root + root, ); } @@ -294,7 +294,7 @@ class ProfileView extends View { { reload, limit: AUTHOR_FEED_PAGE_SIZE + 1, - } + }, ); renderPage(); } @@ -306,7 +306,7 @@ class ProfileView extends View { feed.feedType, { limit: AUTHOR_FEED_PAGE_SIZE + 1, - } + }, ); } } @@ -318,7 +318,7 @@ class ProfileView extends View { } const facets = await getFacetsFromText( profile.description, - identityResolver + identityResolver, ); return { text: profile.description, facets }; } diff --git a/src/js/views/profileFollowers.view.js b/src/js/views/profileFollowers.view.js index 8a24f976..cae4db02 100644 --- a/src/js/views/profileFollowers.view.js +++ b/src/js/views/profileFollowers.view.js @@ -47,12 +47,12 @@ class ProfileFollowersView extends View { >
${followers.map((follower) => - profileListItemTemplate({ actor: follower }) + profileListItemTemplate({ actor: follower }), )}
${hasMore ? Array.from({ length: 5 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), ) : ""} `; @@ -61,7 +61,7 @@ class ProfileFollowersView extends View { function followersSkeletonTemplate() { return html`
${Array.from({ length: 10 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), )}
`; } @@ -84,7 +84,7 @@ class ProfileFollowersView extends View { dataLayer.selectors.getProfileFollowers(profileDid); const profile = dataLayer.selectors.getProfile(profileDid); const profileFollowersRequestStatus = dataLayer.requests.getStatus( - "loadProfileFollowers" + "loadProfileFollowers", ); const hasMore = profileFollowers?.cursor ? true : false; @@ -124,7 +124,7 @@ class ProfileFollowersView extends View { `, })}
`, - root + root, ); } @@ -136,7 +136,7 @@ class ProfileFollowersView extends View { profileDid, { cursor, - } + }, ); renderPage(); await loadingPromise; diff --git a/src/js/views/profileFollowing.view.js b/src/js/views/profileFollowing.view.js index 166b3048..071e9884 100644 --- a/src/js/views/profileFollowing.view.js +++ b/src/js/views/profileFollowing.view.js @@ -52,7 +52,7 @@ class ProfileFollowingView extends View { ${hasMore ? Array.from({ length: 5 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), ) : ""} `; @@ -61,7 +61,7 @@ class ProfileFollowingView extends View { function followingSkeletonTemplate() { return html`
${Array.from({ length: 10 }).map(() => - profileListItemSkeletonTemplate() + profileListItemSkeletonTemplate(), )}
`; } @@ -121,7 +121,7 @@ class ProfileFollowingView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/search.view.js b/src/js/views/search.view.js index 10122e59..73eec57e 100644 --- a/src/js/views/search.view.js +++ b/src/js/views/search.view.js @@ -43,14 +43,14 @@ class SearchView extends View { requests.push( dataLayer.requests.loadProfileSearch(normalizedQuery, { limit: 10, - }) + }), ); if (isAuthenticated) { requests.push( dataLayer.requests.loadPostSearch(normalizedQuery, { limit: 25, - }) + }), ); } @@ -70,7 +70,7 @@ class SearchView extends View { postComposerService, { renderFunc: () => renderPage(), - } + }, ); const handleSearchInput = debounce((value) => { @@ -130,13 +130,14 @@ class SearchView extends View { class=${classnames("loading-area", { loading: status.loading })} > ${postSearchResults.map( - (post) => html`
- ${smallPostTemplate({ - post, - isUserPost: currentUser?.did === post.author?.did, - postInteractionHandler, - })} -
` + (post) => + html`
+ ${smallPostTemplate({ + post, + isUserPost: currentUser?.did === post.author?.did, + postInteractionHandler, + })} +
`, )} `; } @@ -164,7 +165,7 @@ class SearchView extends View { })} > ${profileSearchResults.map((profile) => - profileResultTemplate({ profile }) + profileResultTemplate({ profile }), )} `; } @@ -291,7 +292,7 @@ class SearchView extends View { `, })} `, - root + root, ); } diff --git a/src/js/views/settings.view.js b/src/js/views/settings.view.js index 238c0b17..772a8836 100644 --- a/src/js/views/settings.view.js +++ b/src/js/views/settings.view.js @@ -63,7 +63,7 @@ class SettingsView extends View { >${chevronRightIconTemplate()} - ` + `, )}