diff --git a/web/app/components/header/license-env/index.tsx b/web/app/components/header/license-env/index.tsx
index 800d86d2b8..ca396db37a 100644
--- a/web/app/components/header/license-env/index.tsx
+++ b/web/app/components/header/license-env/index.tsx
@@ -5,6 +5,8 @@ import { LicenseStatus } from '@/types/feature'
import { useTranslation } from 'react-i18next'
import { useContextSelector } from 'use-context-selector'
import dayjs from 'dayjs'
+import PremiumBadge from '../../base/premium-badge'
+import { RiHourglass2Fill } from '@remixicon/react'
const LicenseNav = () => {
const { t } = useTranslation()
@@ -13,15 +15,16 @@ const LicenseNav = () => {
if (systemFeatures.license?.status === LicenseStatus.EXPIRING) {
const expiredAt = systemFeatures.license?.expired_at
const count = dayjs(expiredAt).diff(dayjs(), 'days')
- return
- {count <= 1 && {t('common.license.expiring', { count })}}
- {count > 1 && {t('common.license.expiring_plural', { count })}}
-
+ return
+
+ {count <= 1 && {t('common.license.expiring', { count })}}
+ {count > 1 && {t('common.license.expiring_plural', { count })}}
+
}
if (systemFeatures.license.status === LicenseStatus.ACTIVE) {
- return
- Enterprise
-
+ return
+ Enterprise
+
}
return null
}
diff --git a/web/app/components/header/plan-badge/index.tsx b/web/app/components/header/plan-badge/index.tsx
new file mode 100644
index 0000000000..5068e2da95
--- /dev/null
+++ b/web/app/components/header/plan-badge/index.tsx
@@ -0,0 +1,70 @@
+import { useProviderContext } from '@/context/provider-context'
+import classNames from '@/utils/classnames'
+import type { FC } from 'react'
+import { useTranslation } from 'react-i18next'
+import { SparklesSoft } from '../../base/icons/src/public/common'
+import PremiumBadge from '../../base/premium-badge'
+import { Plan } from '../../billing/type'
+
+type PlanBadgeProps = {
+ plan: Plan
+ size?: 's' | 'm'
+ allowHover?: boolean
+ sandboxAsUpgrade?: boolean
+ onClick?: () => void
+}
+
+const PlanBadge: FC
= ({ plan, allowHover, size = 'm', sandboxAsUpgrade = false, onClick }) => {
+ const { isFetchedPlan } = useProviderContext()
+ const { t } = useTranslation()
+
+ if (!isFetchedPlan) return null
+ if (plan === Plan.sandbox && sandboxAsUpgrade) {
+ return
+
+
+
+
+ {t('billing.upgradeBtn.encourageShort')}
+
+
+
+
+ }
+ if (plan === Plan.sandbox) {
+ return
+ }
+ if (plan === Plan.professional) {
+ return
+ }
+ if (plan === Plan.team) {
+ return
+ }
+ return null
+}
+
+export default PlanBadge