code review
This commit is contained in:
parent
961a122279
commit
1752bf5198
|
@ -19,19 +19,21 @@ type Props = {
|
||||||
export const Draft = (props: Props) => {
|
export const Draft = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
|
||||||
const handlePublishLinkClick = () => {
|
const handlePublishLinkClick = (e) => {
|
||||||
|
e.preventDefault()
|
||||||
props.onPublish(props.shout)
|
props.onPublish(props.shout)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDeleteLinkClick = () => {
|
const handleDeleteLinkClick = (e) => {
|
||||||
|
e.preventDefault()
|
||||||
props.onDelete(props.shout)
|
props.onDelete(props.shout)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={clsx(props.class)}>
|
<div class={clsx(props.class)}>
|
||||||
<div class={styles.created}>
|
<div class={styles.created}>
|
||||||
<Icon name="pencil-outline" class={styles.icon} /> {formatDate(new Date(props.shout.createdAt))}{' '}
|
<Icon name="pencil-outline" class={styles.icon} /> {formatDate(new Date(props.shout.createdAt))}
|
||||||
{formatDateTime(props.shout.createdAt)()}
|
{formatDateTime(props.shout.createdAt)()}
|
||||||
</div>
|
</div>
|
||||||
<div class={styles.titleContainer}>
|
<div class={styles.titleContainer}>
|
||||||
<span class={styles.title}>{props.shout.title || t('Unnamed draft')}</span> {props.shout.subtitle}
|
<span class={styles.title}>{props.shout.title || t('Unnamed draft')}</span> {props.shout.subtitle}
|
||||||
|
|
|
@ -37,11 +37,13 @@ export const Panel = (props: Props) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleSaveLinkClick = () => {
|
const handleSaveLinkClick = (e) => {
|
||||||
|
e.preventDefault()
|
||||||
saveShout()
|
saveShout()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePublishLinkClick = () => {
|
const handlePublishLinkClick = (e) => {
|
||||||
|
e.preventDefault()
|
||||||
publishShout()
|
publishShout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
|
||||||
openPage(router, 'article', { slug: shout.slug })
|
openPage(router, 'article', { slug: shout.slug })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('[saveShout]', error)
|
||||||
showSnackbar({ type: 'error', body: t('Error') })
|
showSnackbar({ type: 'error', body: t('Error') })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
|
||||||
publish: true
|
publish: true
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('[publishShout]', error)
|
||||||
showSnackbar({ type: 'error', body: t('Error') })
|
showSnackbar({ type: 'error', body: t('Error') })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
|
||||||
|
|
||||||
openPage(router, 'feed')
|
openPage(router, 'feed')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('[publishShoutById]', error)
|
||||||
showSnackbar({ type: 'error', body: t('Error') })
|
showSnackbar({ type: 'error', body: t('Error') })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user