mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 16:19:10 +03:00
* chore: cleanup packages - Avoid circular imports - Export API-types as types - pg-format without depending on Node internal Buffer (not browser-compatible) - Avoid importing from barrel files in ui dir * chore: avoid barrel file imports in studio (#27771) * chore: avoid barrel file imports - Removes some unused imports - Avoids barrel file import for faster builds + less memory * add eslint rule * type fixes * delete layouts barrel * delete components/grid barrel file * delete components/grid/utils barrel file * delete components/grid/components/common barrel file * delete components/grid/components/editor barrel file * delete components/grid/components/formatter barrel file * delete components/grid/components/grid barrel file * delete components/grid/components/header/filter barrel file * remote components/grid/store barrel file * remove components/interfaces/Auth/Policies barrel file * delete components/interfaces/Settings/Logs barrel file * delete components/ui/CodeEditor barrel file * delete components/ui/Forms barrel file * delete components/ui/Shimmers barrel file * delete data/analytics barrel file * delete hooks barrel file * cleanup lib/common/fetch barrel file * final * barral files cleanup * global react-data-grid styles * remove console.log --------- Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com> * fix build --------- Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import { useState } from 'react'
|
|
|
|
import AddNewPaymentMethodModal from 'components/interfaces/Billing/Payment/AddNewPaymentMethodModal'
|
|
import InformationBox from 'components/ui/InformationBox'
|
|
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
|
import { getURL } from 'lib/helpers'
|
|
import { Button, IconAlertCircle } from 'ui'
|
|
|
|
const EmptyPaymentMethodWarning = ({
|
|
onPaymentMethodAdded,
|
|
}: {
|
|
onPaymentMethodAdded: () => void
|
|
}) => {
|
|
const selectedOrganization = useSelectedOrganization()
|
|
const slug = selectedOrganization?.slug
|
|
|
|
const [showAddPaymentMethodModal, setShowAddPaymentMethodModal] = useState<boolean>(false)
|
|
|
|
const onLocalPaymentMethodAdded = () => {
|
|
setShowAddPaymentMethodModal(false)
|
|
|
|
return onPaymentMethodAdded()
|
|
}
|
|
|
|
return (
|
|
<div className="mt-4">
|
|
<InformationBox
|
|
icon={<IconAlertCircle size="large" strokeWidth={1.5} />}
|
|
defaultVisibility={true}
|
|
hideCollapse
|
|
title="Your organization has no payment methods"
|
|
description={
|
|
<div className="space-y-3">
|
|
<p className="text-sm leading-normal">
|
|
You need to add a payment method for your organization before creating a paid project.
|
|
</p>
|
|
<Button type="secondary" onClick={() => setShowAddPaymentMethodModal(true)}>
|
|
Add a payment method
|
|
</Button>
|
|
</div>
|
|
}
|
|
/>
|
|
<AddNewPaymentMethodModal
|
|
visible={showAddPaymentMethodModal}
|
|
returnUrl={`${getURL()}/new/${slug}`}
|
|
onCancel={() => setShowAddPaymentMethodModal(false)}
|
|
onConfirm={() => onLocalPaymentMethodAdded()}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default EmptyPaymentMethodWarning
|