The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Shows an upgrade prompt if user goes beyond 7 days
Terry Suttoneb14a479f0cf
diff --git a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsxindex b7b7a71a90c..e46d992789b 100644--- a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx+++ b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx@@ -9,12 +9,17 @@ import { useProjectSubscription } from 'hooks'interface Props {projectRef: stringfrom: string+ showUpgradePrompt: boolean+ setShowUpgradePrompt: (showUpgradePrompt: boolean) => void}-const UpgradePrompt: React.FC<Props> = ({ projectRef, from }) => {- const [showHelperModal, setShowHelperModal] = useState(false)+const UpgradePrompt: React.FC<Props> = ({+ projectRef,+ from,+ showUpgradePrompt,+ setShowUpgradePrompt,+}) => {const { subscription, isLoading, isError } = useProjectSubscription(projectRef)-if (isLoading) return <IconLoader size={16} className="animate-spin" />if (isError) console.error('Error fetching project subscription')@@ -27,33 +32,13 @@ const UpgradePrompt: React.FC<Props> = ({ projectRef, from }) => {return (<>- <div- className={`flex flex-row items-center gap-3 px-2 py-1 text-xs transition-all ${- isExceedingLimit- ? 'text-yellow-1100 rounded border border-yellow-700 bg-yellow-200 font-semibold'- : ''- }`}- >- <span className="text-scale-1100">{`${queryLimit.text} retention`}</span>- <IconHelpCircle- size={16}- strokeWidth={1.5}- className="text-scale-1100 hover:text-scale-1200 cursor-pointer transition"- onClick={() => setShowHelperModal(true)}- />- {queryLimit.promptUpgrade && (- <Link href={`/project/${projectRef}/settings/billing`}>- <Button size="tiny">Upgrade</Button>- </Link>- )}- </div>-<ModalhideFooter- visible={showHelperModal}+ visible={showUpgradePrompt}+ closablesize="medium"header="Log retention"- onCancel={() => setShowHelperModal(false)}+ onCancel={() => setShowUpgradePrompt(false)}><div className="space-y-4 py-4"><Modal.Content>@@ -87,10 +72,14 @@ const UpgradePrompt: React.FC<Props> = ({ projectRef, from }) => {</Modal.Content><Modal.Seperator /><Modal.Content>- <div className="flex items-center gap-2">- <Button block type="primary" onClick={() => setShowHelperModal(false)}>- Understood+ <div className="flex justify-between">+ <Button type="default" onClick={() => setShowUpgradePrompt(false)}>+ Close</Button>++ <Link href={`/project/${projectRef}/settings/billing`}>+ <Button size="tiny">Upgrade</Button>+ </Link></div></Modal.Content></div>diff --git a/studio/pages/project/[ref]/logs-explorer/index.tsx b/studio/pages/project/[ref]/logs-explorer/index.tsxindex ee1a2c1d963..9dd164d9656 100644--- a/studio/pages/project/[ref]/logs-explorer/index.tsx+++ b/studio/pages/project/[ref]/logs-explorer/index.tsx@@ -23,6 +23,7 @@ import { NextPageWithLayout, UserContent } from 'types'import toast from 'react-hot-toast'import dayjs from 'dayjs'import UpgradePrompt from 'components/interfaces/Settings/Logs/UpgradePrompt'+import { useProjectSubscription } from 'hooks'export const LogsExplorerPage: NextPageWithLayout = () => {const router = useRouter()@@ -31,7 +32,11 @@ export const LogsExplorerPage: NextPageWithLayout = () => {const [editorValue, setEditorValue] = useState<string>('')const [saveModalOpen, setSaveModalOpen] = useState<boolean>(false)const [warnings, setWarnings] = useState<LogsWarning[]>([])+ const [showUpgradePrompt, setShowUpgradePrompt] = useState<boolean>(false)+const { content } = useStore()+ const { subscription } = useProjectSubscription(ref as string)+ const tier = subscription?.tierconst [{ params, logData, error, isLoading }, { changeQuery, runQuery, setParams }] =useLogsQuery(ref as string, {@@ -106,6 +111,11 @@ export const LogsExplorerPage: NextPageWithLayout = () => {}const handleDateChange = ({ to, from }: DatePickerToFrom) => {+ if (tier?.key === 'FREE') {+ setShowUpgradePrompt(!showUpgradePrompt)+ return+ }+setParams((prev) => ({...prev,iso_timestamp_start: from || '',@@ -135,7 +145,6 @@ export const LogsExplorerPage: NextPageWithLayout = () => {isLoading={isLoading}warnings={warnings}/>-<div className="h-48 min-h-[7rem]"><ShimmerLine active={isLoading} /><CodeEditor@@ -154,7 +163,12 @@ export const LogsExplorerPage: NextPageWithLayout = () => {</div></LoadingOpacity><div className="mt-2 flex flex-row justify-end">- <UpgradePrompt projectRef={ref as string} from={params.iso_timestamp_start || ''} />+ <UpgradePrompt+ projectRef={ref as string}+ from={params.iso_timestamp_start || ''}+ showUpgradePrompt={showUpgradePrompt}+ setShowUpgradePrompt={setShowUpgradePrompt}+ /></div></div></div>