Files
orca/mobile/src/files/MobileFilePreviewDiscardModal.tsx
T
Neilandm4air dddc1260e5 chore(lint): oxlint 1.91, cheap perf/correctness rules, return-await fixes (#39730)
* chore(lint): bump oxlint to 1.91, add perf lint rules and perf audits

* fix(lint): await promises returned inside try/catch/finally for return-await

Prepare typescript/return-await with error-handling-correctness-only: await
returns whose catch or finally was meant to cover them, and suppress the eight
sites where the catch must not re-handle the returned promise.

* chore(lint): enable return-await (error-handling-correctness-only); exempt secondary-scan directives in the changed gate

* refactor(mobile): move file preview discard modal into its own module

Keeps MobileFilePreviewScreen under the 400-line limit after merging main.

---------

Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
2026-11-08 06:21:54 -08:00

31 lines
975 B
TypeScript

import { ConfirmModal } from '../components/ConfirmModal'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
export function MobileFilePreviewDiscardModal(props: {
visible: boolean
saving: boolean
onConfirm: () => void
onCancel: () => void
}) {
const t = useMobileTranslation()
return (
<ConfirmModal
visible={props.visible}
title={t('files.filePreviewScreen.discardTitle', 'Discard changes?')}
message={
props.saving
? t(
'files.filePreviewScreen.discardMessageSaving',
'The save in progress may not finish. Unsaved edits will be lost.'
)
: t('files.filePreviewScreen.discardMessage', 'Unsaved edits will be lost.')
}
confirmLabel={t('files.filePreviewScreen.discard', 'Discard')}
cancelLabel={t('files.filePreviewScreen.stay', 'Stay')}
destructive
onConfirm={props.onConfirm}
onCancel={props.onCancel}
/>
)
}