-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supports display license status (#10408)
Co-authored-by: Garfield Dai <[email protected]>
- Loading branch information
1 parent
c2ce2f8
commit 1f87676
Showing
11 changed files
with
186 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client' | ||
|
||
import AppContext from '@/context/app-context' | ||
import { LicenseStatus } from '@/types/feature' | ||
import { useTranslation } from 'react-i18next' | ||
import { useContextSelector } from 'use-context-selector' | ||
import dayjs from 'dayjs' | ||
|
||
const LicenseNav = () => { | ||
const { t } = useTranslation() | ||
const systemFeatures = useContextSelector(AppContext, s => s.systemFeatures) | ||
|
||
if (systemFeatures.license?.status === LicenseStatus.EXPIRING) { | ||
const expiredAt = systemFeatures.license?.expired_at | ||
const count = dayjs(expiredAt).diff(dayjs(), 'days') | ||
return <div className='px-2 py-1 mr-4 rounded-full bg-util-colors-orange-orange-50 border-util-colors-orange-orange-100 system-xs-medium text-util-colors-orange-orange-600'> | ||
{count <= 1 && <span>{t('common.license.expiring', { count })}</span>} | ||
{count > 1 && <span>{t('common.license.expiring_plural', { count })}</span>} | ||
</div> | ||
} | ||
if (systemFeatures.license.status === LicenseStatus.ACTIVE) { | ||
return <div className='px-2 py-1 mr-4 rounded-md bg-util-colors-indigo-indigo-50 border-util-colors-indigo-indigo-100 system-xs-medium text-util-colors-indigo-indigo-600'> | ||
Enterprise | ||
</div> | ||
} | ||
return null | ||
} | ||
|
||
export default LicenseNav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters