From 3a0e0a90855521b3c55e6e244c4d8cd9c7901edb Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Sun, 21 Apr 2024 22:10:41 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20front:=20WIP=20Implementation=20?= =?UTF-8?q?of=20the=20design=20for=20the=20share=20link=20portion=20(#50)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tdrive/frontend/public/locales/en.json | 18 +- tdrive/frontend/public/locales/fr.json | 15 +- tdrive/frontend/public/locales/ru.json | 15 +- tdrive/frontend/public/locales/vn.json | 15 +- .../modals/public-link/expiry-editor-row.tsx | 189 ++++++++++++++++++ .../body/drive/modals/public-link/index.tsx | 120 ++++++++++- .../public-link/password-editor-row.tsx | 168 ++++++++++++++++ .../public-link-access-options.tsx | 134 ++----------- .../modals/public-link/public-link-access.tsx | 7 +- .../body/drive/modals/public-link/styles.ts | 7 + .../body/drive/modals/update-access/index.tsx | 40 +--- 11 files changed, 561 insertions(+), 167 deletions(-) create mode 100644 tdrive/frontend/src/app/views/client/body/drive/modals/public-link/expiry-editor-row.tsx create mode 100644 tdrive/frontend/src/app/views/client/body/drive/modals/public-link/password-editor-row.tsx create mode 100644 tdrive/frontend/src/app/views/client/body/drive/modals/public-link/styles.ts diff --git a/tdrive/frontend/public/locales/en.json b/tdrive/frontend/public/locales/en.json index 33b0a1c6..4ebe5722 100644 --- a/tdrive/frontend/public/locales/en.json +++ b/tdrive/frontend/public/locales/en.json @@ -204,12 +204,24 @@ "components.public-link-get" : "Create link", "components.public-link-copy" : "Copy link", "components.public-link-access-level-create" : "Anyone with the link will have access to", - "components.public-link-access-level-update" : "Anyone with the link has access to", + "components.public-link-access-level-update-subtitle" : "Anyone with the link has access to", "components.public-link-access-level-delete" : "Delete link", - "components.public-link-security": "Public link security", + "components.public-link-security-title": "Share with link", + "components.public-link-security": "Link security settings", + "components.public-link-security-change": "Change", + "components.public-link-security-change-subtitle": "Set password, expiration date, etc.", "components.public-link-security_password": "Password", "components.public-link-security_password_copied": "Password copied to clipboard", - "components.public-link-security_expired": "Expiration", + "components.public-link-security_password_removal_title": "About to remove password", + "components.public-link-security_password_removal_body": "Warning: about to remove the password on the public link making available to anyone knowing it", + "components.public-link-security_password_removal_confirm": "Remove password", + "components.public-link-security_expired": "Expired", + "components.public-link-security_field_confirm_edit": "Done", + "components.public-link-security_expiration_title": "Link expiration", + "components.public-link-security_expiration_removal_title": "About to remove expiry date of an expired link", + "components.public-link-security_expiration_removal_no_password": "Warning: about to remove the expiry on the public link making available to anyone knowing it", + "components.public-link-security_expiration_removal_but_password": "Warning: about to remove the expiry on the public link making available to anyone with the password", + "components.public-link-security_expiration_removal_confirm": "Remove expiration", "components.internal-access_access_manage":"General access management", "components.internal-access_inherit_parent":"Inherit parent folder", "components.internal-access_inherit_parent_perm":"Choose to inherit or not the parent folder permissions.", diff --git a/tdrive/frontend/public/locales/fr.json b/tdrive/frontend/public/locales/fr.json index 227697a4..d8f971aa 100644 --- a/tdrive/frontend/public/locales/fr.json +++ b/tdrive/frontend/public/locales/fr.json @@ -182,7 +182,20 @@ "components.public-link-security": "Sécurité du lien public", "components.public-link-security_password": "Mot de passe", "components.public-link-security_password_copied": "Mot de passe copié dans le presse-papiers", - "components.public-link-security_expired": "Expiration", + "components.public-link-security_expired": "Expiré", + "components.public-link-security_expiration_title": "Expiration du lien", + "components.public-link-security_expiration_removal_title": "À propos de la suppression de la date d'expiration d'un lien expiré", + "components.public-link-security_expiration_removal_no_password": "Attention : sur le point de supprimer l'expiration du lien public, rendant celui-ci accessible à quiconque le connaît", + "components.public-link-security_expiration_removal_but_password": "Attention : sur le point de supprimer l'expiration du lien public, rendant celui-ci accessible à quiconque possède le mot de passe", + "components.public-link-security_expiration_removal_confirm": "Supprimer l'expiration", + "components.public-link-security_field_confirm_edit": "Terminé", + "components.public-link-security_password_removal_title": "À propos de la suppression du mot de passe", + "components.public-link-security_password_removal_body": "Attention : sur le point de supprimer le mot de passe du lien public, le rendant accessible à quiconque le connaît", + "components.public-link-security_password_removal_confirm": "Supprimer le mot de passe", + "components.public-link-access-level-update-subtitle": "Toute personne disposant du lien y a accès à", + "components.public-link-security-change": "Modifier", + "components.public-link-security-change-subtitle": "Définir le mot de passe, la date d'expiration, etc.", + "components.public-link-security-title": "Partager avec un lien", "components.internal-access_access_manage": "Gestion générale des accès", "components.internal-access_inherit_parent": "Hériter du dossier parent", "components.internal-access_inherit_parent_perm": "Hériter des permissions du dossier parent", diff --git a/tdrive/frontend/public/locales/ru.json b/tdrive/frontend/public/locales/ru.json index ab5037b7..34ab655d 100644 --- a/tdrive/frontend/public/locales/ru.json +++ b/tdrive/frontend/public/locales/ru.json @@ -179,10 +179,23 @@ "components.public-link-copied-info" : "Ссылка скопирована", "components.public-link-get" : "Создать ссылку", "components.public-link-copy" : "Копировать ссылку", - "components.public-link-security": "Public link security", "components.public-link-security_password": "Password", "components.public-link-security_password_copied": "Password copied to clipboard", "components.public-link-security_expired": "Expiration", + "components.public-link-security_expiration_title": "Истечение срока действия ссылки", + "components.public-link-security_expiration_removal_title": "О удалении срока действия истекшей ссылки", + "components.public-link-security_expiration_removal_no_password": "Предупреждение: о удалении срока действия общедоступной ссылки, что делает её доступной для любого, кто знает её", + "components.public-link-security_expiration_removal_but_password": "Предупреждение: о удалении срока действия общедоступной ссылки, что делает её доступной для любого, кто знает пароль", + "components.public-link-security_expiration_removal_confirm": "Удалить срок действия", + "components.public-link-security_field_confirm_edit": "Готово", + "components.public-link-security_password_removal_title": "О удалении пароля", + "components.public-link-security_password_removal_body": "Предупреждение: о удалении пароля с общедоступной ссылки, что делает её доступной для любого, кто знает её", + "components.public-link-security_password_removal_confirm": "Удалить пароль", + "components.public-link-access-level-update-subtitle": "У каждого, кто имеет ссылку, есть доступ к", + "components.public-link-security": "Настройки безопасности ссылки", + "components.public-link-security-change": "Изменить", + "components.public-link-security-change-subtitle": "Установить пароль, срок действия и т.д.", + "components.public-link-security-title": "Поделиться ссылкой", "components.internal-access_access_manage":"General access management", "components.internal-access_inherit_parent":"Inherit parent folder", "components.internal-access_inherit_parent_perm":"Choose to inherit or not the parent folder permissions.", diff --git a/tdrive/frontend/public/locales/vn.json b/tdrive/frontend/public/locales/vn.json index f4d9045c..5dfb0597 100644 --- a/tdrive/frontend/public/locales/vn.json +++ b/tdrive/frontend/public/locales/vn.json @@ -195,10 +195,23 @@ "components.public-link-copied-info": "Đã sao chép liên kết", "components.public-link-get" : "Tạo đường link", "components.public-link-copy": "Sao chép đường dẫn", - "components.public-link-security": "Bảo mật liên kết công khai", "components.public-link-security_password": "Mật khẩu", "components.public-link-security_password_copied": "Mật khẩu đã được sao chép vào khay nhớ tạm", "components.public-link-security_expired": "Hết hạn", + "components.public-link-security_expiration_title": "Hết hạn liên kết", + "components.public-link-security_expiration_removal_title": "Về việc xóa ngày hết hạn của một liên kết đã hết hạn", + "components.public-link-security_expiration_removal_no_password": "Cảnh báo: về việc xóa ngày hết hạn của liên kết công cộng, khiến nó có sẵn cho bất kỳ ai biết nó", + "components.public-link-security_expiration_removal_but_password": "Cảnh báo: về việc xóa ngày hết hạn của liên kết công cộng, khiến nó có sẵn cho bất kỳ ai có mật khẩu", + "components.public-link-security_expiration_removal_confirm": "Xóa hết hạn", + "components.public-link-security_field_confirm_edit": "Hoàn tất", + "components.public-link-security_password_removal_title": "Về việc xóa mật khẩu", + "components.public-link-security_password_removal_body": "Cảnh báo: về việc xóa mật khẩu của liên kết công cộng, khiến nó có sẵn cho bất kỳ ai biết nó", + "components.public-link-security_password_removal_confirm": "Xóa mật khẩu", + "components.public-link-access-level-update-subtitle": "Bất kỳ ai có liên kết đều có quyền truy cập vào", + "components.public-link-security": "Cài đặt bảo mật liên kết", + "components.public-link-security-change": "Thay đổi", + "components.public-link-security-change-subtitle": "Thiết lập mật khẩu, ngày hết hạn, vv.", + "components.public-link-security-title": "Chia sẻ với liên kết", "components.internal-access_access_manage": "Quản lý quyền truy cập chung", "components.internal-access_inherit_parent": "Thừa hưởng từ thư mục cha", "components.internal-access_inherit_parent_perm": "Chọn có thừa hưởng quyền của thư mục cha hay không.", diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/expiry-editor-row.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/expiry-editor-row.tsx new file mode 100644 index 00000000..d41da38e --- /dev/null +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/expiry-editor-row.tsx @@ -0,0 +1,189 @@ +import moment from 'moment'; +import 'moment/min/locales'; + +import { useEffect, useRef, useState } from 'react'; +import { uniqueId } from 'lodash'; + +import Languages from 'features/global/services/languages-service'; + +import BaseBlock from '@molecules/grouped-rows/base'; +import { Base, Info } from '@atoms/text'; +import { Input } from 'app/atoms/input/input-text'; +import { CheckboxSlider } from 'app/atoms/input/input-checkbox-slider'; +import { Button } from 'app/atoms/button/button'; +import { ShieldExclamationIcon, CalendarIcon, PencilAltIcon } from '@heroicons/react/outline'; +import { Modal, ModalContent } from 'app/atoms/modal'; + +import Styles from './styles'; + +export const ExpiryEditorRow = (props: { + disabled?: boolean; + value: number; + isLinkPasswordProtected: boolean; + onChange: (value: number) => Promise; +}) => { + const [isEditing, setIsEditing] = useState(false); + const [currentEditedValue, setCurrentEditedValue] = useState(0); + const [isWaitingForSave, setIsWaitingForSave] = useState(false); + const [isConfirmingExpiryRemoval, setIsConfirmingExpiryRemoval] = useState(false); + + const inputRef = useRef(null); + const [chkExpiryId] = useState(uniqueId("chk")); + + const disabled = props.disabled || isWaitingForSave; + + useEffect(() => { + if (!isEditing || !inputRef.current) return; + let timeout: NodeJS.Timeout | null = setTimeout(() => { + timeout = null; + inputRef.current?.focus(); + }, 10); + return () => { + if (timeout) clearTimeout(timeout); + timeout = null; + } + }, [ isEditing ]) + + function saveValue(value: number) { + setIsWaitingForSave(true); + props. + onChange(value). + then( + () => { + setIsWaitingForSave(false); + setIsEditing(false); + }, + (e: unknown) => { + console.error("Error while saving expiry date:", e); + setIsWaitingForSave(false); + }, + ); + } + + function confirmSaveExpiry(expiry: number) { + if (expiry === props.value) { + setIsEditing(false); + return; + } + if (expiry == 0 && (props.value > 0 && props.value < Date.now())) + setIsConfirmingExpiryRemoval(true); + else + saveValue(expiry); + } + + function expirationDate(exp: moment.MomentInput) { + moment.locale(Languages.getLanguage()); + return moment(exp).fromNow(true).toLocaleString(); + } + + return <> + } + title={ + + + {!!props.value && !isEditing && + <> + { + if (!disabled) { + setCurrentEditedValue(props.value); + setIsEditing(true); + } + return false; + }} + > + + + + {(currentEditedValue || props.value) <= Date.now() + ? + ({Languages.t('components.public-link-security_expired')}) + + : ({expirationDate(currentEditedValue || props.value)}) + }{' '} + + } + + } + subtitle={''} + suffix={isEditing + ? <> + e.target.value && setCurrentEditedValue(new Date(e.target.value).getTime())} + onKeyUp={e => { + if (e.key == 'Escape') + setIsEditing(false); + else if (e.key == 'Enter') + confirmSaveExpiry(currentEditedValue); + }} + /> + + + : { + if (checked) { + setIsEditing(checked); + if (checked && !currentEditedValue) + setCurrentEditedValue(props.value || moment().add(7, 'days').unix() * 1000); + } else + confirmSaveExpiry(0); + }} + /> + } + /> + + setIsConfirmingExpiryRemoval(false)}> + + + + + } + /> + + ; +} \ No newline at end of file diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/index.tsx index 3c417963..f5b507cb 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/index.tsx @@ -1,13 +1,21 @@ import { atom, useRecoilState } from 'recoil'; import { useState, useEffect } from 'react'; -import { useDriveItem } from '@features/drive/hooks/use-drive-item'; -import { useCurrentCompany } from '@features/companies/hooks/use-companies'; import Languages from 'features/global/services/languages-service'; +import { useDriveItem, getPublicLink } from '@features/drive/hooks/use-drive-item'; +import { useCurrentCompany } from '@features/companies/hooks/use-companies'; import { changePublicLink, hasAnyPublicLinkAccess } from '@features/files/utils/access-info-helpers'; +import type { DriveFileAccessLevel } from '@features/drive/types'; +import A from '@atoms/link'; import { Subtitle } from '@atoms/text'; +import { LockClosedIcon, EyeIcon, PencilIcon, ScaleIcon, EyeOffIcon } from '@heroicons/react/outline'; import { Modal, ModalContent } from '@atoms/modal'; +import { PublicLinkAccessOptions } from '../public-link/public-link-access-options'; +import BaseBlock from '@molecules/grouped-rows/base'; +import { AccessLevelDropdown, translateAccessLevel } from '../../components/access-level-dropdown'; +import { CopyLinkButton } from './copy-link-button'; +import Styles from './styles'; export type PublicLinkModalType = { open: boolean; @@ -30,6 +38,7 @@ export const PublicLinkModal = () => { { + setIsOnAdvancedScreen(false); setState({ ...state, open: false }); }} > @@ -43,6 +52,61 @@ export const PublicLinkModal = () => { ); }; +const ChangePublicLinkAccessLevelRow = (props: { + disabled?: boolean; + level: DriveFileAccessLevel | null; + onChange: (level: DriveFileAccessLevel & 'remove') => void; +}) => { + const IconForLevel = { + 'manage': ScaleIcon, + 'write': PencilIcon, + 'read': EyeIcon, + 'none': EyeOffIcon, + }[props.level || 'none']; + return ( + } + title={translateAccessLevel(props.level || 'none')} + subtitle={Languages.t("components.public-link-access-level-update-subtitle")} + suffix={ + + } + /> + ); +} + +const SwitchToAdvancedSettingsRow = (props: { + disabled: boolean, + onShowAdvancedScreen: (active: boolean) => void, +}) => + } + title={Languages.t('components.public-link-security')} + suffix={ + { + if (!props.disabled) + props.onShowAdvancedScreen(true); + }} + > + {Languages.t("components.public-link-security-change")} + + } + subtitle={Languages.t("components.public-link-security-change-subtitle")} + />; + const PublicLinkModalContent = (props: { id: string, isOnAdvancedScreen: boolean, @@ -57,19 +121,63 @@ const PublicLinkModalContent = (props: { refreshCompany(); }, []); const havePublicLink = hasAnyPublicLinkAccess(item); + const publicLink = getPublicLink(item); return ( - {Languages.t(props.isOnAdvancedScreen - ? 'components.item_context_menu.manage_access_advanced_to' - : 'components.item_context_menu.manage_access_to') + ' '} + {Languages.t('components.public-link-security-title') + ' '} {item?.name} } > - Im content ! {havePublicLink ? "Got a" : "No"} public link. +
+ { + item && update(changePublicLink(item, { level })); + }} + /> + +
+ +
+ +
+ + { props.onShowAdvancedScreen(false); }} + > + + {Languages.t('components.public-link-security-title') + ' '} + {item?.name} + + } + > +
{Languages.t('components.public-link-security')}
+
+ { + item && await update(changePublicLink(item, { password: password || '' })); + }} + onChangeExpiration={async (expiration: number) => { + item && await update(changePublicLink(item, { expiration })); + }} + /> +
+
+
); } \ No newline at end of file diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/password-editor-row.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/password-editor-row.tsx new file mode 100644 index 00000000..bc4b4517 --- /dev/null +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/password-editor-row.tsx @@ -0,0 +1,168 @@ +import { useEffect, useRef, useState } from 'react'; +import { uniqueId } from 'lodash'; + +import Languages from 'features/global/services/languages-service'; + +import BaseBlock from '@molecules/grouped-rows/base'; +import { Base } from '@atoms/text'; +import { Input } from 'app/atoms/input/input-text'; +import { CheckboxSlider } from 'app/atoms/input/input-checkbox-slider'; +import { Button } from 'app/atoms/button/button'; +import { ShieldCheckIcon, PencilAltIcon, ShieldExclamationIcon } from '@heroicons/react/outline'; +import { Modal, ModalContent } from 'app/atoms/modal'; + +import Styles from './styles'; + +export const PasswordEditorRow = (props: { + disabled?: boolean; + password?: string; + isLinkExpired: boolean; + onChangePassword: (password: string) => Promise; +}) => { + const [isEditingPassword, setIsEditingPassword] = useState(false); + const [currentEditedPassword, setCurrentEditedPassword] = useState(""); + const [isWaitingForPasswordSave, setIsWaitingForPasswordSave] = useState(false); + const [isConfirmingPasswordRemoval, setIsConfirmingPasswordRemoval] = useState(false); + + const inputRef = useRef(null); + const [chkPasswordId] = useState(uniqueId("chk")); + + const disabled = props.disabled || isWaitingForPasswordSave; + + useEffect(() => { + if (!isEditingPassword || !inputRef.current) return; + let timeout: NodeJS.Timeout | null = setTimeout(() => { + timeout = null; + inputRef.current?.focus(); + }, 10); + return () => { + if (timeout) clearTimeout(timeout); + timeout = null; + } + }, [ isEditingPassword ]) + + function savePassword(password: string) { + setIsWaitingForPasswordSave(true); + props. + onChangePassword(password). + then( + () => { + setIsWaitingForPasswordSave(false); + setIsEditingPassword(false); + }, + (e: unknown) => { + console.error("Error while saving password:", e); + setIsWaitingForPasswordSave(false); + }, + ); + } + + function confirmSavePassword(password: string) { + if (password === (props.password ?? "")) { + setIsEditingPassword(false); + return; + } + // If link is also expired, removing the password won't expose it, + // no need to stress the user with a confirmation + if (!password.length && !props.isLinkExpired) + setIsConfirmingPasswordRemoval(true); + else + savePassword(password); + } + + return <> + } + title={ + + + {!!props.password?.length && !isEditingPassword && + { + if (!disabled) { + setCurrentEditedPassword(props.password!); + setIsEditingPassword(true); + } + }} + > + + + } + + } + subtitle={''} + suffix={isEditingPassword + ? <> + setCurrentEditedPassword(e.target.value)} + onKeyUp={e => { + if (e.key == 'Escape') + setIsEditingPassword(false); + else if (e.key == 'Enter') + confirmSavePassword(currentEditedPassword); + }} + /> + + + : { + if (checked) { + setIsEditingPassword(checked); + if (checked && !currentEditedPassword.length) + setCurrentEditedPassword(!props.password?.length ? Math.random().toString(36).slice(-8) : props.password); + } else + setIsConfirmingPasswordRemoval(true); + }} + /> + } + /> + + setIsConfirmingPasswordRemoval(false)}> + + + + + } + /> + + ; +} \ No newline at end of file diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access-options.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access-options.tsx index 5fa4a456..6be0a35e 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access-options.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access-options.tsx @@ -1,120 +1,26 @@ -import { Info, Subtitle } from '@atoms/text'; -import { ToasterService } from '@features/global/services/toaster-service'; -import { copyToClipboard } from '@features/global/utils/CopyClipboard'; -import { Checkbox } from 'app/atoms/input/input-checkbox'; -import { Input } from 'app/atoms/input/input-text'; -import { useEffect, useRef, useState } from 'react'; -import moment from 'moment'; -import 'moment/min/locales'; -import Languages from 'features/global/services/languages-service'; -import { debounce } from 'lodash'; +import { PasswordEditorRow } from './password-editor-row'; +import { ExpiryEditorRow } from './expiry-editor-row'; export const PublicLinkAccessOptions = (props: { disabled?: boolean; password?: string; expiration?: number; - onChangePassword: Function; - onChangeExpiration: Function; -}) => { - const [usePassword, setUsePassword] = useState(!!props.password); - const [password, setPassword] = useState(props.password); - const [useExpiration, setUseExpiration] = useState((props.expiration || 0) > 0); - const [expiration, setExpiration] = useState(props.expiration); - const handlePasswordBlur = () => { - props.onChangePassword(password); - }; + onChangePassword: (password: string) => Promise; + onChangeExpiration: (expiration: number) => Promise; +}) => ( + <> + + + +); - const debouncedOnChangePassword = debounce(passwordValue => { - props.onChangePassword(passwordValue); - }, 500); // 500ms delay - - useEffect(() => { - // Ensure the effect runs only if usePassword or password changes - debouncedOnChangePassword(usePassword ? password : ''); - - // Cleanup function to cancel the debounced call if the component is unmounted or the dependencies change - return () => { - debouncedOnChangePassword.cancel(); - }; - }, [usePassword, password]); - - useEffect(() => { - props.onChangeExpiration(useExpiration ? expiration : 0); - }, [useExpiration, expiration]); - - function expirationDate(exp: moment.MomentInput) { - moment.locale(Languages.getLanguage()); - return moment(exp).fromNow(true).toLocaleString(); - } - - return ( - <> - - {Languages.t('components.public-link-security')} - - -
-
- { - setUsePassword(s); - if (!password && s) setPassword(Math.random().toString(36).slice(-8)); - }} - value={!!usePassword} - label={Languages.t('components.public-link-security_password')} - /> -
- {!!usePassword && ( - setPassword(e.target.value)} - // saves and copies password - onClick={() => { - if (password) copyToClipboard(password); - ToasterService.success( - Languages.t('components.public-link-security_password_copied'), - ); - }} - /> - )} -
-
- { - setUseExpiration(s); - if (!expiration && s) setExpiration(Date.now() + 1000 * 60 * 60 * 24 * 7); - }} - value={!!useExpiration} - label={Languages.t('components.public-link-security_expired')} - /> - {useExpiration && (expiration || 0) < Date.now() && ( - - ({Languages.t('components.public-link-security_expired')}) - - )} - {useExpiration && (expiration || 0) > Date.now() && ( - ({expirationDate(expiration)}) - )}{' '} -
- {!!useExpiration && ( - { - e.target.value && setExpiration(new Date(e.target.value).getTime()); - }} - /> - )} -
-
- - ); -}; diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx index 635b2f35..4b56cc23 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/public-link/public-link-access.tsx @@ -1,12 +1,10 @@ import { Subtitle } from '@atoms/text'; import { useDriveItem, getPublicLink } from '@features/drive/hooks/use-drive-item'; -import { copyToClipboard } from '@features/global/utils/CopyClipboard'; import { Input } from 'app/atoms/input/input-text'; import { useState } from 'react'; import { AccessLevelDropdown } from '../../components/access-level-dropdown'; import Languages from 'features/global/services/languages-service'; -import { Button } from '@atoms/button/button'; -import { LinkIcon, UserGroupIcon, CheckCircleIcon } from '@heroicons/react/outline'; +import { UserGroupIcon } from '@heroicons/react/outline'; import type { DriveFileAccessLevelForPublicLink } from 'app/features/drive/types'; import { changePublicLink } from '@features/files/utils/access-info-helpers'; import { CopyLinkButton } from './copy-link-button'; @@ -24,7 +22,6 @@ export const PublicLinkManager = ({ id, disabled }: { id: string; disabled?: boo if (level === 'none') setPublicLinkCreationLevel(defaultPublicLinkLevel); }; - const [didJustCompleteACopy, setDidJustCompleteACopy] = useState(false); return ( <> @@ -57,7 +54,7 @@ export const PublicLinkManager = ({ id, disabled }: { id: string; disabled?: boo
} > - {!props.isOnAdvancedScreen ? - <> - + - {FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_SEARCH_USERS) && ( - - )} - - {haveAdvancedSettings && } - : <> - {havePublicLink && - { - item && changePublicLink(item, { password: password || '' }); - }} - onChangeExpiration={(expiration: number) => { - item && changePublicLink(item, { expiration: expiration || 0 }); - }} - />} - { parentItem?.parent_id !== null && <> - - - } - } + {FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_SEARCH_USERS) && ( + + )} ); };