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

@ -91,24 +91,9 @@ export function CourseTemplate({ course }) {
WebkitBoxOrient: "vertical",
WebkitLineClamp: "2"
}}>
{course.description || course.summary && (
<>
{course.description && (
<div>
{course.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
{(course.summary || course.description)?.split('\n').map((line, index) => (
<span key={index}>{line}</span>
))}
</div>
)}
{course.summary && (
<div>
{course.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</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">
<p className="text-sm text-gray-300">{course?.published_at && course.published_at !== "" ? (

@ -79,24 +79,9 @@ export function DocumentTemplate({ document }) {
WebkitBoxOrient: "vertical",
WebkitLineClamp: "2"
}}>
{document.description || document.summary && (
<>
{document.description && (
<div>
{document.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
{(document.summary || document.description)?.split('\n').map((line, index) => (
<span key={index}>{line}</span>
))}
</div>
)}
{document.summary && (
<div>
{document.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</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">
<p className="text-sm text-gray-300">{document?.published_at && document.published_at !== "" ? (

@ -80,24 +80,9 @@ export function VideoTemplate({ video }) {
WebkitBoxOrient: "vertical",
WebkitLineClamp: "2"
}}>
{video.description || video.summary && (
<>
{video.description && (
<div>
{video.description.split('\n').map((line, index) => (
<p key={index}>{line}</p>
{(video.summary || video.description)?.split('\n').map((line, index) => (
<span key={index}>{line}</span>
))}
</div>
)}
{video.summary && (
<div>
{video.summary.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</>
)}
</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">
<p className="text-sm text-gray-300">{video?.published_at && video.published_at !== "" ? (

@ -47,7 +47,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
const renderContent = () => {
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) {
return (
@ -62,7 +62,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
);
}
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;
}

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

@ -47,7 +47,7 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
if (isPaid && decryptionPerformed) {
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) {
@ -71,7 +71,7 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
</div>
);
} 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;
}

@ -81,7 +81,7 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
const renderContent = () => {
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) {
return (
@ -108,7 +108,7 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
);
}
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;
}
@ -136,14 +136,9 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price,
)}
</div>
</div>
<p className='text-xl text-gray-200 mb-4 mt-4'>{summary && (
<div className="text-xl mt-4">
{summary.split('\n').map((line, index) => (
{(summary)?.split('\n').map((line, index) => (
<p key={index}>{line}</p>
))}
</div>
)}
</p>
<div className='flex items-center justify-between'>
<div className='flex items-center'>
<Image

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

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

@ -93,10 +93,17 @@ export const createUser = async (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({
where: { id },
data,
data: updateData,
});
};

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

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