Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ import { ContextButton } from "../ContextButton";
import { DictationBar } from "../DictationBar";
import { MentionMenu } from "../MentionMenu";

const FOOTER_BUTTON_CLASS =
"flex size-[26px] shrink-0 items-center justify-center rounded-full transition-colors";
const GHOST_FOOTER_BUTTON_CLASS = cn(
FOOTER_BUTTON_CLASS,
"cursor-pointer text-muted-foreground hover:bg-accent hover:text-foreground",
);
const FILLED_FOOTER_BUTTON_CLASS = cn(
FOOTER_BUTTON_CLASS,
"cursor-pointer bg-secondary text-secondary-foreground hover:bg-secondary/80",
);
const INACTIVE_SEND_BUTTON_CLASS = cn(
FOOTER_BUTTON_CLASS,
"cursor-not-allowed bg-secondary text-muted-foreground",
);

// Slash commands only trigger while the "/token" is the entire message.
function matchCommandToken(text: string) {
const match = /^\/([^/\r\n]*)$/.exec(text);
Expand Down Expand Up @@ -878,7 +893,7 @@ export function ComposerBody({
message: "Retry dictation",
})}
onClick={() => void dictationSession.retry()}
className="flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-md bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80"
className={FILLED_FOOTER_BUTTON_CLASS}
>
<RefreshCcwIcon className="size-3.5" />
</button>
Expand All @@ -888,7 +903,7 @@ export function ComposerBody({
message: "Discard recording",
})}
onClick={dictationSession.cancel}
className="flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
className={GHOST_FOOTER_BUTTON_CLASS}
>
<XIcon className="size-3.5" />
</button>
Expand All @@ -898,7 +913,7 @@ export function ComposerBody({
message: "Send message",
})}
disabled
className="flex size-[26px] shrink-0 cursor-not-allowed items-center justify-center rounded-md bg-secondary text-muted-foreground"
className={INACTIVE_SEND_BUTTON_CLASS}
>
<ArrowUpIcon className="size-4" />
</button>
Expand All @@ -916,7 +931,10 @@ export function ComposerBody({
})}
disabled={dictationSession.status === "transcribing"}
onClick={() => void dictationSession.finish()}
className="flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-md bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80 disabled:cursor-default disabled:opacity-50"
className={cn(
FILLED_FOOTER_BUTTON_CLASS,
"disabled:cursor-default disabled:opacity-50",
)}
>
<SquareIcon className="size-3 fill-current" />
</button>
Expand All @@ -926,7 +944,7 @@ export function ComposerBody({
message: "Send message",
})}
disabled
className="flex size-[26px] shrink-0 cursor-not-allowed items-center justify-center rounded-md bg-secondary text-muted-foreground"
className={INACTIVE_SEND_BUTTON_CLASS}
>
<ArrowUpIcon className="size-4" />
</button>
Expand All @@ -946,7 +964,7 @@ export function ComposerBody({
setBrowseOpen(false);
void dictationSession.start();
}}
className="flex size-[26px] cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
className={GHOST_FOOTER_BUTTON_CLASS}
>
<MicIcon className="size-4" />
</button>
Expand All @@ -959,7 +977,7 @@ export function ComposerBody({
message: "Stop response",
})}
onClick={onStop}
className="flex size-[26px] cursor-pointer items-center justify-center rounded-md bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80"
className={FILLED_FOOTER_BUTTON_CLASS}
>
<SquareIcon className="size-3 fill-current" />
</button>
Expand All @@ -971,12 +989,14 @@ export function ComposerBody({
})}
disabled={!canSend}
onClick={() => submit()}
className={cn(
"flex size-[26px] items-center justify-center rounded-md transition-colors",
className={
canSend
? "cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90"
: "cursor-not-allowed bg-secondary text-muted-foreground",
)}
? cn(
FOOTER_BUTTON_CLASS,
"cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90",
)
: INACTIVE_SEND_BUTTON_CLASS
}
>
<ArrowUpIcon className="size-4" />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export function ContextButton({ onClick, disabled }: ContextButtonProps) {
})}
disabled={disabled}
onClick={onClick}
className="flex size-8 cursor-pointer items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted-foreground"
className="flex size-[26px] cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted-foreground"
>
<PlusIcon className="size-4.5" />
<PlusIcon className="size-4" />
</button>
);
}
Loading