Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

Polish touch chat composer shape and send control

Gusfb7bd9bb78b3
diff --git a/src/web/src/components/community/messages/FLUENT_SEND_FILLED_LICENSE.md b/src/web/src/components/community/messages/FLUENT_SEND_FILLED_LICENSE.md
deleted file mode 100644
index a87a8ee25..000000000
--- a/src/web/src/components/community/messages/FLUENT_SEND_FILLED_LICENSE.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Fluent Send 24 Filled attribution
-
-Vendored asset: `assets/Send/SVG/ic_fluent_send_24_filled.svg`
-
-Source: `https://github.com/microsoft/fluentui-system-icons/blob/4d685f77b2cb8f3f412a74ec8d920c8c91149528/assets/Send/SVG/ic_fluent_send_24_filled.svg`
-
-The SVG path is unchanged. Its fixed `#212121` fill is adapted to `currentColor` for theme support.
-
-MIT License
-
-Copyright (c) 2020 Microsoft Corporation
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/src/web/src/components/community/messages/composer-view.dom.test.ts b/src/web/src/components/community/messages/composer-view.dom.test.ts
index 4d45a42c3..9f8df603a 100644
--- a/src/web/src/components/community/messages/composer-view.dom.test.ts
+++ b/src/web/src/components/community/messages/composer-view.dom.test.ts
@@ -294,18 +294,16 @@ describe("ComposerView", () => {
expect(preview.textContent).toBe("Replying to Ada · Second target")
})
- it("renders the explicit send control after emoji with exact eligibility and styling", async () => {
+ it("renders only the send control on the right for touch chat", async () => {
const onSend = vi.fn()
const renderer = render(createElement(
ComposerView,
baseProps({ showSend: true, sendDisabled: true, onSend }),
))
const input = renderer.container.querySelector(`[data-testid="${tid.composerInput}"]`)!
- expect(input.className).toContain("pl-12 pr-24")
- expect(input.className).not.toContain("px-12")
- expect(
- renderer.container.querySelector("[data-emoji-picker] button")?.className,
- ).toContain("right-12")
+ expect(input.className).toContain("px-12")
+ expect(input.parentElement?.className).toContain("rounded-[24px]")
+ expect(renderer.container.querySelector("[data-emoji-picker]")).toBeNull()
const send = renderer.container.querySelector<HTMLButtonElement>(
`[data-testid="${tid.composerSend}"]`,
)!
@@ -314,26 +312,26 @@ describe("ComposerView", () => {
expect(send.disabled).toBe(true)
expect(send.className).toContain("right-2")
expect(send.className).toContain("size-8")
- expect(send.className).toContain("rounded-[8px]")
+ expect(send.className).toContain("rounded-full")
expect(send.className).toContain("disabled:bg-transparent")
expect(send.className).toContain("disabled:text-muted-foreground")
expect(send.className).toContain("enabled:hover:bg-primary/90")
expect(send.className).toContain("enabled:active:bg-primary/80")
- expect(send.className).not.toContain("rounded-full")
const icon = send.querySelector("svg")!
expect(icon.getAttribute("viewBox")).toBe("0 0 24 24")
expect(icon.getAttribute("aria-hidden")).toBe("true")
expect(icon.getAttribute("class")).toBe("size-5")
- const path = icon.querySelector("path")!
- expect(path.getAttribute("d")).toBe(
- "M12.8147 12.1969L5.28344 13.4521C5.10705 13.4815 4.95979 13.6029 4.89723 13.7704L2.29933 20.7278C2.05066 21.3673 2.72008 21.9773 3.33375 21.6705L21.3337 12.6705C21.8865 12.3941 21.8865 11.6052 21.3337 11.3288L3.33375 2.32885C2.72008 2.02201 2.05066 2.63206 2.29933 3.2715L4.89723 10.2289C4.95979 10.3964 5.10705 10.5178 5.28344 10.5472L12.8147 11.8024C12.9236 11.8205 12.9972 11.9236 12.9791 12.0325C12.965 12.1168 12.899 12.1829 12.8147 12.1969Z",
- )
- expect(path.getAttribute("fill")).toBe("currentColor")
+ expect(icon.getAttribute("fill")).toBe("none")
+ expect(icon.getAttribute("stroke")).toBe("currentColor")
+ expect(icon.getAttribute("stroke-width")).toBe("1.5")
+ expect(icon.getAttribute("stroke-linecap")).toBe("round")
+ expect(icon.getAttribute("stroke-linejoin")).toBe("round")
+ expect(icon.querySelectorAll("path")).toHaveLength(2)
expect(
[...renderer.container.querySelectorAll("button")]
.map((node) => node.getAttribute("aria-label"))
.filter(Boolean),
- ).toEqual(["Add file", "Emoji picker", "Send message"])
+ ).toEqual(["Add file", "Send message"])
renderer.rerender(createElement(
ComposerView,
@@ -356,41 +354,21 @@ describe("ComposerView", () => {
).toContain("px-12")
})
- it("pins the vendored Fluent asset to its exact MIT attribution", () => {
- const license = readFileSync(
- resolve(
- process.cwd(),
- process.cwd().endsWith("/src/web") ? "" : "src/web",
- "src/components/community/messages/FLUENT_SEND_FILLED_LICENSE.md",
- ),
- "utf8",
- )
- expect(license).toContain(
- "4d685f77b2cb8f3f412a74ec8d920c8c91149528/assets/Send/SVG/ic_fluent_send_24_filled.svg",
- )
- expect(license).toContain("Copyright (c) 2020 Microsoft Corporation")
- expect(license).toContain("MIT License")
- expect(license).toContain(
- "The above copyright notice and this permission notice shall be included",
- )
- })
-
it("keeps the exact ComposerSkeleton footprint", async () => {
const renderer = render(createElement(ComposerSkeleton))
const skeletons = renderer.container.querySelectorAll("[data-skeleton]")
- expect(skeletons).toHaveLength(4)
+ expect(skeletons).toHaveLength(3)
expect([...skeletons].map((node) => node.className)).toEqual([
"h-6 w-2/5 rounded",
"absolute left-2 bottom-2 size-8 rounded-full",
- "absolute right-12 bottom-2 size-8 rounded-full sm:right-2",
- "absolute right-2 bottom-2 size-8 rounded-full sm:hidden",
+ "absolute right-2 bottom-2 size-8 rounded-full",
])
expect(renderer.container.firstElementChild?.tagName).toBe("DIV")
expect(renderer.container.firstElementChild?.className).toBe(
"relative pl-[max(0.75rem,var(--app-safe-area-left))] pr-[max(0.75rem,var(--app-safe-area-right))] pb-[calc(0.75rem+var(--app-safe-area-bottom))] pt-0 sm:px-3 sm:pb-3",
)
expect(renderer.container.innerHTML).toContain(
- "relative rounded-xl bg-muted py-3 pl-12 pr-24 shadow-(--e1) ring-1 ring-border/40 sm:px-12",
+ "relative rounded-xl [@media(hover:none)]:rounded-[24px] bg-muted py-3 px-12 shadow-(--e1) ring-1 ring-border/40",
)
})
})
diff --git a/src/web/src/components/community/messages/composer-view.tsx b/src/web/src/components/community/messages/composer-view.tsx
index e088445f1..74f374208 100644
--- a/src/web/src/components/community/messages/composer-view.tsx
+++ b/src/web/src/components/community/messages/composer-view.tsx
@@ -29,7 +29,7 @@ import {
CommunityMentionList,
} from "./composer-suggestion-popups"
import type { ComposerReplyTarget } from "./composer-types"
-import { FluentSendFilledIcon } from "./fluent-send-filled-icon"
+import { SendStrokeRoundedIcon } from "./send-stroke-rounded-icon"
const COMPOSER_OUTER_CLASS =
"relative pl-[max(0.75rem,var(--app-safe-area-left))] pr-[max(0.75rem,var(--app-safe-area-right))] pb-[calc(0.75rem+var(--app-safe-area-bottom))] pt-0 sm:px-3 sm:pb-3"
@@ -91,6 +91,10 @@ export function ComposerView({
? stripInlineMarkup(replyingTo.text).replace(/\s+/g, " ").trim()
: null
+ const composerRadius = replyingTo || pendingFiles.length > 0
+ ? showSend ? "rounded-b-[24px]" : "rounded-b-xl"
+ : showSend ? "rounded-[24px]" : "rounded-xl"
+
return (
<div
className={
@@ -173,11 +177,11 @@ export function ComposerView({
isForumThreadBody
? "bg-transparent ring-0"
: "bg-muted shadow-(--e1) ring-1 ring-border/40 transition-shadow focus-within:ring-2 focus-within:ring-ring/60"
- } ${replyingTo || pendingFiles.length > 0 ? "rounded-b-xl" : "rounded-xl"}`}
+ } ${composerRadius}`}
>
{dragging && (
<div
- className={`pointer-events-none absolute inset-0 z-10 grid place-items-center border-2 border-dashed border-ring bg-background/80 ${replyingTo || pendingFiles.length > 0 ? "rounded-b-xl" : "rounded-xl"}`}
+ className={`pointer-events-none absolute inset-0 z-10 grid place-items-center border-2 border-dashed border-ring bg-background/80 ${composerRadius}`}
>
<p className="text-sm font-medium text-muted-foreground">
Drop files here
@@ -196,9 +200,7 @@ export function ComposerView({
className={`chat-composer relative py-3 ${
isForumThreadBody
? "px-2"
- : showSend
- ? "pl-12 pr-24"
- : "px-12"
+ : "px-12"
}`}
data-testid={tid.composerInput}
>
@@ -218,10 +220,10 @@ export function ComposerView({
<PlusCircle className="size-5" />
</button>
)}
- {!hideEmoji && (
+ {!hideEmoji && !showSend && (
<EmojiPickerPopover side="top" align="end" onPick={onEmojiPick}>
<button
- className={`absolute bottom-2 grid size-8 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground ${showSend ? "right-12" : "right-2"}`}
+ className="absolute right-2 bottom-2 grid size-8 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground"
aria-label="Emoji picker"
>
<Smile className="size-5" />
@@ -232,12 +234,12 @@ export function ComposerView({
<button
type="button"
data-testid={tid.composerSend}
- className="absolute right-2 bottom-2 grid size-8 place-items-center rounded-[8px] bg-primary text-primary-foreground enabled:hover:bg-primary/90 enabled:active:bg-primary/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-transparent disabled:text-muted-foreground"
+ className="absolute right-2 bottom-2 grid size-8 place-items-center rounded-full bg-primary text-primary-foreground enabled:hover:bg-primary/90 enabled:active:bg-primary/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-transparent disabled:text-muted-foreground"
aria-label="Send message"
disabled={sendDisabled}
onClick={onSend}
>
- <FluentSendFilledIcon className="size-5" />
+ <SendStrokeRoundedIcon className="size-5" />
</button>
)}
</div>
@@ -248,11 +250,10 @@ export function ComposerView({
export function ComposerSkeleton() {
return (
<div className={COMPOSER_OUTER_CLASS}>
- <div className="relative rounded-xl bg-muted py-3 pl-12 pr-24 shadow-(--e1) ring-1 ring-border/40 sm:px-12">
+ <div className="relative rounded-xl [@media(hover:none)]:rounded-[24px] bg-muted py-3 px-12 shadow-(--e1) ring-1 ring-border/40">
<Skeleton className="h-6 w-2/5 rounded" />
<Skeleton className="absolute left-2 bottom-2 size-8 rounded-full" />
- <Skeleton className="absolute right-12 bottom-2 size-8 rounded-full sm:right-2" />
- <Skeleton className="absolute right-2 bottom-2 size-8 rounded-full sm:hidden" />
+ <Skeleton className="absolute right-2 bottom-2 size-8 rounded-full" />
</div>
</div>
)
diff --git a/src/web/src/components/community/messages/fluent-send-filled-icon.tsx b/src/web/src/components/community/messages/fluent-send-filled-icon.tsx
deleted file mode 100644
index 7be9baf35..000000000
--- a/src/web/src/components/community/messages/fluent-send-filled-icon.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { SVGProps } from "react"
-
-export function FluentSendFilledIcon(props: SVGProps<SVGSVGElement>) {
- return (
- <svg
- viewBox="0 0 24 24"
- fill="none"
- aria-hidden="true"
- focusable="false"
- {...props}
- >
- <path
- d="M12.8147 12.1969L5.28344 13.4521C5.10705 13.4815 4.95979 13.6029 4.89723 13.7704L2.29933 20.7278C2.05066 21.3673 2.72008 21.9773 3.33375 21.6705L21.3337 12.6705C21.8865 12.3941 21.8865 11.6052 21.3337 11.3288L3.33375 2.32885C2.72008 2.02201 2.05066 2.63206 2.29933 3.2715L4.89723 10.2289C4.95979 10.3964 5.10705 10.5178 5.28344 10.5472L12.8147 11.8024C12.9236 11.8205 12.9972 11.9236 12.9791 12.0325C12.965 12.1168 12.899 12.1829 12.8147 12.1969Z"
- fill="currentColor"
- />
- </svg>
- )
-}
diff --git a/src/web/src/components/community/messages/send-stroke-rounded-icon.tsx b/src/web/src/components/community/messages/send-stroke-rounded-icon.tsx
new file mode 100644
index 000000000..e37db3d65
--- /dev/null
+++ b/src/web/src/components/community/messages/send-stroke-rounded-icon.tsx
@@ -0,0 +1,20 @@
+import type { SVGProps } from "react"
+
+export function SendStrokeRoundedIcon(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ focusable="false"
+ {...props}
+ >
+ <path d="M8.87038 6.13264L14.7327 4.19538C18.033 3.10476 19.6831 2.55945 20.5579 3.43426C21.4327 4.30907 20.8874 5.95922 19.7968 9.25953L17.8595 15.1218C16.6236 18.8619 16.0056 20.7319 14.8796 20.9603C14.6411 21.0087 14.3955 21.0129 14.1549 20.9727C13.019 20.7832 12.3132 18.9359 10.9016 15.2413C10.6328 14.5376 10.4983 14.1858 10.2574 13.9127C10.2018 13.8497 10.1424 13.7903 10.0795 13.7348C9.80638 13.4938 9.45455 13.3594 8.75089 13.0906C5.05627 11.679 3.20896 10.9732 3.01945 9.83727C2.97931 9.59669 2.98353 9.35108 3.03189 9.11259C3.26025 7.98657 5.13029 7.36859 8.87038 6.13264Z" />
+ <path d="M12.8008 11.1865L15.498 8.48926" />
+ </svg>
+ )
+}