Cudos to our developers
❤️
🎉
test
❤️
🎉
8/21/23
7/31/23
'use client'
import { forwardRef } from 'react'
import { ToggleSwitch } from '@primer/react'
export default forwardRef(function Switch(properties, ref) {
return <ToggleSwitch ref={ref} {...properties} />
})❤️
🎉
7/31/23
import useServerAction from '@/components/useServerAction'
export default observer(function WorkspaceUpdatesNewPostContent({ workspaceJSON }) {
const richEditorRef = useRef()
const [submitting, setSubmitting] = useState(false)
const workspace = useMemo(() => Workspace.fromServer(workspaceJSON), [workspaceJSON])
const { i18n } = useI18n('workspace-updates')
const { action: createUpdatePostAction /* status: createUpdatePostStatus */ } = useServerAction({
serverAction: createUpdatePostServerAction,
onSuccess: () => {
window.location.href = workspace.makePath('/updates')
},
})
const newPost = useLocalObservable(() => ({
category: '',
title: '',
content: '',
}))
const handleSubmit = async (evt) => {
evt.preventDefault()
setSubmitting(true)
try {
const { content, html } = await richEditorRef.current.finish()
newPost.content = content
newPost.contentHtml = html
createUpdatePostAction(workspace.id, toJS(newPost))
} finally {
setSubmitting(false)
}
return false
}
return (
<PageLayout containerWidth="full">
<PageLayout.Content width="medium">❤️
🎉
7/28/23
import useServerAction from '@/components/useServerAction'
export default observer(function WorkspaceUpdatesNewPostContent({ workspaceJSON }) {
const richEditorRef = useRef()
const [submitting, setSubmitting] = useState(false)
const workspace = useMemo(() => Workspace.fromServer(workspaceJSON), [workspaceJSON])
const { i18n } = useI18n('workspace-updates')
const { action: createUpdatePostAction /* status: createUpdatePostStatus */ } = useServerAction({
serverAction: createUpdatePostServerAction,
onSuccess: () => {
window.location.href = workspace.makePath('/updates')
},
})
const newPost = useLocalObservable(() => ({
category: '',
title: '',
content: '',
}))
const handleSubmit = async (evt) => {
evt.preventDefault()
setSubmitting(true)
try {
const { content, html } = await richEditorRef.current.finish()
newPost.content = content
newPost.contentHtml = html
createUpdatePostAction(workspace.id, toJS(newPost))
} finally {
setSubmitting(false)
}
return false
}
return (
<PageLayout containerWidth="full">
<PageLayout.Content width="medium">❤️
🎉
7/28/23
some code
if (!title || !content) {
throw new ServerError(
'A validation error has occurred please check your data',
'errors.data-validation',
)
}❤️
🎉
7/28/23
Check out our new website released today
❤️
🎉
7/24/23
aaaaaaaaaaaaaaa
❤️
🎉
7/24/23
line1
line2
line3
one empty line above and below
H1
Text line below h1
❤️
🎉
