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(onboarding): fix mobile layout, skip on touch, add referral hint (#2404)

Seamus62ce4912d6ef
diff --git a/js/app/packages/app/component/app-sidebar/invite-modal.tsx b/js/app/packages/app/component/app-sidebar/invite-modal.tsx
index e5eda7cb59..e1efef3846 100644
--- a/js/app/packages/app/component/app-sidebar/invite-modal.tsx
+++ b/js/app/packages/app/component/app-sidebar/invite-modal.tsx
@@ -8,7 +8,8 @@ import { isOk } from '@core/util/maybeResult';
import { DialogWrapper } from '@core/component/DialogWrapper';
import { Button } from '@ui/components/Button';
import { toast } from '@core/component/Toast/Toast';
-import CloseIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
+import CloseIcon from '@icon/regular/x.svg';
+import ClipboardIcon from '@icon/regular/clipboard.svg';
function parseEmails(raw: string): string[] {
return raw
@@ -71,16 +72,20 @@ export const InviteModal = () => {
<Dialog.Portal>
<DialogWrapper>
<div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-2 border-b-1 border-b-edge-muted h-[40px]">
+ <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b-1 border-b-edge-muted h-[40px]">
<Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
<CloseIcon />
</Dialog.CloseButton>
<Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Invite Your Team
+ Invite
</Dialog.Title>
</div>
<div class="p-3 flex flex-col gap-3">
+ <p>
+ Invite friends and teammates to Macro. You’ll get $100 in
+ credits for each person who signs up.
+ </p>
<div class="flex flex-col gap-2">
<textarea
ref={(el) => {
@@ -96,13 +101,35 @@ export const InviteModal = () => {
/>
</div>
+ <div class="flex justify-end gap-1 pt-2">
+ <Button
+ variant="ghost"
+ class="rounded-xs"
+ onClick={handleClose}
+ >
+ Cancel
+ </Button>
+ <Button
+ onClick={handleSend}
+ variant={
+ sending() || !parseEmails(value()).length
+ ? 'ghost'
+ : 'accent'
+ }
+ disabled={sending() || !parseEmails(value()).length}
+ class="rounded-xs font-semibold"
+ >
+ {sending() ? 'Sending…' : 'Send Invites'}
+ </Button>
+ </div>
+
<Show when={referralUrl()}>
{(url) => (
- <div class="flex flex-col gap-1.5 pt-3 border-t border-edge-muted">
+ <div class="flex flex-col gap-1.5 pt-3 ">
<p class="text-xs text-ink/50">
Or share your personal referral link:
</p>
- <div class="flex items-center gap-2">
+ <div class="flex items-stretch gap-2">
<input
type="text"
readOnly
@@ -110,31 +137,20 @@ export const InviteModal = () => {
class="flex-1 px-3 py-1.5 text-xs border border-edge-muted rounded-xs bg-input text-ink/70 outline-none select-all"
onClick={(e) => e.currentTarget.select()}
/>
- <button
+ <Button
type="button"
onClick={handleCopy}
- class="px-3 py-1.5 text-xs font-medium rounded-xs border border-edge-muted bg-panel text-ink hover:bg-hover/60 transition-colors whitespace-nowrap"
+ size="md"
+ variant="secondary"
+ class="font-medium rounded-xs border px-2"
>
+ <ClipboardIcon class="size-3" />
{copied() ? 'Copied!' : 'Copy'}
- </button>
+ </Button>
</div>
</div>
)}
</Show>
-
- <div class="flex justify-end gap-2 pt-2">
- <Button variant="ghost" onClick={handleClose}>
- Cancel
- </Button>
- <button
- type="button"
- onClick={handleSend}
- disabled={sending() || !parseEmails(value()).length}
- class="py-1.5 px-3 text-sm font-medium rounded-xs bg-accent text-menu hover:bg-accent/90 transition-colors disabled:opacity-50"
- >
- {sending() ? 'Sending…' : 'Send Invites'}
- </button>
- </div>
</div>
</div>
</DialogWrapper>
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 2d6fb406fb..e6d2815597 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -46,7 +46,6 @@ import {
InviteModal,
setInviteModalOpen,
} from '@app/component/app-sidebar/invite-modal';
-import { DEV_MODE_ENV } from '@core/constant/featureFlags';
interface SidebarItem {
id: ListView;
@@ -198,7 +197,7 @@ export const registerSidebarHotkeys = ({
registerHotkey({
scopeId: 'global',
hotkeyToken: TOKENS.global.inviteTeam,
- description: 'Invite team',
+ description: 'Send Invites',
keyDownHandler: (e) => {
e?.preventDefault();
setInviteModalOpen(true);
@@ -465,14 +464,12 @@ export const AppSidebar = (props: AppSidebarProps) => {
</div>
<div class=" w-full px-2 flex flex-col">
- <Show when={DEV_MODE_ENV}>
- <SidebarActionButton
- label="Invite Team"
- isSlim={isSlim}
- onClick={() => setInviteModalOpen(true)}
- icon={AnimatedUsersIcon}
- />
- </Show>
+ <SidebarActionButton
+ label="Invite"
+ isSlim={isSlim}
+ onClick={() => setInviteModalOpen(true)}
+ icon={AnimatedUsersIcon}
+ />
<SidebarActionButton
label="New Split"
diff --git a/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
index c79ab8152f..6308daeefd 100644
--- a/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx
@@ -29,6 +29,7 @@ import { ClippedPanel } from '@core/component/ClippedPanel';
import { PcNoiseGrid } from '@core/component/PcNoiseGrid';
import { useAnalytics } from '@app/component/analytics-context';
import { useHasPaidAccess } from '@core/auth/license';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
export default function InteractiveOnboarding() {
const analytics = useAnalytics();
@@ -38,10 +39,15 @@ export default function InteractiveOnboarding() {
const tutorialCompleted = useTutorialCompleted();
const location = useLocation();
+ const isTouch = isTouchDevice();
+
const hasPaid = useHasPaidAccess();
- const lessons = hasPaid()
+ const allLessons = hasPaid()
? LESSONS.filter((l) => l.id !== 'choose-plan')
: LESSONS;
+ const lessons = isTouch
+ ? allLessons.filter((l) => l.id === 'welcome' || l.id === 'choose-plan')
+ : allLessons;
const testMode = new URLSearchParams(location.search).has('test');
if (testMode) {
@@ -233,13 +239,24 @@ export default function InteractiveOnboarding() {
);
// Mark tutorial complete on the backend once the email-invite lesson is
- // completed or skipped — before the paywall step.
+ // completed or skipped — before the paywall step. On touch devices there is
+ // no email-invite step, so we complete after the welcome lesson instead.
createEffect(() => {
- const invite = state
- .lessons()
- .find((l) => l.definition.id === 'email-invite');
- if (invite && (invite.completed || invite.skipped) && !testMode) {
- completeTutorial.mutate(undefined);
+ if (testMode) return;
+ if (isTouch) {
+ const welcome = state
+ .lessons()
+ .find((l) => l.definition.id === 'welcome');
+ if (welcome && (welcome.completed || welcome.skipped)) {
+ completeTutorial.mutate(undefined);
+ }
+ } else {
+ const invite = state
+ .lessons()
+ .find((l) => l.definition.id === 'email-invite');
+ if (invite && (invite.completed || invite.skipped)) {
+ completeTutorial.mutate(undefined);
+ }
}
});
@@ -351,7 +368,63 @@ export default function InteractiveOnboarding() {
}
>
{(lesson) => (
- <>
+ <Show
+ when={!isTouch}
+ fallback={
+ /* Touch layout — single vertical column */
+ <div class="size-full flex flex-col items-center overflow-y-auto p-6">
+ <div
+ style={bodyStyle()}
+ class="flex flex-col items-center text-center gap-6 w-full max-w-md my-auto"
+ >
+ <div class="w-24 opacity-20">
+ <MacroLogo class="fill-ink" />
+ </div>
+ <h2 class="text-3xl font-semibold text-ink">
+ {lesson().definition.title}
+ </h2>
+ <Show when={lesson().definition.subtitle}>
+ <p class="text-base text-ink/60">
+ {lesson().definition.subtitle}
+ </p>
+ </Show>
+ <div class="onboarding-stagger">
+ <Dynamic
+ component={lesson().definition.content}
+ onComplete={handleLessonComplete}
+ isActive={true}
+ scopeId={scopeId}
+ />
+ </div>
+ {/* Show plan cards inline on touch for choose-plan */}
+ <Show when={lesson().definition.demo}>
+ {(Demo) => (
+ <div class="w-full">
+ <Dynamic
+ component={Demo()}
+ onComplete={handleLessonComplete}
+ isActive={true}
+ scopeId={scopeId}
+ />
+ </div>
+ )}
+ </Show>
+ <Show when={!lesson().definition.hideContinue}>
+ <div class="w-full flex flex-col gap-2 mt-2">
+ <ContinueButton
+ ref={(el) => {
+ continueButtonRef = el;
+ }}
+ onClick={handleContinue}
+ label={continueLabel()}
+ disabled={!readyToContinue()}
+ />
+ </div>
+ </Show>
+ </div>
+ </div>
+ }
+ >
{/* Left panel — text content (~1/3) */}
<div class="w-1/3 h-full min-w-0 flex flex-col border-r border-edge-muted">
{/* Header */}
@@ -436,7 +509,7 @@ export default function InteractiveOnboarding() {
</Show>
</div>
</div>
- </>
+ </Show>
)}
</Show>
</div>
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
index 42ffd32d5b..88d8cd11f4 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx
@@ -3,6 +3,7 @@ import type { LessonContentProps, LessonDefinition } from '../types';
import { stripeServiceClient } from '@service-stripe/client';
import { useAnalytics } from '@app/component/analytics-context';
import { toast } from '@core/component/Toast/Toast';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
const PLANS: {
tier: string;
@@ -70,7 +71,13 @@ function ChoosePlanDemo() {
return (
<div class="h-full w-full flex items-center justify-center px-8">
- <div class="flex gap-4 w-full max-w-2xl items-start">
+ <div
+ class="w-full max-w-2xl items-start"
+ classList={{
+ 'flex flex-col gap-3': isTouchDevice(),
+ 'flex gap-4': !isTouchDevice(),
+ }}
+ >
<For each={PLANS}>
{(plan) => (
<div class="flex-1 flex flex-col">
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
index 508d93381b..17f33bc788 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
@@ -71,7 +71,7 @@ function CommandKContent(_props: LessonContentProps) {
<span class="flex border border-edge-muted text-[0.625rem] rounded-xs items-center px-1.5 py-0.25 font-normal">
<Hotkey shortcut="arrowdown" class="space-x-1" />
</span>
- to move the cursor, then select an item to continue.
+ to move the cursor.
</p>
</div>
);
@@ -80,10 +80,23 @@ function CommandKContent(_props: LessonContentProps) {
function CommandKDemo(props: LessonContentProps) {
const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();
+ const [hasOpened, setHasOpened] = createSignal(false);
+
onMount(() => {
CommandState.forceReset();
});
+ // Complete the lesson the first time the command menu closes after being opened.
+ createEffect(() => {
+ const open = commandKOpen();
+ if (open) {
+ setHasOpened(true);
+ } else if (hasOpened() && !completed()) {
+ setCompleted(true);
+ props.onComplete();
+ }
+ });
+
onCleanup(() => {
CommandState.forceReset();
setCommandKOpen(false);
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx
index 63867d9989..fa3af31a05 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx
@@ -1,8 +1,6 @@
-import { createSignal, onCleanup, onMount, Show } from 'solid-js';
+import { createSignal, onCleanup, onMount } from 'solid-js';
import type { LessonContentProps, LessonDefinition } from '../types';
import { MockAppChrome } from '../components/MockAppChrome';
-import { useReferralCode } from '@core/context/user';
-import { getWebOrigin } from '@core/util/webOrigin';
import { authServiceClient } from '@service-auth/client';
import { contactsClient } from '@service-contacts/client';
import { isOk } from '@core/util/maybeResult';
@@ -16,24 +14,8 @@ function parseEmails(raw: string): string[] {
function EmailInviteContent(props: LessonContentProps) {
const [value, setValue] = createSignal('');
- const [copied, setCopied] = createSignal(false);
- const referralCode = useReferralCode();
let textareaRef: HTMLTextAreaElement | undefined;
- const referralUrl = () => {
- const code = referralCode();
- if (!code) return undefined;
- return `${getWebOrigin()}/app/signup?referral_code=${code}`;
- };
-
- const handleCopy = () => {
- const url = referralUrl();
- if (!url) return;
- navigator.clipboard.writeText(url);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
- };
-
// setTimeout defers onComplete to a new macrotask, safely after the shell's
// handleContinue has finished calling setReadyToContinue(false). Then the
// double-rAF focuses the textarea after the shell's own rAF focuses the button.
@@ -61,8 +43,8 @@ function EmailInviteContent(props: LessonContentProps) {
return (
<div class="flex flex-col gap-3 onboarding-stagger">
<p>
- Macro is better with your team. Invite collaborators to your workspace
- by email.
+ Invite friends and teammates to Macro. You'll get $100 in credits for
+ each person who signs up.
</p>
<div class="flex flex-col gap-2">
<textarea
@@ -77,31 +59,6 @@ function EmailInviteContent(props: LessonContentProps) {
Separate addresses with a new line or comma.
</p>
</div>
- <Show when={referralUrl()}>
- {(url) => (
- <div class="flex flex-col gap-1.5 pt-2 border-t border-edge-muted">
- <p class="text-xs text-ink/50">
- Or share your personal referral link:
- </p>
- <div class="flex items-center gap-2">
- <input
- type="text"
- readOnly
- value={url()}
- class="flex-1 px-3 py-1.5 text-xs border border-edge-muted rounded-xs bg-surface-secondary text-ink/70 outline-none select-all"
- onClick={(e) => e.currentTarget.select()}
- />
- <button
- type="button"
- onClick={handleCopy}
- class="px-3 py-1.5 text-xs font-medium rounded-xs border border-edge-muted bg-panel text-ink hover:bg-hover/60 transition-colors whitespace-nowrap"
- >
- {copied() ? 'Copied!' : 'Copy'}
- </button>
- </div>
- </div>
- )}
- </Show>
</div>
);
}
@@ -113,7 +70,6 @@ function EmailInviteDemo() {
export const emailInviteLesson: LessonDefinition = {
id: 'email-invite',
title: 'Invite Your Team',
- subtitle: 'Bring your teammates into Macro.',
content: EmailInviteContent,
demo: EmailInviteDemo,
order: 70,
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx
index 563ed5e39e..427f07c4b6 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx
@@ -1,5 +1,6 @@
import { onMount } from 'solid-js';
import type { LessonContentProps, LessonDefinition } from '../types';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
function WelcomeContent(props: LessonContentProps) {
onMount(() => props.onComplete('Get Started'));
@@ -8,8 +9,9 @@ function WelcomeContent(props: LessonContentProps) {
<div class="flex flex-col gap-3 onboarding-stagger">
<p>
Macro is a unified system for work – built for <strong>speed</strong>{' '}
- and <strong>focus</strong>. This short walk-through will introduce a few
- core features.
+ and <strong>focus</strong>.
+ {!isTouchDevice() &&
+ ' This short walk-through will introduce a few core features.'}
</p>
</div>
);