v3: added localization, use global player for uploaded audio/video files
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { useEffect } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { t } from "@lingui/core/macro"
|
||||
import { Trans } from "@lingui/react/macro";
|
||||
|
||||
interface ConfirmModalProps {
|
||||
message: string;
|
||||
@@ -9,8 +11,10 @@ interface ConfirmModalProps {
|
||||
}
|
||||
|
||||
export function ConfirmModal(
|
||||
{ message, confirmLabel = "Delete", onConfirm, onCancel }: ConfirmModalProps,
|
||||
{ message, confirmLabel, onConfirm, onCancel }: ConfirmModalProps,
|
||||
) {
|
||||
const label = confirmLabel ?? t`Delete`;
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
@@ -24,9 +28,11 @@ export function ConfirmModal(
|
||||
<div className="confirm-modal" onClick={(e) => e.stopPropagation()}>
|
||||
<p className="confirm-modal-message">{message}</p>
|
||||
<div className="confirm-modal-actions">
|
||||
<button type="button" onClick={onCancel}>Cancel</button>
|
||||
<button type="button" onClick={onCancel}>
|
||||
<Trans>Cancel</Trans>
|
||||
</button>
|
||||
<button type="button" className="btn-danger" onClick={onConfirm}>
|
||||
{confirmLabel}
|
||||
{label}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user