Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Avatar from '@polar-sh/ui/components/atoms/Avatar'
import { useThemePreset } from '@polar-sh/ui/hooks/theming'
import { twMerge } from 'tailwind-merge'
import { Navigation } from './Navigation'
import { Toaster } from '@/components/Toast/Toaster'

export default async function Layout({
params,
Expand Down Expand Up @@ -52,6 +53,7 @@ export default async function Layout({
<div className="flex min-h-screen w-full flex-col items-stretch gap-6 px-4 py-8 md:mx-auto md:max-w-5xl md:flex-row md:gap-12 lg:px-0">
<Navigation organization={organization} themePreset={themePreset} />
<div className="flex w-full flex-col md:py-12">{children}</div>
<Toaster />
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { twMerge } from 'tailwind-merge'
import { Modal } from '../Modal'
import { useModal } from '../Modal/useModal'
import { Well, WellContent, WellHeader } from '../Shared/Well'
import { useToast } from '../Toast/use-toast'
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
import { AddPaymentMethodModal } from './AddPaymentMethodModal'
import EditBillingDetails from './EditBillingDetails'
import PaymentMethod from './PaymentMethod'
Expand All @@ -37,6 +39,10 @@ export const CustomerPortalSettings = ({
} = useModal()
const { data: customer } = useAuthenticatedCustomer(api)
const { data: paymentMethods } = useCustomerPaymentMethods(api)
const { toast } = useToast()
const router = useRouter()
const pathname = usePathname()
const searchParams = useSearchParams()

const theme = useTheme()
const themingPreset = useThemePreset(
Expand Down Expand Up @@ -102,6 +108,12 @@ export const CustomerPortalSettings = ({
customer={customer}
onSuccess={() => {
revalidate(`customer_portal`)
const newSearchParams = new URLSearchParams(searchParams.toString())
newSearchParams.set('toast', 'true')
newSearchParams.set('status', 'Details updated')
newSearchParams.set('status_description', 'Your billing details have been updated')
const redirectPath = `${pathname}?${newSearchParams.toString()}`
router.replace(redirectPath, { scroll: false })
}}
themingPreset={themingPreset}
/>
Expand Down