Drafts toast
This commit is contained in:
committed by
Samuel Newman
parent
7da77a3107
commit
d1e62af654
@@ -479,6 +479,14 @@ export const ComposePost = ({
|
||||
setViewMode('drafts')
|
||||
}, [clearDraft])
|
||||
|
||||
// Handler for saving draft and closing with toast
|
||||
const onSaveDraftAndClose = useCallback(() => {
|
||||
saveImmediate(composerState)
|
||||
closeComposer()
|
||||
clearThumbnailCache(queryClient)
|
||||
Toast.show(_(msg`Saved to drafts`))
|
||||
}, [_, saveImmediate, composerState, closeComposer, queryClient])
|
||||
|
||||
// Handler for when a draft is deleted from the drafts list
|
||||
const onDraftDeleted = useCallback(
|
||||
(deletedDraftId: string) => {
|
||||
@@ -1086,17 +1094,12 @@ export const ComposePost = ({
|
||||
<Trans>Update draft?</Trans>
|
||||
</Prompt.TitleText>
|
||||
<Prompt.DescriptionText>
|
||||
<Trans>Update draft and save it to post at a later time.</Trans>
|
||||
<Trans>Update draft and save it to post later.</Trans>
|
||||
</Prompt.DescriptionText>
|
||||
<Prompt.Actions>
|
||||
<Prompt.Action
|
||||
cta={_(msg`Update draft`)}
|
||||
onPress={() => {
|
||||
// Explicitly save the changes before closing
|
||||
saveImmediate(composerState)
|
||||
closeComposer()
|
||||
clearThumbnailCache(queryClient)
|
||||
}}
|
||||
onPress={onSaveDraftAndClose}
|
||||
/>
|
||||
<Prompt.Action
|
||||
cta={_(msg`Don't update`)}
|
||||
@@ -1116,10 +1119,13 @@ export const ComposePost = ({
|
||||
<Trans>Save to drafts?</Trans>
|
||||
</Prompt.TitleText>
|
||||
<Prompt.DescriptionText>
|
||||
<Trans>Save to drafts to edit and post at a later time.</Trans>
|
||||
<Trans>Save to drafts to edit and post later.</Trans>
|
||||
</Prompt.DescriptionText>
|
||||
<Prompt.Actions>
|
||||
<Prompt.Action cta={_(msg`Save draft`)} onPress={onClose} />
|
||||
<Prompt.Action
|
||||
cta={_(msg`Save draft`)}
|
||||
onPress={onSaveDraftAndClose}
|
||||
/>
|
||||
<Prompt.Action
|
||||
cta={_(msg`Don't save`)}
|
||||
color="negative_subtle"
|
||||
@@ -1139,7 +1145,7 @@ export const ComposePost = ({
|
||||
<Trans>Save to drafts?</Trans>
|
||||
</Prompt.TitleText>
|
||||
<Prompt.DescriptionText>
|
||||
<Trans>Save to drafts to edit and post at a later time.</Trans>
|
||||
<Trans>Save to drafts to edit and post later.</Trans>
|
||||
</Prompt.DescriptionText>
|
||||
<Prompt.Actions>
|
||||
<Prompt.Action
|
||||
@@ -1160,7 +1166,7 @@ export const ComposePost = ({
|
||||
<Trans>Update draft?</Trans>
|
||||
</Prompt.TitleText>
|
||||
<Prompt.DescriptionText>
|
||||
<Trans>Update draft and save it to post at a later time.</Trans>
|
||||
<Trans>Update draft and save it to post later.</Trans>
|
||||
</Prompt.DescriptionText>
|
||||
<Prompt.Actions>
|
||||
<Prompt.Action
|
||||
|
||||
@@ -66,10 +66,20 @@ export function DraftsView({
|
||||
<View style={[a.flex_1]} />
|
||||
</View>
|
||||
|
||||
<ScrollView style={[a.flex_1]} contentContainerStyle={[a.gap_md]}>
|
||||
<ScrollView
|
||||
style={[a.flex_1]}
|
||||
contentContainerStyle={[
|
||||
a.gap_md,
|
||||
drafts.length === 0 && {flexGrow: 1},
|
||||
]}>
|
||||
{drafts.length === 0 ? (
|
||||
<View style={[a.py_xl, a.align_center, a.gap_md]}>
|
||||
<PencilLineIcon width={64} style={[t.atoms.text_contrast_low]} />
|
||||
<View
|
||||
style={[
|
||||
a.align_center,
|
||||
a.gap_lg,
|
||||
isNative ? [a.flex_1, a.justify_center] : [a.pt_xl, a.pb_4xl],
|
||||
]}>
|
||||
<PencilLineIcon width={48} style={[t.atoms.text_contrast_low]} />
|
||||
<Text style={[t.atoms.text_contrast_medium]}>
|
||||
<Trans>No drafts yet</Trans>
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user