88 PostType ,
99} from "@changes-page/supabase/types/page" ;
1010import { PostDateTime , PostTypeBadge } from "@changes-page/ui" ;
11+ import { DateTime } from "@changes-page/utils" ;
1112import { Menu } from "@headlessui/react" ;
1213import { DotsVerticalIcon } from "@heroicons/react/solid" ;
1314import classNames from "classnames" ;
@@ -16,14 +17,14 @@ import ReactMarkdown from "react-markdown";
1617import rehypeRaw from "rehype-raw" ;
1718import rehypeSanitize from "rehype-sanitize" ;
1819import remarkGfm from "remark-gfm" ;
20+ import { createAuditLog } from "../../utils/auditLog" ;
1921import usePageUrl from "../../utils/hooks/usePageUrl" ;
2022import { httpGet } from "../../utils/http" ;
2123import { useUserData } from "../../utils/useUser" ;
2224import { notifyError } from "../core/toast.component" ;
2325import ConfirmDeleteDialog from "../dialogs/confirm-delete-dialog.component" ;
2426import PostOptions from "./post-options" ;
2527import { PostStatusIcon } from "./post-status" ;
26- import { createAuditLog } from "../../utils/auditLog" ;
2728
2829const ReactionsCounter = ( { aggregate } : { aggregate : IReactions } ) => {
2930 return (
@@ -216,14 +217,36 @@ export function Post({
216217 < span className = "inline-flex flex-col md:flex-row text-sm md:space-x-2 space-y-2 md:space-y-0 whitespace-nowrap text-gray-500 dark:text-gray-400" >
217218 < PostDateTime publishedAt = { publishedAt } startWithFullDate />
218219
219- < div className = "flex items-center -mt-0.5" >
220+ < div className = "flex items-center -mt-0.5 flex-wrap gap-2 " >
220221 { ( post ?. tags ?? [ ] ) . map ( ( tag : PostType , idx ) => (
221- < div key = { tag } className = { classNames ( idx ? "ml-2" : "" ) } >
222+ < div key = { tag } >
222223 < PostTypeBadge type = { tag } />
223224 </ div >
224225 ) ) }
225226 { settings ?. pinned_post_id === post . id && (
226- < PostTypeBadge type = "pinned" className = "ml-2" />
227+ < PostTypeBadge type = "pinned" />
228+ ) }
229+ { post . status !== PostStatus . published && (
230+ < div className = { classNames (
231+ "flex lg:hidden items-center space-x-1.5" ,
232+ post . status === PostStatus . draft && "text-slate-700 dark:text-slate-500" ,
233+ post . status === PostStatus . publish_later && "text-orange-700 dark:text-orange-500"
234+ ) } >
235+ < PostStatusIcon
236+ status = { post . status }
237+ className = "w-4 h-4"
238+ />
239+ < div className = "flex flex-col" >
240+ < span className = "text-xs font-medium" >
241+ { PostStatusToLabel [ post . status ] }
242+ </ span >
243+ { post . status === PostStatus . publish_later && post . publish_at && (
244+ < span className = "text-xs" >
245+ { DateTime . fromISO ( post . publish_at ) . toNiceFormat ( ) }
246+ </ span >
247+ ) }
248+ </ div >
249+ </ div >
227250 ) }
228251 </ div >
229252
@@ -253,22 +276,25 @@ export function Post({
253276 < aside className = "hidden lg:block absolute top-4 -right-52 w-48" >
254277 < h2 className = "sr-only" > Options</ h2 >
255278 < div className = "space-y-5" >
256- < div className = "flex items-center space-x-2" >
257- < span
258- className = { classNames (
259- "text-sm font-medium text-green-700 dark:text-green-500" ,
260- post . status === PostStatus . draft &&
261- "text-slate-700 dark:text-slate-500" ,
262- post . status === PostStatus . publish_later &&
263- "text-orange-700 dark:text-orange-500"
264- ) }
265- >
279+ < div className = { classNames (
280+ "flex flex-col space-y-1 text-green-700 dark:text-green-500" ,
281+ post . status === PostStatus . draft &&
282+ "text-slate-700 dark:text-slate-500" ,
283+ post . status === PostStatus . publish_later &&
284+ "text-orange-700 dark:text-orange-500"
285+ ) } >
286+ < span className = "text-sm font-medium" >
266287 < PostStatusIcon
267288 status = { post . status }
268289 className = "w-5 h-5 inline-block mr-1.5"
269290 />
270291 { PostStatusToLabel [ post . status ] }
271292 </ span >
293+ { post . status === PostStatus . publish_later && post . publish_at && (
294+ < span className = "text-xs pl-[1.625rem]" >
295+ { DateTime . fromISO ( post . publish_at ) . toNiceFormat ( ) }
296+ </ span >
297+ ) }
272298 </ div >
273299
274300 < div className = "flex items-center space-x-2" >
@@ -328,8 +354,8 @@ export function Post({
328354 < ReactionsCounter aggregate = { reactions } />
329355 ) : null }
330356 </ div >
331- </ div >
332- </ li >
357+ </ div >
358+ </ li >
333359 </ >
334360 ) ;
335361}
0 commit comments