@@ -12,6 +12,9 @@ import type { SerializedEditorState } from "@/components/ContentEditor";
1212import { useBlogEditor } from "@/hooks/blog/useBlogEditor" ;
1313import { useAuth } from "@/hooks/useAuth" ;
1414import { publishBlogPost , unpublishBlogPost } from "@/lib/firebase/firestore" ;
15+ import { useTranslations } from "next-intl" ;
16+ import { useLanguage } from "@/hooks/useLanguage" ;
17+ import { khitHaungg } from "@/fonts/fonts" ;
1518
1619const INPUT_CLASS = cn (
1720 "w-full px-4 py-3 rounded-xl text-sm" ,
@@ -25,10 +28,12 @@ function TagInput({
2528 tags,
2629 onAdd,
2730 onRemove,
31+ placeholder = "Add tags (press Enter)" ,
2832} : {
2933 tags : string [ ] ;
3034 onAdd : ( tag : string ) => void ;
3135 onRemove : ( tag : string ) => void ;
36+ placeholder ?: string ;
3237} ) {
3338 const [ value , setValue ] = useState ( "" ) ;
3439
@@ -67,7 +72,7 @@ function TagInput({
6772 value = { value }
6873 onChange = { ( e ) => setValue ( e . target . value ) }
6974 onKeyDown = { handleKeyDown }
70- placeholder = "Add tags (press Enter)"
75+ placeholder = { placeholder }
7176 className = { INPUT_CLASS }
7277 />
7378 </ div >
@@ -76,6 +81,9 @@ function TagInput({
7681
7782function BlogEditForm ( { postId } : { postId : string } ) {
7883 const router = useRouter ( ) ;
84+ const t = useTranslations ( "blog" ) ;
85+ const { isMyanmar } = useLanguage ( ) ;
86+ const mmFont = isMyanmar ? khitHaungg . className : "" ;
7987 const { user, isAdmin } = useAuth ( ) ;
8088 const {
8189 title,
@@ -168,19 +176,19 @@ function BlogEditForm({ postId }: { postId: string }) {
168176 < PenLine className = "w-4.5 h-4.5 text-prism-cyan" />
169177 </ div >
170178 < div >
171- < h1 className = "text-xl font-semibold font-display text-white tracking-tight" >
172- Edit Blog
179+ < h1 className = { cn ( "text-xl font-semibold font-display text-white tracking-tight" , mmFont ) } >
180+ { t ( "editBlog" ) }
173181 </ h1 >
174- < p className = "text-[11px] text-zinc-600 font-mono" >
175- { post ?. status === "published" ? "Published" : "Draft" } · Auto-saves every 5s
182+ < p className = { cn ( "text-[11px] text-zinc-600 font-mono" , mmFont ) } >
183+ { post ?. status === "published" ? t ( "published" ) : t ( "draft" ) } · { t ( "autoSaveNote" ) }
176184 </ p >
177185 </ div >
178186 </ div >
179187
180188 { post ?. status === "published" && (
181- < span className = "flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-mono uppercase tracking-wider bg-emerald-500/10 text-emerald-400 border border-emerald-500/20" >
189+ < span className = { cn ( "flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-mono uppercase tracking-wider bg-emerald-500/10 text-emerald-400 border border-emerald-500/20" , mmFont ) } >
182190 < CheckCircle className = "w-3 h-3" />
183- Published
191+ { t ( "published" ) }
184192 </ span >
185193 ) }
186194 </ div >
@@ -194,65 +202,66 @@ function BlogEditForm({ postId }: { postId: string }) {
194202 className = "space-y-5"
195203 >
196204 < div >
197- < label className = "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" >
198- Title
205+ < label className = { cn ( "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" , mmFont ) } >
206+ { t ( "formTitle" ) }
199207 </ label >
200208 < input
201209 type = "text"
202210 value = { title }
203211 onChange = { ( e ) => setTitle ( e . target . value ) }
204- placeholder = "Post title"
212+ placeholder = { t ( "formTitlePlaceholder" ) }
205213 className = { cn ( INPUT_CLASS , "text-lg font-display" ) }
206214 />
207215 </ div >
208216
209217 < div >
210- < label className = "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" >
211- Description
218+ < label className = { cn ( "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" , mmFont ) } >
219+ { t ( "formDescription" ) }
212220 </ label >
213221 < textarea
214222 value = { description }
215223 onChange = { ( e ) => setDescription ( e . target . value ) }
216- placeholder = "Brief summary"
224+ placeholder = { t ( "formDescriptionPlaceholder" ) }
217225 rows = { 2 }
218226 className = { cn ( INPUT_CLASS , "resize-none" ) }
219227 />
220228 </ div >
221229
222230 < div >
223- < label className = "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" >
231+ < label className = { cn ( "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" , mmFont ) } >
224232 < ImageIcon className = "w-3 h-3 inline mr-1" />
225- Cover Image URL
233+ { t ( "formCoverImage" ) }
226234 </ label >
227235 < input
228236 type = "url"
229237 value = { coverImageURL ?? "" }
230238 onChange = { ( e ) => setCoverImageURL ( e . target . value || null ) }
231- placeholder = "https://example.com/image.jpg (optional)"
239+ placeholder = { t ( "formCoverImagePlaceholder" ) }
232240 className = { INPUT_CLASS }
233241 />
234242 </ div >
235243
236244 < div >
237- < label className = "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" >
245+ < label className = { cn ( "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" , mmFont ) } >
238246 < Tag className = "w-3 h-3 inline mr-1" />
239- Tags
247+ { t ( "formTags" ) }
240248 </ label >
241249 < TagInput
242250 tags = { tags }
243251 onAdd = { ( tag ) => setTags ( [ ...tags , tag ] ) }
244252 onRemove = { ( tag ) => setTags ( tags . filter ( ( t ) => t !== tag ) ) }
253+ placeholder = { t ( "formTagsPlaceholder" ) }
245254 />
246255 </ div >
247256
248257 < div >
249- < label className = "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" >
250- Content
258+ < label className = { cn ( "block text-xs font-mono text-zinc-500 uppercase tracking-wider mb-2" , mmFont ) } >
259+ { t ( "formContent" ) }
251260 </ label >
252261 < ContentEditor
253262 value = { content }
254263 onChange = { handleContentChange }
255- placeholder = "Start writing..."
264+ placeholder = { t ( "formContentPlaceholder" ) }
256265 />
257266 </ div >
258267
@@ -272,7 +281,7 @@ function BlogEditForm({ postId }: { postId: string }) {
272281 ) }
273282 >
274283 < Save className = "w-4 h-4" />
275- { saving ? "Saving..." : "Save" }
284+ < span className = { mmFont } > { saving ? t ( "saving" ) : t ( "saveDraft" ) } </ span >
276285 </ button >
277286
278287 < button
@@ -288,16 +297,18 @@ function BlogEditForm({ postId }: { postId: string }) {
288297 ) }
289298 >
290299 < CheckCircle className = "w-4 h-4" />
291- { publishing
292- ? "..."
293- : post ?. status === "published"
294- ? "Unpublish"
295- : "Publish" }
300+ < span className = { mmFont } >
301+ { publishing
302+ ? "..."
303+ : post ?. status === "published"
304+ ? t ( "unpublish" )
305+ : t ( "publish" ) }
306+ </ span >
296307 </ button >
297308
298309 { ! isAdmin && post ?. status !== "published" && (
299- < span className = "text-[11px] text-zinc-600 font-mono" >
300- Max 3 posts/day
310+ < span className = { cn ( "text-[11px] text-zinc-600 font-mono" , mmFont ) } >
311+ { t ( "maxPostsPerDay" ) }
301312 </ span >
302313 ) }
303314 </ div >
0 commit comments