:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { useActions, useValues } from 'kea'
import { TeamMembershipLevel } from 'lib/constants'
import { teamLogic } from 'scenes/teamLogic'
import { SceneSection } from '~/layout/scenes/components/SceneSection'
import { CurrencyCode } from '~/queries/schema/schema-general'
import { RestrictionScope, useRestrictedArea } from '../RestrictedArea'
import { CurrencyDropdown } from './CurrencyDropdown'
interface BaseCurrencyProps {
hideTitle?: boolean
disabledReason?: string
}
export function BaseCurrency({ hideTitle = false, disabledReason }: BaseCurrencyProps): JSX.Element {
const { currentTeam } = useValues(teamLogic)
const { updateCurrentTeam } = useActions(teamLogic)
const restrictedReason = useRestrictedArea({
scope: RestrictionScope.Project,
minimumAccessLevel: TeamMembershipLevel.Admin,
})
return (
<SceneSection
title={!hideTitle ? 'Base currency' : undefined}
description="PostHog will convert all currency values for the entire team to this currency before displaying them to you. If we can't properly detect your currency, we'll assume it's in this currency as well."
>
<div>
<CurrencyDropdown
value={currentTeam?.base_currency || null}
onChange={(currency: CurrencyCode | null) => {
updateCurrentTeam({ base_currency: currency ?? undefined })
}}
disabledReason={disabledReason ?? restrictedReason ?? undefined}
/>
</div>
</SceneSection>
)
}