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.

feat: compose email on mobile (#1524)

Peter Chinman19b8bd6d5995
diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsx
index 3470eed194..f7e38ffa8e 100644
--- a/js/app/packages/app/component/mobile/MobileDock.tsx
+++ b/js/app/packages/app/component/mobile/MobileDock.tsx
@@ -5,6 +5,7 @@ import WidePlus from '@macro-icons/wide/plus.svg';
import WideTask from '@macro-icons/wide/task.svg';
import { impactFeedback } from '@tauri-apps/plugin-haptics';
import { batch, type Component, type JSX } from 'solid-js';
+import { cn } from '@ui/utils/classname';
import { setCreateMenuOpen } from '../Launcher';
import { useSplitPanelOrThrow } from '../split-layout/layoutUtils';
import { useSoup } from '@app/component/next-soup/soup-context';
@@ -25,11 +26,10 @@ function MobileDockButton(props: MobileDockButtonProps) {
impactFeedback('light');
props.onClick();
}}
- class="flex flex-col items-center justify-center w-[20%] py-4"
- classList={{
- 'text-ink-muted': !props.active,
- 'text-ink bg-panel': props.active,
- }}
+ class={cn(
+ 'flex flex-col items-center justify-center w-[20%] pt-3',
+ props.active && 'text-accent'
+ )}
>
<props.icon class="w-6 h-6" />
<span class="text-xs">{props.label}</span>
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-toolbar.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-toolbar.tsx
index 8ec1d45d2e..d726b90314 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-toolbar.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-toolbar.tsx
@@ -1,5 +1,4 @@
import SearchIcon from '@macro-icons/macro-magnifying-glass.svg';
-import IconGear from '@macro-icons/macro-gear.svg';
import BackspaceIcon from '@icon/regular/backspace.svg?component-solid';
import XIcon from '@icon/regular/x.svg?component-solid';
import PreviewIcon from '@macro-icons/wide/preview.svg';
@@ -11,10 +10,8 @@ import {
SplitHeaderLeft,
SplitHeaderRight,
} from '@app/component/split-layout/components/SplitHeader';
-import { useSplitLayout } from '@app/component/split-layout/layout';
import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
-import { useSettingsState } from '@core/constant/SettingsState';
-import { TOKENS } from '@core/hotkey/tokens';
+
import {
For,
Show,
@@ -43,6 +40,7 @@ import { IS_MAC } from '@core/constant/isMac';
import type { SystemSortOption } from '@app/component/next-soup/soup-view/sort-options';
import { Dynamic } from 'solid-js/web';
import { SortDropdown } from '@app/component/next-soup/soup-view/sort-dropdown';
+import { SettingsButton } from '@app/component/settings/SettingsButton';
import {
TaskStatusDropdown,
TaskAssigneeDropdown,
@@ -89,7 +87,7 @@ export const SoupToolbar = () => {
<div
ref={setScrollContainerRef}
- class="flex items-center h-full w-full overflow-x-auto scrollbar-hidden overscroll-none text-xs touch:mobile-width:text-sm"
+ class="flex items-center h-full w-full overflow-x-auto scrollbar-hidden overscroll-none text-xs mobile:text-sm"
>
<SoupFilters />
<SearchBar />
@@ -351,7 +349,7 @@ const SoupFilters = () => {
<Tooltip tooltip={<LabelAndHotKey label="Unread Only" shortcut="u" />}>
<button
type="button"
- class="flex items-center gap-1 h-[22px] touch:mobile-width:h-9 pr-2.5 pl-1 active:bg-accent active:text-panel rounded-full"
+ class="flex items-center gap-1 h-[22px] mobile:h-9 pr-2.5 pl-1 active:bg-accent active:text-panel rounded-full"
classList={{
'bg-accent text-panel': soup.filters.isActive('unread'),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -417,7 +415,7 @@ const SoupFilters = () => {
>
<button
type="button"
- class="flex items-center gap-1.5 h-[22px] touch:mobile-width:h-9 px-2.5 active:bg-accent active:text-panel rounded-full"
+ class="flex items-center gap-1.5 h-[22px] mobile:h-9 px-2.5 active:bg-accent active:text-panel rounded-full"
classList={{
'bg-accent text-panel': !!soup.previewEntity(),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -442,7 +440,7 @@ const SoupFilters = () => {
soup.sort.setAll([value]);
}}
/>
- <div class="touch:mobile-width:-order-1">
+ <div class="mobile:-order-1">
<FilterDivider />
</div>
{/* Filter search bar */}
@@ -450,40 +448,6 @@ const SoupFilters = () => {
);
};
-function SettingsButton() {
- const { settingsOpen, toggleSettings } = useSettingsState();
- const { getSplitCount } = useSplitLayout();
-
- // Hide settings button when there are multiple splits
- const isSingleSplit = () => getSplitCount() <= 1;
-
- return (
- <Show when={isSingleSplit()}>
- <Tooltip
- tooltip={
- <LabelAndHotKey
- label={settingsOpen() ? 'Close Settings' : 'Open Settings'}
- hotkeyToken={TOKENS.global.toggleSettings}
- />
- }
- >
- <button
- type="button"
- class="relative flex items-center justify-center size-[22px] rounded-full active:bg-accent active:text-panel"
- classList={{
- 'bg-hover text-ink': settingsOpen(),
- 'text-ink-muted hover:text-accent hover:bg-accent/20':
- !settingsOpen(),
- }}
- onClick={() => toggleSettings()}
- >
- <IconGear class="size-4.5" />
- </button>
- </Tooltip>
- </Show>
- );
-}
-
const ScrollIndicators = (props: { scrollRef: HTMLElement | undefined }) => {
const [leftOpacity, setLeftOpacity] = createSignal(0);
const [rightOpacity, setRightOpacity] = createSignal(0);
@@ -572,14 +536,14 @@ const SearchBar = () => {
};
return (
- <div class="flex items-center grow min-w-0 touch:mobile-width:-order-2">
+ <div class="flex items-center grow min-w-0 mobile:-order-2">
<Tooltip
class="w-fit"
placement="bottom-start"
tooltip={<LabelAndHotKey label="Filter" shortcut="⌘F" />}
>
<div
- class="relative flex items-center gap-1.5 h-[22px] touch:mobile-width:h-9 px-2.5 rounded-full touch:mobile-width:min-w-35"
+ class="relative flex items-center gap-1.5 h-[22px] mobile:h-9 px-2.5 rounded-full mobile:min-w-35"
classList={{
'bg-accent text-panel': !!searchText() && !searchFocused(),
'text-ink-muted hover:text-accent hover:bg-accent/20':
@@ -707,7 +671,7 @@ export const FilterButton: Component<FilterButtonProps> = (props) => {
>
<button
type="button"
- class={`flex items-center gap-1 h-[22px] touch:mobile-width:h-9 ${props.paddingClass ?? 'pl-2 pr-2.5'} active:bg-accent active:text-panel rounded-full`}
+ class={`flex items-center gap-1 h-[22px] mobile:h-9 ${props.paddingClass ?? 'pl-2 pr-2.5'} active:bg-accent active:text-panel rounded-full`}
classList={{
'bg-accent text-panel': isActive(),
'text-ink-muted hover:text-accent hover:bg-accent/20': !isActive(),
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index 404b228baa..80c63914a1 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -6,12 +6,12 @@ import ThemeList from '../../../block-theme/components/ThemeList';
export function Appearance() {
return (
<div
- class="absolute inset-0 overflow-hidden bg-edge-muted @container gap-px grid grid-cols-1 grid-rows-[min-content_min-content_1fr_1fr] @[650px]:grid-cols-2 @[650px]:grid-rows-[min-content_min-content_1fr] touch:mobile-width:flex"
+ class="absolute inset-0 overflow-hidden bg-edge-muted @container gap-px grid grid-cols-1 grid-rows-[min-content_min-content_1fr_1fr] @[650px]:grid-cols-2 @[650px]:grid-rows-[min-content_min-content_1fr] mobile:flex"
>
- <div class="touch:mobile-width:hidden @[650px]:col-span-2"><ThemeTools /></div>
- <div class="touch:mobile-width:hidden @[650px]:col-span-2"><ThemeEditorBasic /></div>
- <div class="touch:mobile-width:flex-1 overflow-hidden"><ThemeList/></div>
- <div class="touch:mobile-width:hidden overflow-hidden"><ThemeEditorAdvanced /></div>
+ <div class="mobile:hidden @[650px]:col-span-2"><ThemeTools /></div>
+ <div class="mobile:hidden @[650px]:col-span-2"><ThemeEditorBasic /></div>
+ <div class="mobile:flex-1 overflow-hidden"><ThemeList/></div>
+ <div class="mobile:hidden overflow-hidden"><ThemeEditorAdvanced /></div>
</div>
);
}
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index 5acb9069ca..d39f9faf5b 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -18,11 +18,27 @@ import { Shortcuts } from './Shortcuts';
import { isMobile } from '@core/mobile/isMobile';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import type { ValidHotkey } from '@core/hotkey/types';
+import { SplitHeaderRight } from '../split-layout/components/SplitHeader';
+import { SettingsButton } from './SettingsButton';
const SCROLL_THRESHOLD = 10;
const { track, TrackingEvents } = withAnalytics();
+/**
+ * Wrapper specifically for in-Split version of Settings Panel used on Mobile. Includes the correct Header button.
+ */
+export function SettingsPanelComponentWrapper() {
+ return (
+ <>
+ <SplitHeaderRight>
+ <SettingsButton />
+ </SplitHeaderRight>
+ <SettingsPanel />
+ </>
+ )
+}
+
type SettingsPanelProps = {
hide?: boolean;
};
diff --git a/js/app/packages/app/component/settings/SettingsButton.tsx b/js/app/packages/app/component/settings/SettingsButton.tsx
new file mode 100644
index 0000000000..71bc0803f1
--- /dev/null
+++ b/js/app/packages/app/component/settings/SettingsButton.tsx
@@ -0,0 +1,37 @@
+import { useSettingsState } from "@core/constant/SettingsState";
+import { useSplitLayout } from "../split-layout/layout";
+import { Show } from "solid-js";
+import { Button } from "@ui/components/Button";
+import { cn } from "@ui/utils/classname";
+import { LabelAndHotKey } from "@core/component/Tooltip";
+import { TOKENS } from "@core/hotkey/tokens";
+import IconGear from '@macro-icons/macro-gear.svg';
+
+
+export function SettingsButton() {
+ const { settingsOpen, toggleSettings } = useSettingsState();
+ const { getSplitCount } = useSplitLayout();
+
+ // Hide settings button when there are multiple splits
+ const isSingleSplit = () => getSplitCount() <= 1;
+
+ return (
+ <Show when={isSingleSplit()}>
+ <Button
+ suppressInteractionStyling
+ class="px-0"
+ tooltip={
+ <LabelAndHotKey
+ label={settingsOpen() ? 'Close Settings' : 'Open Settings'}
+ hotkeyToken={TOKENS.global.toggleSettings}
+ />
+ }
+ onClick={() => toggleSettings()}
+ >
+ <IconGear class={cn("size-4.5 box-content rounded-full hover:bg-transparent p-1", settingsOpen() && 'bg-accent/20 text-accent hover:text-ink hover:bg-hover',
+ !settingsOpen() &&
+ 'hover:text-accent hover:bg-accent/20')} />
+ </Button>
+ </Show>
+ );
+}
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsx
index 6831c232cf..dd974d506f 100644
--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx
+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx
@@ -5,7 +5,7 @@ import { DEV_MODE_ENV, LOCAL_ONLY } from '@core/constant/featureFlags';
import type { ViewId } from '@core/types/view';
import { type JSXElement, lazy } from 'solid-js';
import { EmailCompose } from '../../../block-email/component/Compose';
-import { SettingsPanel } from '../settings/Settings';
+import { SettingsPanelComponentWrapper } from '../settings/Settings';
import NotificationRoute from '@notifications/components/NotificationRoute';
import { SoupView } from '@app/component/next-soup/soup-view/soup-view';
@@ -64,7 +64,7 @@ registerComponent(
'import-linear',
lazy(() => import('@app/component/import-linear/ImportLinear'))
);
-registerComponent('settings', () => <SettingsPanel />);
+registerComponent('settings', () => <SettingsPanelComponentWrapper />);
registerComponent('notification', () => <NotificationRoute />);
if (LOCAL_ONLY) {
diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
index 0cceb90306..674300efcf 100644
--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
@@ -13,7 +13,6 @@ import CaretLeft from '@icon/regular/caret-left.svg';
import CaretRight from '@icon/regular/caret-right.svg';
import SplitIcon from '@icon/regular/square-half.svg';
import CloseIcon from '@icon/regular/x.svg';
-import IconGear from '@macro-icons/macro-gear.svg';
import { Button } from '@ui/components/Button';
import {
createEffect,
@@ -27,7 +26,7 @@ import {
import { Portal } from 'solid-js/web';
import { SplitLayoutContext, SplitPanelContext } from '../context';
import { canSpotlight } from '../utils/canSpotlight';
-import { useSettingsState } from '@core/constant/SettingsState';
+import { cn } from '@ui/utils/classname';
function SplitBackButton() {
const context = useContext(SplitPanelContext);
@@ -51,7 +50,6 @@ function SplitForwardButton() {
if (!context) return '';
return (
<Button
- class="p-1"
tooltip={
<LabelAndHotKey
label="Go Forward"
@@ -60,6 +58,10 @@ function SplitForwardButton() {
}
disabled={!context.handle.canGoForward()}
onClick={context.handle.goForward}
+ class={cn(
+ 'p-1',
+ isMobile() && !context.handle.canGoForward() && 'hidden'
+ )}
>
<CaretRight class="h-4" />
</Button>
@@ -160,7 +162,7 @@ function _SplitPreviewToggle() {
function _SplitControlButtons() {
return (
<div class="flex flex-row items-center px-2 h-full shrink-0">
- <div class="touch:mobile-width:hidden">
+ <div class="mobile:hidden">
<SplitCloseButton />
</div>
<SplitBackButton />
@@ -169,28 +171,6 @@ function _SplitControlButtons() {
);
}
-function SplitSettingsButton() {
- const { settingsOpen, toggleSettings } = useSettingsState();
-
- return (
- <Button
- class="p-1"
- classList={{
- 'bg-accent/20 text-accent': settingsOpen(),
- }}
- tooltip={
- <LabelAndHotKey
- label={settingsOpen() ? 'Close Settings' : 'Open Settings'}
- hotkeyToken={TOKENS.global.toggleSettings}
- />
- }
- onClick={toggleSettings}
- >
- <IconGear class="h-4" />
- </Button>
- );
-}
-
export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
const ctx = useContext(SplitPanelContext);
if (!ctx)
@@ -203,8 +183,8 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
ref={props.ref}
>
<div class="absolute inset-0 flex justify-start items-center bg-panel">
- <div class="z-2 relative flex items-center bg-panel pl-2 h-full">
- <div class="touch:mobile-width:hidden">
+ <div class="z-2 relative flex items-center bg-panel pl-2 mobile:pl-0 h-full">
+ <div class="mobile:hidden">
<SplitCloseButton />
</div>
<SplitBackButton />
@@ -217,23 +197,18 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
}}
/>
- <Show when={!isMobile()}>
- <div
- class="min-w-4 h-full shrink-0"
- ref={(ref) => {
- ctx.layoutRefs.headerRight = ref;
- }}
- />
+ <div
+ class="min-w-4 h-full shrink-0"
+ ref={(ref) => {
+ ctx.layoutRefs.headerRight = ref;
+ }}
+ />
+ <Show when={!isTouchDevice()}>
<div class="z-2 relative flex items-center bg-panel pr-2 h-full">
<EntityNavigationIndicator />
<SplitSpotlightButton />
</div>
</Show>
- <Show when={isTouchDevice()}>
- <div class="z-2 relative flex items-center bg-panel pr-2 h-full">
- <SplitSettingsButton />
- </div>
- </Show>
</div>
</div>
);
diff --git a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx b/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
index 3a19ebb24d..5c2a68b7ef 100644
--- a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
@@ -95,7 +95,7 @@ export function SplitTabs(props: {
});
return (
- <div class="touch:mobile-width:hidden relative isolate h-full shrink grow-2 @container-normal">
+ <div class="mobile:hidden relative isolate h-full shrink grow-2 @container-normal">
{/* Left clip boundary indicator */}
<div
class="absolute pointer-events-none left-0 top-px bottom-px w-3 z-2 pattern-diagonal-4 pattern-edge mask-r-from-0% border-l border-edge-muted transition-opacity duration-150"
diff --git a/js/app/packages/app/component/useAppSquishHandlers.ts b/js/app/packages/app/component/useAppSquishHandlers.ts
index 00a14a339d..9689abef62 100644
--- a/js/app/packages/app/component/useAppSquishHandlers.ts
+++ b/js/app/packages/app/component/useAppSquishHandlers.ts
@@ -9,7 +9,7 @@ import { onCleanup, onMount } from 'solid-js';
*/
export function useAppSquishHandlers() {
if (isIOS) {
- // We are tracking viewport height, and using that to set a CSS variable and the viewport offset,
+ // We are tracking viewport height, and using that to set a CSS variable,
// so that we can properly constrain the viewport-height for mobile in response to changes such as
// the virtual keyboard appearing.
let previousViewportHeight = window.visualViewport?.height || 0;
diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.css
index 951e82746b..cf1785a9a1 100644
--- a/js/app/packages/app/index.css
+++ b/js/app/packages/app/index.css
@@ -245,6 +245,14 @@
@custom-variant ios (&:where(.tauri-ios *));
@custom-variant touch (&:where(html[data-touch-device="true"] *));
@custom-variant mobile-width (@media (max-width: 639px));
+/* `mobile:` is equivalent to `touch:mobile-width:` */
+@custom-variant mobile {
+ &:where(html[data-touch-device="true"] *) {
+ @media (max-width: 639px) {
+ @slot;
+ }
+ }
+}
:root {
--color-focus: var(--color-accent);
@@ -509,6 +517,9 @@
--font-serif: "Georgia", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
--text-xxs: 0.625rem;
+
+ /* Custom container size */
+ --container-small: 40rem;
/* Colors */
--color-macro-accent: #00c4ff;
diff --git a/js/app/packages/block-channel/component/BaseInput.tsx b/js/app/packages/block-channel/component/BaseInput.tsx
index b38300edc5..e132c6f864 100644
--- a/js/app/packages/block-channel/component/BaseInput.tsx
+++ b/js/app/packages/block-channel/component/BaseInput.tsx
@@ -496,7 +496,7 @@ export function BaseInput(props: BaseInputProps) {
/>
</Show>
<div
- class="transition-all duration-150 px-3 pt-2 pb-2 @min-[40rem]:pb-4 overflow-y-auto placeholder:text-ink-placeholder text-ink w-full text-sm touch:mobile-width:text-base"
+ class="transition-all duration-150 px-3 pt-2 pb-2 @min-[40rem]:pb-4 overflow-y-auto placeholder:text-ink-placeholder text-ink w-full text-sm mobile:text-base"
onClick={(e) => {
e.stopPropagation();
focusMarkdownArea();
diff --git a/js/app/packages/block-email/component/CollapsedMessage.tsx b/js/app/packages/block-email/component/CollapsedMessage.tsx
index 084e534c25..daf0a27bd6 100644
--- a/js/app/packages/block-email/component/CollapsedMessage.tsx
+++ b/js/app/packages/block-email/component/CollapsedMessage.tsx
@@ -115,7 +115,7 @@ export function CollapsedMessage(props: CollapsedMessageProps) {
<span class="text-ink truncate">{snippet()}</span>
</div>
{/* Date */}
- <div class="text-xs touch:mobile-width:text-sm text-ink shrink-0 ml-4 pr-2">
+ <div class="text-xs text-ink shrink-0 ml-4 pr-2">
{props.message.internal_date_ts &&
formatShortDate(props.message.internal_date_ts)}
</div>
diff --git a/js/app/packages/block-email/component/Compose.tsx b/js/app/packages/block-email/component/Compose.tsx
index 4d80d64c07..ad22dba283 100644
--- a/js/app/packages/block-email/component/Compose.tsx
+++ b/js/app/packages/block-email/component/Compose.tsx
@@ -31,6 +31,7 @@ import {
import {
createMemo,
createSignal,
+ type JSX,
Match,
onMount,
Show,
@@ -69,6 +70,8 @@ import { useMaybeEmailContext } from '@block-email/component/EmailContext';
import { decodeBase64Utf8 } from '@block-email/util/decodeBase64';
import { stickyGate } from '@core/util/debounce';
import { invalidateSoupEntity } from '@queries/soup/cache';
+import { WrapUnlessMobile } from '@core/mobile/WrapUnlessMobile';
+import { isMobile } from '@core/mobile/isMobile';
const DRAFT_DEBOUNCE_MS = 1000;
@@ -98,6 +101,17 @@ type EmailComposeProps = {
draftID?: string;
};
+function ComposeFieldRow(props: { label: string; children: JSX.Element }) {
+ return (
+ <div class="flex items-baseline gap-2 border-b border-edge-muted focus-within:border-accent">
+ <div class="text-sm w-4 shrink-0 text-ink-placeholder/70">
+ {props.label}
+ </div>
+ <div class="flex-1">{props.children}</div>
+ </div>
+ );
+}
+
export function EmailCompose(props: EmailComposeProps) {
const hasPaidAccess = useHasPaidAccess();
const { showPaywall } = usePaywallState();
@@ -113,6 +127,8 @@ export function EmailCompose(props: EmailComposeProps) {
messageInput: undefined,
});
+ let mobileScrollRef: HTMLDivElement | undefined;
+
const registerRef = (name: keyof EmailComposeElementRefs) => {
return (el: HTMLElement) => {
setRefs((p) => ({ ...p, [name]: el }));
@@ -322,6 +338,9 @@ export function EmailCompose(props: EmailComposeProps) {
const [showCc, setShowCc] = createSignal(false);
const [showBcc, setShowBcc] = createSignal(false);
+ const isCcVisible = () => showCc() || form.recipients().cc.length > 0;
+ const isBccVisible = () => showBcc() || form.recipients().bcc.length > 0;
+
onMount(() => {
const container = refs().containerRef;
if (!container) return;
@@ -657,18 +676,27 @@ export function EmailCompose(props: EmailComposeProps) {
return (
<>
- <SplitHeaderLeft>
- <StaticSplitLabel
- label={form.subject() || previewName()}
- iconType="email"
- badges={[
- <SplitHeaderBadge text="draft" tooltip="This is a Draft Email" />,
- ]}
- />
- </SplitHeaderLeft>
+ <Show when={!isMobile()}>
+ <SplitHeaderLeft>
+ <StaticSplitLabel
+ label={form.subject() || previewName()}
+ iconType={isMobile() ? undefined : 'email'}
+ badges={
+ isMobile()
+ ? []
+ : [
+ <SplitHeaderBadge
+ text="draft"
+ tooltip="This is a Draft Email"
+ />,
+ ]
+ }
+ />
+ </SplitHeaderLeft>
+ </Show>
<div
ref={registerRef('containerRef')}
- class="relative flex flex-col w-full h-full panel min-h-0 overflow-hidden"
+ class="relative flex flex-col w-full h-full min-h-0 overflow-hidden text-sm"
>
<Switch>
<Match when={hasLinkError()}>
@@ -691,7 +719,7 @@ export function EmailCompose(props: EmailComposeProps) {
<div class="w-full bg-alert-bg border-b border-t border-alert/20 text-alert-ink p-2">
<div class="flex items-center justify-between gap-2">
<Caution class="size-4" />
- <span class="text-sm">You must upgrade to send email.</span>
+ <span>You must upgrade to send email.</span>
<span class="grow" />
<DeprecatedTextButton
theme="base"
@@ -706,14 +734,19 @@ export function EmailCompose(props: EmailComposeProps) {
</Switch>
<div
- class="macro-message-width macro-message-padding mx-auto w-full max-h-full my-12 overflow-hidden"
+ ref={mobileScrollRef}
+ class="macro-message-width sm:macro-message-padding mx-auto w-full max-h-full my-2 sm:my-12 mobile:my-0 px-2 sm:px-4 mobile:px-0 overflow-hidden mobile:overflow-y-auto mobile:hide-scrollbar mobile:min-h-full"
classList={{
'pointer-events-none opacity-50': hasLinkError(),
}}
>
- <ClippedPanel tl={!beveledCorners()}>
+ <WrapUnlessMobile
+ wrapper={(children) => (
+ <ClippedPanel tl={!beveledCorners()}>{children}</ClippedPanel>
+ )}
+ >
<div
- class="w-full p-4 bg-input max-h-full overflow-hidden flex flex-col min-h-0"
+ class="w-full p-4 bg-input max-h-full mobile:max-h-none overflow-y-auto flex flex-col min-h-0 mobile:min-h-full"
classList={{
'pointer-events-none opacity-50': hasLinkError(),
}}
@@ -740,7 +773,7 @@ export function EmailCompose(props: EmailComposeProps) {
</Suspense>
<div class="flex gap-2 ml-auto">
<Show when={debouncedIsDraftSaving()}>
- <div class="flex gap-1 items-center text-sm text-ink-muted">
+ <div class="flex gap-1 items-center text-ink-muted">
<Show
when={laggedIsDraftSaving()}
fallback={<span>Draft saved</span>}
@@ -750,20 +783,20 @@ export function EmailCompose(props: EmailComposeProps) {
</Show>
</div>
</Show>
- <Show when={!showCc()}>
+ <Show when={!isCcVisible()}>
<button
type="button"
- class="text-sm text-secondary-text hover:text-primary-text hover:bg-hover"
+ class="text-ink-muted hover:text-ink hover:bg-hover"
onClick={() => setShowCc(true)}
disabled={hasLinkError()}
>
+ Cc
</button>
</Show>
- <Show when={!showBcc()}>
+ <Show when={!isBccVisible()}>
<button
type="button"
- class="text-sm text-secondary-text hover:text-primary-text hover:bg-hover"
+ class="text-ink-muted hover:text-ink hover:bg-hover"
onClick={() => setShowBcc(true)}
disabled={hasLinkError()}
>
@@ -774,82 +807,65 @@ export function EmailCompose(props: EmailComposeProps) {
</div>
<div class="flex flex-col gap-2">
- <div class="flex items-center gap-2 border-b border-edge-muted focus-within:border-accent">
- <div class="text-base w-4 shrink-0 text-ink-placeholder/70">
- To
- </div>
- <div class="flex-1">
+ <ComposeFieldRow label="To">
+ <RecipientSelector
+ inputRef={registerRef('directRecipientsSelector')}
+ options={getRecipientOptions}
+ selectedOptions={form.recipients().to}
+ setSelectedOptions={(next) =>
+ form.setRecipients('to', next)
+ }
+ placeholder="Macro users or email addresses"
+ focusOnMount={!hasLinkError()}
+ hideBorder
+ noBrackets
+ disabled={hasLinkError()}
+ />
+ <Show when={withValidationError('no_recipient')}>
+ {(err) => (
+ <div class="text-failure-ink text-sm mt-1">
+ {err().message}
+ </div>
+ )}
+ </Show>
+ </ComposeFieldRow>
+
+ <Show when={isCcVisible()}>
+ <ComposeFieldRow label="Cc">
<RecipientSelector
- inputRef={registerRef('directRecipientsSelector')}
+ inputRef={registerRef('ccRecipientsSelector')}
options={getRecipientOptions}
- selectedOptions={form.recipients().to}
+ selectedOptions={form.recipients().cc}
setSelectedOptions={(next) =>
- form.setRecipients('to', next)
+ form.setRecipients('cc', next)
}
placeholder="Macro users or email addresses"
- focusOnMount={!hasLinkError()}
hideBorder
noBrackets
disabled={hasLinkError()}
/>
- </div>
- <Show when={withValidationError('no_recipient')}>
- {(err) => (
- <div class="text-failure-ink text-sm mt-1">
- {err().message}
- </div>
- )}
- </Show>
- </div>
-
- <Show when={showCc()}>
- <div class="flex items-center gap-2 border-b border-edge-muted focus-within:border-accent">
- <div class="text-sm w-4 shrink-0 text-ink-placeholder/70">
- Cc
- </div>
- <div class="flex-1">
- <RecipientSelector
- inputRef={registerRef('ccRecipientsSelector')}
- options={getRecipientOptions}
- selectedOptions={form.recipients().cc}
- setSelectedOptions={(next) =>
- form.setRecipients('cc', next)
- }
- placeholder="Macro users or email addresses"
- hideBorder
- noBrackets
- disabled={hasLinkError()}
- />
- </div>
- </div>
+ </ComposeFieldRow>
</Show>
- <Show when={showBcc()}>
- <div class="flex items-center gap-2 border-b border-edge-muted focus-within:border-accent">
- <div class="text-sm w-4 shrink-0 text-ink-placeholder/70">
- Bcc
- </div>
- <div class="flex-1">
- <RecipientSelector
- inputRef={registerRef('bccRecipientsSelector')}
- options={getRecipientOptions}
- selectedOptions={form.recipients().bcc}
- setSelectedOptions={(next) =>
- form.setRecipients('bcc', next)
- }
- placeholder="Macro users or email addresses"
- hideBorder
- noBrackets
- disabled={hasLinkError()}
- />
- </div>
- </div>
+ <Show when={isBccVisible()}>
+ <ComposeFieldRow label="Bcc">
+ <RecipientSelector
+ inputRef={registerRef('bccRecipientsSelector')}
+ options={getRecipientOptions}
+ selectedOptions={form.recipients().bcc}
+ setSelectedOptions={(next) =>
+ form.setRecipients('bcc', next)
+ }
+ placeholder="Macro users or email addresses"
+ hideBorder
+ noBrackets
+ disabled={hasLinkError()}
+ />
+ </ComposeFieldRow>
</Show>
<div class="w-full flex items-center gap-2 border-b border-edge-muted focus-within:border-accent py-2">
- <div class="text-base shrink-0 text-ink-placeholder/70">
- Subject
- </div>
+ <div class="shrink-0 text-ink-placeholder/70">Subject</div>
<div class="flex-1">
<input
@@ -857,7 +873,7 @@ export function EmailCompose(props: EmailComposeProps) {
type="text"
value={form.subject()}
placeholder="Subject"
- class="w-full text-base resize-none placeholder:text-ink-placeholder p-1 ml-1"
+ class="w-full resize-none placeholder:text-ink-placeholder p-1 ml-1"
onInput={(e) => {
form.setSubject(e.currentTarget.value);
scheduleDraftSave();
@@ -886,6 +902,7 @@ export function EmailCompose(props: EmailComposeProps) {
<ComposeEmailInput
captureEditor={setEditor}
inputRef={registerRef('messageInput')}
+ mobileScrollRef={() => mobileScrollRef}
initialHtml={initialHtml()}
onContentChange={onContentChange}
onAddAttachments={onAddAttachments}
@@ -901,14 +918,12 @@ export function EmailCompose(props: EmailComposeProps) {
/>
<Show when={withValidationError('no_message')}>
{(err) => (
- <div class="text-failure-ink text-sm mt-1">
- {err().message}
- </div>
+ <div class="text-failure-ink mt-1">{err().message}</div>
)}
</Show>
</div>
</div>
- </ClippedPanel>
+ </WrapUnlessMobile>
</div>
</div>
</>
diff --git a/js/app/packages/block-email/component/ComposeEmailInput.tsx b/js/app/packages/block-email/component/ComposeEmailInput.tsx
index df12770c3f..003806f077 100644
--- a/js/app/packages/block-email/component/ComposeEmailInput.tsx
+++ b/js/app/packages/block-email/component/ComposeEmailInput.tsx
@@ -14,6 +14,8 @@ import { handleFileFolderDrop } from '@core/util/upload';
import TextAa from '@icon/regular/text-aa.svg';
import Spinner from '@phosphor-icons/core/bold/spinner-gap-bold.svg?component-solid';
import PaperclipIcon from '@phosphor-icons/core/regular/paperclip.svg?component-solid';
+import PaperclipHorizontalIcon from '@phosphor-icons/core/regular/paperclip-horizontal.svg?component-solid';
+import DotsThreeIcon from '@phosphor-icons/core/bold/dots-three-bold.svg?component-solid';
import { useUserId } from '@core/context/user';
import { defaultSelectionData } from 'core/component/LexicalMarkdown/plugins';
import {
@@ -26,7 +28,16 @@ import {
type LexicalEditor,
type TextFormatType,
} from 'lexical';
-import { createSignal, For, Match, onMount, Show, Switch } from 'solid-js';
+import PaperPlane from '@macro-icons/wide/paper-plane-cutout.svg';
+import {
+ type Accessor,
+ createSignal,
+ For,
+ Match,
+ onMount,
+ Show,
+ Switch,
+} from 'solid-js';
import { type FocusableElement, tabbable } from 'tabbable';
import { makeAttachmentPublic } from '../util/makeAttachmentPublic';
import { Button } from '@ui/components/Button';
@@ -36,7 +47,12 @@ import { plural } from '@core/util/string';
import type { DraftFormAttachment } from '@block-email/component/createEmailFormState';
import { EmailAttachmentPill } from '@block-email/component/AttachmentPill';
import { EmailDateSelector } from '@block-email/component/email-date-selector';
+import { DateSelector } from '@block-email/component/date-selector';
import { ENABLE_EMAIL_SCHEDULED_SEND } from '@core/constant/featureFlags';
+import { SplitHeaderRight } from '@app/component/split-layout/components/SplitHeader';
+import { isMobile } from '@core/mobile/isMobile';
+import { DropdownMenu } from '@kobalte/core/dropdown-menu';
+import { DropdownMenuContent, MenuItem } from '@core/component/Menu';
false && fileFolderDrop;
@@ -55,6 +71,7 @@ type ComposeEmailInputProps = {
onContentChange?: (content: string) => void;
sendTime?: Date | null;
onSendTimeChange?: (date: Date | null) => void;
+ mobileScrollRef?: Accessor<HTMLElement | undefined>;
};
export function ComposeEmailInput(props: ComposeEmailInputProps) {
@@ -66,6 +83,8 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
const [showFormatRibbon, setShowFormatRibbon] = createSignal<boolean>(false);
+ const [scheduleSendOpen, setScheduleSendOpen] = createSignal(false);
+
const panel = useSplitPanel();
const focusSibling = (direction: 'next' | 'prev') => {
@@ -191,7 +210,7 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
ref={setComposeContainerRef}
class="relative flex flex-col flex-1 items-center justify-between min-h-0"
>
- <div class="w-full h-full flex flex-col min-h-0">
+ <div class="w-full h-full min-h-60 sm:max-h-full mobile:flex-1 flex flex-col">
<Show when={showFormatRibbon()}>
<FormatRibbon
class="-ml-3"
@@ -206,7 +225,7 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
</Show>
<div
- class="min-h-60 grow w-full h-full flex flex-col cursor-text placeholder:text-ink-placeholder placeholder:opacity-50 overflow-auto"
+ class="grow w-full h-full flex flex-col cursor-text placeholder:text-ink-placeholder placeholder:opacity-50 overflow-auto"
ref={bodyDiv}
onclick={() => {
editor()?.focus();
@@ -227,8 +246,9 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
<MarkdownTextarea
domRef={props.inputRef}
captureEditor={captureEditor}
+ scrollRef={props.mobileScrollRef}
initialHtml={props.initialHtml}
- class="text-sm break-words text-ink"
+ class="text-sm break-words text-ink mobile:overflow-auto h-auto"
editable={() => !props.disabled}
placeholder="Use `@` to reference files"
watermark={!hasPaidAccess() ? <MacroSignatureButton /> : undefined}
@@ -296,63 +316,127 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
</div>
</div>
<div class="flex flex-row w-full h-8 justify-between items-center space-x-2 allow-css-brackets mt-2">
- <div class="flex flex-row items-center gap-2">
- <div class="relative" ref={attachButtonRef}>
- <Button
- ref={(el) =>
- fileSelector(el, () => ({
- multiple: true,
- onSelect: handleAddAttachments,
- }))
- }
- tooltip="Attach"
- class="aspect-square p-1"
+ <Show
+ when={!isMobile()}
+ fallback={
+ <SplitHeaderRight>
+ <div class="flex items-center pl-2">
+ <div class="relative" ref={attachButtonRef}>
+ <Button
+ ref={(el) =>
+ fileSelector(el, () => ({
+ multiple: true,
+ onSelect: handleAddAttachments,
+ }))
+ }
+ tooltip="Attach"
+ class="aspect-square p-1"
+ disabled={props.disabled}
+ >
+ <PaperclipHorizontalIcon class="h-5" />
+ </Button>
+ </div>
+ <Button
+ disabled={props.isSubmitting || props.disabled}
+ onClick={() => {
+ handleSend();
+ }}
+ >
+ <PaperPlane class="size-4.5 text-accent" />
+ </Button>
+ <DropdownMenu placement="bottom-end">
+ <DropdownMenu.Trigger as={Button} class="aspect-square p-1">
+ <DotsThreeIcon class="h-4.5" />
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Portal>
+ <DropdownMenuContent>
+ <Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
+ <MenuItem
+ text="Schedule Send"
+ onClick={() => setScheduleSendOpen(true)}
+ />
+ </Show>
+ <MenuItem
+ text="Delete Draft"
+ disabled={!props.hasDraft}
+ onClick={props.onDraftDeletePress}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu.Portal>
+ </DropdownMenu>
+ <Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
+ <DateSelector
+ open={scheduleSendOpen()}
+ onClose={() => setScheduleSendOpen(false)}
+ selectedDate={props.sendTime}
+ onSelectDate={props.onSendTimeChange}
+ disablePriorToDate={new Date()}
+ trigger={<span class="w-0 h-0 overflow-hidden" />}
+ />
+ </Show>
+ </div>
+ </SplitHeaderRight>
+ }
+ >
+ <div class="flex flex-row items-center gap-2">
+ <div class="relative" ref={attachButtonRef}>
+ <Button
+ ref={(el) =>
+ fileSelector(el, () => ({
+ multiple: true,
+ onSelect: handleAddAttachments,
+ }))
+ }
+ tooltip="Attach"
+ class="aspect-square p-1"
+ disabled={props.disabled}
+ >
+ <PaperclipIcon class="h-5" />
+ </Button>
+ </div>
+ <DeprecatedIconButton
+ theme="base"
+ icon={TextAa}
disabled={props.disabled}
- >
- <PaperclipIcon class="h-5" />
- </Button>
- </div>
- <DeprecatedIconButton
- theme="base"
- icon={TextAa}
- disabled={props.disabled}
- onclick={() => {
- setShowFormatRibbon(!showFormatRibbon());
- }}
- />
- <Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
- <EmailDateSelector
- sendTime={props.sendTime}
- onSendTimeChange={props.onSendTimeChange}
+ onclick={() => {
+ setShowFormatRibbon(!showFormatRibbon());
+ }}
/>
- </Show>
- <Show when={props.hasDraft}>
+ <Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
+ <EmailDateSelector
+ sendTime={props.sendTime}
+ onSendTimeChange={props.onSendTimeChange}
+ />
+ </Show>
+ <Show when={props.hasDraft}>
+ <Button
+ onclick={props.onDraftDeletePress}
+ tooltip="Delete draft"
+ class="aspect-square *:h-5 p-1"
+ >
+ <Trash />
+ </Button>
+ </Show>
<Button
- onclick={props.onDraftDeletePress}
- tooltip="Delete draft"
- class="aspect-square *:h-5 p-1"
+ disabled={props.isSubmitting || props.disabled}
+ onClick={() => {
+ handleSend();
+ }}
+ class="text-ink-muted hover:scale-115 transition ease-in-out flex-col items-center rounded-full p-[0.25lh] hover:bg-transparent disabled:opacity-30"
>
- <Trash />
+ <Show
+ when={!props.isSubmitting}
+ fallback={
+ <Spinner class="size-6 animate-spin cursor-disabled" />
+ }
+ >
+ <div class="group hover:bg-accent transition ease-in-out size-6 border border-accent rounded-full flex items-center justify-center p-0">
+ <ArrowUp class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
+ </div>
+ </Show>
</Button>
- </Show>
- </div>
-
- <Button
- disabled={props.isSubmitting || props.disabled}
- onClick={() => {
- handleSend();
- }}
- class="text-ink-muted hover:scale-115 transition ease-in-out flex-col items-center rounded-full p-[0.25lh] hover:bg-transparent disabled:opacity-30"
- >
- <Show
- when={!props.isSubmitting}
- fallback={<Spinner class="size-6 animate-spin cursor-disabled" />}
- >
- <div class="group hover:bg-accent transition ease-in-out size-6 border border-accent rounded-full flex items-center justify-center p-0">
- <ArrowUp class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
- </div>
- </Show>
- </Button>
+ </div>
+ </Show>
</div>
</div>
);
diff --git a/js/app/packages/block-email/component/EmailMessageTopBar.tsx b/js/app/packages/block-email/component/EmailMessageTopBar.tsx
index 9f82cdbff6..9b72998b48 100644
--- a/js/app/packages/block-email/component/EmailMessageTopBar.tsx
+++ b/js/app/packages/block-email/component/EmailMessageTopBar.tsx
@@ -197,7 +197,7 @@ function CollapsedHeader(props: {
hiddenActions={props.hiddenActions}
/>
<Show when={props.message.internal_date_ts}>
- <div class="text-xs touch:mobile-width:text-sm text-ink">
+ <div class="text-xs text-ink">
{formatShortDate(props.message.internal_date_ts!)}
</div>
</Show>
diff --git a/js/app/packages/block-email/component/MessageList.tsx b/js/app/packages/block-email/component/MessageList.tsx
index eaa9c43338..4ca712760e 100644
--- a/js/app/packages/block-email/component/MessageList.tsx
+++ b/js/app/packages/block-email/component/MessageList.tsx
@@ -25,7 +25,7 @@ export function MessageList(props: MessageListProps) {
return (
<div
- class="pt-3 w-full flex flex-col-reverse items-center overflow-y-scroll overflow-x-hidden suppress-css-brackets hide-scrollbar text-sm touch:mobile-width:text-base"
+ class="pt-3 w-full flex flex-col-reverse items-center overflow-y-scroll overflow-x-hidden suppress-css-brackets hide-scrollbar text-sm"
ref={context.registerMessagesList}
onscroll={(e) => {
// Since the list is reversed, calculate scroll from visual top
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
index 3bc966a351..2afa14c19a 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx
@@ -1,3 +1,4 @@
+import { cn } from '@ui/utils/classname';
import type { PortalScope } from '@core/component/ScopedPortal';
import type { EditorType } from '@lexical-core';
import type { HistoryItem } from '@queries/history/types';
@@ -32,6 +33,7 @@ import {
customSelectionDataPlugin,
emojisPlugin,
filePastePlugin,
+ iosCursorScrollPlugin,
type ItemMention,
keyboardFocusPlugin,
mediaPlugin,
@@ -56,6 +58,8 @@ import { FloatingLinkMenu } from '../menu/FloatingLinkMenu';
import { MentionsMenu } from '../menu/MentionsMenu';
import { DecoratorRenderer } from './DecoratorRenderer';
import { NodeAccessoryRenderer } from './NodeAccessoryRenderer';
+import { isIOS } from '@solid-primitives/platform';
+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
/**
* @param editable - A signal that indicates whether the textarea is editable
@@ -95,6 +99,7 @@ export interface MarkdownTextareaProps {
formatState?: SelectionData;
setFormatState?: SetStoreFunction<SelectionData>;
domRef?: (ref: HTMLDivElement) => void | HTMLDivElement;
+ scrollRef?: Accessor<HTMLElement | undefined>;
onPasteFilesAndDirs?: (
files: FileSystemFileEntry[],
directories: FileSystemDirectoryEntry[]
@@ -103,6 +108,7 @@ export interface MarkdownTextareaProps {
export function MarkdownTextarea(props: MarkdownTextareaProps) {
let mountRef!: HTMLDivElement;
+ let scrollContainerRef: HTMLDivElement | undefined;
const lexicalWrapper = createLexicalWrapper({
type: props.type ?? 'markdown',
namespace: 'markdown-textarea',
@@ -211,6 +217,14 @@ export function MarkdownTextarea(props: MarkdownTextareaProps) {
);
}
+ if (isIOS || isNativeMobilePlatform()) {
+ plugins.use(
+ iosCursorScrollPlugin({
+ scrollContainer: props.scrollRef ?? (() => scrollContainerRef),
+ })
+ );
+ }
+
const [accessoryStore, setAccessoryStore] = createAccessoryStore();
plugins.use(
codePlugin({
@@ -292,7 +306,8 @@ export function MarkdownTextarea(props: MarkdownTextareaProps) {
return (
<LexicalWrapperContext.Provider value={lexicalWrapper}>
<div
- class={`${props.class ?? ''} relative w-full h-full overflow-auto min-h-8`}
+ ref={scrollContainerRef}
+ class={cn('relative w-full h-full overflow-auto min-h-8', props.class)}
on:keydown={(e) => {
e.stopPropagation();
}}
diff --git a/js/app/packages/core/component/Message.tsx b/js/app/packages/core/component/Message.tsx
index 785e563707..3d14f654e2 100644
--- a/js/app/packages/core/component/Message.tsx
+++ b/js/app/packages/core/component/Message.tsx
@@ -116,12 +116,12 @@ const TopBar: Component<MessageTopBarProps> = (props) => {
<Show when={!context.isConsecutive()}>
<div class="font-mono flex flex-row items-center justify-between">
{/* Name */}
- <div class="shrink-1 min-w-0 text-sm touch:mobile-width:text-base truncate text-ink-muted">
+ <div class="shrink-1 min-w-0 text-sm truncate text-ink-muted">
{local.name}
</div>
{/* Tag */}
<Show when={local.tagLabel}>
- <div class="inline-flex items-center ml-2 px-0.5 text-xs touch:mobile-width:text-sm bg-edge/15 text-ink border-1 border-edge/30 max-w-[240px] min-w-0">
+ <div class="inline-flex items-center ml-2 px-0.5 text-xs bg-edge/15 text-ink border-1 border-edge/30 max-w-[240px] min-w-0">
<div class="flex-shrink-0 px-0.5">
<Show when={local.tagIcon}>
<CustomEntityIcon icon={local.tagIcon!} size="xs" />
@@ -132,7 +132,7 @@ const TopBar: Component<MessageTopBarProps> = (props) => {
</Show>
{/* Date - hidden when hovering since it shows above hover actions */}
<Show when={local.timestamp && !context.hover()}>
- <div class="text-xs touch:mobile-width:text-sm text-ink-muted min-w-0 shrink-2 truncate">
+ <div class="text-xs mobile:text-sm text-ink-muted min-w-0 shrink-2 truncate">
{local.timestamp && formatDate(local.timestamp)}
</div>
</Show>
@@ -153,14 +153,10 @@ const Body: Component<MessageBodyProps> = (props) => {
<Show
when={!props.isDeleted}
fallback={
- <div class="text-xs touch:mobile-width:text-sm text-ink-muted font-mono">
- Message Deleted
- </div>
+ <div class="text-xs text-ink-muted font-mono">Message Deleted</div>
}
>
- <div class="text-sm touch:mobile-width:text-base text-ink pr-4">
- {props.children}
- </div>
+ <div class="text-sm text-ink pr-4">{props.children}</div>
</Show>
);
};
diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsx
index 2a481f70d2..ac5a208491 100644
--- a/js/app/packages/core/component/RecipientSelector.tsx
+++ b/js/app/packages/core/component/RecipientSelector.tsx
@@ -1,6 +1,8 @@
import { EntityIcon } from '@core/component/EntityIcon';
import { toast } from '@core/component/Toast/Toast';
+import { Tooltip } from '@core/component/Tooltip';
import { UserIcon } from '@core/component/UserIcon';
+import { UserTooltip } from '@core/component/UserTooltip';
import {
type CombinedRecipientItem,
type CombinedRecipientKind,
@@ -9,6 +11,7 @@ import {
recipientEntityMapper,
type WithCustomUserInput,
} from '@core/user';
+import { isMobileWidth } from '@core/mobile/mobileWidth';
import { matches } from '@core/util/match';
import { clamp } from '@core/util/math';
import { truncateString } from '@core/util/string';
@@ -34,11 +37,29 @@ import {
type JSX,
Match,
onMount,
+ Show,
Switch,
} from 'solid-js';
import { type VirtualizerHandle, VList } from 'virtua/solid';
import { useAugmentUserWithDmActivity } from '@core/user/dmActivity';
+function RecipientChip(props: {
+ icon?: JSX.Element;
+ label: string;
+ onRemove: () => void;
+}) {
+ return (
+ <div class="flex flex-row py-1 pl-2 gap-1 pr-0.5 overflow-hidden items-center bg-hover">
+ <Show when={props.icon}>{props.icon}</Show>
+ <p class="text-sm">{truncateString(props.label, 20)}</p>
+ <XIcon
+ class="w-5 h-5 cursor-pointer hover:bg-hover hover-transition-bg p-1"
+ onClick={props.onRemove}
+ />
+ </div>
+ );
+}
+
function getRecipientOptionEmail(
option: CombinedRecipientItem
): string | undefined {
@@ -464,26 +485,36 @@ export function RecipientSelector<K extends CombinedRecipientKind>(
const name = getRecipientOptionName(opt);
const email = getRecipientOptionEmail(opt);
- const displayText =
- name && name !== email
- ? `${name} | ${email}`
- : email;
+ const displayText = () => name || email;
return (
- <div class="flex flex-row ml-2 py-1 pl-2 gap-1 pr-0.5 overflow-hidden items-center bg-hover">
- <UserIcon
- id={opt.id}
- size="xs"
- isDeleted={false}
+ <Tooltip
+ placement="bottom"
+ unstyled
+ tooltip={
+ <UserTooltip
+ displayName={name || ''}
+ email={email}
+ id={opt.id}
+ isDeleted={false}
+ />
+ }
+ >
+ <RecipientChip
+ icon={
+ !isMobileWidth() ? (
+ <UserIcon
+ id={opt.id}
+ size="xs"
+ isDeleted={false}
+ showTooltip={false}
+ />
+ ) : undefined
+ }
+ label={displayText() ?? ''}
+ onRemove={() => state.remove(option)}
/>
- <p class={'text-sm'}>
- {truncateString(displayText ?? '', 20)}
- </p>
- <XIcon
- class="w-5 h-5 hover:bg-hover hover-transition-bg p-1 "
- onClick={() => state.remove(option)}
- />
- </div>
+ </Tooltip>
);
}}
</Match>
@@ -492,41 +523,47 @@ export function RecipientSelector<K extends CombinedRecipientKind>(
>
{(channelOption) => {
return (
- <div class="flex flex-row ml-2 py-1 pl-2 gap-1 pr-0.5 overflow-hidden items-center bg-hover">
- <HashIcon class="w-4 h-4" />
- <p class={'text-sm'}>
- {truncateString(
- channelOption().data.name ??
- channelOption().id,
- 20
- )}
- </p>
- <XIcon
- class="w-5 h-5 hover:bg-hover hover-transition-bg p-1 "
- onClick={() => state.remove(option)}
- />
- </div>
+ <RecipientChip
+ icon={<HashIcon class="w-4 h-4" />}
+ label={
+ channelOption().data.name ?? channelOption().id
+ }
+ onRemove={() => state.remove(option)}
+ />
);
}}
</Match>
<Match when={matches(option, (o) => o.kind === 'custom')}>
{(customOption) => {
const email = customOption().data.email;
+
return (
- <div class="flex flex-row ml-2 py-1 pl-2 gap-1 pr-0.5 overflow-hidden items-center bg-hover">
- <UserIcon
- id={email}
- size="xs"
- isDeleted={false}
- />
- <p class={'text-sm'}>
- {truncateString(email, 20)}
- </p>
- <XIcon
- class="w-5 h-5 hover:bg-hover hover-transition-bg p-1 "
- onClick={() => state.remove(option)}
+ <Tooltip
+ placement="bottom"
+ unstyled
+ tooltip={
+ <UserTooltip
+ displayName={email}
+ email={email}
+ isDeleted={false}
+ />
+ }
+ >
+ <RecipientChip
+ icon={
+ !isMobileWidth() ? (
+ <UserIcon
+ id={email}
+ size="xs"
+ isDeleted={false}
+ showTooltip={false}
+ />
+ ) : undefined
+ }
+ label={email}
+ onRemove={() => state.remove(option)}
/>
- </div>
+ </Tooltip>
);
}}
</Match>
diff --git a/js/app/packages/core/component/UserIcon.tsx b/js/app/packages/core/component/UserIcon.tsx
index 1dd8480b52..99ff089b15 100644
--- a/js/app/packages/core/component/UserIcon.tsx
+++ b/js/app/packages/core/component/UserIcon.tsx
@@ -1,10 +1,8 @@
-import { toast } from '@core/component/Toast/Toast';
import { macroIdToEmail, tryMacroId, useDisplayName } from '@core/user';
import { isOk } from '@core/util/maybeResult';
import Trash from '@phosphor-icons/core/regular/trash.svg?component-solid';
import { commsServiceClient } from '@service-comms/client';
-import { debounce } from '@solid-primitives/scheduled';
-import { createMemo, createSignal, Match, Show, Switch } from 'solid-js';
+import { createMemo, Match, Show, Switch } from 'solid-js';
import { useSplitLayout } from '../../app/component/split-layout/layout';
import { ProfilePicture } from './ProfilePicture';
import { Tooltip } from './Tooltip';
@@ -126,21 +124,6 @@ export function UserIcon(props: UserIconProps) {
</div>
));
- const [copied, setCopied] = createSignal(false);
-
- const resetCopied = debounce(() => setCopied(false), 800);
-
- function handleCopyEmail(e: MouseEvent) {
- e.stopPropagation();
- const email_ = email();
- if (!email_) return;
-
- setCopied(true);
- navigator.clipboard.writeText(email_);
- toast.success('Email copied');
- resetCopied();
- }
-
return (
<Show
when={
@@ -158,8 +141,6 @@ export function UserIcon(props: UserIconProps) {
email={email()}
id={props.id}
isDeleted={props.isDeleted}
- copied={copied()}
- onCopyEmail={handleCopyEmail}
/>
}
>
diff --git a/js/app/packages/core/component/UserTooltip.tsx b/js/app/packages/core/component/UserTooltip.tsx
index b685d87aba..9d92435385 100644
--- a/js/app/packages/core/component/UserTooltip.tsx
+++ b/js/app/packages/core/component/UserTooltip.tsx
@@ -10,7 +10,8 @@ import Trash from '@phosphor-icons/core/regular/trash.svg?component-solid';
import { commsServiceClient } from '@service-comms/client';
import { useUserId } from '@core/context/user';
import { Button } from '@ui/components/Button';
-import { Match, Show, Switch } from 'solid-js';
+import { createSignal, Match, Show, Switch } from 'solid-js';
+import { debounce } from '@solid-primitives/scheduled';
import { ProfilePicture } from './ProfilePicture';
export type UserTooltipProps = {
@@ -18,11 +19,21 @@ export type UserTooltipProps = {
email?: string;
id?: string;
isDeleted?: boolean;
- copied: boolean;
- onCopyEmail: (e: MouseEvent) => void;
};
export function UserTooltip(props: UserTooltipProps) {
+ const [copied, setCopied] = createSignal(false);
+ const resetCopied = debounce(() => setCopied(false), 800);
+
+ function handleCopyEmail(e: MouseEvent) {
+ e.stopPropagation();
+ const email = props.email;
+ if (!email) return;
+ setCopied(true);
+ navigator.clipboard.writeText(email);
+ toast.success('Email copied');
+ resetCopied();
+ }
const currentUserId = useUserId();
const { openWithSplit } = useSplitLayout();
@@ -101,8 +112,8 @@ export function UserTooltip(props: UserTooltipProps) {
<div class="border-t border-edge/20"></div>
<div class="py-2 flex flex-col gap-0">
<Show when={props.email}>
- <Button onClick={props.onCopyEmail} class={buttonStyle}>
- {props.copied ? (
+ <Button onClick={handleCopyEmail} class={buttonStyle}>
+ {copied() ? (
<IconCheck class="w-3.5 h-3.5" />
) : (
<WideCopy class="w-3.5 h-3.5" />
diff --git a/js/app/packages/core/mobile/WrapUnlessMobile.tsx b/js/app/packages/core/mobile/WrapUnlessMobile.tsx
new file mode 100644
index 0000000000..8aafdbe407
--- /dev/null
+++ b/js/app/packages/core/mobile/WrapUnlessMobile.tsx
@@ -0,0 +1,18 @@
+import { Show, children, type JSX, type ParentProps } from 'solid-js';
+import { isMobile } from './isMobile';
+
+/**
+ * Applies `wrapper` on non-mobile, renders children unwrapped on mobile..
+ */
+export function WrapUnlessMobile(
+ props: ParentProps<{
+ wrapper: (children: JSX.Element) => JSX.Element;
+ }>
+) {
+ const resolved = children(() => props.children);
+ return (
+ <Show when={!isMobile()} fallback={resolved()}>
+ {props.wrapper(resolved() as JSX.Element)}
+ </Show>
+ );
+}
diff --git a/js/app/packages/macro-icons/wide/paper-plane-cutout.svg b/js/app/packages/macro-icons/wide/paper-plane-cutout.svg
new file mode 100644
index 0000000000..e0791c5eae
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/paper-plane-cutout.svg
@@ -0,0 +1,3 @@
+<svg width="100%" height="100%" viewBox="0 -4 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M23.9457.6661A1.019 1.019 0 0 0 22.9868 0H2.1609v1.9983h18.0302L6.3612 13.309 4.727 8.9126l5.0512-3.264-5.983.746-1.6343-4.3963H0L4.9566 15.334c.108.3064.3647.5329.6888.6261.081.0267.1756.04.2701.04.2296 0 .4592-.0799.6483-.2265L23.635 1.7719c.3242-.2665.4457-.7061.3107-1.1058"/>
+</svg>
diff --git a/js/app/packages/macro-icons/wide/readme.md b/js/app/packages/macro-icons/wide/readme.md
index 10cdf8fa64..089d522003 100644
--- a/js/app/packages/macro-icons/wide/readme.md
+++ b/js/app/packages/macro-icons/wide/readme.md
@@ -3,3 +3,5 @@ Note on the formatting of these wide icons.
1. The view box should be set to 0 n 24 24 where n = -1 * {the height of the svg} / 2. This is so that the svg is correctly centered in a square viewbox.
2. In the <svg> tag set fill to "currentColor" and width and height to "100%" and stroke set to "None".
3. <path> tag should not have any fill or stroke set on it.
+
+When exporting the SVGs we should export the inner-most container.
diff --git a/js/app/packages/ui/components/Button.tsx b/js/app/packages/ui/components/Button.tsx
index 40f8e6e910..4d4761fec1 100644
--- a/js/app/packages/ui/components/Button.tsx
+++ b/js/app/packages/ui/components/Button.tsx
@@ -7,6 +7,7 @@ type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: 'primary' | 'secondary' | 'tertiary' | 'destructive';
tooltip?: JSX.Element;
showChevron?: boolean;
+ suppressInteractionStyling?: boolean;
};
/**
@@ -16,6 +17,7 @@ type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
* @param props.tooltip - Optional tooltip content to display when hovering over the button.
* @param props.class - Use for custom styling. Tailwind will be merged automatically, be granular as you like.
* @param props.showChevron - Show an indicator
+ * @param props.suppressInteractionStyling - Override the default interaction styling, e.g. hover bg changes
* @param props.children - Labels, icons, hotkey hints, etc. The body of the button.
*
* @example
@@ -41,6 +43,7 @@ export const Button: ParentComponent<ButtonProps> = (props) => {
'children',
'tooltip',
'showChevron',
+ 'suppressInteractionStyling',
'type',
]);
@@ -57,10 +60,8 @@ export const Button: ParentComponent<ButtonProps> = (props) => {
class={cn(
'relative flex items-center justify-center gap-[1ch] px-[1ch] py-[0.25lh] border border-transparent',
'font-mono font-medium uppercase leading-none',
- 'hover:bg-surface-4',
- 'focus:[--focus-border-inset:-4px]',
- 'active:border-accent active:bg-accent active:text-panel',
- 'disabled:opacity-50 disabled:cursor-not-allowed',
+ !local.suppressInteractionStyling &&
+ 'hover:bg-surface-4 focus:[--focus-border-inset:-4px] active:border-accent active:bg-accent active:text-panel disabled:opacity-50 disabled:cursor-not-allowed',
'touch:min-h-11 touch:min-w-11 touch:[&_svg]:size-6',
{
diff --git a/js/app/tauri/src-tauri/capabilities/default.json b/js/app/tauri/src-tauri/capabilities/default.json
index 16caa44fe3..213331b29f 100644
--- a/js/app/tauri/src-tauri/capabilities/default.json
+++ b/js/app/tauri/src-tauri/capabilities/default.json
@@ -2,9 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "enables the default permissions",
- "windows": [
- "main"
- ],
+ "windows": ["main"],
"permissions": [
"core:default",
{
@@ -25,6 +23,12 @@
{
"url": "https://static-file-storage-prod.s3.us-east-1.amazonaws.com"
},
+ {
+ "url": "https://macro-email-attachments-prod.s3.us-east-1.amazonaws.com"
+ },
+ {
+ "url": "https://macro-email-attachments-dev.s3.us-east-1.amazonaws.com"
+ },
{
"url": "https://*.macroverse.workers.dev"
},
@@ -42,4 +46,4 @@
"os:default",
"log:default"
]
-}
\ No newline at end of file
+}