free trial completed ui

This commit is contained in:
Nate 2024-09-12 14:48:41 -07:00
parent b9c508127d
commit 89478d3fae
3 changed files with 31 additions and 2 deletions

View file

@ -1,15 +1,16 @@
import { ExclamationCircleIcon } from "@heroicons/react/24/outline";
import ReactDOM from "react-dom";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { StyledTooltip, lightGray, vscForeground } from "..";
import AddModelForm from "../../forms/AddModelForm";
import {
setDialogMessage,
setShowDialog,
} from "../../redux/slices/uiStateSlice";
import { getFontSize } from "../../util";
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
import AddModelForm from "../../forms/AddModelForm";
const ProgressBarWrapper = styled.div`
width: 100px;
@ -58,6 +59,27 @@ const ProgressBar = ({ completed, total }: ProgressBarProps) => {
const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
if (completed > total) {
return (
<>
<div
className="flex items-center gap-1 cursor-default"
data-tooltip-id="usage_progress_bar"
>
<ExclamationCircleIcon width="18px" height="18px" color="red" />
Trial limit reached
</div>
{tooltipPortalDiv &&
ReactDOM.createPortal(
<StyledTooltip id="usage_progress_bar" place="top">
Configure a model above in order to continue
</StyledTooltip>,
tooltipPortalDiv,
)}
</>
);
}
return (
<>
<GridDiv

View file

@ -42,7 +42,10 @@ function AddModelForm({
: selectedProvider.apiKeyUrl;
function isDisabled() {
if (selectedProvider.downloadUrl) {
if (
selectedProvider.downloadUrl ||
selectedProvider.provider === "free-trial"
) {
return false;
}

View file

@ -220,6 +220,10 @@ function GUI() {
if (u >= FREE_TRIAL_LIMIT_REQUESTS) {
onboardingCard.open("Best");
posthog?.capture("ftc_reached");
ideMessenger.ide.showToast(
"info",
"You've reached the free trial limit. Please configure a model to continue.",
);
return;
}
} else {