diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index aa427b7..dc00701 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -4,6 +4,7 @@ import Link from "next/link";
import { Show, UserButton } from "@clerk/nextjs";
import { isDemoMode } from "../utils/demoContext";
+import { TrialDetails } from "./TrialDetails";
const Navbar = () => {
return (
@@ -42,6 +43,7 @@ const Navbar = () => {
) : (
+
)}
diff --git a/src/components/TrialDetails.tsx b/src/components/TrialDetails.tsx
new file mode 100644
index 0000000..7352eff
--- /dev/null
+++ b/src/components/TrialDetails.tsx
@@ -0,0 +1,39 @@
+import { TrialPill, useTrialPill } from "@schematichq/schematic-components";
+import { useSchematicPlan } from "@schematichq/schematic-react";
+
+export const TrialDetails = () => {
+ const plan = useSchematicPlan();
+ const trial = useTrialPill({
+ trialEndDate: plan?.trialEndDate,
+ trialStatus: plan?.trialStatus,
+ });
+
+ return (
+
+ {plan?.name}
+
+ {plan?.trialEndDate && (
+
+ Trial ends in {trial.endDateLabel}
+
+ )}
+
+
+
+ );
+};
diff --git a/src/components/UsageDetails.tsx b/src/components/UsageDetails.tsx
new file mode 100644
index 0000000..c3970ea
--- /dev/null
+++ b/src/components/UsageDetails.tsx
@@ -0,0 +1,50 @@
+import { UsageMeter } from "@schematichq/schematic-components";
+
+interface UsageDetailsProps {
+ value?: number;
+ max?: number;
+}
+
+export const UsageDetails = ({ value = 0, max = 0 }: UsageDetailsProps) => {
+ const percent = (value / max) * 100;
+
+ return (
+
+ {value > 0 && max > 0 && (
+
+
+
+ )}
+
+
+ {value} / {max || "?"} used
+
+
+
+
+ );
+};
diff --git a/src/components/Weather.tsx b/src/components/Weather.tsx
index 5ae47da..dfcc603 100644
--- a/src/components/Weather.tsx
+++ b/src/components/Weather.tsx
@@ -13,6 +13,7 @@ import {
import useSavedLocations from "../hooks/useSavedLocations";
import Loader from "./Loader";
+import { UsageDetails } from "./UsageDetails";
interface WeatherData {
description: string;
@@ -61,6 +62,7 @@ const Weather: React.FC = () => {
const { track } = useSchematicEvents();
const schematicIsPending = useSchematicIsPending();
const humidityFlag = useSchematicFlag("humidity");
+ const weatherSearch = useSchematicEntitlement("weather-search");
const {
featureAllocation: weatherSearchAllocation,
featureUsage: weatherSearchUsage,
@@ -68,7 +70,7 @@ const Weather: React.FC = () => {
featureUsagePeriod: weatherSearchUsagePeriod,
featureUsageResetAt: weatherSearchUsageResetAt,
value: weatherSearchFlag,
- } = useSchematicEntitlement("weather-search");
+ } = weatherSearch;
const windSpeedFlag = useSchematicFlag("wind-speed");
const addPinnedLocationFlag = useSchematicFlag("pinned-locations");
const savedLocations = useSavedLocations();
@@ -225,13 +227,14 @@ const Weather: React.FC = () => {
)}
- {!schematicIsPending &&
- typeof weatherSearchUsage !== "undefined" &&
- typeof weatherSearchAllocation !== "undefined" && (
-
- {weatherSearchUsage} / {weatherSearchAllocation} used
-
- )}
+ {!schematicIsPending && (
+
+
+
+ )}
{
font-family: "Helvetica Neue", Arial, sans-serif;
position: relative;
}
- .usage-pill {
+ .usage-floater {
float: right;
background-color: rgba(0, 0, 0, 0.4);
color: rgba(255, 255, 255, 0.9);