From 1750c8f7f001f9ff0831e5a675f833f2b19d0760 Mon Sep 17 00:00:00 2001 From: Romaric Mourgues Date: Mon, 27 Mar 2023 19:00:21 +0200 Subject: [PATCH] Fix public links and menu dark mode --- .../node/src/services/documents/utils.ts | 2 +- .../components/auto-complete/auto-complete.tsx | 5 +++-- .../src/app/components/file/parts/actions.tsx | 17 +++++++---------- .../src/app/components/menus/menu-component.jsx | 2 +- .../frontend/src/app/components/menus/menu.scss | 4 ---- .../plugins/suggestion/suggestion-list.tsx | 9 ++++++--- .../src/app/views/client/body/drive/browser.tsx | 2 +- .../body/drive/documents/document-row.tsx | 2 +- .../client/body/drive/documents/folder-row.tsx | 2 +- .../src/app/views/client/body/drive/index.tsx | 1 - .../src/app/views/client/common/app-grid.tsx | 6 +++--- 11 files changed, 24 insertions(+), 28 deletions(-) diff --git a/twake/backend/node/src/services/documents/utils.ts b/twake/backend/node/src/services/documents/utils.ts index c622606f..5edf1180 100644 --- a/twake/backend/node/src/services/documents/utils.ts +++ b/twake/backend/node/src/services/documents/utils.ts @@ -319,7 +319,7 @@ export const checkAccess = async ( repository: Repository, context: CompanyExecutionContext & { public_token?: string; twake_tab_token?: string }, ): Promise => { - if (context.user.server_request) { + if (context.user?.server_request) { return true; } diff --git a/twake/frontend/src/app/components/auto-complete/auto-complete.tsx b/twake/frontend/src/app/components/auto-complete/auto-complete.tsx index bcf4129a..08591cdd 100644 --- a/twake/frontend/src/app/components/auto-complete/auto-complete.tsx +++ b/twake/frontend/src/app/components/auto-complete/auto-complete.tsx @@ -266,7 +266,8 @@ export default class AutoComplete extends Component { if (this.input && this.state.resultPosition === '' && this.state.currentList.length > 0) { const size = this.state.currentList.length * 32 + 5; if ( - document.documentElement.clientHeight - (window as any).getBoundingClientRect(this.input).bottom < + document.documentElement.clientHeight - + (window as any).getBoundingClientRect(this.input).bottom < size || this.props.position === 'top' ) { @@ -366,7 +367,7 @@ export default class AutoComplete extends Component { {!this.props.hideResult && this.state.currentList.length > 0 ? (
(); const { open: openPreview } = useFileViewerModal(); - const { candidates } = useEditors(file.name.split(".").pop() || "") + const { candidates } = useEditors(file.name.split('.').pop() || ''); const onClickDownload = async () => { file.company_id && @@ -53,7 +53,7 @@ export const FileActions = ({ const onClickOpen = async () => { openPreview(messageFile); - } + }; const buildMenu = (e: React.MouseEvent) => { e.stopPropagation(); @@ -66,7 +66,7 @@ export const FileActions = ({ }, ]; - if(candidates.length > 0) { + if (candidates.length > 0) { const openerName = candidates[0].name || candidates[0].app?.identity.name; menu.push({ @@ -80,12 +80,9 @@ export const FileActions = ({ }); } - MenuManager.openMenu( - menu, - (window as any).getBoundingClientRect(menuRef.current), - null, - { margin: 0 }, - ); + MenuManager.openMenu(menu, (window as any).getBoundingClientRect(menuRef.current), null, { + margin: 0, + }); }; const onClickCancel = (e: React.MouseEvent) => { diff --git a/twake/frontend/src/app/components/menus/menu-component.jsx b/twake/frontend/src/app/components/menus/menu-component.jsx index f991bb66..2433a2f2 100755 --- a/twake/frontend/src/app/components/menus/menu-component.jsx +++ b/twake/frontend/src/app/components/menus/menu-component.jsx @@ -57,7 +57,7 @@ export default class MenuComponent extends React.Component {
(this.original_menu = node)} className={ - 'menu-list ' + (this.props.withFrame ? 'as_frame ' : '') + this.props.animationClass + 'menu-list ' + (this.props.withFrame ? 'as_frame text-black bg-white dark:bg-zinc-800 dark:text-white rounded-lg ' : '') + this.props.animationClass } > {(this.props.menu || []) diff --git a/twake/frontend/src/app/components/menus/menu.scss b/twake/frontend/src/app/components/menus/menu.scss index c8670159..d5ca7c6d 100755 --- a/twake/frontend/src/app/components/menus/menu.scss +++ b/twake/frontend/src/app/components/menus/menu.scss @@ -26,9 +26,7 @@ } &.as_frame { - border-radius: var(--border-radius-base); box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05), 0 0 20px 0 rgba(0, 0, 0, 0.15); - background-color: var(--white); width: 250px; max-height: 80vh; overflow: auto; @@ -39,7 +37,6 @@ line-height: 32px; font-size: 14px; font-weight: bold; - color: var(--black); margin: 0 8px; padding: 0 8px; } @@ -85,7 +82,6 @@ height: 32px; line-height: 32px; font-size: 14px; - color: var(--black); margin: 0 8px; padding: 0 8px; border-radius: var(--border-radius-base); diff --git a/twake/frontend/src/app/components/rich-text-editor/plugins/suggestion/suggestion-list.tsx b/twake/frontend/src/app/components/rich-text-editor/plugins/suggestion/suggestion-list.tsx index 020aa3ee..c68f15b4 100644 --- a/twake/frontend/src/app/components/rich-text-editor/plugins/suggestion/suggestion-list.tsx +++ b/twake/frontend/src/app/components/rich-text-editor/plugins/suggestion/suggestion-list.tsx @@ -150,9 +150,12 @@ export const SuggestionList = (props: Props): JSX.Element => { return (
{props?.list && props.list.length > 0 ? ( props.list.map((item, index) => { diff --git a/twake/frontend/src/app/views/client/body/drive/browser.tsx b/twake/frontend/src/app/views/client/body/drive/browser.tsx index cd0fa6ab..02895ae6 100644 --- a/twake/frontend/src/app/views/client/body/drive/browser.tsx +++ b/twake/frontend/src/app/views/client/body/drive/browser.tsx @@ -85,7 +85,7 @@ export default memo( //In case we are kicked out of the current folder, we need to reset the parent id useEffect(() => { - if (!loading && !path?.length) setParentId('root'); + if (!loading && !path?.length && !inPublicSharing) setParentId('root'); }, [path, loading, setParentId]); useEffect(() => { diff --git a/twake/frontend/src/app/views/client/body/drive/documents/document-row.tsx b/twake/frontend/src/app/views/client/body/drive/documents/document-row.tsx index 6db57a7f..9997c70e 100644 --- a/twake/frontend/src/app/views/client/body/drive/documents/document-row.tsx +++ b/twake/frontend/src/app/views/client/body/drive/documents/document-row.tsx @@ -44,7 +44,7 @@ export const DocumentRow = ({ return (