ClockSkewBanner.tsx 940 B

1234567891011121314151617181920212223242526272829303132
  1. import { useEffect, useState } from 'react'
  2. import { HeaderBanner } from '@/components/interfaces/Organization/HeaderBanner'
  3. import { InlineLink } from '@/components/ui/InlineLink'
  4. import { useClockSkewQuery } from '@/data/misc/clock-skew-query'
  5. import { DOCS_URL } from '@/lib/constants'
  6. export const ClockSkewBanner = () => {
  7. const [isClockSkewed, setIsClockSkewed] = useState(false)
  8. const { data } = useClockSkewQuery()
  9. useEffect(() => setIsClockSkewed(!!data), [data])
  10. if (!isClockSkewed) return null
  11. return (
  12. <HeaderBanner
  13. variant="warning"
  14. title="Your computer’s clock appears to be inaccurate"
  15. description={
  16. <>
  17. This can cause issues with certain features.{' '}
  18. <InlineLink
  19. href={`${DOCS_URL}/guides/troubleshooting/jwt-expired-error-in-briven-dashboard-F06k3x`}
  20. >
  21. Learn more
  22. </InlineLink>
  23. </>
  24. }
  25. />
  26. )
  27. }