-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛(frontend) hide the sharing method when you don't have the rights
- Added a new hook `useCopyDocLink` to handle copying document links to the clipboard with success/error notifications. - Updated the `DocToolBox`, `DocsGridActions`, and `DocShareModal` components to utilize the new copy link feature. - Enhanced tests to verify the functionality of the copy link button in various scenarios. - Adjusted visibility checks for sharing options based on user access rights.
- Loading branch information
1 parent
de8dea2
commit 601099a
Showing
14 changed files
with
268 additions
and
119 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
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
1 change: 1 addition & 0 deletions
1
src/frontend/apps/impress/src/features/docs/doc-management/hooks/index.ts
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './useCollaboration'; | ||
export * from './useTrans'; | ||
export * from './useCopyDocLink'; |
19 changes: 19 additions & 0 deletions
19
src/frontend/apps/impress/src/features/docs/doc-management/hooks/useCopyDocLink.tsx
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,19 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useClipboard } from '@/hook'; | ||
|
||
import { Doc } from '../types'; | ||
|
||
export const useCopyDocLink = (doc: Doc) => { | ||
const { t } = useTranslation(); | ||
const { copyToClipboard } = useClipboard(); | ||
|
||
const copyDocLink = () => { | ||
copyToClipboard( | ||
`${window.location.origin}/docs/${doc.id}/`, | ||
t('Link Copied !'), | ||
t('Failed to copy link'), | ||
); | ||
}; | ||
return { copyDocLink }; | ||
}; |
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
Oops, something went wrong.