Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Show share synchronization as a minor action (Part 1) #3250

Merged
merged 12 commits into from
Nov 22, 2024
18 changes: 15 additions & 3 deletions src/modules/actions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ export const hr = () => {
}
}

export const trash = ({ t, pushModal, popModal, hasWriteAccess, refresh }) => {
const label = t('SelectionBar.trash')
export const trash = ({
t,
pushModal,
popModal,
hasWriteAccess,
refresh,
byDocId,
isOwner
}) => {
const icon = TrashIcon

return {
name: 'trash',
label,
Merkur39 marked this conversation as resolved.
Show resolved Hide resolved
icon,
displayCondition: () => hasWriteAccess,
action: files =>
Expand All @@ -87,6 +93,12 @@ export const trash = ({ t, pushModal, popModal, hasWriteAccess, refresh }) => {
/>
),
Component: forwardRef(function Trash(props, ref) {
const sharedWithMe =
byDocId !== undefined &&
byDocId[props.docs[0].id] &&
!isOwner(props.docs[0].id)
const label = sharedWithMe ? t('toolbar.leave') : t('SelectionBar.trash')

return (
<ActionsMenuItem {...props} ref={ref}>
<ListItemIcon>
Expand Down
7 changes: 5 additions & 2 deletions src/modules/views/Drive/DriveFolderView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ const DriveFolderView = () => {
const { isMobile } = useBreakpoints()
const { t, lang } = useI18n()
const { isFabDisplayed, setIsFabDisplayed } = useContext(FabContext)
const { allLoaded, hasWriteAccess, refresh } = useSharingContext()
const { allLoaded, hasWriteAccess, refresh, isOwner, byDocId } =
useSharingContext()
const client = useClient()
const vaultClient = useVaultClient()
const { pushModal, popModal } = useModalContext()
Expand Down Expand Up @@ -156,7 +157,9 @@ const DriveFolderView = () => {
canMove: true,
isPublic: false,
allLoaded,
showAlert
showAlert,
Merkur39 marked this conversation as resolved.
Show resolved Hide resolved
isOwner,
byDocId
}
const actions = makeActions(
[
Expand Down