From f0917473809d7b297be27a04bd9367e2ac0b43fc Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 8 Sep 2023 20:27:00 -0700 Subject: [PATCH] At-mention popups for chat --- package-lock.json | 66 ++++++++++++++++ package.json | 2 + public/static/css/bulma-prefers-dark.css | 4 + public/static/css/chat.css | 3 + src/App.vue | 99 +++++++++++++++++------- 5 files changed, 147 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e81dd1..7b2bf4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,8 +8,10 @@ "name": "barertc", "version": "0.0.0", "dependencies": { + "floating-vue": "^2.0.0-beta.24", "interactjs": "^1.10.18", "vue": "^3.3.4", + "vue-mention": "^2.0.0-alpha.3", "vue3-emoji-picker": "^1.1.7" }, "devDependencies": { @@ -447,6 +449,27 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz", + "integrity": "sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==", + "dependencies": { + "@floating-ui/utils": "^0.1.1" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.1.1.tgz", + "integrity": "sha512-TpIO93+DIujg3g7SykEAGZMDtbJRrmnYRCNYSjJlvIbGhBjRSNTLVbNeDQBrzy9qDgUbiWdc7KA0uZHZ2tJmiw==", + "dependencies": { + "@floating-ui/core": "^1.1.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz", + "integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw==" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -1144,6 +1167,24 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "node_modules/floating-vue": { + "version": "2.0.0-beta.24", + "resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.24.tgz", + "integrity": "sha512-URSzP6YXaF4u1oZ9XGL8Sn8puuM7ivp5jkOUrpy5Q1mfo9BfGppJOn+ierTmsSUfJEeHBae8KT7r5DeI3vQIEw==", + "dependencies": { + "@floating-ui/dom": "~1.1.1", + "vue-resize": "^2.0.0-alpha.1" + }, + "peerDependencies": { + "@nuxt/kit": "^3.2.0", + "vue": "^3.2.0" + }, + "peerDependenciesMeta": { + "@nuxt/kit": { + "optional": true + } + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1817,6 +1858,11 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/textarea-caret": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/textarea-caret/-/textarea-caret-3.1.0.tgz", + "integrity": "sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -1947,6 +1993,26 @@ "eslint": ">=6.0.0" } }, + "node_modules/vue-mention": { + "version": "2.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/vue-mention/-/vue-mention-2.0.0-alpha.3.tgz", + "integrity": "sha512-NtM6Z6UpqHByKJPyiy2SrBy3K7wyi/6bvXltaRfWcSQdNwW3YrWzrr1M7lYB4NoWRhDFuk+4X1GpY8HH06g+XQ==", + "dependencies": { + "textarea-caret": "^3.1.0" + }, + "peerDependencies": { + "floating-vue": "^2.0.0-beta.1", + "vue": "^3.2" + } + }, + "node_modules/vue-resize": { + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-2.0.0-alpha.1.tgz", + "integrity": "sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg==", + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue3-emoji-picker": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/vue3-emoji-picker/-/vue3-emoji-picker-1.1.7.tgz", diff --git a/package.json b/package.json index b14d9f1..8fd2bb8 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore" }, "dependencies": { + "floating-vue": "^2.0.0-beta.24", "interactjs": "^1.10.18", "vue": "^3.3.4", + "vue-mention": "^2.0.0-alpha.3", "vue3-emoji-picker": "^1.1.7" }, "devDependencies": { diff --git a/public/static/css/bulma-prefers-dark.css b/public/static/css/bulma-prefers-dark.css index 9d7e1e9..3f58272 100644 --- a/public/static/css/bulma-prefers-dark.css +++ b/public/static/css/bulma-prefers-dark.css @@ -19,6 +19,10 @@ background-color: rgba(15, 129, 204, 0.25) !important; } + .has-background-at-mention { + background-color: rgb(50, 50, 0); +} + .tag.is-success { background-color: #15241d !important; color: #85dfb6 !important; diff --git a/public/static/css/chat.css b/public/static/css/chat.css index 6462e6d..952840c 100644 --- a/public/static/css/chat.css +++ b/public/static/css/chat.css @@ -22,6 +22,9 @@ body { .has-background-dm { background-color: #ffefff; } +.has-background-at-mention { + background-color: rgb(250, 250, 192); +} /* Truncate long text, e.g. usernames in the who list */ .truncate-text-line { diff --git a/src/App.vue b/src/App.vue index 96fe2d4..671b80c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,9 @@