Fix public links and menu dark mode
This commit is contained in:
@@ -319,7 +319,7 @@ export const checkAccess = async (
|
||||
repository: Repository<DriveFile>,
|
||||
context: CompanyExecutionContext & { public_token?: string; twake_tab_token?: string },
|
||||
): Promise<boolean> => {
|
||||
if (context.user.server_request) {
|
||||
if (context.user?.server_request) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,8 @@ export default class AutoComplete extends Component<Props, State> {
|
||||
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<Props, State> {
|
||||
{!this.props.hideResult && this.state.currentList.length > 0 ? (
|
||||
<div
|
||||
className={
|
||||
'menu-list as_frame inline ' +
|
||||
'menu-list as_frame bg-white text-black dark:bg-zinc-800 dark:text-white rounded-lg inline ' +
|
||||
(this.state.focused && this.state.currentList.length ? 'fade_in ' : '') +
|
||||
this.state.resultPosition
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import MenuManager from 'app/components/menus/menus-manager';
|
||||
import { PendingFileRecoilType } from 'app/features/files/types/file';
|
||||
import { MessageFileType } from 'app/features/messages/types/message';
|
||||
import { useFileViewerModal } from 'app/features/viewer/hooks/use-viewer';
|
||||
import { useEditors } from 'app/views/applications/viewer/other/editors-service';
|
||||
import { useEditors } from 'app/views/client/viewer/other/editors-service';
|
||||
|
||||
type PropsType = {
|
||||
file: DataFileType;
|
||||
@@ -40,7 +40,7 @@ export const FileActions = ({
|
||||
const { cancelUpload, deleteOneFile, downloadOneFile, retryUpload } = useUpload();
|
||||
const menuRef = useRef<HTMLElement>();
|
||||
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<HTMLElement, 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<HTMLElement, MouseEvent>) => {
|
||||
|
||||
@@ -57,7 +57,7 @@ export default class MenuComponent extends React.Component {
|
||||
<div
|
||||
ref={node => (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 || [])
|
||||
|
||||
@@ -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);
|
||||
|
||||
+6
-3
@@ -150,9 +150,12 @@ export const SuggestionList = <T,>(props: Props<T>): JSX.Element => {
|
||||
return (
|
||||
<div className="suggestions" style={cssPosition}>
|
||||
<div
|
||||
className={classNames(['menu-list', 'as_frame', 'inline', 'top'], {
|
||||
fade_in: isFocused && props.list?.length,
|
||||
})}
|
||||
className={classNames(
|
||||
['menu-list', 'as_frame bg-white dark:bg-zinc-900 rounded-lg', 'inline', 'top'],
|
||||
{
|
||||
fade_in: isFocused && props.list?.length,
|
||||
},
|
||||
)}
|
||||
>
|
||||
{props?.list && props.list.length > 0 ? (
|
||||
props.list.map((item, index) => {
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -44,7 +44,7 @@ export const DocumentRow = ({
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
'flex flex-row items-center border -mt-px px-4 py-3 cursor-pointer ' +
|
||||
'flex flex-row items-center border border-zinc-200 dark:border-zinc-800 -mt-px px-4 py-3 cursor-pointer ' +
|
||||
(checked
|
||||
? 'bg-blue-500 bg-opacity-10 hover:bg-opacity-25 '
|
||||
: 'hover:bg-zinc-500 hover:bg-opacity-10 ') +
|
||||
|
||||
@@ -21,7 +21,7 @@ export const FolderRow = ({
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
'flex flex-row items-center border -mt-px px-4 py-3 cursor-pointer ' +
|
||||
'flex flex-row items-center border border-zinc-200 dark:border-zinc-800 -mt-px px-4 py-3 cursor-pointer ' +
|
||||
(className || '') +
|
||||
(checked
|
||||
? 'bg-blue-500 bg-opacity-10 hover:bg-opacity-25 '
|
||||
|
||||
@@ -10,7 +10,6 @@ export type EmbedContext = {
|
||||
|
||||
export default ({
|
||||
initialParentId,
|
||||
context,
|
||||
inPublicSharing,
|
||||
}: {
|
||||
initialParentId?: string;
|
||||
|
||||
@@ -18,7 +18,7 @@ export default ({ className }: { className?: string }): JSX.Element => {
|
||||
{
|
||||
type: 'react-element',
|
||||
reactElement: (
|
||||
<div className="grid grid-cols-3">
|
||||
<div className="grid grid-cols-3 -m-2">
|
||||
{applications.map((app, index) => {
|
||||
return (
|
||||
<a
|
||||
@@ -26,9 +26,9 @@ export default ({ className }: { className?: string }): JSX.Element => {
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href={app.url}
|
||||
className="inline-block flex flex-col items-center justify-center cursor-pointer hover:bg-zinc-100 rounded-md p-2 pb-1"
|
||||
className="inline-block flex flex-col items-center justify-center cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-900 rounded-md p-2 pb-1"
|
||||
>
|
||||
<img src={app.logo} className="w-14 h-14 mb-1" />
|
||||
<img src={app.logo} className="w-10 h-10 mb-1" />
|
||||
<Base>{app.name}</Base>
|
||||
</a>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user