mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-09-17 04:28:26 +00:00
fix: share link issues (#6465)
This commit is contained in:
parent
6b585ef9a7
commit
9c05788834
@ -0,0 +1,46 @@
|
||||
import NormalModal from '@/components/_shared/modal/NormalModal';
|
||||
import { AFConfigContext, useCurrentUser } from '@/components/main/app.hooks';
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { ReactComponent as ErrorIcon } from '@/assets/error.svg';
|
||||
|
||||
function ChangeAccount ({
|
||||
setModalOpened,
|
||||
modalOpened,
|
||||
}: {
|
||||
setModalOpened: (opened: boolean) => void;
|
||||
modalOpened: boolean;
|
||||
|
||||
}) {
|
||||
const currentUser = useCurrentUser();
|
||||
const navigate = useNavigate();
|
||||
const openLoginModal = useContext(AFConfigContext)?.openLoginModal;
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<NormalModal
|
||||
onCancel={() => {
|
||||
setModalOpened(false);
|
||||
navigate('/');
|
||||
}}
|
||||
closable={false}
|
||||
cancelText={t('invitation.errorModal.close')}
|
||||
onOk={openLoginModal}
|
||||
okText={t('invitation.errorModal.changeAccount')}
|
||||
title={<div className={'text-left font-bold flex gap-2 items-center'}>
|
||||
<ErrorIcon className={'w-5 h-5 text-function-error'} />
|
||||
{t('invitation.errorModal.title')}
|
||||
</div>}
|
||||
open={modalOpened}
|
||||
>
|
||||
<div className={'text-text-title flex flex-col text-sm gap-1 whitespace-pre-wrap break-words'}>
|
||||
{t('invitation.errorModal.description', {
|
||||
email: currentUser?.email,
|
||||
})}
|
||||
</div>
|
||||
</NormalModal>
|
||||
);
|
||||
}
|
||||
|
||||
export default ChangeAccount;
|
@ -13,7 +13,7 @@ export function ViewIcon ({ layout, size }: { layout: ViewLayout; size: number |
|
||||
}
|
||||
|
||||
if (size === 'medium') {
|
||||
return 'h-5 w-5';
|
||||
return 'h-4.5 w-4.5';
|
||||
}
|
||||
|
||||
if (size === 'large') {
|
||||
|
@ -235,12 +235,17 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
try {
|
||||
|
||||
await service.openWorkspace(workspaceId);
|
||||
const path = window.location.pathname.split('/')[2];
|
||||
const wId = window.location.pathname.split('/')[2];
|
||||
const pageId = window.location.pathname.split('/')[3];
|
||||
|
||||
if (path && !uuidValidate(path)) {
|
||||
// skip /app/trash and /app/*other-pages
|
||||
if (wId && !uuidValidate(wId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// skip /app/:workspaceId/:pageId
|
||||
if (pageId && uuidValidate(pageId) && wId && uuidValidate(wId) && wId === workspaceId) return;
|
||||
|
||||
const lastViewId = localStorage.getItem('last_view_id');
|
||||
|
||||
if (lastViewId && findView(res, lastViewId)) {
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
import { ReactComponent as AppflowyLogo } from '@/assets/appflowy.svg';
|
||||
import { ReactComponent as WarningIcon } from '@/assets/warning.svg';
|
||||
import { NormalModal } from '@/components/_shared/modal';
|
||||
import ChangeAccount from '@/components/_shared/modal/ChangeAccount';
|
||||
import { notify } from '@/components/_shared/notify';
|
||||
import { getAvatar } from '@/components/_shared/view-icon/utils';
|
||||
import { AFConfigContext, useService } from '@/components/main/app.hooks';
|
||||
@ -23,6 +24,8 @@ const REPEAT_REQUEST_CODE = 1043;
|
||||
|
||||
function ApproveRequestPage () {
|
||||
const [searchParams] = useSearchParams();
|
||||
const isAuthenticated = useContext(AFConfigContext)?.isAuthenticated;
|
||||
|
||||
const [requestInfo, setRequestInfo] = React.useState<GetRequestAccessInfoResponse | null>(null);
|
||||
const [currentPlans, setCurrentPlans] = React.useState<SubscriptionPlan[]>([]);
|
||||
const isPro = useMemo(() => currentPlans.includes(SubscriptionPlan.Pro), [currentPlans]);
|
||||
@ -33,9 +36,13 @@ function ApproveRequestPage () {
|
||||
const [upgradeModalOpen, setUpgradeModalOpen] = React.useState(false);
|
||||
const [errorModalOpen, setErrorModalOpen] = React.useState(false);
|
||||
const [alreadyProModalOpen, setAlreadyProModalOpen] = React.useState(false);
|
||||
const openLoginModal = useContext(AFConfigContext)?.openLoginModal;
|
||||
const [clicked, setClicked] = React.useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated) {
|
||||
navigate('/login?redirectTo=' + encodeURIComponent(window.location.href));
|
||||
}
|
||||
}, [isAuthenticated, navigate]);
|
||||
const loadRequestInfo = useCallback(async () => {
|
||||
if (!service || !requestId) return;
|
||||
try {
|
||||
@ -248,36 +255,7 @@ function ApproveRequestPage () {
|
||||
</p>
|
||||
|
||||
</NormalModal>
|
||||
<NormalModal
|
||||
keepMounted={false}
|
||||
onOk={() => setErrorModalOpen(false)}
|
||||
title={
|
||||
<div className={'text-left font-semibold'}>{t('approveAccess.getRequestInfoError')}</div>
|
||||
} open={errorModalOpen} onClose={() => setErrorModalOpen(false)}
|
||||
>
|
||||
<div className={'flex flex-col'}>
|
||||
<span>
|
||||
<Trans
|
||||
i18nKey="requestAccess.tip"
|
||||
components={{
|
||||
link: <span
|
||||
className={'underline text-fill-default'}
|
||||
>{requestInfo?.requester.name}</span>,
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<Trans
|
||||
i18nKey="requestAccess.mightBe"
|
||||
components={{
|
||||
login: <span
|
||||
onClick={() => openLoginModal?.()} className={'underline text-fill-default cursor-pointer'}
|
||||
>{t('signIn.logIn')}</span>,
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</NormalModal>
|
||||
<ChangeAccount setModalOpened={setErrorModalOpen} modalOpened={errorModalOpen} />
|
||||
<NormalModal
|
||||
onOk={() => setAlreadyProModalOpen(false)}
|
||||
keepMounted={false}
|
||||
|
@ -97,6 +97,9 @@ function RequestAccess () {
|
||||
</div>
|
||||
</div>
|
||||
<NormalModal
|
||||
cancelButtonProps={{
|
||||
className: 'hidden',
|
||||
}}
|
||||
onCancel={() => {
|
||||
setModalOpen(false);
|
||||
}} onOk={() => {
|
||||
@ -106,7 +109,8 @@ function RequestAccess () {
|
||||
<TaskAltRounded className={'text-function-success'} />
|
||||
{t('requestAccess.successful')}
|
||||
</div>
|
||||
} open={modalOpen} onClose={() => setModalOpen(false)}
|
||||
} open={modalOpen}
|
||||
onClose={() => setModalOpen(false)}
|
||||
>
|
||||
{t('requestAccess.successfulMessage')}
|
||||
</NormalModal>
|
||||
|
@ -37,7 +37,7 @@ function ToggleIcon ({ block, className }: { block: ToggleListNode; className: s
|
||||
onMouseDown={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
className={`${className} ${readOnly ? '' : 'cursor-pointer'} pr-1 text-xl hover:text-fill-default`}
|
||||
className={`${className} ${readOnly ? '' : 'cursor-pointer hover:text-fill-default'} pr-1 text-xl`}
|
||||
>
|
||||
{collapsed ? <ExpandSvg className={'-rotate-90 transform'} /> : <ExpandSvg />}
|
||||
</span>
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Invitation } from '@/application/types';
|
||||
import { ReactComponent as AppflowyLogo } from '@/assets/appflowy.svg';
|
||||
import { ReactComponent as ErrorIcon } from '@/assets/error.svg';
|
||||
import { NormalModal } from '@/components/_shared/modal';
|
||||
import ChangeAccount from '@/components/_shared/modal/ChangeAccount';
|
||||
import { notify } from '@/components/_shared/notify';
|
||||
import { getAvatar } from '@/components/_shared/view-icon/utils';
|
||||
import { AFConfigContext, useCurrentUser, useService } from '@/components/main/app.hooks';
|
||||
@ -17,7 +16,6 @@ function AcceptInvitationPage () {
|
||||
const isAuthenticated = useContext(AFConfigContext)?.isAuthenticated;
|
||||
const currentUser = useCurrentUser();
|
||||
const navigate = useNavigate();
|
||||
const openLoginModal = useContext(AFConfigContext)?.openLoginModal;
|
||||
const [searchParams] = useSearchParams();
|
||||
const invitationId = searchParams.get('invited_id');
|
||||
const service = useService();
|
||||
@ -156,27 +154,7 @@ function AcceptInvitationPage () {
|
||||
{t('invitation.joinWorkspace')}
|
||||
</Button>
|
||||
</div>
|
||||
<NormalModal
|
||||
onCancel={() => {
|
||||
setModalOpened(false);
|
||||
navigate('/');
|
||||
}}
|
||||
closable={false}
|
||||
cancelText={t('invitation.errorModal.close')}
|
||||
onOk={openLoginModal}
|
||||
okText={t('invitation.errorModal.changeAccount')}
|
||||
title={<div className={'text-left font-bold flex gap-2 items-center'}>
|
||||
<ErrorIcon className={'w-5 h-5 text-function-error'} />
|
||||
{t('invitation.errorModal.title')}
|
||||
</div>}
|
||||
open={modalOpened}
|
||||
>
|
||||
<div className={'text-text-title flex flex-col text-sm gap-1 whitespace-pre-wrap break-words'}>
|
||||
{t('invitation.errorModal.description', {
|
||||
email: currentUser?.email,
|
||||
})}
|
||||
</div>
|
||||
</NormalModal>
|
||||
<ChangeAccount setModalOpened={setModalOpened} modalOpened={modalOpened} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user