mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-20 14:35:05 +00:00
Copy fix and fix linking to crrect content in UserContent items on 'open'
This commit is contained in:
parent
347ca659d3
commit
15738c955e
@ -64,7 +64,7 @@ const DraftCourseLesson = ({ lesson, course }) => {
|
|||||||
<p className='text-xl mt-6'>{lesson?.summary}</p>
|
<p className='text-xl mt-6'>{lesson?.summary}</p>
|
||||||
{lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
|
{lesson?.additionalLinks && lesson.additionalLinks.length > 0 && (
|
||||||
<div className='mt-6'>
|
<div className='mt-6'>
|
||||||
<h3 className='text-lg font-semibold mb-2'>Additional links:</h3>
|
<h3 className='text-lg font-semibold mb-2'>External links:</h3>
|
||||||
<ul className='list-disc list-inside'>
|
<ul className='list-disc list-inside'>
|
||||||
{lesson.additionalLinks.map((link, index) => (
|
{lesson.additionalLinks.map((link, index) => (
|
||||||
<li key={index}>
|
<li key={index}>
|
||||||
|
@ -7,27 +7,22 @@ import { useRouter } from "next/router";
|
|||||||
const ContentListItem = (content) => {
|
const ContentListItem = (content) => {
|
||||||
const { returnImageProxy } = useImageProxy();
|
const { returnImageProxy } = useImageProxy();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const isDraft = Object.keys(content).includes('type');
|
const isPublishedCourse = content?.kind === 30004;
|
||||||
const isCourse = content && content?.kind === 30004;
|
const isDraftCourse = !content?.kind && content?.draftLessons;
|
||||||
const isCourseDraft = content && content?.resources?.length > 0 && !content?.kind;
|
const isResource = content?.kind && content?.kind === 30023;
|
||||||
|
const isDraft = !content?.kind && !content?.draftLessons;
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
let path = '';
|
console.log(content);
|
||||||
|
if (isPublishedCourse) {
|
||||||
if (isDraft) {
|
router.push(`/course/${content.id}`);
|
||||||
path = '/draft';
|
} else if (isDraftCourse) {
|
||||||
} else if (isCourse) {
|
router.push(`/course/${content.id}/draft`);
|
||||||
path = '/course';
|
} else if (isResource) {
|
||||||
} else if (isCourseDraft) {
|
router.push(`/details/${content.id}`);
|
||||||
path = `/course/${content.id}/draft`
|
} else if (isDraft) {
|
||||||
return router.push(path);
|
router.push(`/draft/${content.id}`);
|
||||||
} else {
|
|
||||||
path = '/details';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullPath = `${path}/${content.id}`;
|
|
||||||
|
|
||||||
router.push(fullPath);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ const ResourceForm = ({ draft = null, isPublished = false }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-8 flex-col w-full">
|
<div className="mt-8 flex-col w-full">
|
||||||
<span className="pl-1 flex items-center">
|
<span className="pl-1 flex items-center">
|
||||||
Additional Links
|
External Links
|
||||||
<i className="pi pi-info-circle ml-2 cursor-pointer"
|
<i className="pi pi-info-circle ml-2 cursor-pointer"
|
||||||
data-pr-tooltip="Add any relevant links that pair with this content"
|
data-pr-tooltip="Add any relevant external links that pair with this content"
|
||||||
data-pr-position="right"
|
data-pr-position="right"
|
||||||
data-pr-at="right+5 top"
|
data-pr-at="right+5 top"
|
||||||
data-pr-my="left center-2"
|
data-pr-my="left center-2"
|
||||||
|
@ -161,9 +161,9 @@ const WorkshopForm = ({ draft = null }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-8 flex-col w-full">
|
<div className="mt-8 flex-col w-full">
|
||||||
<span className="pl-1 flex items-center">
|
<span className="pl-1 flex items-center">
|
||||||
Additional Links
|
External Links
|
||||||
<i className="pi pi-info-circle ml-2 cursor-pointer"
|
<i className="pi pi-info-circle ml-2 cursor-pointer"
|
||||||
data-pr-tooltip="Add any relevant or additional links that pair with this content"
|
data-pr-tooltip="Add any relevant external links that pair with this content"
|
||||||
data-pr-position="right"
|
data-pr-position="right"
|
||||||
data-pr-at="right+5 top"
|
data-pr-at="right+5 top"
|
||||||
data-pr-my="left center-2"
|
data-pr-my="left center-2"
|
||||||
|
@ -244,7 +244,7 @@ export default function Draft() {
|
|||||||
<p className='text-xl mt-6'>{draft?.summary}</p>
|
<p className='text-xl mt-6'>{draft?.summary}</p>
|
||||||
{draft?.additionalLinks && draft.additionalLinks.length > 0 && (
|
{draft?.additionalLinks && draft.additionalLinks.length > 0 && (
|
||||||
<div className='mt-6'>
|
<div className='mt-6'>
|
||||||
<h3 className='text-lg font-semibold mb-2'>Additional links:</h3>
|
<h3 className='text-lg font-semibold mb-2'>External links:</h3>
|
||||||
<ul className='list-disc list-inside'>
|
<ul className='list-disc list-inside'>
|
||||||
{draft.additionalLinks.map((link, index) => (
|
{draft.additionalLinks.map((link, index) => (
|
||||||
<li key={index}>
|
<li key={index}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user