Remove draft count from button, just show "Drafts"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {type StoredDraft, useDrafts, useSaveDraft} from '#/state/drafts'
|
import {type StoredDraft, useSaveDraft} from '#/state/drafts'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
@@ -20,11 +20,8 @@ export function DraftsButton({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const draftsDialogControl = Dialog.useDialogControl()
|
const draftsDialogControl = Dialog.useDialogControl()
|
||||||
const savePromptControl = Prompt.usePromptControl()
|
const savePromptControl = Prompt.usePromptControl()
|
||||||
const {data: drafts} = useDrafts()
|
|
||||||
const {isPending: isSaving} = useSaveDraft()
|
const {isPending: isSaving} = useSaveDraft()
|
||||||
|
|
||||||
const draftCount = drafts?.length ?? 0
|
|
||||||
|
|
||||||
const handlePress = () => {
|
const handlePress = () => {
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
// Composer is empty, go directly to drafts list
|
// Composer is empty, go directly to drafts list
|
||||||
@@ -56,11 +53,7 @@ export function DraftsButton({
|
|||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
onPress={handlePress}>
|
onPress={handlePress}>
|
||||||
<ButtonText style={[a.text_md]}>
|
<ButtonText style={[a.text_md]}>
|
||||||
{draftCount > 0 ? (
|
<Trans>Drafts</Trans>
|
||||||
<Trans>Drafts ({draftCount})</Trans>
|
|
||||||
) : (
|
|
||||||
<Trans>Drafts</Trans>
|
|
||||||
)}
|
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user