pdf-orphan-refresh-button.tsx 669 B

12345678910111213141516171819202122
  1. import { useTranslation } from 'react-i18next'
  2. import { memo, useCallback } from 'react'
  3. import { buildUrlWithDetachRole } from '@/shared/utils/url-helper'
  4. import { useLocation } from '@/shared/hooks/use-location'
  5. import OLButton from '@/features/ui/components/ol/ol-button'
  6. function PdfOrphanRefreshButton() {
  7. const { t } = useTranslation()
  8. const location = useLocation()
  9. const redirect = useCallback(() => {
  10. location.assign(buildUrlWithDetachRole(null).toString())
  11. }, [location])
  12. return (
  13. <OLButton variant="primary" size="sm" onClick={redirect}>
  14. {t('redirect_to_editor')}
  15. </OLButton>
  16. )
  17. }
  18. export default memo(PdfOrphanRefreshButton)