mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-04-19 19:01:19 +00:00
Published and unpublished tags on course content
This commit is contained in:
parent
4e4904bbf8
commit
1165c6d7c8
@ -20,7 +20,7 @@ const SelectedContentItem = ({ content }) => {
|
||||
<div className="text-lg text-900 font-bold">{content.title}</div>
|
||||
<div className="w-full text-sm text-600 text-wrap">{content.summary}</div>
|
||||
<div className="text-sm pt-6 text-gray-500">
|
||||
{content.published_at ? formatUnixTimestamp(content.published_at) : "not yet published"}
|
||||
{content.published_at ? `Published: ${formatUnixTimestamp(content.published_at)}` : "not yet published"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Tag } from "primereact/tag";
|
||||
import { Message } from "primereact/message";
|
||||
import Image from "next/image";
|
||||
import { useImageProxy } from "@/hooks/useImageProxy";
|
||||
import dynamic from "next/dynamic";
|
||||
@ -13,6 +14,14 @@ const MDDisplay = dynamic(
|
||||
|
||||
const DraftCourseLesson = ({ lesson, course }) => {
|
||||
const { returnImageProxy } = useImageProxy();
|
||||
const [isPublished, setIsPublished] = useState(false);
|
||||
useEffect(() => {
|
||||
if (lesson?.kind) {
|
||||
setIsPublished(true);
|
||||
} else {
|
||||
setIsPublished(false);
|
||||
}
|
||||
}, [lesson]);
|
||||
|
||||
return (
|
||||
<div className='w-full px-24 pt-12 mx-auto mt-4 max-tab:px-0 max-mob:px-0 max-tab:pt-2 max-mob:pt-2'>
|
||||
@ -43,6 +52,13 @@ const DraftCourseLesson = ({ lesson, course }) => {
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div className='flex flex-row w-full mt-6 items-center'>
|
||||
{isPublished ? (
|
||||
<Message severity="success" text="published" />
|
||||
) : (
|
||||
<Message severity="info" text="draft" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-col max-tab:mt-12 max-mob:mt-12'>
|
||||
{lesson && (
|
||||
|
@ -25,7 +25,7 @@ const ContentDropdownItem = ({ content, onSelect }) => {
|
||||
<div className="text-lg text-900 font-bold">{content.title}</div>
|
||||
<div className="w-full text-sm text-600 text-wrap">{content.summary}</div>
|
||||
<div className="text-sm pt-6 text-gray-500">
|
||||
{content.published_at ? formatUnixTimestamp(content.published_at) : "not yet published"}
|
||||
{content.published_at ? `Published: ${formatUnixTimestamp(content.published_at)}` : "not yet published"}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col justify-end">
|
||||
|
Loading…
x
Reference in New Issue
Block a user