Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(channel): fix opacity on scroll to bottom btn (#6464)

Seamus7df9dacd53c3
diff --git a/apps/web/src/features/block-agent/component/Transcript.test.tsx b/apps/web/src/features/block-agent/component/Transcript.test.tsx
index 0cd5e1a72d..3169f5ee45 100644
--- a/apps/web/src/features/block-agent/component/Transcript.test.tsx
+++ b/apps/web/src/features/block-agent/component/Transcript.test.tsx
@@ -26,7 +26,10 @@ vi.mock('@components/app/mobile/float-regions/float-region-state', () => ({
vi.mock('@core/mobile/isTouchDevice', () => ({
isTouchDevice: () => session.touch,
}));
-vi.mock('@ui', () => ({ cn: (...classes: string[]) => classes.join(' ') }));
+vi.mock('@ui', async () => ({
+ cn: (...classes: string[]) => classes.join(' '),
+ ...(await import('@ui/components/Layer')),
+}));
vi.mock('./AgentMessage', () => ({
Message: (props: { message: FoldedMessage }) => (
<span data-message={`${props.message.turn}:${props.message.author.kind}`}>
diff --git a/apps/web/src/features/channel/Channel/ScrollToBottomOverlay.tsx b/apps/web/src/features/channel/Channel/ScrollToBottomOverlay.tsx
index e792b420f7..13e63fa1a6 100644
--- a/apps/web/src/features/channel/Channel/ScrollToBottomOverlay.tsx
+++ b/apps/web/src/features/channel/Channel/ScrollToBottomOverlay.tsx
@@ -1,4 +1,4 @@
-import { cn } from '@ui';
+import { cn, Layer } from '@ui';
import { type Accessor, Show } from 'solid-js';
import type { ThreadListScrollState } from './ThreadList';
@@ -23,18 +23,20 @@ type ScrollToBottomOverlayProps = {
export function ScrollToBottomOverlay(props: ScrollToBottomOverlayProps) {
return (
<Show when={shouldShowScrollToBottomButton(props.scrollState())}>
- <button
- type="button"
- class={cn(
- 'absolute top-4 left-1/2 -translate-x-1/2 z-10 px-3 py-1.5 text-xs bg-surface border border-edge-muted hover:bg-hover hover-transition-bg',
- props.class
- )}
- onClick={() => {
- props.onScrollToBottom();
- }}
- >
- Scroll to bottom
- </button>
+ <Layer depth={3}>
+ <button
+ type="button"
+ class={cn(
+ 'absolute top-4 left-1/2 -translate-x-1/2 z-10 rounded-full px-3 py-1.5 text-xs bg-surface border border-edge-muted shadow-lg not-touch:hover:overlay-hover not-touch:active:overlay-active',
+ props.class
+ )}
+ onClick={() => {
+ props.onScrollToBottom();
+ }}
+ >
+ Scroll to bottom
+ </button>
+ </Layer>
</Show>
);
}
diff --git a/apps/web/src/features/channel/Channel/tests/scroll-to-bottom-overlay.test.ts b/apps/web/src/features/channel/Channel/tests/scroll-to-bottom-overlay.test.ts
deleted file mode 100644
index bc3b585104..0000000000
--- a/apps/web/src/features/channel/Channel/tests/scroll-to-bottom-overlay.test.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import { shouldShowScrollToBottomButton } from '../ScrollToBottomOverlay';
-
-describe('shouldShowScrollToBottomButton', () => {
- it('shows only when initial scroll is done, scrolled away, and user scrolls down', () => {
- expect(
- shouldShowScrollToBottomButton({
- didInitialScroll: true,
- isNearBottom: false,
- isScrollingDown: true,
- distanceFromTop: 1200,
- distanceFromBottom: 1800,
- viewportSize: 900,
- })
- ).toBe(true);
- });
-
- it('hides when near bottom', () => {
- expect(
- shouldShowScrollToBottomButton({
- didInitialScroll: true,
- isNearBottom: true,
- isScrollingDown: true,
- distanceFromTop: 1200,
- distanceFromBottom: 10,
- viewportSize: 900,
- })
- ).toBe(false);
- });
-
- it('hides when not scrolling down', () => {
- expect(
- shouldShowScrollToBottomButton({
- didInitialScroll: true,
- isNearBottom: false,
- isScrollingDown: false,
- distanceFromTop: 1200,
- distanceFromBottom: 1800,
- viewportSize: 900,
- })
- ).toBe(false);
- });
-
- it('hides when not past one page from bottom', () => {
- expect(
- shouldShowScrollToBottomButton({
- didInitialScroll: true,
- isNearBottom: false,
- isScrollingDown: true,
- distanceFromTop: 200,
- distanceFromBottom: 300,
- viewportSize: 900,
- })
- ).toBe(false);
- });
-});