This commit is contained in:
2025-09-07 14:43:39 +08:00
parent b4e00814bf
commit a51d4ec598
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
import React from "react"; import React from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import { i18nContext } from "../utils/i18n";
import { i18nData } from "../i18n.ts";
export default function showPopup( export default function showPopup(
content: React.ReactNode, content: React.ReactNode,
@@ -43,7 +45,9 @@ export default function showPopup(
document.body.appendChild(mask); document.body.appendChild(mask);
createRoot(div).render( createRoot(div).render(
<context.Provider value={close}>{content}</context.Provider>, <context.Provider value={close}>
<i18nContext.Provider value={i18nData}>{content}</i18nContext.Provider>
</context.Provider>,
); );
} }

View File

@@ -686,6 +686,7 @@ function fileSizeToString(size: number) {
function FileTile({ file }: { file: RFile }) { function FileTile({ file }: { file: RFile }) {
const buttonRef = createRef<HTMLButtonElement>(); const buttonRef = createRef<HTMLButtonElement>();
const buttonRef2 = createRef<HTMLButtonElement>();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -774,13 +775,14 @@ function FileTile({ file }: { file: RFile }) {
<div className="flex flex-row-reverse xs:hidden p-2"> <div className="flex flex-row-reverse xs:hidden p-2">
{file.size > 10 * 1024 * 1024 ? ( {file.size > 10 * 1024 * 1024 ? (
<button <button
ref={buttonRef2}
className={"btn btn-primary btn-soft btn-sm"} className={"btn btn-primary btn-soft btn-sm"}
onClick={() => { onClick={() => {
if (!app.cloudflareTurnstileSiteKey) { if (!app.cloudflareTurnstileSiteKey) {
const link = network.getFileDownloadLink(file.id, ""); const link = network.getFileDownloadLink(file.id, "");
window.open(link, "_blank"); window.open(link, "_blank");
} else { } else {
showPopup(<CloudflarePopup file={file} />, buttonRef.current!); showPopup(<CloudflarePopup file={file} />, buttonRef2.current!);
} }
}} }}
> >