FEATURE: resizeable chat drawer (#20160)

This commit implements a requested feature: resizing the chat drawer.

The user can now adjust the drawer size to their liking, and the new size will be stored in localstorage so that it persists across refreshes. In addition to this feature, a bug was fixed where the --composer-right margin was not being correctly computed. This bug could have resulted in incorrectly positioned drawer when the composer was expanded.

Note that it includes support for RTL.
This commit is contained in:
Joffrey JAFFEUX
2023-02-03 15:11:12 +01:00
committed by GitHub
parent 66b015b472
commit d5024d96f1
8 changed files with 294 additions and 20 deletions

View File

@@ -0,0 +1,22 @@
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
module("Discourse Chat | Unit | Service | chat-drawer-size", function (hooks) {
hooks.beforeEach(function () {
this.subject = getOwner(this).lookup("service:chat-drawer-size");
});
test("get size (with default)", async function (assert) {
assert.deepEqual(this.subject.size, { width: 400, height: 530 });
});
test("set size", async function (assert) {
this.subject.size = { width: 400, height: 500 };
assert.deepEqual(this.subject.size, { width: 400, height: 500 });
});
test("min size", async function (assert) {
this.subject.size = { width: 100, height: 100 };
assert.deepEqual(this.subject.size, { width: 250, height: 300 });
});
});