Skip to content
4 changes: 4 additions & 0 deletions app/src/components/channels/composer/composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from "react";
import { attachmentModality } from "@/components/channels/chat-messages";
import { IconWaveform } from "@/components/icons/waveform";
import { TrialNote } from "@/components/plan/trial-note";
import { useTouchTyping } from "@/hooks/use-touch-typing";
import {
attachmentAddress,
Expand Down Expand Up @@ -2092,6 +2093,8 @@ export function Composer({
</div>
</DictationSurface>
</form>
{/* Under the box once most of the free trial is used: components/plan/trial-note.tsx. */}
<TrialNote />
</div>
);
}
Expand Down Expand Up @@ -2191,6 +2194,7 @@ export function Composer({
</div>
</DictationSurface>
</form>
<TrialNote />
{/* The notice's invisible copy, below the box: see above. Hidden from everyone and inert. */}
<div
aria-hidden="true"
Expand Down
38 changes: 31 additions & 7 deletions app/src/components/organizations/organization-settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import {
employeePaysForOthers,
employeeTrialUsedUp,
organizationNeedsCard,
trialRunningLow,
usePlan,
} from "@/lib/plan/queries";
import {
Expand All @@ -86,6 +87,7 @@ import {
OTHERS_NEED_A_CARD,
planSummary,
trialUsed,
WHEN_USED_UP,
} from "@/lib/plan/words";
import { cn } from "@/lib/utils";
import { queryClient } from "@/query-client";
Expand Down Expand Up @@ -201,9 +203,10 @@ function NameRow({
* divider, where no plan is needed or while it is read.
*
* On the free trial it shows how much of it is used, as a bar and a percentage
* (`freeRunsUsedPercent`, the person's own share). Never a count or a limit: the server sends
* neither while runs are left. A CopilotKit employee who has used it all keeps the full bar, with
* the line that says their runs are free.
* (`freeRunsUsedPercent`, the person's own share), and a line on what happens at 100%. Never a
* count or a limit: the server sends neither while runs are left. From 80% used it offers the card
* under the bar, where the server sent the way to add one (`addCardUrl`). A CopilotKit employee
* who has used it all keeps the full bar, with the line that says their runs are free.
*/
function PlanRow() {
const plan = usePlan();
Expand All @@ -223,15 +226,21 @@ function PlanRow() {
</ItemMedia>
<ItemContent className="min-w-0">
<ItemTitle>Plan</ItemTitle>
<Progress className="mt-0.5 gap-x-3 gap-y-2" value={used}>
<ProgressLabel className="font-normal text-muted-foreground text-xs">
{/* The primitive's own bar, with the row's own text size. */}
<Progress className="mt-1 gap-x-3 gap-y-2" value={used}>
<ProgressLabel className="font-normal text-muted-foreground">
Free trial
</ProgressLabel>
<ProgressValue className="text-xs">
<ProgressValue className="text-foreground">
{() => trialUsed(used)}
</ProgressValue>
</Progress>
{employeeTrialUsedUp(plan) ? (
{/* An employee's runs never pause: they get their own line once it is all used. */}
{plan.copilotKitEmployee !== true ? (
<ItemDescription className="mt-1.5 line-clamp-none">
{WHEN_USED_UP}
</ItemDescription>
) : employeeTrialUsedUp(plan) ? (
<ItemDescription className="mt-1.5 line-clamp-none">
{COPILOTKIT_EMPLOYEE_LINE}
</ItemDescription>
Expand All @@ -257,6 +266,21 @@ function PlanRow() {
</a>
</>
) : null}
{/*
* Once most of it is used, where the server sent the way to add a card. Under the bar,
* as the employee's button is, so the bar keeps its width in a narrow window.
*/}
{trialRunningLow(plan) && plan.addCardUrl ? (
<a
className={cn(
buttonVariants({ size: "sm", variant: "outline" }),
"mt-2 self-start",
)}
href={plan.addCardUrl}
>
{cardAction(plan)}
</a>
) : null}
</ItemContent>
</Item>
</>
Expand Down
Loading
Loading