mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-05 07:47:01 +02:00
fix: improve share completed dialog redirection for reverse shares
This commit is contained in:
@@ -30,6 +30,8 @@ const Body = ({ share, appUrl }: { share: CompletedShare; appUrl: string }) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslate();
|
const t = useTranslate();
|
||||||
|
|
||||||
|
const isReverseShare = !!router.query["reverseShareToken"];
|
||||||
|
|
||||||
const link = `${appUrl}/s/${share.id}`;
|
const link = `${appUrl}/s/${share.id}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -65,7 +67,11 @@ const Body = ({ share, appUrl }: { share: CompletedShare; appUrl: string }) => {
|
|||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
modals.closeAll();
|
modals.closeAll();
|
||||||
router.push("/upload");
|
if (isReverseShare) {
|
||||||
|
router.reload();
|
||||||
|
} else {
|
||||||
|
router.push("/upload");
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormattedMessage id="common.button.done" />
|
<FormattedMessage id="common.button.done" />
|
||||||
|
|||||||
@@ -291,6 +291,9 @@ export default {
|
|||||||
"upload.notify.generic-error":
|
"upload.notify.generic-error":
|
||||||
"An error occurred while finishing your share.",
|
"An error occurred while finishing your share.",
|
||||||
"upload.notify.count-failed": "{count} files failed to upload. Trying again.",
|
"upload.notify.count-failed": "{count} files failed to upload. Trying again.",
|
||||||
|
"upload.reverse-share.error.invalid.title": "Invalid reverse share link",
|
||||||
|
"upload.reverse-share.error.invalid.description":
|
||||||
|
"This reverse share has expired or is invalid.",
|
||||||
|
|
||||||
// Dropzone.tsx
|
// Dropzone.tsx
|
||||||
"upload.dropzone.title": "Upload files",
|
"upload.dropzone.title": "Upload files",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useEffect, useState } from "react";
|
|||||||
import Upload from ".";
|
import Upload from ".";
|
||||||
import showErrorModal from "../../components/share/showErrorModal";
|
import showErrorModal from "../../components/share/showErrorModal";
|
||||||
import shareService from "../../services/share.service";
|
import shareService from "../../services/share.service";
|
||||||
|
import useTranslate from "../../hooks/useTranslate.hook";
|
||||||
|
|
||||||
export function getServerSideProps(context: GetServerSidePropsContext) {
|
export function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
return {
|
return {
|
||||||
@@ -14,6 +15,7 @@ export function getServerSideProps(context: GetServerSidePropsContext) {
|
|||||||
|
|
||||||
const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
|
const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
|
||||||
const modals = useModals();
|
const modals = useModals();
|
||||||
|
const t = useTranslate();
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const [maxShareSize, setMaxShareSize] = useState(0);
|
const [maxShareSize, setMaxShareSize] = useState(0);
|
||||||
@@ -30,8 +32,8 @@ const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
showErrorModal(
|
showErrorModal(
|
||||||
modals,
|
modals,
|
||||||
"Invalid Link",
|
t("upload.reverse-share.error.invalid.title"),
|
||||||
"This link is invalid. Please check your link.",
|
t("upload.reverse-share.error.invalid.description"),
|
||||||
"go-home",
|
"go-home",
|
||||||
);
|
);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user