Small styling fixes, also tested auth with new appConfig with multiple author pubkeys, also added i tag to videos

This commit is contained in:
austinkelsay 2024-09-17 18:06:03 -05:00
parent 09e0ba026a
commit 8f2935a7dc
12 changed files with 52 additions and 92 deletions

View File

@ -91,24 +91,9 @@ export function CourseTemplate({ course }) {
WebkitBoxOrient: "vertical", WebkitBoxOrient: "vertical",
WebkitLineClamp: "2" WebkitLineClamp: "2"
}}> }}>
{course.description || course.summary && ( {(course.summary || course.description)?.split('\n').map((line, index) => (
<> <span key={index}>{line}</span>
{course.description && (
<div>
{course.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))} ))}
</div>
)}
{course.summary && (
<div>
{course.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</CardDescription> </CardDescription>
<CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4"> <CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4">
<p className="text-sm text-gray-300">{course?.published_at && course.published_at !== "" ? ( <p className="text-sm text-gray-300">{course?.published_at && course.published_at !== "" ? (

View File

@ -79,24 +79,9 @@ export function DocumentTemplate({ document }) {
WebkitBoxOrient: "vertical", WebkitBoxOrient: "vertical",
WebkitLineClamp: "2" WebkitLineClamp: "2"
}}> }}>
{document.description || document.summary && ( {(document.summary || document.description)?.split('\n').map((line, index) => (
<> <span key={index}>{line}</span>
{document.description && (
<div>
{document.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))} ))}
</div>
)}
{document.summary && (
<div>
{document.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</CardDescription> </CardDescription>
<CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4"> <CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4">
<p className="text-sm text-gray-300">{document?.published_at && document.published_at !== "" ? ( <p className="text-sm text-gray-300">{document?.published_at && document.published_at !== "" ? (

View File

@ -80,24 +80,9 @@ export function VideoTemplate({ video }) {
WebkitBoxOrient: "vertical", WebkitBoxOrient: "vertical",
WebkitLineClamp: "2" WebkitLineClamp: "2"
}}> }}>
{video.description || video.summary && ( {(video.summary || video.description)?.split('\n').map((line, index) => (
<> <span key={index}>{line}</span>
{video.description && (
<div>
{video.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))} ))}
</div>
)}
{video.summary && (
<div>
{video.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</CardDescription> </CardDescription>
<CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4"> <CardFooter className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 border-t border-gray-700 pt-4">
<p className="text-sm text-gray-300">{video?.published_at && video.published_at !== "" ? ( <p className="text-sm text-gray-300">{video?.published_at && video.published_at !== "" ? (

View File

@ -47,7 +47,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
const renderContent = () => { const renderContent = () => {
if (isPaid && decryptionPerformed) { if (isPaid && decryptionPerformed) {
return <MDDisplay className='p-4 rounded-lg w-full' source={lesson.content} />; return <MDDisplay className='p-2 rounded-lg w-full' source={lesson.content} />;
} }
if (isPaid && !decryptionPerformed) { if (isPaid && !decryptionPerformed) {
return ( return (
@ -62,7 +62,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
); );
} }
if (lesson?.content) { if (lesson?.content) {
return <MDDisplay className='p-4 rounded-lg w-full' source={lesson.content} />; return <MDDisplay className='p-2 rounded-lg w-full' source={lesson.content} />;
} }
return null; return null;
} }

View File

@ -291,6 +291,8 @@ export default function DraftCourseDetails({ processedEvent, draftId, lessons })
['title', draft.title], ['title', draft.title],
['summary', draft.summary], ['summary', draft.summary],
['image', draft.image], ['image', draft.image],
// todo populate this tag from the config
['i', 'youtube:plebdevs', 'V_fvmyJ91m0'],
...draft.topics.map(topic => ['t', topic]), ...draft.topics.map(topic => ['t', topic]),
['published_at', Math.floor(Date.now() / 1000).toString()], ['published_at', Math.floor(Date.now() / 1000).toString()],
...(draft?.price ? [['price', draft.price.toString()], ['location', `https://plebdevs.com/details/${draft.id}`]] : []), ...(draft?.price ? [['price', draft.price.toString()], ['location', `https://plebdevs.com/details/${draft.id}`]] : []),

View File

@ -47,7 +47,7 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
if (isPaid && decryptionPerformed) { if (isPaid && decryptionPerformed) {
return ( return (
<> <>
<MDDisplay className='p-4 rounded-lg w-full' source={lesson.content} /> <MDDisplay className='p-0 rounded-lg w-full' source={lesson.content} />
</> </>
); );
} else if (isPaid && !decryptionPerformed) { } else if (isPaid && !decryptionPerformed) {
@ -71,7 +71,7 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
</div> </div>
); );
} else if (lesson?.content) { } else if (lesson?.content) {
return <MDDisplay className='p-4 rounded-lg w-full' source={lesson.content} />; return <MDDisplay className='p-0 rounded-lg w-full' source={lesson.content} />;
} }
return null; return null;
} }

View File

@ -81,7 +81,7 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
const renderContent = () => { const renderContent = () => {
if (decryptedContent) { if (decryptedContent) {
return <MDDisplay className='p-4 rounded-lg w-full' source={decryptedContent} />; return <MDDisplay className='p-2 rounded-lg w-full' source={decryptedContent} />;
} }
if (paidResource && !decryptedContent) { if (paidResource && !decryptedContent) {
return ( return (
@ -108,7 +108,7 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
); );
} }
if (processedEvent?.content) { if (processedEvent?.content) {
return <MDDisplay className='p-4 rounded-lg w-full' source={processedEvent.content} />; return <MDDisplay className='p-2 rounded-lg w-full' source={processedEvent.content} />;
} }
return null; return null;
} }
@ -136,14 +136,9 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
)} )}
</div> </div>
</div> </div>
<p className='text-xl text-gray-200 mb-4 mt-4'>{summary && ( {(summary)?.split('\n').map((line, index) => (
<div className="text-xl mt-4">
{summary.split('\n').map((line, index) => (
<p key={index}>{line}</p> <p key={index}>{line}</p>
))} ))}
</div>
)}
</p>
<div className='flex items-center justify-between'> <div className='flex items-center justify-between'>
<div className='flex items-center'> <div className='flex items-center'>
<Image <Image

View File

@ -77,7 +77,7 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au
const renderContent = () => { const renderContent = () => {
if (decryptedContent) { if (decryptedContent) {
return <MDDisplay className='p-4 rounded-lg w-full' source={decryptedContent} />; return <MDDisplay className='p-0 rounded-lg w-full' source={decryptedContent} />;
} }
if (paidResource && !decryptedContent) { if (paidResource && !decryptedContent) {
return ( return (
@ -130,14 +130,11 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au
} }
</div> </div>
<div className='flex flex-row items-center justify-between w-full'> <div className='flex flex-row items-center justify-between w-full'>
<p className='text-xl mt-4'>{summary && ( <div className="mt-4 max-mob:text-base max-tab:text-base">
<div className="text-xl mt-4 max-mob:text-base max-tab:text-base"> {(summary)?.split('\n').map((line, index) => (
{summary.split('\n').map((line, index) => (
<p key={index}>{line}</p> <p key={index}>{line}</p>
))} ))}
</div> </div>
)}
</p>
<ZapDisplay <ZapDisplay
zapAmount={zapAmount} zapAmount={zapAmount}
event={processedEvent} event={processedEvent}

View File

@ -11,7 +11,7 @@ const appConfig = {
"wss://purplerelay.com/", "wss://purplerelay.com/",
// "wss://relay.devs.tools/" // "wss://relay.devs.tools/"
], ],
authorPubkeys: ["8cb60e215678879cda0bef4d5b3fc1a5c5925d2adb5d8c4fa7b7d03b5f2deaea"] authorPubkeys: ["8cb60e215678879cda0bef4d5b3fc1a5c5925d2adb5d8c4fa7b7d03b5f2deaea", "676c02247668d5b18479be3d1a80933044256f3fbd03640a8c234684e641b6d6"]
}; };
export default appConfig; export default appConfig;

View File

@ -93,10 +93,17 @@ export const createUser = async (data) => {
}; };
export const updateUser = async (id, data) => { export const updateUser = async (id, data) => {
console.log("Updating user", id, data) const updateData = { ...data };
if (data.role) {
updateData.role = {
connect: { id: data.role }
};
}
return await prisma.user.update({ return await prisma.user.update({
where: { id }, where: { id },
data, data: updateData,
}); });
}; };

View File

@ -114,6 +114,8 @@ export const authOptions = {
subscribed: false, subscribed: false,
}); });
console.log("role", role);
if (!role) { if (!role) {
console.error("Failed to create role"); console.error("Failed to create role");
return null; return null;

View File

@ -239,6 +239,8 @@ export default function Draft() {
['title', draft.title], ['title', draft.title],
['summary', draft.summary], ['summary', draft.summary],
['image', draft.image], ['image', draft.image],
// todo populate this tag from the config
['i', 'youtube:plebdevs', 'V_fvmyJ91m0'],
...draft.topics.map(topic => ['t', topic]), ...draft.topics.map(topic => ['t', topic]),
['published_at', Math.floor(Date.now() / 1000).toString()], ['published_at', Math.floor(Date.now() / 1000).toString()],
...(draft?.price ? [['price', draft.price.toString()], ['location', `https://plebdevs.com/details/${draft.id}`]] : []), ...(draft?.price ? [['price', draft.price.toString()], ['location', `https://plebdevs.com/details/${draft.id}`]] : []),