code review

This commit is contained in:
bniwredyc 2023-05-08 20:01:11 +02:00
parent 961a122279
commit 1752bf5198
3 changed files with 13 additions and 9 deletions

View File

@ -19,19 +19,21 @@ type Props = {
export const Draft = (props: Props) => {
const { t } = useLocalize()
const handlePublishLinkClick = () => {
const handlePublishLinkClick = (e) => {
e.preventDefault()
props.onPublish(props.shout)
}
const handleDeleteLinkClick = () => {
const handleDeleteLinkClick = (e) => {
e.preventDefault()
props.onDelete(props.shout)
}
return (
<div class={clsx(props.class)}>
<div class={styles.created}>
<Icon name="pencil-outline" class={styles.icon} /> {formatDate(new Date(props.shout.createdAt))}{' '}
{formatDateTime(props.shout.createdAt)()}
<Icon name="pencil-outline" class={styles.icon} /> {formatDate(new Date(props.shout.createdAt))}
&nbsp;{formatDateTime(props.shout.createdAt)()}
</div>
<div class={styles.titleContainer}>
<span class={styles.title}>{props.shout.title || t('Unnamed draft')}</span> {props.shout.subtitle}

View File

@ -37,11 +37,13 @@ export const Panel = (props: Props) => {
}
})
const handleSaveLinkClick = () => {
const handleSaveLinkClick = (e) => {
e.preventDefault()
saveShout()
}
const handlePublishLinkClick = () => {
const handlePublishLinkClick = (e) => {
e.preventDefault()
publishShout()
}

View File

@ -107,7 +107,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
openPage(router, 'article', { slug: shout.slug })
}
} catch (error) {
console.error(error)
console.error('[saveShout]', error)
showSnackbar({ type: 'error', body: t('Error') })
}
}
@ -140,7 +140,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
publish: true
})
} catch (error) {
console.error(error)
console.error('[publishShout]', error)
showSnackbar({ type: 'error', body: t('Error') })
}
}
@ -154,7 +154,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
openPage(router, 'feed')
} catch (error) {
console.error(error)
console.error('[publishShoutById]', error)
showSnackbar({ type: 'error', body: t('Error') })
}
}